Closed Bug 1365926 Opened 7 years ago Closed 7 years ago

Support 'context-fill-opacity'/'context-stroke-opacity' as SVG-as-an-image context properties

Categories

(Core :: SVG, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
firefox57 --- affected

People

(Reporter: jwatt, Assigned: jwatt)

References

Details

Attachments

(2 files)

Bug 1058040 didn't add support for 'context-fill-opacity'/'context-stroke-opacity' as SVG-as-an-image context properties. There's now been a request for that in bug 1362408 comment 3.
Is this likely to make it in time for 55 (soft code freeze June 5)? Just wondering if we should ask bug 1362408 to go a different route.
Flags: needinfo?(jwatt)
Comment on attachment 8872839 [details] [diff] [review]
part 1 - Support 'context-fill-opacity'/'context-stroke-opacity' as SVG-as-an-image context properties

Review of attachment 8872839 [details] [diff] [review]:
-----------------------------------------------------------------

::: layout/svg/SVGContextPaint.cpp
@@ +395,5 @@
>      hash = HashGeneric(hash, mStroke->ToABGR());
>    }
>  
> +  if (mFillOpacity != 1.0f) {
> +    hash = HashGeneric(hash, mFillOpacity);

Why not just include the hash when it is 1.0f?

::: layout/svg/SVGContextPaint.h
@@ +308,5 @@
>  private:
>    Maybe<Color> mFill;
>    Maybe<Color> mStroke;
> +  float mFillOpacity;
> +  float mStrokeOpacity;

Do we not use Maybe<float> here because it's not possible to provide a fallback fill/stroke-opacity?
Attachment #8872839 - Flags: review?(cam) → review+
(In reply to Cameron McCormack (:heycam) from comment #3)
> Why not just include the hash when it is 1.0f?

Just because in the very common case that fill/stroke opacity are not part of the context paint it allows us to avoid the overhead of a couple of HashGeneric calls.

> ::: layout/svg/SVGContextPaint.h
> @@ +308,5 @@
> >  private:
> >    Maybe<Color> mFill;
> >    Maybe<Color> mStroke;
> > +  float mFillOpacity;
> > +  float mStrokeOpacity;
> 
> Do we not use Maybe<float> here because it's not possible to provide a
> fallback fill/stroke-opacity?

Exactly. And because on SVGContextPaint the GetFillOpacity and GetStrokeOpacity methods return a float (rather than a Maybe<float>). The behavior of these keywords and whether they should have a fallback is not really specified anywhere, but I think it would be sensible to have a fallback so I'd like to add that, but that's something for another bug.
Attachment #8873279 - Flags: review?(cam) → review+
Pushed by jwatt@jwatt.org:
https://hg.mozilla.org/integration/mozilla-inbound/rev/71669172faf1
part 1 - Support 'context-fill-opacity'/'context-stroke-opacity' as SVG-as-an-image context properties. r=heycam
https://hg.mozilla.org/integration/mozilla-inbound/rev/5f6d6bbd7890
part 2 - Always allow the 'context-fill-opacity'/'context-stroke-opacity' keywords in SVG 'fill-opacity'/'stroke-opacity'. r=heycam
Leaving open for finishing the tests.
Keywords: leave-open
Actually I'm moving in the direction of replacing the context-* mechanism with a CSS variables based replacement, so I don't think it's worth finishing these tests just to remove them.
Status: NEW → RESOLVED
Closed: 7 years ago
Keywords: leave-open
Resolution: --- → FIXED
See Also: → 1442867
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: