diff --git a/Tests/LibWeb/Text/expected/scroll-left-and-top-on-colgroup.txt b/Tests/LibWeb/Text/expected/scroll-left-and-top-on-colgroup.txt new file mode 100644 index 0000000000..3f514e04d2 --- /dev/null +++ b/Tests/LibWeb/Text/expected/scroll-left-and-top-on-colgroup.txt @@ -0,0 +1,2 @@ + scroll left = 0 +scroll top = 0 diff --git a/Tests/LibWeb/Text/input/scroll-left-and-top-on-colgroup.html b/Tests/LibWeb/Text/input/scroll-left-and-top-on-colgroup.html new file mode 100644 index 0000000000..7c2c0464d1 --- /dev/null +++ b/Tests/LibWeb/Text/input/scroll-left-and-top-on-colgroup.html @@ -0,0 +1,13 @@ + +++ + + + diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index 7d62a0b592..133209b503 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -1085,8 +1085,16 @@ double Element::scroll_top() const if (!layout_node() || !is(layout_node())) return 0.0; + // FIXME: Ideally we would stop creating a layout node for column group so that a layout node would always have + // a paintable, but in the meantime, special case this node. + if (layout_node()->display().is_table_column_group()) { + VERIFY(!paintable_box()); + return 0.0; + } + // 9. Return the y-coordinate of the scrolling area at the alignment point with the top of the padding edge of the element. // FIXME: Is this correct? + VERIFY(paintable_box()); return paintable_box()->scroll_offset().y().to_double(); } @@ -1125,8 +1133,16 @@ double Element::scroll_left() const if (!layout_node() || !is(layout_node())) return 0.0; + // FIXME: Ideally we would stop creating a layout node for column group so that a layout node would always have + // a paintable, but in the meantime, special case this node. + if (layout_node()->display().is_table_column_group()) { + VERIFY(!paintable_box()); + return 0.0; + } + // 9. Return the x-coordinate of the scrolling area at the alignment point with the left of the padding edge of the element. // FIXME: Is this correct? + VERIFY(paintable_box()); return paintable_box()->scroll_offset().x().to_double(); }