Commit 95dc91b6 authored by ch.dumez@samsung.com's avatar ch.dumez@samsung.com

Make Traversal<SVGElement> API a little bit more efficient

Make Traversal<SVGElement> API a little bit more efficient by specializing the
following templated function for SVGElement:
template <typename T> inline bool isElementOfType(const Node& node);

It leverages the fact that Node has an IsSVGFlag flag and we can call
Node::isSVGElement() directly on the input Node. Without this specialization,
the default template implementation would do the following check:
- node.isElementNode() && toElement(node).isSVGElement()

We thus bypass the redundant Node::isElementNode() call.

R=pdr
BUG=346733

Review URL: https://codereview.chromium.org/196563003

git-svn-id: svn://svn.chromium.org/blink/trunk@169703 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 361229dd
...@@ -229,6 +229,8 @@ struct SVGAttributeHashTranslator { ...@@ -229,6 +229,8 @@ struct SVGAttributeHashTranslator {
DEFINE_ELEMENT_TYPE_CASTS(SVGElement, isSVGElement()); DEFINE_ELEMENT_TYPE_CASTS(SVGElement, isSVGElement());
template <> inline bool isElementOfType<const SVGElement>(const Node& node) { return node.isSVGElement(); }
} }
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment