LibWeb: Layout nodes without own style can't be absolutely positioned

The only layout nodes that don't have their own style are LayoutText
(they inherit the style from their parent element since text cannot
be styled by CSS.)

However, it never makes sense for text nodes to have absolute position
so don't claim it.
This commit is contained in:
Andreas Kling 2020-06-15 12:57:43 +02:00
parent 9825f7792b
commit ce3260c6bf
Notes: sideshowbarker 2024-07-19 05:38:35 +09:00

View file

@ -200,12 +200,16 @@ Gfx::FloatPoint LayoutNode::box_type_agnostic_position() const
bool LayoutNode::is_absolutely_positioned() const
{
if (!has_style())
return false;
auto position = style().position();
return position == CSS::Position::Absolute || position == CSS::Position::Fixed;
}
bool LayoutNode::is_fixed_position() const
{
if (!has_style())
return false;
return style().position() == CSS::Position::Fixed;
}