Skip to content

Commit 7eb98ff

Browse files
committed
Bug 1507308 - Serialize mask using servo. r=jwatt
text-decoration is dealt with in D130018. Remove the test that checks that we don't serialize mask with various non-default properties since now we serialize it correctly. Remove mask from another test, because with this patch we start serializing the url like the mask-image shorthand, which would also fail this test. Making serialization consistent with the longhand makes sense IMO. There's w3c/csswg-drafts#3195 to make image serialization and non-image URL serialization consistent. Will try to fix that in the coming days. After that we can re-add mask/mask-image to that test. Differential Revision: https://phabricator.services.mozilla.com/D130095
1 parent 2125a04 commit 7eb98ff

File tree

4 files changed

+1
-126
lines changed

4 files changed

+1
-126
lines changed

layout/style/ServoCSSPropList.mako.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ def method(prop):
9999

100100
def serialized_by_servo(prop):
101101
if prop.type() == "shorthand":
102-
# FIXME: Need to figure out what to do with relative mask urls.
103-
return prop.name != "mask"
102+
return True
104103
# Keywords are all fine, except -moz-osx-font-smoothing, which does
105104
# resistfingerprinting stuff.
106105
if prop.keyword and prop.name != "-moz-osx-font-smoothing":

layout/style/nsComputedDOMStyle.cpp

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2441,32 +2441,6 @@ already_AddRefed nsComputedDOMStyle::GetTransformValue(
24412441
return MatrixToCSSValue(matrix);
24422442
}
24432443

2444-
already_AddRefed nsComputedDOMStyle::DoGetMask() {
2445-
const nsStyleSVGReset* svg = StyleSVGReset();
2446-
const nsStyleImageLayers::Layer& firstLayer = svg->mMask.mLayers[0];
2447-
2448-
// Mask is now a shorthand, but it used to be a longhand, so that we
2449-
// need to support computed style for the cases where it used to be
2450-
// a longhand.
2451-
if (svg->mMask.mImageCount > 1 ||
2452-
firstLayer.mClip != StyleGeometryBox::BorderBox ||
2453-
firstLayer.mOrigin != StyleGeometryBox::BorderBox ||
2454-
firstLayer.mComposite != StyleMaskComposite::Add ||
2455-
firstLayer.mMaskMode != StyleMaskMode::MatchSource ||
2456-
firstLayer.mPosition != Position::FromPercentage(0.0f) ||
2457-
!firstLayer.mRepeat.IsInitialValue() ||
2458-
!firstLayer.mSize.IsInitialValue() ||
2459-
!(firstLayer.mImage.IsNone() || firstLayer.mImage.IsUrl())) {
2460-
return nullptr;
2461-
}
2462-
2463-
RefPtr val = new nsROCSSPrimitiveValue;
2464-
2465-
SetValueToURLValue(firstLayer.mImage.GetImageRequestURLValue(), val);
2466-
2467-
return val.forget();
2468-
}
2469-
24702444
already_AddRefed nsComputedDOMStyle::DummyGetter() {
24712445
MOZ_CRASH("DummyGetter is not supposed to be invoked");
24722446
}

layout/style/nsComputedDOMStyle.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,6 @@ class nsComputedDOMStyle final : public nsDOMCSSDeclaration,
240240
already_AddRefed DoGetImageLayerPosition(
241241
const nsStyleImageLayers& aLayers);
242242

243-
/* Mask properties */
244-
already_AddRefed DoGetMask();
245-
246243
/* Padding properties */
247244
already_AddRefed DoGetPaddingTop();
248245
already_AddRefed DoGetPaddingBottom();

layout/style/test/test_computed_style.html

Lines changed: 0 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -220,99 +220,6 @@
220220
p.remove();
221221
})();
222222

223-
(function test_bug_1235015() {
224-
// "masks" object contains non-initial mask longhand values.
225-
var emptyMasks = {
226-
// More then one , or any mask-image value other then
227-
// ,
228-
"mask-image": [
229-
"url(#mask1), url(#mask2)",
230-
"linear-gradient(red, yellow)",
231-
"-moz-element(#test)"
232-
],
233-
// any mask-clip value other than "border-box".
234-
"mask-clip": [
235-
"content-box", "padding-box", "margin-box", "fill-box", "stroke-box",
236-
"view-box", "no-clip"
237-
],
238-
// any mask-origin value other than "border-box".
239-
"mask-origin": [
240-
"content-box", "padding-box", "margin-box", "fill-box", "stroke-box",
241-
"view-box"
242-
],
243-
// any mask-composite value other than "add".
244-
"mask-composite": [
245-
"subtract", "intersect", "exclude"
246-
],
247-
// any mask-mode value other than "match-source".
248-
"mask-mode": [
249-
"alpha", "luminance"
250-
],
251-
// any mask-position value other then "0%" "top" "left"
252-
// "center center".
253-
"mask-position": [
254-
"0%", "center", "right", "bottom", "50%", "100%"
255-
],
256-
// any mask-repeat value other then "repeat" "repeat repeat".
257-
"mask-repeat": [
258-
"repeat-x", "repeat-y", "no-repeat", "space", "round"
259-
],
260-
// any mask-size value other then "auto" "auto auto".
261-
"mask-size": [
262-
"10px", "100%", "cover", "contain", "auto 5px"
263-
],
264-
};
265-
266-
// "masks" object contains initial mask longhand values.
267-
var nonEmptyMasks = {
268-
"mask-image": [
269-
"url(#mask1)", "none"
270-
],
271-
"mask-clip": [
272-
"border-box"
273-
],
274-
"mask-origin": [
275-
"border-box"
276-
],
277-
"mask-composite": [
278-
"add"
279-
],
280-
"mask-mode": [
281-
"match-source"
282-
],
283-
"mask-position": [
284-
"0% 0%", "left top"
285-
],
286-
"mask-repeat": [
287-
"repeat", "repeat repeat"
288-
],
289-
"mask-size": [
290-
"auto", "auto auto"
291-
],
292-
};
293-
294-
var p = document.createElement("p");
295-
var cs = getComputedStyle(p, "");
296-
frame_container.appendChild(p);
297-
298-
for (var prop in emptyMasks) {
299-
var subProp = emptyMasks[prop];
300-
for (var i = 0; i < subProp.length; i++) {
301-
p.style.mask = subProp[i];
302-
is(cs.mask, "", "computed value of " + subProp[i] + " mask");
303-
}
304-
}
305-
306-
for (var prop in nonEmptyMasks) {
307-
var subProp = nonEmptyMasks[prop];
308-
for (var i = 0; i < subProp.length; i++) {
309-
p.style.mask = subProp[i];
310-
isnot(cs.mask, "", "computed value of " + subProp[i] + " mask");
311-
}
312-
}
313-
p.remove();
314-
})();
315-
316223
(function test_bug_1363349_linear() {
317224
const specPrefix = "-webkit-gradient(linear, ";
318225
const specSuffix = ", from(blue), to(lime))";
@@ -512,7 +419,6 @@
512419
})();
513420

514421
(function test_bug_1293164() {
515-
516422
var p = document.createElement("p");
517423
var cs = getComputedStyle(p, "");
518424
frame_container.appendChild(p);
@@ -524,7 +430,6 @@
524430
var resolvedNonLocalURL = "url(\"" + docPath + "foo.svg#foo\")";
525431

526432
var testStyles = [
527-
"mask",
528433
"markerStart",
529434
"markerMid",
530435
"markerEnd",

0 commit comments

Comments
 (0)