From ce3260c6bf9ef918ac3d13818a56d62e51f89163 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 15 Jun 2020 12:57:43 +0200 Subject: [PATCH] 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. --- Libraries/LibWeb/Layout/LayoutNode.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Libraries/LibWeb/Layout/LayoutNode.cpp b/Libraries/LibWeb/Layout/LayoutNode.cpp index 1c8a43d718..75708df343 100644 --- a/Libraries/LibWeb/Layout/LayoutNode.cpp +++ b/Libraries/LibWeb/Layout/LayoutNode.cpp @@ -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; }