mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-16 06:22:17 +00:00
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.
This commit is contained in:
parent
7ad0767aa0
commit
36553d4566
Notes:
sideshowbarker
2024-07-17 10:10:18 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: 36553d4566
Pull-request: https://github.com/SerenityOS/serenity/pull/23057
3 changed files with 29 additions and 4 deletions
|
@ -0,0 +1,13 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<link rel="match" href="reference/overflow-hidden-text-inside-translated-container-ref.html" />
|
||||||
|
<style>
|
||||||
|
.text {
|
||||||
|
overflow: hidden;
|
||||||
|
font-size: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
transform: translate(0px, -50%);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div class="container"><div class="text">Verify with something else</div></div>
|
|
@ -0,0 +1,11 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<style>
|
||||||
|
.text {
|
||||||
|
font-size: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
transform: translate(0px, -50%);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div class="container"><div class="text">Verify with something else</div></div>
|
|
@ -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;
|
bool should_clip_overflow = computed_values().overflow_x() != CSS::Overflow::Visible && computed_values().overflow_y() != CSS::Overflow::Visible;
|
||||||
Optional<u32> corner_clip_id;
|
Optional<u32> 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) {
|
if (should_clip_overflow) {
|
||||||
context.recording_painter().save();
|
context.recording_painter().save();
|
||||||
// FIXME: Handle overflow-x and overflow-y being different values.
|
// FIXME: Handle overflow-x and overflow-y being different values.
|
||||||
context.recording_painter().add_clip_rect(clip_box.to_type<int>());
|
context.recording_painter().add_clip_rect(context.rounded_device_rect(clip_box).to_type<int>());
|
||||||
auto scroll_offset = context.rounded_device_point(this->scroll_offset());
|
auto scroll_offset = context.rounded_device_point(this->scroll_offset());
|
||||||
context.recording_painter().translate(-scroll_offset.to_type<int>());
|
context.recording_painter().translate(-scroll_offset.to_type<int>());
|
||||||
|
|
||||||
|
@ -617,7 +618,7 @@ void PaintableWithLines::paint(PaintContext& context, PaintPhase phase) const
|
||||||
};
|
};
|
||||||
if (corner_radii.has_any_radius()) {
|
if (corner_radii.has_any_radius()) {
|
||||||
corner_clip_id = context.allocate_corner_clipper_id();
|
corner_clip_id = context.allocate_corner_clipper_id();
|
||||||
context.recording_painter().sample_under_corners(*corner_clip_id, corner_radii, clip_box.to_type<int>(), CornerClip::Outside);
|
context.recording_painter().sample_under_corners(*corner_clip_id, corner_radii, context.rounded_device_rect(clip_box).to_type<int>(), CornerClip::Outside);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue