mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-21 16:58:58 +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
Notes:
sideshowbarker
2024-07-17 21:26:19 +09:00
Author: https://github.com/awesomekling
Commit: f5771a5789
Pull-request: https://github.com/SerenityOS/serenity/pull/21746
Reviewed-by: https://github.com/AtkinsSJ ✅
1 changed files with 1 additions and 1 deletions
|
@ -48,7 +48,7 @@ private:
|
|||
};
|
||||
|
||||
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>
|
||||
inline IterationDecision Node::for_each_shadow_including_inclusive_descendant(Callback callback)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue