WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
37176
Canvas: radialGradient with negative radius should throw exception
https://bugs.webkit.org/show_bug.cgi?id=37176
Summary
Canvas: radialGradient with negative radius should throw exception
George Staikos
Reported
Wednesday, April 7, 2010 12:08:01 AM UTC
Created
attachment 52677
[details]
Patch to fix the problem, with tests. Canvas specification says that negative radius for radial gradients should trigger INDEX_SIZE_ERR DOM exception. Credit to Dan Bates for the test.
Attachments
Patch to fix the problem, with tests.
(4.82 KB, patch)
2010-04-06 16:08 PDT
,
George Staikos
no flags
Details
Formatted Diff
Diff
Self Contained Test
(1.53 KB, text/html)
2010-04-06 23:54 PDT
,
Daniel Bates
no flags
Details
Patch
(5.94 KB, patch)
2010-09-23 17:49 PDT
,
James Robinson
no flags
Details
Formatted Diff
Diff
Patch
(7.23 KB, patch)
2010-10-13 18:11 PDT
,
James Robinson
darin
: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Eric Seidel (no email)
Comment 1
Wednesday, April 7, 2010 4:59:49 AM UTC
Comment on
attachment 52677
[details]
Patch to fix the problem, with tests. OK. Sounds sane. Lets hope this doesn't break the web.
Oliver Hunt
Comment 2
Wednesday, April 7, 2010 6:30:08 AM UTC
Test firefox -- i'm fairly sure someone tried this before and it caused site breakage (although one would expect a test to have been added if we changed that behaviour, right?)
Eric Seidel (no email)
Comment 3
Wednesday, April 7, 2010 7:46:05 AM UTC
Attachment 52677
[details]
was posted by a committer and has review+, assigning to George Staikos for commit.
Daniel Bates
Comment 4
Wednesday, April 7, 2010 7:54:48 AM UTC
Created
attachment 52707
[details]
Self Contained Test For convenience, a self-contained version of the layout test included in the patch.
George Staikos
Comment 5
Thursday, April 8, 2010 1:45:32 AM UTC
(In reply to
comment #2
)
> Test firefox -- i'm fairly sure someone tried this before and it caused site > breakage (although one would expect a test to have been added if we changed > that behaviour, right?)
Yes, and also I kind of wonder how this could break a site, nevermind an important one. Negative radius on a gradient??
Eric Seidel (no email)
Comment 6
Monday, May 17, 2010 8:40:53 AM UTC
Unsure of the status of this patch. It's been in pending-commit for over a month. Updates?
Dirk Schulze
Comment 7
Monday, May 24, 2010 7:38:38 PM UTC
I agree to olliver. I think it's not good to apply this patch. Some sites use negative radius, and this would break this sites. I remember a site which draws meolcules that were dragable. I also opened a bug report on mozilla
https://bugzilla.mozilla.org/show_bug.cgi?id=491150
. Someone added a patch to this br and it is still not accepted. I would wait for mozilla before we take the patch.
Dirk Schulze
Comment 8
Monday, May 24, 2010 8:06:47 PM UTC
***
Bug 24668
has been marked as a duplicate of this bug. ***
Andreas Kling
Comment 9
Thursday, June 10, 2010 9:27:34 AM UTC
***
Bug 40392
has been marked as a duplicate of this bug. ***
Eric Seidel (no email)
Comment 10
Thursday, September 2, 2010 9:51:09 PM UTC
Comment on
attachment 52677
[details]
Patch to fix the problem, with tests. r- until firefox agreement. What does IE9 do?
James Robinson
Comment 11
Thursday, September 23, 2010 2:14:29 AM UTC
***
Bug 46323
has been marked as a duplicate of this bug. ***
James Robinson
Comment 12
Friday, September 24, 2010 1:49:35 AM UTC
Created
attachment 68633
[details]
Patch
James Robinson
Comment 13
Friday, September 24, 2010 1:50:40 AM UTC
The spec, Opera, and IE9 beta all agree that this should throw. It's also consistent with our behavior for arc() and arcTo() with a negative radius. The canvas molecule demo cited in the mozilla bug isn't available at that URL any more, so I doubt there is any valid concern about legacy content.
Andreas Kling
Comment 14
Tuesday, September 28, 2010 9:07:44 PM UTC
(In reply to
comment #13
)
> The spec, Opera, and IE9 beta all agree that this should throw. It's also consistent with our behavior for arc() and arcTo() with a negative radius. The canvas molecule demo cited in the mozilla bug isn't available at that URL any more, so I doubt there is any valid concern about legacy content.
LGTM, but I'd like someone who's more familiar with this kind of change to give the kiss of death.
Dirk Schulze
Comment 15
Wednesday, October 13, 2010 10:00:38 AM UTC
Comment on
attachment 68633
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=68633&action=review
r=me
> WebCore/html/canvas/CanvasRenderingContext2D.cpp:1458 > + if (r0 < 0 || r1 < 0) { > + ec = INDEX_SIZE_ERR; > + return 0; > + }
Add a newline before and after the condition.
Darin Adler
Comment 16
Wednesday, October 13, 2010 5:40:07 PM UTC
Comment on
attachment 68633
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=68633&action=review
> WebCore/html/canvas/CanvasRenderingContext2D.cpp:1461 > PassRefPtr<CanvasGradient> gradient = CanvasGradient::create(FloatPoint(x0, y0), r0, FloatPoint(x1, y1), r1); > prepareGradientForDashboard(gradient.get()); > return gradient;
This is a misuse of PassRefPtr.
Dirk Schulze
Comment 17
Wednesday, October 13, 2010 5:45:15 PM UTC
(In reply to
comment #16
)
> (From update of
attachment 68633
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=68633&action=review
> > > WebCore/html/canvas/CanvasRenderingContext2D.cpp:1461 > > PassRefPtr<CanvasGradient> gradient = CanvasGradient::create(FloatPoint(x0, y0), r0, FloatPoint(x1, y1), r1); > > prepareGradientForDashboard(gradient.get()); > > return gradient; > > This is a misuse of PassRefPtr.
Oh, thats right! James can you fix this as well?
Dirk Schulze
Comment 18
Wednesday, October 13, 2010 5:48:26 PM UTC
(In reply to
comment #17
)
> (In reply to
comment #16
) > > (From update of
attachment 68633
[details]
[details]) > > View in context:
https://bugs.webkit.org/attachment.cgi?id=68633&action=review
> > > > > WebCore/html/canvas/CanvasRenderingContext2D.cpp:1461 > > > PassRefPtr<CanvasGradient> gradient = CanvasGradient::create(FloatPoint(x0, y0), r0, FloatPoint(x1, y1), r1); > > > prepareGradientForDashboard(gradient.get()); > > > return gradient; > > > > This is a misuse of PassRefPtr. > > Oh, thats right! James can you fix this as well?
The same for linerGradient, should be RefPtr<CanvasGradient>
James Robinson
Comment 19
Wednesday, October 13, 2010 8:30:44 PM UTC
Sure thing. I'll add the extra newlines, fix the PassRefPtr<> violations in this file and post a new patch. Thanks for looking.
James Robinson
Comment 20
Thursday, October 14, 2010 2:11:58 AM UTC
Created
attachment 70697
[details]
Patch
James Robinson
Comment 21
Thursday, October 14, 2010 2:12:29 AM UTC
Patch adds some whitespace and fixes all the misuses of PassRefPtr / RefPtr I could find in this .cpp. Mind taking another look?
James Robinson
Comment 22
Thursday, October 14, 2010 3:13:23 AM UTC
Committed
r69727
: <
http://trac.webkit.org/changeset/69727
>
WebKit Review Bot
Comment 23
Thursday, October 14, 2010 5:32:48 AM UTC
http://trac.webkit.org/changeset/69727
might have broken GTK Linux 64-bit Debug The following tests are not passing: canvas/philip/tests/2d.gradient.radial.negative.html editing/selection/context-menu-on-text.html
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug