Closed
Bug 1304353
Opened 8 years ago
Closed 8 years ago
HTML5 Canvas globalAlpha has no effect on fillText in Firefox.49
Categories
(Core :: Graphics: Canvas2D, defect, P3)
Tracking
()
People
(Reporter: pmarton80, Assigned: jfkthame)
References
()
Details
(4 keywords, Whiteboard: [gfx-noted])
Attachments
(11 files, 1 obsolete file)
552 bytes,
application/x-javascript
|
Details | |
62.47 KB,
image/png
|
Details | |
63.52 KB,
image/png
|
Details | |
317 bytes,
text/html
|
Details | |
1.73 KB,
patch
|
bas.schouten
:
review+
ritu
:
approval-mozilla-aurora+
ritu
:
approval-mozilla-beta+
|
Details | Diff | Splinter Review |
1.14 KB,
patch
|
bas.schouten
:
review+
|
Details | Diff | Splinter Review |
5.15 KB,
patch
|
bas.schouten
:
review+
|
Details | Diff | Splinter Review |
2.66 KB,
patch
|
bas.schouten
:
review+
|
Details | Diff | Splinter Review |
4.99 KB,
patch
|
lizzard
:
approval-mozilla-release+
|
Details | Diff | Splinter Review |
43.39 KB,
image/png
|
Details | |
7.11 KB,
patch
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0
Build ID: 20160916101415
Steps to reproduce:
part of index.html file:
<canvas id="myCanvas" width="500" height="140"></canvas>
<script type="text/javascript" src="main.js"></script>
onload function in main.js file:
var myCanvas = document.getElementById("myCanvas");
var ctx = myCanvas.getContext("2d");
ctx.fillStyle = "black";
ctx.fillRect(0, 0, myCanvas.width, myCanvas.height);
ctx.fillStyle = "white";
ctx.font = "50px sans-serif";
ctx.textBaseline = "top";
var x = 10, y = 10, w = 480, h = 14;
ctx.fillRect(x, y, w, h);
ctx.fillText('globalAlpha = ' + ctx.globalAlpha, x, y);
ctx.globalAlpha = 0.5;
y = 80;
ctx.fillRect(10, y, w, h);
ctx.fillText('globalAlpha = ' + ctx.globalAlpha, x, y);
test project with screenshots:
http://www.ultistars.hu/globalalphatest
Actual results:
set globalAlpha to 0.5 has no effect on fillText in Firefox.49
Expected results:
set globalAlpha to 0.5 has the expected effect on fillText in Firefox.48.0.2
Reporter | ||
Updated•8 years ago
|
OS: Unspecified → Windows 7
Hardware: Unspecified → x86_64
Reporter | ||
Updated•8 years ago
|
Reporter | ||
Comment 1•8 years ago
|
||
Reporter | ||
Comment 2•8 years ago
|
||
Reporter | ||
Comment 3•8 years ago
|
||
Reporter | ||
Comment 4•8 years ago
|
||
Reporter | ||
Updated•8 years ago
|
Severity: normal → major
Attachment #8793276 -
Attachment is obsolete: true
Reg range:
https://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=15359139459812abed51ce740a819624f1d8de2d&tochange=51b1f2343ad9544921e68859dfbe9d3c79b00951
onathan Kew — Bug 1274936 - When <canvas> fillText is using a simple color, draw via the gfxTextRun::Draw code path to get support for COLR and SVG-in-OT fonts. r=bas
Blocks: 1274936
Status: UNCONFIRMED → NEW
Has Regression Range: --- → yes
Has STR: --- → yes
status-firefox49:
--- → affected
status-firefox50:
--- → affected
status-firefox51:
--- → affected
status-firefox52:
--- → affected
tracking-firefox49:
--- → ?
tracking-firefox50:
--- → ?
tracking-firefox51:
--- → ?
tracking-firefox52:
--- → ?
Ever confirmed: true
Flags: needinfo?(jfkthame)
Keywords: regression,
testcase
Updated•8 years ago
|
Keywords: site-compat
Updated•8 years ago
|
Flags: in-testsuite?
Comment 7•8 years ago
|
||
Is this something we should consider for uplift to 49 (if we patch it) or can we wontfix for 49?
Updated•8 years ago
|
Flags: needinfo?(milan)
Assignee | ||
Comment 8•8 years ago
|
||
I think I see what the problem is, and am testing a patch at the moment. Personally, I don't think the issue is likely to be widespread and serious enough to justify uplifting to 49. But the patch should be safe enough that we can take it for 50 and up, if all goes well.
Flags: needinfo?(jfkthame)
Updated•8 years ago
|
Severity: major → normal
Priority: -- → P3
Whiteboard: [gfx-noted]
Updated•8 years ago
|
Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Assignee | ||
Comment 9•8 years ago
|
||
Attachment #8793648 -
Flags: review?(bas)
Assignee | ||
Comment 10•8 years ago
|
||
Attachment #8793649 -
Flags: review?(bas)
Assignee | ||
Comment 11•8 years ago
|
||
Looks like this doesn't break any existing tests, at least: https://treeherder.mozilla.org/#/jobs?repo=try&revision=2f9d53d7f9b0. We should also add a new reftest that would have caught the regression here.
Updated•8 years ago
|
Attachment #8793648 -
Flags: review?(bas) → review+
Updated•8 years ago
|
Attachment #8793649 -
Flags: review?(bas) → review+
Assignee | ||
Comment 13•8 years ago
|
||
Simple reftests for globalAlpha with fillText (fails before the patches here) and strokeText (already passes, but it seemed worth having tests for both APIs).
Attachment #8793905 -
Flags: review?(bas)
Assignee | ||
Comment 14•8 years ago
|
||
Oops, I see the tests have tab characters in them. I'll de-tab them before landing to tidy things up.
Updated•8 years ago
|
Attachment #8793905 -
Flags: review?(bas) → review+
Assignee | ||
Comment 15•8 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/7c4c4312a8c639feb1be77c32e709625ce58ac1d
Bug 1304353 - part 1 - Set up the DrawOptions appropriately when painting canvas text for FILL, not only for STROKE. r=bas
https://hg.mozilla.org/integration/mozilla-inbound/rev/59a8a58754d58667c5484a2a4b8c889a640a2f89
Bug 1304353 - part 2 - Initialize font's DrawOptions from the textrun's options when painting, so we don't drop any opacity that has already been set. r=bas
https://hg.mozilla.org/integration/mozilla-inbound/rev/3a3751c3573a81e751079ed0a2ddbe1a29d0be3e
Bug 1304353 - part 3 - Add reftests for use of globalAlpha with canvas text drawing. r=bas
Comment 16•8 years ago
|
||
Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/7c4c4312a8c6
part 1 - Set up the DrawOptions appropriately when painting canvas text for FILL, not only for STROKE. r=bas
https://hg.mozilla.org/integration/mozilla-inbound/rev/59a8a58754d5
part 2 - Initialize font's DrawOptions from the textrun's options when painting, so we don't drop any opacity that has already been set. r=bas
https://hg.mozilla.org/integration/mozilla-inbound/rev/3a3751c3573a
part 3 - Add reftests for use of globalAlpha with canvas text drawing. r=bas
Assignee | ||
Comment 17•8 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/65566510613321ab3153c5e602b6fb7a42cbc5d1
Bug 1304353 followup, mark test as slightly fuzzy on Windows.
Comment 19•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/7c4c4312a8c6
https://hg.mozilla.org/mozilla-central/rev/59a8a58754d5
https://hg.mozilla.org/mozilla-central/rev/3a3751c3573a
https://hg.mozilla.org/mozilla-central/rev/655665106133
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
Assignee | ||
Comment 20•8 years ago
|
||
Comment on attachment 8793648 [details] [diff] [review]
part 1 - Set up the DrawOptions appropriately when painting canvas text for FILL, not only for STROKE
Approval Request Comment (for parts 1 and 2 together, both are needed to fix the bug)
[Feature/regressing bug #]: 1274936
[User impact if declined]: some <canvas> elements render incorrectly (text is painted with a solid color when it should be transparent)
[Describe test coverage new/current, TreeHerder]: new reftest landed with the fix (patch 3)
[Risks and why]: low risk patch to correctly pass the canvas alpha value to text painting
[String/UUID change made/needed]: none
Attachment #8793648 -
Flags: approval-mozilla-beta?
Attachment #8793648 -
Flags: approval-mozilla-aurora?
Updated•8 years ago
|
Flags: needinfo?(milan)
Comment 22•8 years ago
|
||
Wontfix for 49, looks likely we can take this in 50 though.
Hello Marton, could you please verify this issue is fixed as expected on a latest Nightly build? Thanks!
Flags: needinfo?(pmarton80)
Comment on attachment 8793648 [details] [diff] [review]
part 1 - Set up the DrawOptions appropriately when painting canvas text for FILL, not only for STROKE
Fixes a recent regression, Aurora51+, Beta50+
Attachment #8793648 -
Flags: approval-mozilla-beta?
Attachment #8793648 -
Flags: approval-mozilla-beta+
Attachment #8793648 -
Flags: approval-mozilla-aurora?
Attachment #8793648 -
Flags: approval-mozilla-aurora+
I don't feel the need to track now that it's fixed.
Comment 26•8 years ago
|
||
bugherder uplift |
Comment 27•8 years ago
|
||
landed also the tests in
remote: https://hg.mozilla.org/releases/mozilla-aurora/rev/246a46a11eb8
remote: https://hg.mozilla.org/releases/mozilla-aurora/rev/816341411190
Comment 28•8 years ago
|
||
bugherder uplift |
Comment 30•8 years ago
|
||
Jonathan, bug 1305710 is about the same issue but with ctx.globalCompositeOperation = "destination-out" which is fixed with your patch in Nightly.
Do we need to add a test about globalCompositeOperation to track future regressions too?
Flags: needinfo?(jfkthame)
Assignee | ||
Comment 31•8 years ago
|
||
Sure, why not. More tests == more fun for everyone. :)
Flags: needinfo?(jfkthame)
Assignee | ||
Comment 32•8 years ago
|
||
Here's an extra test that uses globalCompositeOperation, and fails badly in a build before this bug was fixed. I suspect it'll need a bit of fuzzing for antialiasing around the text, so I've pushed it to tryserver and will add annotations depending on what that reports. https://treeherder.mozilla.org/#/jobs?repo=try&revision=16d4e8f239d9.
Attachment #8795397 -
Flags: review?(bas)
Updated•8 years ago
|
Attachment #8795397 -
Flags: review?(bas) → review+
Assignee | ||
Comment 33•8 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/e791148312529e338c6958267406de69d198b66d
Bug 1304353 followup, add a reftest using globalCompositeOperation with canvas text painting. r=bas
Comment 34•8 years ago
|
||
bugherder |
Comment 36•8 years ago
|
||
Posted the site compatibility doc given several duplicates. https://www.fxsitecompat.com/en-CA/docs/2016/canvas-2d-globalalpha-and-globalcompositeoperation-have-no-effect-on-filltext/
Keywords: dev-doc-complete
Reporter | ||
Comment 38•8 years ago
|
||
Hello Ritu, yes, I can verify that this issue is fixed as expected on a latest Nightly build.
I think this is a major bug, because too many expensive html5 apps and games brokes because of it.
Thanks!
Comment 39•8 years ago
|
||
Glad to hear this is fixed but this bug has caused us major issues in our app as we use globalCompositeOperation for efficient glyph caching in webgl (drawing each one into each colour component). Is it confirmed to be in the next major release? this is affecting out customers.
Thanks
Assignee | ||
Comment 40•8 years ago
|
||
(In reply to adrian from comment #39)
> Glad to hear this is fixed but this bug has caused us major issues in our
> app as we use globalCompositeOperation for efficient glyph caching in webgl
> (drawing each one into each colour component). Is it confirmed to be in the
> next major release? this is affecting out customers
You can test with the latest Firefox Beta[1] to check whether the upcoming release is on track to fix your issues. (As far as I know, it will; but there's no substitute for verifying with your actual use-case!)
[1] https://www.mozilla.org/en-US/firefox/channel/desktop/#beta
Flags: needinfo?(pmarton80)
Comment 42•8 years ago
|
||
Jonathan, since we now have several duplicates reported, do you think this should be included in a dot release? The duplicates weren't marked as affected for 49 or tagged as regressions, but looks like they should have been.
Kohei, can you help if you have examples of games and html5 apps broken? I don't have a great way to assess user impact, other than seeing there are some duplicate bugs, and some things folks are saying, for example in comment 38.
Flags: needinfo?(kohei.yoshino)
Flags: needinfo?(jfkthame)
Comment 43•8 years ago
|
||
Yeah, we haven't seen specific cases here, but my quick GitHub search finds 500K+ code including one from the popular Qt framework:
https://github.com/search?q=globalAlpha+OR+globalCompositeOperation&type=Code
I'm forwarding the question to Marton. Do you have any examples of broken apps or games?
Flags: needinfo?(kohei.yoshino) → needinfo?(pmarton80)
Comment 44•8 years ago
|
||
Ah, well, some results may be not related to fillText. Try this:
https://github.com/search?q=globalAlpha+fillText&type=Code
https://github.com/search?q=globalCompositeOperation+fillText&type=Code
Assignee | ||
Comment 45•8 years ago
|
||
(In reply to Liz Henry (:lizzard) (needinfo? me) from comment #42)
> Jonathan, since we now have several duplicates reported, do you think this
> should be included in a dot release? The duplicates weren't marked as
> affected for 49 or tagged as regressions, but looks like they should have
> been.
I'm not sure I have a good sense of how serious the regressions are for sites that are affected -- I'd have thought that in many cases it's more cosmetic than a critical usability issue, but perhaps it's worse for some. (I haven't been seeing affected sites personally, but that's probably a function of the kinds of sites I tend to visit -- or not!)
Anyway, IMO the fix here is sufficiently contained and well-understood (and has been on beta and up for some time now) that we could include it in a dot release without significant risk. I wouldn't have thought it is critical enough to drive a dot release in its own right, but if we're doing one for other reasons I'd be happy to see this as a ride-along.
Assignee | ||
Updated•8 years ago
|
Flags: needinfo?(jfkthame)
Assignee | ||
Comment 46•8 years ago
|
||
I realized that the patch here needs minor rebasing in order to apply on mozilla-release (because of bug 1275693, which landed on mozilla-50). The actual fix required remains the same, though.
I'm doing a test build of Fx49 locally, and will post the rebased patch for possible approval later today after confirming that it works as expected.
Assignee | ||
Comment 47•8 years ago
|
||
This is the combined patch (parts 1 and 2) rebased to apply on mozilla-release. It was necessary to incorporate the addition of the drawOpts field in TextRunDrawParams from bug 1275693 pt 2, as the patch here depends on that field, but it's still a straightforward fix. I've confirmed locally that this fixes the reftests here (which would fail with current release code), and have also pushed a try run (https://treeherder.mozilla.org/#/jobs?repo=try&revision=37460c2486a733fac075e23f86c2922f9557570a) to double-check, although I'm not sure how well Try handles mozilla-release at the moment; it's possible other issues will show up there.
Comment 48•8 years ago
|
||
Here is what our product "KeyLines" looks like in Firefox 49
Assignee | ||
Comment 49•8 years ago
|
||
Comment on attachment 8801038 [details] [diff] [review]
[rebased for mozilla-49] Set up the DrawOptions appropriately when painting canvas text, and initialize font's DrawOptions from the textrun's options when painting, so we don't drop any opacity that has already been set
Approval Request Comment
(for consideration as a possible dot-release ridealong, see comment 42 and following)
[Feature/regressing bug #]: 1274936
[User impact if declined]: bad rendering for <canvas> text when global opacity or composition operators are used
[Describe test coverage new/current, TreeHerder]: reftests added in this bug
[Risks and why]: low-risk patch to pass the relevant properties from canvas through to the textrun drawing code
[String/UUID change made/needed]: none
Attachment #8801038 -
Flags: approval-mozilla-release?
Assignee | ||
Comment 50•8 years ago
|
||
(In reply to Jonathan Kew (:jfkthame) from comment #47)
> have also pushed a try run
> (https://treeherder.mozilla.org/#/
> jobs?repo=try&revision=37460c2486a733fac075e23f86c2922f9557570a) to
> double-check
Turns out that tryserver says we'll need to adjust the fuzz annotation a bit for Windows if we land the tests on release, but that's OK; it's not a real/worrying failure.
Comment 51•8 years ago
|
||
Comment on attachment 8801038 [details] [diff] [review]
[rebased for mozilla-49] Set up the DrawOptions appropriately when painting canvas text, and initialize font's DrawOptions from the textrun's options when painting, so we don't drop any opacity that has already been set
Let's take this as a ridealong for 49.0.2, since it seems to have a broad impact on game and html5 sites. We will plan to release next week.
Attachment #8801038 -
Flags: approval-mozilla-release? → approval-mozilla-release+
Assignee | ||
Comment 52•8 years ago
|
||
Patch with all the reftests here, folded together and with fuzz annotation updated for mozilla-release.
Assignee | ||
Updated•8 years ago
|
Attachment #8801228 -
Attachment description: Add reftests for use of globalAlpha and globalCompositeOperation with canvas text drawing → [for mozilla-49] Add reftests for use of globalAlpha and globalCompositeOperation with canvas text drawing
Comment 53•8 years ago
|
||
bugherder uplift |
https://hg.mozilla.org/releases/mozilla-release/rev/775ab918e224
https://hg.mozilla.org/releases/mozilla-release/rev/f194bf906233
Flags: in-testsuite? → in-testsuite+
Updated•8 years ago
|
Updated•7 years ago
|
Flags: needinfo?(pmarton80)
You need to log in
before you can comment on or make changes to this bug.
Description
•