Closed
Bug 1304539
Opened 8 years ago
Closed 8 years ago
Canvas fillText / strokeText do not respect canvas filters
Categories
(Core :: Graphics: Canvas2D, defect, P3)
Tracking
()
People
(Reporter: mstange, Assigned: ethlin)
References
Details
(Keywords: dev-doc-complete, regression, site-compat, Whiteboard: [gfx-noted])
Attachments
(4 files, 5 obsolete files)
477 bytes,
text/html
|
Details | |
1.34 KB,
patch
|
mstange
:
review+
ritu
:
approval-mozilla-aurora+
ritu
:
approval-mozilla-beta+
|
Details | Diff | Splinter Review |
1.38 KB,
patch
|
lizzard
:
approval-mozilla-release+
|
Details | Diff | Splinter Review |
17.48 KB,
patch
|
ethlin
:
review+
|
Details | Diff | Splinter Review |
[Tracking Requested - why for this release]: regression in a new feature that we just shipped in 49 (canvas filters)
In the testcase, the text should be green, but it's red because the canvas filter is being ignored.
Bug 1274936 broke this for fillText (which shipped in 49) and then bug 1275693 also broke it for strokeText (which will ship in 50).
This breaks the interactive example that somebody added to the main documentation for canvas filters at https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/filter
Reporter | ||
Updated•8 years ago
|
Reporter | ||
Comment 1•8 years ago
|
||
Updated•8 years ago
|
Has Regression Range: --- → yes
Has STR: --- → yes
Priority: -- → P3
Whiteboard: [gfx-noted]
Version: Trunk → 49 Branch
Comment 2•8 years ago
|
||
I guess the new text-painting code path that goes through gfxTextRun::Draw etc doesn't know about the AdjustedTarget stuff used for filter support. :( Are you aiming to look into this, Markus, or do we need to find someone else to tackle it?
Reporter | ||
Comment 3•8 years ago
|
||
I was hoping that your patch for bug 1304353 might magically fix this, but it does not sound like it will.
If it does not respect AdjustedTarget, does that mean that canvas shadows are also broken for fillText/strokeText?
I wasn't really planning to look into this, but if you don't want to work on it I can take a look.
Comment 4•8 years ago
|
||
(In reply to Markus Stange [:mstange] from comment #3)
> I was hoping that your patch for bug 1304353 might magically fix this, but
> it does not sound like it will.
I tried your testcase here with that patch, but it remains red. So no magic fix this time, sadly.
> If it does not respect AdjustedTarget, does that mean that canvas shadows
> are also broken for fillText/strokeText?
Looks like it. (Hmm, we didn't have tests for that?)
> I wasn't really planning to look into this, but if you don't want to work on
> it I can take a look.
If you could, that would be awesome.... I have a couple other issues that I need to focus on at the moment, so probably wouldn't get to this for a week or two at least.
Assignee | ||
Comment 5•8 years ago
|
||
I pass AdjustedDrawTarget to gfxTextRun and the text is green, though I'm not sure if there is any side effect.
Attachment #8794124 -
Flags: feedback?(mstange)
Comment 7•8 years ago
|
||
(In reply to David Bolter [:davidb] from comment #6)
> [Tracking Requested - why for this release]:
Oops. The 'why' is so Liz sees this and possibly adds to the growing ridealong list for a possible point release. Not sure I'd advocate for that though...
Reporter | ||
Comment 8•8 years ago
|
||
(In reply to Ethan Lin[:ethlin] from comment #5)
> Created attachment 8794124 [details] [diff] [review]
> use AdjustedDrawTarget
>
> I pass AdjustedDrawTarget to gfxTextRun and the text is green, though I'm
> not sure if there is any side effect.
This looks good. Does it cause us to apply globalAlpha twice, when combined with the fix for bug 1304353? If not, then this should be fine.
We also need a bunch of reftests. For example:
== fillText-with-color-rgb(0,32,0)-and-filter:brightness(4) fillText-with-color-rgb(0,128,0)-and-no-filter
== same for strokeText
!= fillText-with-shadow fillText-without-shadow
!= same for strokeText
And the above with globalAlpha 0.5.
Comment 9•8 years ago
|
||
Tracking 52+ since this is a regression in a new feature that we just shipped in 49 (canvas filters).
Assignee | ||
Comment 10•8 years ago
|
||
(In reply to Markus Stange [:mstange] from comment #8)
> (In reply to Ethan Lin[:ethlin] from comment #5)
> > Created attachment 8794124 [details] [diff] [review]
> > use AdjustedDrawTarget
> >
> > I pass AdjustedDrawTarget to gfxTextRun and the text is green, though I'm
> > not sure if there is any side effect.
>
> This looks good. Does it cause us to apply globalAlpha twice, when combined
> with the fix for bug 1304353? If not, then this should be fine.
> We also need a bunch of reftests. For example:
> == fillText-with-color-rgb(0,32,0)-and-filter:brightness(4)
> fillText-with-color-rgb(0,128,0)-and-no-filter
> == same for strokeText
> != fillText-with-shadow fillText-without-shadow
> != same for strokeText
> And the above with globalAlpha 0.5.
Okay, I will check with the patch in bug 1304353 and add reftests.
Assignee: nobody → ethlin
Assignee | ||
Comment 11•8 years ago
|
||
(In reply to Ethan Lin[:ethlin] from comment #10)
> (In reply to Markus Stange [:mstange] from comment #8)
> > This looks good. Does it cause us to apply globalAlpha twice, when combined
> > with the fix for bug 1304353? If not, then this should be fine.
> > We also need a bunch of reftests. For example:
> > == fillText-with-color-rgb(0,32,0)-and-filter:brightness(4)
> > fillText-with-color-rgb(0,128,0)-and-no-filter
> > == same for strokeText
> > != fillText-with-shadow fillText-without-shadow
> > != same for strokeText
> > And the above with globalAlpha 0.5.
>
> Okay, I will check with the patch in bug 1304353 and add reftests.
After testing, it doesn't apply globalAlpha twice with the fix in bug 1304353. So I'll add more reftests.
Assignee | ||
Comment 12•8 years ago
|
||
Use AdjustedDrawTarget for drawing text. The previous patch caused a failure in "dom/canvas/test/reftest/1177726-text-stroke-bounds.html".
The try result looks good:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=d7b0b8e61ede
I'll add reftests in another patch, but I may need some time to prepare.
Attachment #8794124 -
Attachment is obsolete: true
Attachment #8794124 -
Flags: feedback?(mstange)
Attachment #8794451 -
Flags: review?(mstange)
Assignee | ||
Comment 13•8 years ago
|
||
Add reftest for fillText and strokeText. I need to add fuzzy for these tests. It looks like after filter, the stroke of text is slightly different.
Attachment #8794723 -
Flags: review?(mstange)
Reporter | ||
Updated•8 years ago
|
Attachment #8794451 -
Flags: review?(mstange) → review+
Reporter | ||
Comment 14•8 years ago
|
||
Comment on attachment 8794723 [details] [diff] [review]
Add reftest
Review of attachment 8794723 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/canvas/test/reftest/filters/reftest.list
@@ +17,5 @@
> == units.html ref.html
> == units-em.html ref.html
> == units-ex.html ref.html
> == units-off-screen.html ref.html
> +fuzzy(47,633) == fillText-with-filter-brightness.html fillText-with-filter-brightness-ref.html
That's a lot of fuzz. I tested a bit and found that with the opacity() filter, you don't need as much fuzz. Can you remove the hue-rotate and the brightness tests, and replace them with tests that use ctx.filter = "opacity(0.5)"? And instead of using globalAlpha in all tests, I think we should have two versions of all of them, with and without globalAlpha.
Attachment #8794723 -
Flags: review?(mstange)
Assignee | ||
Comment 15•8 years ago
|
||
(In reply to Markus Stange [:mstange] from comment #14)
> Comment on attachment 8794723 [details] [diff] [review]
> Add reftest
>
> Review of attachment 8794723 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: dom/canvas/test/reftest/filters/reftest.list
> @@ +17,5 @@
> > == units.html ref.html
> > == units-em.html ref.html
> > == units-ex.html ref.html
> > == units-off-screen.html ref.html
> > +fuzzy(47,633) == fillText-with-filter-brightness.html fillText-with-filter-brightness-ref.html
>
> That's a lot of fuzz. I tested a bit and found that with the opacity()
> filter, you don't need as much fuzz. Can you remove the hue-rotate and the
> brightness tests, and replace them with tests that use ctx.filter =
> "opacity(0.5)"? And instead of using globalAlpha in all tests, I think we
> should have two versions of all of them, with and without globalAlpha.
I just tried opacity() filter, and for 'fillText', the result is much better, but for 'strokeText', I still have to set something like 'fuzzy(45,748)'.
Assignee | ||
Comment 16•8 years ago
|
||
Upload my patch first. I'll see if there's other way to reduce the fuzzy number of strokeText. Markus, any idea?
Attachment #8794723 -
Attachment is obsolete: true
Flags: needinfo?(mstange)
Assignee | ||
Comment 17•8 years ago
|
||
I tried grayscale() filter and the result seems better. So I add grayscale test for fillText and strokeText. The fuzzy number may change after I send the patch try server.
Attachment #8795057 -
Attachment is obsolete: true
Flags: needinfo?(mstange)
Attachment #8795065 -
Flags: review?(mstange)
Reporter | ||
Comment 18•8 years ago
|
||
Comment on attachment 8795065 [details] [diff] [review]
Add reftest
Review of attachment 8795065 [details] [diff] [review]:
-----------------------------------------------------------------
That's a lot better!
Attachment #8795065 -
Flags: review?(mstange) → review+
Tracked 50+ as it's a new regression since Fx49
Assignee | ||
Comment 20•8 years ago
|
||
According to try result, I should change the fuzz of 'strokeText-with-filter-grayscale-1.html' to (1,400).
https://treeherder.mozilla.org/#/jobs?repo=try&revision=20401f6a44d2
Attachment #8795065 -
Attachment is obsolete: true
Assignee | ||
Updated•8 years ago
|
Keywords: checkin-needed
Assignee | ||
Updated•8 years ago
|
Attachment #8796004 -
Flags: review+
Assignee | ||
Comment 21•8 years ago
|
||
Comment on attachment 8794451 [details] [diff] [review]
use AdjustedDrawTarget
Approval Request Comment
[Feature/regressing bug #]: Bug 1274936
[User impact if declined]: The filter and shadow of canvas doesn't work for fillText and strokeText.
[Describe test coverage new/current, TreeHerder]: Tested on locally and try server.
[Risks and why]: Low. Just use the original way to render.
[String/UUID change made/needed]: None.
Attachment #8794451 -
Flags: approval-mozilla-beta?
Attachment #8794451 -
Flags: approval-mozilla-aurora?
Assignee | ||
Comment 22•8 years ago
|
||
Create patch for FF release.
Assignee | ||
Comment 23•8 years ago
|
||
Comment on attachment 8796106 [details] [diff] [review]
use AdjustedDrawTarget
Approval Request Comment
[Feature/regressing bug #]: Bug 1274936
[User impact if declined]: The filter and shadow of canvas doesn't work for fillText and strokeText.
[Describe test coverage new/current, TreeHerder]: Tested on locally and try server.
[Risks and why]: Low. Just use the original way to render.
[String/UUID change made/needed]: None.
Attachment #8796106 -
Flags: approval-mozilla-release?
Comment 24•8 years ago
|
||
(In reply to Ethan Lin[:ethlin] from comment #22)
> Created attachment 8796106 [details] [diff] [review]
> use AdjustedDrawTarget
>
> Create patch for FF release.
Are we considering this for a FF49.dot release? If so, we should probably reconsider taking bug 1304353 (currently wontfix'd for 49) as well, given how closely related they are.
Comment 25•8 years ago
|
||
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/f205f28cbcf3
Use AdjustedDrawTarget to draw text. r=mstange
https://hg.mozilla.org/integration/mozilla-inbound/rev/fbfe71842bb7
Add reftest for fillText and strokeText with filter. r=mstange
Keywords: checkin-needed
I had to back this out for Windows reftest failures https://treeherder.mozilla.org/logviewer.html#?job_id=36733785&repo=mozilla-inbound
https://hg.mozilla.org/integration/mozilla-inbound/rev/37580f7e092f
Flags: needinfo?(ethlin)
Assignee | ||
Comment 27•8 years ago
|
||
In win8, the fuzz number is different. I'll update the the patch.
Flags: needinfo?(ethlin)
Assignee | ||
Comment 28•8 years ago
|
||
Fix win8 try server failure.
Attachment #8796004 -
Attachment is obsolete: true
Assignee | ||
Updated•8 years ago
|
Attachment #8796382 -
Flags: review+
Assignee | ||
Updated•8 years ago
|
Keywords: checkin-needed
Comment 29•8 years ago
|
||
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/2ac1c5fdaef5
Use AdjustedDrawTarget to draw text. r=mstange
https://hg.mozilla.org/integration/mozilla-inbound/rev/1422dee77e60
Add reftest for fillText and strokeText with filter. r=mstange
Keywords: checkin-needed
Comment 30•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/2ac1c5fdaef5
https://hg.mozilla.org/mozilla-central/rev/1422dee77e60
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
Comment 31•8 years ago
|
||
I think that like bug 1304353, this regression from 49 can wait for a fix in 50. Sounds like a new development feature that most web sites will not yet be using.
Comment 32•8 years ago
|
||
Comment on attachment 8796106 [details] [diff] [review]
use AdjustedDrawTarget
I don't think this is a dot release driver, and not used widely yet; let's aim to fix this in 50.
Attachment #8796106 -
Flags: approval-mozilla-release? → approval-mozilla-release-
Comment on attachment 8794451 [details] [diff] [review]
use AdjustedDrawTarget
As mentioned in comment 0, if this bug breaks an MDN example, it's worth fixing soon, Aurora51+, Beta50+
Attachment #8794451 -
Flags: approval-mozilla-beta?
Attachment #8794451 -
Flags: approval-mozilla-beta+
Attachment #8794451 -
Flags: approval-mozilla-aurora?
Attachment #8794451 -
Flags: approval-mozilla-aurora+
Comment 34•8 years ago
|
||
bugherder uplift |
https://hg.mozilla.org/releases/mozilla-aurora/rev/45c3cb513380
https://hg.mozilla.org/releases/mozilla-aurora/rev/7c06ade5c9d3
Flags: in-testsuite+
Comment 35•8 years ago
|
||
bugherder uplift |
Comment 38•8 years ago
|
||
[Tracking Requested - why for this release]: Bug 1304353 to ride 49.0.2. This can also be fixed given the risk is low, 2 dups reported, and an MDN example is also broken.
Comment 39•8 years ago
|
||
Posted the site compatibility doc: https://www.fxsitecompat.com/en-CA/docs/2016/specific-canvas-text-effects-are-not-rendered-properly/
Reporter | ||
Comment 40•8 years ago
|
||
Comment on attachment 8796106 [details] [diff] [review]
use AdjustedDrawTarget
I agree, we should reconsider release uplift here. This not only affects filters (which aren't used widely yet), it also affects canvas shadows, which have been around for a long time.
Comment 41•8 years ago
|
||
Liz: please reconsider uplifting the release patch.
Flags: needinfo?(lhenry)
Comment 42•8 years ago
|
||
Now that we do have a dot release planned it makes sense to take this for 49.0.2, especially as folks are chiming in to say it's already widely in use.
Flags: needinfo?(lhenry)
Comment 43•8 years ago
|
||
Comment on attachment 8796106 [details] [diff] [review]
use AdjustedDrawTarget
Fix a regression, taking this as a ridealong for 49.0.2.
Attachment #8796106 -
Flags: approval-mozilla-release- → approval-mozilla-release+
Comment 45•8 years ago
|
||
Release Note Request (optional, but appreciated)
[Why is this notable]: Ridealong for 49.0.2
[Suggested wording]: Fix a Canvas filters graphics issue affecting HTML5 apps (Bug 1304539)
[Links (documentation, blog post, etc)]:
relnote-firefox:
--- → 49+
You need to log in
before you can comment on or make changes to this bug.
Description
•