canvas fillText stopped supporting gradient fill

RESOLVED FIXED in Firefox 13

Status

()

Core
Graphics
RESOLVED FIXED
5 years ago
3 years ago

People

(Reporter: gmc, Assigned: jrmuizel)

Tracking

({regression})

12 Branch
mozilla15
x86
Mac OS X
regression
Points:
---

Firefox Tracking Flags

(firefox13+ verified, firefox14+ verified, firefox15+ verified)

Details

(Whiteboard: [qa+])

Attachments

(1 attachment)

(Reporter)

Description

5 years ago
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:12.0) Gecko/20100101 Firefox/12.0
Build ID: 20120420145725

Steps to reproduce:

Loaded the following HTML:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<title>bug demo</title>
</head>
<body>
<canvas id="mycanvas" width="300" height="300"></canvas>
<script type="text/javascript">
var canvas = document.getElementById('mycanvas');
var ctx = canvas.getContext('2d');
ctx.font = "bold 36px sans-serif";
var gradient = ctx.createLinearGradient(0, 0, 150, 100);
gradient.addColorStop(0, "rgb(255, 0, 0)");
gradient.addColorStop(1, "rgb(255, 255, 0)");
ctx.fillStyle = gradient;
ctx.fillText("Hello, world..", 10, 100);
</script>
</body>
</html>


Actual results:

Nothing was shown.


Expected results:

The text "Hello, world.." should have been shown with a gradient fill going from red in the top left to yellow in the bottom right.

Updated

5 years ago
Component: Untriaged → Canvas: 2D
Product: Firefox → Core
QA Contact: untriaged → canvas.2d
Regression range:

http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=34572943a3e4&tochange=f4049f65efc6

Turning off Azure canvas on Mac makes the bug go away, so this is a bug in either azure canvas or the coregraphics azure backend.
Blocks: 692879
Status: UNCONFIRMED → NEW
tracking-firefox13: --- → ?
tracking-firefox14: --- → ?
tracking-firefox15: --- → ?
Component: Canvas: 2D → Graphics
Ever confirmed: true
QA Contact: canvas.2d → thebes

Comment 2

5 years ago
Sending over to JP to find an assignee on the gfx team. If for whatever reason this goes unfixed in FF13, we don't expect major fallout given the lack of dupes here.
Assignee: nobody → jpr
tracking-firefox13: ? → +
tracking-firefox14: ? → +
tracking-firefox15: ? → +
Keywords: regression
(Assignee)

Updated

5 years ago
Assignee: jpr → jmuizelaar
If this helps, we use different gradient and different fill code in TenFourFox's 10.4 version of CG Azure. On my internal build of 12, I get Hello, w and part of the o.

        for (unsigned int i = 0; i < aBuffer.mNumGlyphs; i++) {
                CGContextSaveGState(cg); // push the "non-clip" on the stack
                CGContextSetTextDrawingMode(cg, kCGTextClip);
                it[0] = aBuffer.mGlyphs[i].mIndex;
                CGContextShowGlyphsAtPoint(cg, 
                        aBuffer.mGlyphs[i].mPosition.x,
                        aBuffer.mGlyphs[i].mPosition.y,
                        it, 1);
                DrawGradient(cg, aPattern);
                CGContextRestoreGState(cg); // pop the clip off
        }
(Assignee)

Comment 4

5 years ago
It looks like we're hitting the problem mentioned in this commit:

http://cgit.freedesktop.org/cairo/commit/?id=9c0d761bfcdd28d52c83d74f46dd3c709ae0fa69

I'm not sure how best to fix it yet.
(Assignee)

Comment 5

5 years ago
Created attachment 625109 [details] [diff] [review]
Avoid using CGContextSetTextMatrix
Attachment #625109 - Flags: review?(matt.woodrow)
(Assignee)

Updated

5 years ago
Attachment #625109 - Flags: review?(matt.woodrow) → review?(bgirard)

Updated

5 years ago
Attachment #625109 - Flags: review?(bgirard) → review+
(Assignee)

Comment 6

5 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/05f23d27c37a
Target Milestone: --- → mozilla15

Comment 7

5 years ago
(In reply to Jeff Muizelaar [:jrmuizel] from comment #6)
> https://hg.mozilla.org/integration/mozilla-inbound/rev/05f23d27c37a

If this patch is low risk, please nominate for aurora/beta approval prior to tomorrow's beta 5 go to build.
(Assignee)

Comment 8

5 years ago
Comment on attachment 625109 [details] [diff] [review]
Avoid using CGContextSetTextMatrix

[Approval Request Comment]
Bug caused by (feature/regressing bug #): 692879
User impact if declined: Gradient fills for text won't work on OS X
Testing completed (on m-c, etc.): limited (I haven't had a chance to test this much) It does pass the our reftests and mochitests so it's unlikely to break anything too badly.
Risk to taking this patch (and alternatives if risky): Canvas text could paint in the wrong place or not at all.
String or UUID changes made by this patch: None
Attachment #625109 - Flags: approval-mozilla-beta?
Attachment #625109 - Flags: approval-mozilla-aurora?

Comment 9

5 years ago
(In reply to Jeff Muizelaar [:jrmuizel] from comment #8)
> Risk to taking this patch (and alternatives if risky): Canvas text could
> paint in the wrong place or not at all.

Would you consider this as having a very low probability of regression? If not, we'd probably have this only land in FF14 and up given where we are in the cycle.
(Assignee)

Comment 10

5 years ago
(In reply to Alex Keybl [:akeybl] from comment #9)
> (In reply to Jeff Muizelaar [:jrmuizel] from comment #8)
> > Risk to taking this patch (and alternatives if risky): Canvas text could
> > paint in the wrong place or not at all.
> 
> Would you consider this as having a very low probability of regression? If
> not, we'd probably have this only land in FF14 and up given where we are in
> the cycle.

I can do some testing tomorrow that should give an idea if this is likely to cause a regression. I should have a pretty good feeling after that.
(Assignee)

Comment 11

5 years ago
(In reply to Jeff Muizelaar [:jrmuizel] from comment #10)
> (In reply to Alex Keybl [:akeybl] from comment #9)
> > (In reply to Jeff Muizelaar [:jrmuizel] from comment #8)
> > > Risk to taking this patch (and alternatives if risky): Canvas text could
> > > paint in the wrong place or not at all.
> > 
> > Would you consider this as having a very low probability of regression? If
> > not, we'd probably have this only land in FF14 and up given where we are in
> > the cycle.
> 
> I can do some testing tomorrow that should give an idea if this is likely to
> cause a regression. I should have a pretty good feeling after that.

I did some testing and this appears to be quite safe.
https://hg.mozilla.org/mozilla-central/rev/05f23d27c37a
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Comment on attachment 625109 [details] [diff] [review]
Avoid using CGContextSetTextMatrix

[Triage Comment]
Low risk fix for a regression in FF12, approved for Aurora 14 and Beta 13.
Attachment #625109 - Flags: approval-mozilla-beta?
Attachment #625109 - Flags: approval-mozilla-beta+
Attachment #625109 - Flags: approval-mozilla-aurora?
Attachment #625109 - Flags: approval-mozilla-aurora+
https://hg.mozilla.org/releases/mozilla-beta/rev/491fd5c11f42

Landed on beta because of deadline. Jeff can you take care of landing on aurora.
(In reply to Benoit Girard (:BenWa) from comment #14)
> https://hg.mozilla.org/releases/mozilla-beta/rev/491fd5c11f42
> 
> Landed on beta because of deadline. Jeff can you take care of landing on
> aurora.

I missed that the patch I imported didn't have an author field. It was written by Jeff, I did not review my own patch as the commit message says.
status-firefox13: --- → fixed
status-firefox14: --- → affected
(Assignee)

Comment 16

5 years ago
https://hg.mozilla.org/releases/mozilla-aurora/rev/17bdb597ba39
status-firefox14: affected → fixed
Whiteboard: [qa+]
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:13.0) Gecko/20100101 Firefox/13.0

Verified on Mac OS 10.6 with test case in comment 0 on F13 beta6. Could previously reproduce the issue in F12.
status-firefox13: fixed → verified

Comment 18

5 years ago
Verified on:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:14.0) Gecko/20100101 Firefox/14.0 beta 6

The text appears as described as above when the html file is loaded in browser.
Setting the flag to Verified on Firefox 14.
status-firefox14: fixed → verified

Updated

5 years ago
status-firefox15: --- → fixed
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:15.0) Gecko/20100101 Firefox/15.0

Verified on Mac OS 10.6 with test case in comment 0 on F15 beta1.
status-firefox15: fixed → verified

Comment 20

3 years ago
12/27/2013 This bug appears to be back in FF 26 for Mac. I filled text with a gradient in Safari, Opera and Chrome, all worked. In Firefox, the first color of a gradient is used to fill text, not the full gradient.
Ken, the testcase in this bug works fine for me in Firefox 26 on Mac.

Please file a new bug with your testcase that shows a problem and cc me on it?
You need to log in before you can comment on or make changes to this bug.