Closed
Bug 1189024
Opened 11 years ago
Closed 11 years ago
Set filterUnits and primitiveUnits to objectBoundingBox for Devtools "invert" filter
Categories
(DevTools :: General, defect)
DevTools
General
Tracking
(firefox42 fixed)
RESOLVED
FIXED
Firefox 42
| Tracking | Status | |
|---|---|---|
| firefox42 | --- | fixed |
People
(Reporter: dholbert, Assigned: dholbert)
References
Details
Attachments
(1 file)
|
1.19 KB,
patch
|
bgrins
:
review+
|
Details | Diff | Splinter Review |
As noted in bug 1180048 comment 13, we're triggering some NS_WARNINGS when rendering filters.svg's "invert" filter for the first time (at least), due to it having percentages which apply to a frame which initially has 0 width and 0 height (until reflow has completed).
This is in part because it has the default "userSpaceOnUse" sizing behavior, which means x/y/width/height are in the coordinate space that the target-element is inside of:
http://www.w3.org/TR/SVG11/filters.html#FilterElementPrimitiveUnitsAttribute
This filter *really* wants to have its units (x="0%" y="0%" width="100%" height="100%") apply to the target-element's bounding-box -- not to the coordinate space around the element. So, it should request objectBoundingBox to opt-in to that sizing behavior.
(I'm not 100% sure, but I think objectBoundingBox and userSpaceOnUse effectively behave the same when SVG filters are applied to HTML content. But we get to the eventual result in different ways, and in this case we trip over ourselves a bit [triggering this warning] when trying to evaluate the userSpaceOnUse behavior -- so directly asking for objectBoundingBox would be nicer there, in addition to being a bit more declarative about the intent.)
| Assignee | ||
Comment 1•11 years ago
|
||
Comment 2•11 years ago
|
||
Comment on attachment 8640656 [details] [diff] [review]
fix v1
Review of attachment 8640656 [details] [diff] [review]:
-----------------------------------------------------------------
I tested and all the icons are still being inverted properly in the light theme.
The weird thing is that I see in the docs on MDN:
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/primitiveUnits - "If the filterUnits attribute isn't specified, then the effect is as if a value of objectBoundingBox were specified."
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/filterUnits - "If the primitiveUnits attribute isn't specified, then the effect is as if a value of objectBoundingBox were specified."
Based on Comment 0, maybe those docs need to be updated?
Attachment #8640656 -
Flags: review?(bgrinstead) → review+
| Assignee | ||
Comment 3•11 years ago
|
||
(In reply to Brian Grinstead [:bgrins] from comment #2)
> I tested and all the icons are still being inverted properly in the light
> theme.
Thanks!
> The weird thing is that I see in the docs on MDN
[Looks like you got the quotes/links swapped there]
Yeah, the MDN text on primitiveUnits there is incorrect. (It doesn't match the spec:
http://www.w3.org/TR/SVG11/filters.html#FilterElementPrimitiveUnitsAttribute
...or our implementation:
http://mxr.mozilla.org/mozilla-central/source/dom/svg/SVGFilterElement.cpp?rev=bd079aadd3fe&mark=40-40,42-42#40
...or the bolded default on the same page.
The text on filterUnits is correct, though (and matches our implmentation) -- so that means the |filterUnits="objectBoundingBox"| that I'm adding in the patch is unnecessary. (I only put it in there for completeness, and because I initially got filterUnits and primitiveUnits mixed up.) I'll go ahead and drop that part before landing.
Thanks for the review!
| Assignee | ||
Comment 4•11 years ago
|
||
(I'll fix the primitiveUnits MDN page, too.)
| Assignee | ||
Comment 5•11 years ago
|
||
(Turns out the previous edit to the primitiveUnits MDN page was someone fixing up the default value elsewhere in the page -- bolding the correct default value -- but they just forgot to update the prose. :) Fixed now anyway.)
Comment 7•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 42
Updated•8 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•