mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:47:35 +00:00
LibWeb: Check node type first in fast_is<ShadowRoot>()
We know that shadow roots are always document fragments, so we can check that before calling is_shadow_root() to avoid the cost of a virtual call.
This commit is contained in:
parent
204c46f097
commit
f5771a5789
1 changed files with 1 additions and 1 deletions
|
@ -48,7 +48,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
inline bool Node::fast_is<ShadowRoot>() const { return is_shadow_root(); }
|
inline bool Node::fast_is<ShadowRoot>() const { return node_type() == to_underlying(NodeType::DOCUMENT_FRAGMENT_NODE) && is_shadow_root(); }
|
||||||
|
|
||||||
template<typename Callback>
|
template<typename Callback>
|
||||||
inline IterationDecision Node::for_each_shadow_including_inclusive_descendant(Callback callback)
|
inline IterationDecision Node::for_each_shadow_including_inclusive_descendant(Callback callback)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue