Skip to content

Commit

Permalink
Bug 1882621 - Fix the serialization of mask property to avoid ambigui…
Browse files Browse the repository at this point in the history
…ty. r=dholbert

Even if `mask-origin` is at its initial value `border-box`, we still have to
serialize it to avoid ambiguity iF the `mask-clip` longhand has some other
`<coord-box>` value (i.e. neither `border-box` nor `no-clip`).

Differential Revision: https://phabricator.services.mozilla.com/D203209
  • Loading branch information
BorisChiou committed Mar 1, 2024
1 parent f21399d commit d90afd8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
19 changes: 14 additions & 5 deletions servo/components/style/properties/shorthands/svg.mako.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@
// <mask-reference> ||
// <position> [ / <bg-size> ]? ||
// <repeat-style> ||
// <geometry-box> ||
// [ <geometry-box> | no-clip ] ||
// <coord-box> ||
// [ <coord-box> | no-clip ] ||
// <compositing-operator> ||
// <masking-mode>
// https://drafts.fxtf.org/css-masking-1/#the-mask
Expand Down Expand Up @@ -198,12 +198,21 @@
writer.item(repeat)?;
}

// <geometry-box>
if has_origin {
// <coord-box>
// Note:
// Even if 'mask-origin' is at its initial value 'border-box',
// we still have to serialize it to avoid ambiguity iF the
// 'mask-clip' longhand has some other <coord-box> value
// (i.e. neither 'border-box' nor 'no-clip'). (If we naively
// declined to serialize the 'mask-origin' value in this
// situation, then whatever value we serialize for 'mask-clip'
// would implicitly also represent 'mask-origin' and would be
// providing the wrong value for that longhand.)
if has_origin || (has_clip && *clip != Clip::NoClip) {
writer.item(origin)?;
}

// [ <geometry-box> | no-clip ]
// [ <coord-box> | no-clip ]
if has_clip && *clip != From::from(*origin) {
writer.item(clip)?;
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,3 @@
[e.style['mask'\] = "none, linear-gradient(to left bottom, red, blue) padding-box" should set mask-border-width]
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=877294
expected: FAIL

[e.style['mask'\] = "border-box content-box" should set the property value]
expected: FAIL

0 comments on commit d90afd8

Please sign in to comment.