Closed
Bug 1303623
Opened 9 years ago
Closed 9 years ago
Parsing mask-clip/mask-origin: fill-box|stroke-box|view-box|no-clip values
Categories
(Core :: Layout, defect, P2)
Core
Layout
Tracking
()
RESOLVED
FIXED
mozilla53
| Tracking | Status | |
|---|---|---|
| firefox53 | --- | fixed |
People
(Reporter: u459114, Assigned: ethlin)
References
(Blocks 1 open bug)
Details
(Keywords: dev-doc-complete)
Attachments
(5 files, 12 obsolete files)
|
58 bytes,
text/x-review-board-request
|
heycam
:
review+
|
Details |
|
58 bytes,
text/x-review-board-request
|
heycam
:
review+
|
Details |
|
58 bytes,
text/x-review-board-request
|
heycam
:
review+
|
Details |
|
58 bytes,
text/x-review-board-request
|
heycam
:
review+
|
Details |
|
58 bytes,
text/x-review-board-request
|
heycam
:
review+
|
Details |
According to masking spec:
https://drafts.fxtf.org/css-masking-1/#the-mask-clip
4 more properties support needed.
Hi Astley,
This bug is similiar to bug 1289011. Want to find someone fix it?
If no one want to fix it, please assign back to me.
Flags: needinfo?(aschen)
Updated•9 years ago
|
Keywords: dev-doc-needed
Comment 2•9 years ago
|
||
rename to correct prop name.
Summary: Handle mask-repeat: fill-box|stroke-box|view-box|no-clip → Handle mask-clip: fill-box|stroke-box|view-box|no-clip values
Whiteboard: tlt-queue
| Assignee | ||
Updated•9 years ago
|
Assignee: nobody → ethlin
Updated•9 years ago
|
Flags: needinfo?(aschen)
Whiteboard: tlt-queue → tlt-wip
Updated•9 years ago
|
Status: NEW → ASSIGNED
| Assignee | ||
Comment 3•9 years ago
|
||
This patch is for CSS parse. But I seems to mix background-clip and mask-clip.
We may just handle css parsing + style and make sure all test case pass in this bug. And create another one to fix rendering issues in nsCSSRendering + nsDisplayMask + nsSVGIntergrationUtils
And, not only mask-clip, mask-position need to support these new box as well
Summary: Handle mask-clip: fill-box|stroke-box|view-box|no-clip values → Parsing mask-clip/mask-origin: fill-box|stroke-box|view-box|no-clip values
| Assignee | ||
Comment 6•9 years ago
|
||
Fix the struct 'CSS_PROP_SVGRESET'. 'mask-clip' can read these values correctly, but 'background-clip' can read too. I need make these values illegal for 'background-clip'.
Attachment #8801021 -
Attachment is obsolete: true
Updated•9 years ago
|
Priority: -- → P2
| Assignee | ||
Comment 7•9 years ago
|
||
Style constant changes.
Attachment #8801606 -
Attachment is obsolete: true
Attachment #8802418 -
Flags: review?(cam)
| Assignee | ||
Comment 9•9 years ago
|
||
The patch is for parser changes.
Attachment #8802420 -
Flags: review?(cam)
| Assignee | ||
Comment 10•9 years ago
|
||
Bug 1311270 will implement the rendering part. So this patch is for fallback to default value.
Attachment #8802422 -
Flags: review?(cam)
| Assignee | ||
Comment 11•9 years ago
|
||
Fix testcase after adding fill-box|stroke-box|view-box|no-clip values.
Attachment #8802423 -
Flags: review?(cam)
Updated•9 years ago
|
Attachment #8802418 -
Flags: review?(cam) → review+
Comment 12•9 years ago
|
||
Comment on attachment 8802419 [details] [diff] [review]
Part2. Style structure changes
Review of attachment 8802419 [details] [diff] [review]:
-----------------------------------------------------------------
OK, but a couple of things to fix.
::: layout/style/nsCSSProps.cpp
@@ +930,5 @@
> + { eCSSKeyword_view_box, NS_STYLE_IMAGELAYER_CLIP_VIEW },
> + { eCSSKeyword_no_clip, NS_STYLE_IMAGELAYER_CLIP_NO_CLIP },
> + // The next entry is controlled by the layout.css.background-clip-text.enabled
> + // pref.
> + { eCSSKeyword_text, NS_STYLE_IMAGELAYER_CLIP_TEXT },
The "text" value should only be supported for background-clip, not for mask-clip. The value is defined here:
https://compat.spec.whatwg.org/#valdef--webkit-background-clip-text
@@ +936,5 @@
> +};
> +
> +static_assert(MOZ_ARRAY_LENGTH(nsCSSProps::kMaskOriginKTable) ==
> + MOZ_ARRAY_LENGTH(nsCSSProps::kMaskClipKTable) - 2,
> + "background-clip has two extra value, which are no-clip and text, compared"
The original assertion was checking that {background,mask}-origin and background-clip had almost identical arrays. If we want to preserve that, we should keep that assertion (just for background-origin vs background-clip) and have a second one for the mask arrays.
But I think it's probably not important to keep. We have should have mochitest that check we support the right set of values. So I suggest removing it.
::: layout/style/nsCSSProps.h
@@ +691,5 @@
> static const KTableEntry kAzimuthKTable[];
> static const KTableEntry kBackfaceVisibilityKTable[];
> static const KTableEntry kTransformStyleKTable[];
> static const KTableEntry kImageLayerAttachmentKTable[];
> static const KTableEntry kImageLayerOriginKTable[];
Please rename this to kBackgroundOriginKTable, now that it is not being used for both background-origin and mask-origin.
@@ +702,5 @@
> static const KTableEntry kImageLayerModeKTable[];
> // Not const because we modify its entries when the pref
> // "layout.css.background-clip.text" changes:
> static KTableEntry kBackgroundClipKTable[];
> + static KTableEntry kMaskClipKTable[];
Then we can make this const.
Attachment #8802419 -
Flags: review?(cam) → review-
Comment 13•9 years ago
|
||
Comment on attachment 8802418 [details] [diff] [review]
Part1. Style const changes.
Review of attachment 8802418 [details] [diff] [review]:
-----------------------------------------------------------------
::: layout/style/nsStyleConsts.h
@@ +351,5 @@
> +#define NS_STYLE_IMAGELAYER_CLIP_MARGIN 3
> +#define NS_STYLE_IMAGELAYER_CLIP_FILL 4
> +#define NS_STYLE_IMAGELAYER_CLIP_STROKE 5
> +#define NS_STYLE_IMAGELAYER_CLIP_VIEW 6
> +#define NS_STYLE_IMAGELAYER_CLIP_NO_CLIP 7
Can you comment somewhere in here that MARGIN, FILL, etc. are only supported by mask-clip, and not background-clip.
@@ +370,5 @@
> #define NS_STYLE_IMAGELAYER_ORIGIN_CONTENT 2
> +#define NS_STYLE_IMAGELAYER_ORIGIN_MARGIN 3
> +#define NS_STYLE_IMAGELAYER_ORIGIN_FILL 4
> +#define NS_STYLE_IMAGELAYER_ORIGIN_STROKE 5
> +#define NS_STYLE_IMAGELAYER_ORIGIN_VIEW 6
Similarly here, that that MARGIN, FILL, etc. are only supported by mask-origin, and not background-origin.
Updated•9 years ago
|
Attachment #8802420 -
Flags: review?(cam) → review+
Comment 14•9 years ago
|
||
Comment on attachment 8802422 [details] [diff] [review]
Part4. Rendering changes
Review of attachment 8802422 [details] [diff] [review]:
-----------------------------------------------------------------
::: layout/base/nsCSSRendering.cpp
@@ +1835,5 @@
> + backgroundClip == NS_STYLE_IMAGELAYER_CLIP_FILL ||
> + backgroundClip == NS_STYLE_IMAGELAYER_CLIP_STROKE ||
> + backgroundClip == NS_STYLE_IMAGELAYER_CLIP_VIEW ||
> + backgroundClip == NS_STYLE_IMAGELAYER_CLIP_NO_CLIP) {
> + backgroundClip = NS_STYLE_IMAGELAYER_CLIP_BORDER;
It would be nice to be able to assert that we don't get these values for background-clip (and only for mask-clip). But inside GetImageLayerClip we don't know if we're here for background or mask...
Attachment #8802422 -
Flags: review?(cam) → review+
Comment 15•9 years ago
|
||
Comment on attachment 8802423 [details] [diff] [review]
Part5. Testcase changes
Review of attachment 8802423 [details] [diff] [review]:
-----------------------------------------------------------------
::: layout/style/test/property_database.js
@@ +2372,5 @@
> inherited: false,
> type: CSS_TYPE_LONGHAND,
> initial_values: [ "padding-box" ],
> other_values: [ "border-box", "content-box", "border-box, padding-box", "padding-box, padding-box, padding-box", "border-box, border-box" ],
> + invalid_values: [ "margin-box", "padding-box padding-box", "fill-box", "stroke-box", "view-box" ]
Put no-clip in here too?
Attachment #8802423 -
Flags: review?(cam) → review+
Comment 16•9 years ago
|
||
Since these properties are enabled by default on Nightly (and Aurora) currently, we shouldn't land these changes until we have the rendering changes ready to land at the same time. Otherwise style sheets like the following will be broken, as it will seem like these keywords are supported but their rendering isn't:
@supports (mask-clip: fill-box) {
/* for when the browser supports mask-clip:fill-box */
#abc { mask-image: url(...); mask-clip: fill-box; ... }
#abc-fallback { display: none; }
}
@supports not (mask-clip: fill-box) {
/* for when the browser doesn't support mask-clip:fill-box */
#abc { display: none; }
#abc-fallback { display: block; }
}
| Assignee | ||
Comment 17•9 years ago
|
||
(In reply to Cameron McCormack (:heycam) (away Oct 25) from comment #15)
> Comment on attachment 8802423 [details] [diff] [review]
> Part5. Testcase changes
>
> Review of attachment 8802423 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: layout/style/test/property_database.js
> @@ +2372,5 @@
> > inherited: false,
> > type: CSS_TYPE_LONGHAND,
> > initial_values: [ "padding-box" ],
> > other_values: [ "border-box", "content-box", "border-box, padding-box", "padding-box, padding-box, padding-box", "border-box, border-box" ],
> > + invalid_values: [ "margin-box", "padding-box padding-box", "fill-box", "stroke-box", "view-box" ]
>
> Put no-clip in here too?
Oh, 'no-clip' should be here. I'll add it.
| Assignee | ||
Comment 18•9 years ago
|
||
Address heycam's comments.
Attachment #8802418 -
Attachment is obsolete: true
| Assignee | ||
Comment 19•9 years ago
|
||
Add 'no-clip' for invalid value of background-origin.
Attachment #8802423 -
Attachment is obsolete: true
| Assignee | ||
Comment 20•9 years ago
|
||
Address comment 12.
Attachment #8802419 -
Attachment is obsolete: true
Attachment #8806223 -
Flags: review?(cam)
Comment 21•9 years ago
|
||
(In reply to Ethan Lin[:ethlin] from comment #20)
> Created attachment 8806223 [details] [diff] [review]
> Part2. Style structure changes
>
> Address comment 12.
Don't we need to change how CSSParserImpl::ParseImageLayersItem works so that it uses the correct keyword table for the origin property, i.e. uses kBackgroundOriginKTable or kMaskOriginKTable depending on what property we're parsing?
Flags: needinfo?(ethlin)
| Assignee | ||
Comment 22•9 years ago
|
||
(In reply to Cameron McCormack (:heycam) from comment #21)
> Don't we need to change how CSSParserImpl::ParseImageLayersItem works so
> that it uses the correct keyword table for the origin property, i.e. uses
> kBackgroundOriginKTable or kMaskOriginKTable depending on what property
> we're parsing?
We should do this. I'll update the patch.
Flags: needinfo?(ethlin)
| Assignee | ||
Comment 23•9 years ago
|
||
Choose correct table (kBackgroundOriginKTable or kMaskOriginKTable) in ParseImageLayersItem.
Attachment #8806223 -
Attachment is obsolete: true
Attachment #8806223 -
Flags: review?(cam)
Attachment #8807412 -
Flags: review?(cam)
Comment 24•9 years ago
|
||
Comment on attachment 8807412 [details] [diff] [review]
Part2. Style structure changes
Review of attachment 8807412 [details] [diff] [review]:
-----------------------------------------------------------------
::: layout/style/nsCSSParser.cpp
@@ +12226,5 @@
>
> + MOZ_ASSERT(aTable == nsStyleImageLayers::kBackgroundLayerTable ||
> + aTable == nsStyleImageLayers::kMaskLayerTable);
> + const KTableEntry* originTable = (aTable == nsStyleImageLayers::kBackgroundLayerTable) ?
> + nsCSSProps::kBackgroundOriginKTable : nsCSSProps::kMaskOriginKTable;
I just thought of a slightly better way to get the origin table. You can use nsCSSProps::kKeywordTableTable to look it up based on whether we have background-origin or mask-origin in aTable. So:
const KTableEntry* originTable = nsCSSProps::kKeywordTableTable[aTable[nsStyleImageLayers::origin]];
Then we don't need the assertion on the aTable value itself.
So, r=me with that (here, and below for looping and the clip keyword table, and in Declaration.cpp too).
Attachment #8807412 -
Flags: review?(cam) → review+
| Assignee | ||
Comment 25•9 years ago
|
||
(In reply to Cameron McCormack (:heycam) from comment #24)
> Comment on attachment 8807412 [details] [diff] [review]
> Part2. Style structure changes
>
> Review of attachment 8807412 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: layout/style/nsCSSParser.cpp
> @@ +12226,5 @@
> >
> > + MOZ_ASSERT(aTable == nsStyleImageLayers::kBackgroundLayerTable ||
> > + aTable == nsStyleImageLayers::kMaskLayerTable);
> > + const KTableEntry* originTable = (aTable == nsStyleImageLayers::kBackgroundLayerTable) ?
> > + nsCSSProps::kBackgroundOriginKTable : nsCSSProps::kMaskOriginKTable;
>
> I just thought of a slightly better way to get the origin table. You can
> use nsCSSProps::kKeywordTableTable to look it up based on whether we have
> background-origin or mask-origin in aTable. So:
>
> const KTableEntry* originTable =
> nsCSSProps::kKeywordTableTable[aTable[nsStyleImageLayers::origin]];
>
> Then we don't need the assertion on the aTable value itself.
>
> So, r=me with that (here, and below for looping and the clip keyword table,
> and in Declaration.cpp too).
Okay, thanks for the review.
| Assignee | ||
Comment 26•9 years ago
|
||
Address :heycam's comment.
Attachment #8807412 -
Attachment is obsolete: true
| Assignee | ||
Updated•9 years ago
|
Attachment #8808021 -
Attachment description: Part2. Style structure changes → Part2. Style structure changes (carry r: heycam)
Updated•9 years ago
|
Whiteboard: tlt-wip
| Reporter | ||
Comment 27•9 years ago
|
||
Ehtan,
https://treeherder.mozilla.org/#/jobs?repo=try&revision=99a88b0c346c6e38eab49dbd190c01d4b4119fb3&selectedJob=31657719
TEST-UNEXPECTED-FAIL | layout/style/test/test_property_syntax_errors.html | invalid value 'margin-box' not accepted for 'mask-origin' property - got "margin-box", expected ""
Not only mask-clip, you probably should also update mask-origin valid/invalid value in property database
| Comment hidden (mozreview-request) |
| Comment hidden (mozreview-request) |
| Comment hidden (mozreview-request) |
| Comment hidden (mozreview-request) |
| Comment hidden (mozreview-request) |
| Assignee | ||
Comment 33•9 years ago
|
||
Using mozreview is easier for bug 1311270 to merge and push the patches. I also rebased the patches. :heycam, sorry for sending review request again.
| Assignee | ||
Updated•9 years ago
|
Attachment #8802420 -
Attachment is obsolete: true
| Assignee | ||
Updated•9 years ago
|
Attachment #8802422 -
Attachment is obsolete: true
| Assignee | ||
Updated•9 years ago
|
Attachment #8806221 -
Attachment is obsolete: true
| Assignee | ||
Updated•9 years ago
|
Attachment #8806222 -
Attachment is obsolete: true
| Assignee | ||
Updated•9 years ago
|
Attachment #8808021 -
Attachment is obsolete: true
| Reporter | ||
Comment 34•9 years ago
|
||
Ethan, bug 1260094 commend 6. We probably should remove implementation of margin-box first.
| Assignee | ||
Comment 35•9 years ago
|
||
(In reply to C.J. Ku[:cjku](UTC+8) from comment #34)
> Ethan, bug 1260094 commend 6. We probably should remove implementation of
> margin-box first.
Okay, I'll update the patches.
| Comment hidden (mozreview-request) |
| Comment hidden (mozreview-request) |
| Comment hidden (mozreview-request) |
| Comment hidden (mozreview-request) |
| Comment hidden (mozreview-request) |
Comment 41•9 years ago
|
||
| mozreview-review | ||
Comment on attachment 8814024 [details]
Bug 1303623 - Part2. Style structure changes.
https://reviewboard.mozilla.org/r/95328/#review95618
::: layout/style/Declaration.cpp:404
(Diff revision 2)
> - for (size_t i = 0; nsCSSProps::kImageLayerOriginKTable[i].mValue != -1; i++) {
> + const nsCSSProps::KTableEntry* originTable = nsCSSProps::kKeywordTableTable[aTable[nsStyleImageLayers::origin]];
> + const nsCSSProps::KTableEntry* clipTable = nsCSSProps::kKeywordTableTable[aTable[nsStyleImageLayers::clip]];
Please keep these within 80 columns.
::: layout/style/nsCSSParser.cpp:12365
(Diff revision 2)
> haveOrigin = false,
> haveComposite = false,
> haveMode = false,
> haveSomething = false;
>
> + const KTableEntry* originTable = nsCSSProps::kKeywordTableTable[aTable[nsStyleImageLayers::origin]];
Here too.
::: layout/style/nsCSSParser.cpp:12450
(Diff revision 2)
>
> // The spec allows a second box value (for background-clip),
> // immediately following the first one (for background-origin).
>
> #ifdef DEBUG
> - for (size_t i = 0; nsCSSProps::kImageLayerOriginKTable[i].mValue != -1; i++) {
> + const KTableEntry* clipTable = nsCSSProps::kKeywordTableTable[aTable[nsStyleImageLayers::clip]];
And here.
Attachment #8814024 -
Flags: review?(cam) → review+
Comment 42•9 years ago
|
||
| mozreview-review | ||
Comment on attachment 8814023 [details]
Bug 1303623 - Part1. Style const changes.
https://reviewboard.mozilla.org/r/95326/#review95622
Attachment #8814023 -
Flags: review?(cam) → review+
Comment 43•9 years ago
|
||
| mozreview-review | ||
Comment on attachment 8814025 [details]
Bug 1303623 - Part3. Parser changes.
https://reviewboard.mozilla.org/r/95330/#review95626
Attachment #8814025 -
Flags: review?(cam) → review+
Comment 44•9 years ago
|
||
| mozreview-review | ||
Comment on attachment 8814026 [details]
Bug 1303623 - Part4. Rendering changes.
https://reviewboard.mozilla.org/r/95332/#review95628
Attachment #8814026 -
Flags: review?(cam) → review+
Comment 45•9 years ago
|
||
| mozreview-review | ||
Comment on attachment 8814027 [details]
Bug 1303623 - Part5. Testcase changes.
https://reviewboard.mozilla.org/r/95334/#review95630
Attachment #8814027 -
Flags: review?(cam) → review+
Comment 46•9 years ago
|
||
Looks good. Again, let's not land this until bug 1311270 is ready to land.
| Comment hidden (mozreview-request) |
| Comment hidden (mozreview-request) |
| Comment hidden (mozreview-request) |
| Comment hidden (mozreview-request) |
Comment 51•9 years ago
|
||
Pushed by cku@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/a5d992a04bfc
Part1. Style const changes. r=heycam
https://hg.mozilla.org/integration/mozilla-inbound/rev/e5a2498583f1
Part2. Style structure changes. r=heycam
https://hg.mozilla.org/integration/mozilla-inbound/rev/72f4b8000ec2
Part3. Parser changes. r=heycam
https://hg.mozilla.org/integration/mozilla-inbound/rev/c5dee39ac4db
Part4. Rendering changes. r=heycam
https://hg.mozilla.org/integration/mozilla-inbound/rev/1f837ec9ae16
Part5. Testcase changes. r=heycam
Comment 52•9 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/a5d992a04bfc
https://hg.mozilla.org/mozilla-central/rev/e5a2498583f1
https://hg.mozilla.org/mozilla-central/rev/72f4b8000ec2
https://hg.mozilla.org/mozilla-central/rev/c5dee39ac4db
https://hg.mozilla.org/mozilla-central/rev/1f837ec9ae16
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox53:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
Comment 53•8 years ago
|
||
These are already documented at
https://developer.mozilla.org/en-US/docs/Web/CSS/mask-clip
https://developer.mozilla.org/en-US/docs/Web/CSS/mask-origin
And the Fx53 release notes already mention support for the mask-* properties.
So I don't think anything else needs to be done for the docs.
Keywords: dev-doc-needed → dev-doc-complete
You need to log in
before you can comment on or make changes to this bug.
Description
•