diff --git a/Tests/LibWeb/Ref/reference/scrollable-content-inside-fixed-position-box-ref.html b/Tests/LibWeb/Ref/reference/scrollable-content-inside-fixed-position-box-ref.html new file mode 100644 index 00000000000..53cd4c54aa7 --- /dev/null +++ b/Tests/LibWeb/Ref/reference/scrollable-content-inside-fixed-position-box-ref.html @@ -0,0 +1,67 @@ + + + +
+

Fixed Element

+
Box 1
+
Box 2
+
Box 3
+
Box 4
+
Box 5
+
diff --git a/Tests/LibWeb/Ref/scrollable-content-inside-fixed-position-box.html b/Tests/LibWeb/Ref/scrollable-content-inside-fixed-position-box.html new file mode 100644 index 00000000000..f7e1cb77302 --- /dev/null +++ b/Tests/LibWeb/Ref/scrollable-content-inside-fixed-position-box.html @@ -0,0 +1,72 @@ + + + +
+

Fixed Element

+
Box 1
+
Box 2
+
Box 3
+
Box 4
+
Box 5
+
+ diff --git a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp index b5ca0d22cc5..9d943f9aa35 100644 --- a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp +++ b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp @@ -1107,10 +1107,14 @@ void PaintableWithLines::resolve_paint_properties() RefPtr PaintableBox::nearest_scroll_frame() const { + if (is_fixed_position()) + return nullptr; auto const* paintable = this->containing_block(); while (paintable) { if (paintable->own_scroll_frame()) return paintable->own_scroll_frame(); + if (paintable->is_fixed_position()) + return nullptr; paintable = paintable->containing_block(); } return nullptr; @@ -1132,6 +1136,8 @@ PaintableBox const* PaintableBox::nearest_scrollable_ancestor() const while (paintable) { if (paintable->is_scrollable()) return paintable; + if (paintable->is_fixed_position()) + return nullptr; paintable = paintable->containing_block(); } return nullptr;