mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:07:45 +00:00
LibWeb: Make inline paintables own their fragments
The paintable tree structure more closely matches the painting order when fragments are owned by corresponding inline paintables. This change does not affect the layout tree, as it is more convenient for layout purposes to have all fragments owned by a block container in one place. Additionally, this improves performance significantly on pages with many fragments, as we no longer have to walk the ancestor chain up to the closest block container to determine if a fragment belongs to an inline paintable.
This commit is contained in:
parent
5ed936289a
commit
2960bf4ec8
34 changed files with 310 additions and 258 deletions
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <LibWeb/Layout/InlineNode.h>
|
||||
#include <LibWeb/Painting/PaintableBox.h>
|
||||
#include <LibWeb/Painting/PaintableFragment.h>
|
||||
|
||||
namespace Web::Painting {
|
||||
|
||||
|
@ -23,10 +24,12 @@ public:
|
|||
auto const& box_model() const { return layout_node().box_model(); }
|
||||
|
||||
CSSPixelRect bounding_rect() const;
|
||||
Vector<PaintableFragment> const& fragments() const { return m_fragments; }
|
||||
Vector<PaintableFragment>& fragments() { return m_fragments; }
|
||||
|
||||
virtual bool is_inline_paintable() const override { return true; }
|
||||
|
||||
void mark_contained_fragments();
|
||||
virtual Optional<HitTestResult> hit_test(CSSPixelPoint, HitTestType) const override;
|
||||
|
||||
void set_box_shadow_data(Vector<ShadowData>&& box_shadow_data) { m_box_shadow_data = move(box_shadow_data); }
|
||||
Vector<ShadowData> const& box_shadow_data() const { return m_box_shadow_data; }
|
||||
|
@ -38,6 +41,7 @@ private:
|
|||
void for_each_fragment(Callback) const;
|
||||
|
||||
Vector<ShadowData> m_box_shadow_data;
|
||||
Vector<PaintableFragment> m_fragments;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue