1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 05:07:35 +00:00

LibWeb: Move set_needs_display() from layout node to paintable

For this method, there is no need to go through the layout node when we
can directly reach the paintable.
This commit is contained in:
Aliaksandr Kalenik 2024-01-14 13:46:52 +01:00 committed by Andreas Kling
parent 814bed33b4
commit 7c2713c14f
21 changed files with 97 additions and 87 deletions

View file

@ -60,15 +60,6 @@ bool Box::is_user_scrollable() const
return computed_values().overflow_y() == CSS::Overflow::Scroll || computed_values().overflow_y() == CSS::Overflow::Auto;
}
void Box::set_needs_display()
{
if (!navigable())
return;
if (paintable_box())
navigable()->set_needs_display(paintable_box()->absolute_rect());
}
bool Box::is_body() const
{
return dom_node() && dom_node() == document().body();

View file

@ -25,8 +25,6 @@ public:
Painting::PaintableBox const* paintable_box() const;
Painting::PaintableBox* paintable_box();
virtual void set_needs_display() override;
bool is_body() const;
// https://www.w3.org/TR/css-images-3/#natural-dimensions

View file

@ -226,31 +226,6 @@ Viewport& Node::root()
return *document().layout_node();
}
void Node::set_needs_display()
{
auto* containing_block = this->containing_block();
if (!containing_block)
return;
if (!containing_block->paintable_box())
return;
auto navigable = this->navigable();
if (!navigable)
return;
if (this->paintable() && is<Painting::InlinePaintable>(this->paintable())) {
auto const& fragments = static_cast<Painting::InlinePaintable*>(this->paintable())->fragments();
for (auto const& fragment : fragments)
navigable->set_needs_display(fragment.absolute_rect());
}
if (!is<Painting::PaintableWithLines>(*containing_block->paintable_box()))
return;
static_cast<Painting::PaintableWithLines const&>(*containing_block->paintable_box()).for_each_fragment([&](auto& fragment) {
navigable->set_needs_display(fragment.absolute_rect());
return IterationDecision::Continue;
});
}
bool Node::is_floating() const
{
if (!has_style())

View file

@ -155,8 +155,6 @@ public:
void removed_from(Node&) { }
void children_changed() { }
virtual void set_needs_display();
bool children_are_inline() const { return m_children_are_inline; }
void set_children_are_inline(bool value) { m_children_are_inline = value; }