mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 16:18:12 +00:00
LibWeb: Fix resolution of CSS clip rect
Previously the clip rect was not relative to the top/left egdes of the element, which lead to it being positioned incorrectly. This fixes the clip-rect-auto-004 and clip-rect-auto-005 web platform tests.
This commit is contained in:
parent
038017ce11
commit
9c8aa5b777
1 changed files with 8 additions and 4 deletions
|
@ -849,11 +849,15 @@ Gfx::FloatRect EdgeRect::resolved(Layout::Node const& layout_node, Gfx::FloatRec
|
|||
// widths for <bottom>, and the same as the used value of the width plus the sum of the
|
||||
// horizontal padding and border widths for <right>, such that four 'auto' values result in the
|
||||
// clipping region being the same as the element's border box).
|
||||
auto left = border_box.left() + (left_edge.is_auto() ? 0 : left_edge.to_px(layout_node));
|
||||
auto top = border_box.top() + (top_edge.is_auto() ? 0 : top_edge.to_px(layout_node));
|
||||
auto right = border_box.left() + (right_edge.is_auto() ? border_box.width() : right_edge.to_px(layout_node));
|
||||
auto bottom = border_box.top() + (bottom_edge.is_auto() ? border_box.height() : bottom_edge.to_px(layout_node));
|
||||
return Gfx::FloatRect {
|
||||
left_edge.is_auto() ? 0 : left_edge.to_px(layout_node),
|
||||
top_edge.is_auto() ? 0 : top_edge.to_px(layout_node),
|
||||
right_edge.is_auto() ? border_box.width() : right_edge.to_px(layout_node) - left_edge.to_px(layout_node),
|
||||
bottom_edge.is_auto() ? border_box.height() : bottom_edge.to_px(layout_node) - top_edge.to_px(layout_node)
|
||||
left,
|
||||
top,
|
||||
right - left,
|
||||
bottom - top
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue