Fix inset box-shadow to use the padding box (#33433)

As specified in https://drafts.csswg.org/css-backgrounds-3/#shadow-shape

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2024-09-13 12:47:50 +02:00 committed by GitHub
parent 6e80a34d09
commit 52f89c95b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 4 additions and 13 deletions

View file

@ -1028,18 +1028,17 @@ impl<'a> BuilderForBoxFragment<'a> {
}
// NB: According to CSS-BACKGROUNDS, box shadows render in *reverse* order (front to back).
let border_rect = self.border_rect;
let common = builder.common_properties(MaxRect::max_rect(), &self.fragment.style);
for box_shadow in box_shadows.iter().rev() {
let clip_mode = if box_shadow.inset {
BoxShadowClipMode::Inset
let (rect, clip_mode) = if box_shadow.inset {
(*self.padding_rect(), BoxShadowClipMode::Inset)
} else {
BoxShadowClipMode::Outset
(self.border_rect, BoxShadowClipMode::Outset)
};
builder.wr().push_box_shadow(
&common,
border_rect,
rect,
LayoutVector2D::new(
box_shadow.base.horizontal.px(),
box_shadow.base.vertical.px(),

View file

@ -1,2 +0,0 @@
[box-shadow-041.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[box-shadow-042.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[box-shadow-inset-without-border-radius.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[box-shadow-001.html]
expected: FAIL