mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:38:11 +00:00
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:
parent
9825f7792b
commit
ce3260c6bf
1 changed files with 4 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue