Let context-fill, context-stroke values be used as colours




6 years ago
2 years ago


(Reporter: eflores, Unassigned)


Firefox Tracking Flags

(Not tracked)



(3 attachments)

In the current SVG fonts implementation, context-fill and context-stroke are valid paint values, but not colours. It would be useful to use the fallback colour when either is used in a colour property, e.g. stop-color.
Duplicate of this bug: 801856
Created attachment 719779 [details] [diff] [review]
Test for using context-fill and context-stroke in stop-color
Attachment #719779 - Flags: review?(roc)
Created attachment 719780 [details] [diff] [review]
Style system changes

Let context-fill and context-stroke be used in stop-color, and context-fill-opacity and context-stroke-opacity be used in stop-opacity.

Not marking r? yet as waiting to hear whether we can unprefix the context-* values.
Created attachment 719781 [details] [diff] [review]
Non-style system changes
Attachment #719781 - Flags: review?(roc)
Comment on attachment 719781 [details] [diff] [review]
Non-style system changes

Review of attachment 719781 [details] [diff] [review]:

::: layout/svg/nsSVGStopFrame.h
@@ +21,5 @@
> +  NS_NewSVGStopFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
> +
> +  bool mIsResolved;
> +  nscolor mStopColor;
> +  float mStopOpacity;

These should go at the end of the class, by convention.

Is it really worth caching mStopColor/mStopOpacity?
(In reply to Robert O'Callahan (:roc) (Mozilla Corporation) from comment #5)
> Is it really worth caching mStopColor/mStopOpacity?

There are uses where the context fill/stroke won't be visible, so we have to cache these. A (very) contrived example would be if a document D were to use an SVG glyph G, which itself used an SVG glyph H; then G has a gradient which uses context-fill to get the fill colour from D; and then H uses context-fill to use that gradient from G.
Why can't we get the colors on-demand via mFillPattern in that case?
Assignee: edwin → nobody
You need to log in before you can comment on or make changes to this bug.