mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:47:45 +00:00
LibWeb: Move box_type_agnostic_position() 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:
parent
31e5b5f5de
commit
814bed33b4
8 changed files with 39 additions and 36 deletions
|
@ -251,29 +251,6 @@ void Node::set_needs_display()
|
|||
});
|
||||
}
|
||||
|
||||
CSSPixelPoint Node::box_type_agnostic_position() const
|
||||
{
|
||||
if (is<Box>(*this))
|
||||
return verify_cast<Box>(*this).paintable_box()->absolute_position();
|
||||
VERIFY(is_inline());
|
||||
|
||||
if (paintable() && paintable()->is_inline_paintable()) {
|
||||
auto const& inline_paintable = static_cast<Painting::InlinePaintable const&>(*paintable());
|
||||
if (!inline_paintable.fragments().is_empty())
|
||||
return inline_paintable.fragments().first().absolute_rect().location();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
CSSPixelPoint position;
|
||||
if (auto const* block = containing_block(); block && block->paintable() && is<Painting::PaintableWithLines>(*block->paintable())) {
|
||||
static_cast<Painting::PaintableWithLines const&>(*block->paintable_box()).for_each_fragment([&](auto& fragment) {
|
||||
position = fragment.absolute_rect().location();
|
||||
return IterationDecision::Break;
|
||||
});
|
||||
}
|
||||
return position;
|
||||
}
|
||||
|
||||
bool Node::is_floating() const
|
||||
{
|
||||
if (!has_style())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue