From 9def582fba8102c282fa11a86cd75a95a6005366 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Wed, 7 Aug 2024 19:18:41 +0300 Subject: [PATCH] LibWeb: Apply enclosing scroll frame offset to iframe's position Fixes iframe painting when it's nested into a scrollable box. --- .../scrollable-contains-iframe-ref.html | 22 +++++++++++++++ .../Ref/scrollable-contains-iframe.html | 27 +++++++++++++++++++ .../NestedBrowsingContextPaintable.cpp | 1 + 3 files changed, 50 insertions(+) create mode 100644 Tests/LibWeb/Ref/reference/scrollable-contains-iframe-ref.html create mode 100644 Tests/LibWeb/Ref/scrollable-contains-iframe.html diff --git a/Tests/LibWeb/Ref/reference/scrollable-contains-iframe-ref.html b/Tests/LibWeb/Ref/reference/scrollable-contains-iframe-ref.html new file mode 100644 index 00000000000..c1eaea74ed6 --- /dev/null +++ b/Tests/LibWeb/Ref/reference/scrollable-contains-iframe-ref.html @@ -0,0 +1,22 @@ + + + +
+ +
diff --git a/Tests/LibWeb/Ref/scrollable-contains-iframe.html b/Tests/LibWeb/Ref/scrollable-contains-iframe.html new file mode 100644 index 00000000000..a94d999bbea --- /dev/null +++ b/Tests/LibWeb/Ref/scrollable-contains-iframe.html @@ -0,0 +1,27 @@ + + + +
+
+ +
+ diff --git a/Userland/Libraries/LibWeb/Painting/NestedBrowsingContextPaintable.cpp b/Userland/Libraries/LibWeb/Painting/NestedBrowsingContextPaintable.cpp index 84e6722f765..9515ff44216 100644 --- a/Userland/Libraries/LibWeb/Painting/NestedBrowsingContextPaintable.cpp +++ b/Userland/Libraries/LibWeb/Painting/NestedBrowsingContextPaintable.cpp @@ -40,6 +40,7 @@ void NestedBrowsingContextPaintable::paint(PaintContext& context, PaintPhase pha if (phase == PaintPhase::Foreground) { auto absolute_rect = this->absolute_rect(); + absolute_rect.translate_by(enclosing_scroll_frame_offset()); auto clip_rect = context.rounded_device_rect(absolute_rect); ScopedCornerRadiusClip corner_clip { context, clip_rect, normalized_border_radii_data(ShrinkRadiiForBorders::Yes) };