Skip to content

Commit

Permalink
LibWeb: Add fast_is<Layout::InitialContainingBlockBox>
Browse files Browse the repository at this point in the history
This is used by Layout::Node::containing_block() which is fairly hot.
  • Loading branch information
awesomekling committed Aug 18, 2021
1 parent 1268b39 commit a401a0f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Userland/Libraries/LibWeb/Layout/InitialContainingBlockBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ class InitialContainingBlockBox final : public BlockBox {
void recompute_selection_states();

private:
virtual bool is_initial_containing_block_box() const override { return true; }

LayoutRange m_selection;
};

template<>
inline bool Node::fast_is<InitialContainingBlockBox>() const { return is_initial_containing_block_box(); }

}
1 change: 1 addition & 0 deletions Userland/Libraries/LibWeb/Layout/Node.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class Node : public TreeNode<Node> {
virtual bool is_box() const { return false; }
virtual bool is_block_box() const { return false; }
virtual bool is_text_node() const { return false; }
virtual bool is_initial_containing_block_box() const { return false; }

template<typename T>
bool fast_is() const = delete;
Expand Down

0 comments on commit a401a0f

Please sign in to comment.