From 36553d456641b3fe1f65cbf9f7606821eab7644f Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Sat, 3 Feb 2024 18:25:31 +0100 Subject: [PATCH] LibWeb: Do not add CSS transforms into clip rect in PaintableWithLines Painting command executor already accounts for CSS transforms so clip rect only needs to be adjusted by scroll offset. --- ...low-hidden-text-inside-translated-container.html | 13 +++++++++++++ ...hidden-text-inside-translated-container-ref.html | 11 +++++++++++ Userland/Libraries/LibWeb/Painting/PaintableBox.cpp | 9 +++++---- 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 Tests/LibWeb/Ref/overflow-hidden-text-inside-translated-container.html create mode 100644 Tests/LibWeb/Ref/reference/overflow-hidden-text-inside-translated-container-ref.html diff --git a/Tests/LibWeb/Ref/overflow-hidden-text-inside-translated-container.html b/Tests/LibWeb/Ref/overflow-hidden-text-inside-translated-container.html new file mode 100644 index 0000000000..252663b319 --- /dev/null +++ b/Tests/LibWeb/Ref/overflow-hidden-text-inside-translated-container.html @@ -0,0 +1,13 @@ + + + +
Verify with something else
diff --git a/Tests/LibWeb/Ref/reference/overflow-hidden-text-inside-translated-container-ref.html b/Tests/LibWeb/Ref/reference/overflow-hidden-text-inside-translated-container-ref.html new file mode 100644 index 0000000000..6ed91a4908 --- /dev/null +++ b/Tests/LibWeb/Ref/reference/overflow-hidden-text-inside-translated-container-ref.html @@ -0,0 +1,11 @@ + + +
Verify with something else
diff --git a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp index 8969dcfd0c..eeb6b7e330 100644 --- a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp +++ b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp @@ -599,12 +599,13 @@ void PaintableWithLines::paint(PaintContext& context, PaintPhase phase) const bool should_clip_overflow = computed_values().overflow_x() != CSS::Overflow::Visible && computed_values().overflow_y() != CSS::Overflow::Visible; Optional corner_clip_id; - auto clip_box = context.rounded_device_rect(compute_absolute_padding_rect_with_css_transform_applied()); - + auto clip_box = absolute_padding_box_rect(); + if (enclosing_scroll_frame_offset().has_value()) + clip_box.translate_by(enclosing_scroll_frame_offset().value()); if (should_clip_overflow) { context.recording_painter().save(); // FIXME: Handle overflow-x and overflow-y being different values. - context.recording_painter().add_clip_rect(clip_box.to_type()); + context.recording_painter().add_clip_rect(context.rounded_device_rect(clip_box).to_type()); auto scroll_offset = context.rounded_device_point(this->scroll_offset()); context.recording_painter().translate(-scroll_offset.to_type()); @@ -617,7 +618,7 @@ void PaintableWithLines::paint(PaintContext& context, PaintPhase phase) const }; if (corner_radii.has_any_radius()) { corner_clip_id = context.allocate_corner_clipper_id(); - context.recording_painter().sample_under_corners(*corner_clip_id, corner_radii, clip_box.to_type(), CornerClip::Outside); + context.recording_painter().sample_under_corners(*corner_clip_id, corner_radii, context.rounded_device_rect(clip_box).to_type(), CornerClip::Outside); } }