WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
58730
currentColor not supported in CSS gradients
https://bugs.webkit.org/show_bug.cgi?id=58730
Summary
currentColor not supported in CSS gradients
Lea Verou
Reported
2011-04-16 05:27:54 PDT
See testcase. It should be a linear gradient from gray to red but instead the whole declaration is dropped. Gecko gets this right.
Attachments
Patch
(17.16 KB, patch)
2011-05-15 23:02 PDT
,
David Barr
no flags
Details
Formatted Diff
Diff
Patch
(7.62 KB, patch)
2011-05-16 16:55 PDT
,
David Barr
no flags
Details
Formatted Diff
Diff
Revised patch
(6.98 KB, patch)
2011-06-08 22:06 PDT
,
David Barr
no flags
Details
Formatted Diff
Diff
Patch
(7.74 KB, patch)
2011-06-09 00:07 PDT
,
David Barr
no flags
Details
Formatted Diff
Diff
Patch
(7.97 KB, patch)
2011-06-09 17:36 PDT
,
David Barr
no flags
Details
Formatted Diff
Diff
Patch
(7.95 KB, patch)
2011-09-28 22:34 PDT
,
David Barr
no flags
Details
Formatted Diff
Diff
Patch
(8.30 KB, patch)
2011-09-29 00:54 PDT
,
David Barr
no flags
Details
Formatted Diff
Diff
Patch
(8.42 KB, patch)
2011-09-29 18:35 PDT
,
David Barr
no flags
Details
Formatted Diff
Diff
Show Obsolete
(7)
View All
Add attachment
proposed patch, testcase, etc.
David Barr
Comment 1
2011-05-15 23:02:06 PDT
Created
attachment 93609
[details]
Patch
Simon Fraser (smfr)
Comment 2
2011-05-16 07:56:40 PDT
Comment on
attachment 93609
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=93609&action=review
> LayoutTests/fast/css/linear-gradient-currentcolor.html:5 > + color:red;
Please don't have visible red in a passing test. It would be better to use green, and maybe put two color stops next to eachother to get a sharp edge that's less likely to suffer from platform differences. Spaces after colons please.
> Source/WebCore/ChangeLog:8 > +
https://bugs.webkit.org/show_bug.cgi?id=58730
> + > + Test: fast/css/linear-gradient-currentcolor.html
This needs some text saying how you fixed the issue.
> Source/WebCore/css/CSSGradientValue.cpp:159 > + stops[i].color = renderer->document()->styleSelector()->getColorFromPrimitiveValue(color);
I don't get it. getColorFromPrimitiveValue() already looks for CSSValueCurrentcolor.
David Barr
Comment 3
2011-05-16 16:55:25 PDT
Created
attachment 93714
[details]
Patch
Simon Fraser (smfr)
Comment 4
2011-05-16 17:01:27 PDT
Comment on
attachment 93714
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=93714&action=review
> Source/WebCore/css/CSSGradientValue.cpp:159 > - stops[i].color = renderer->document()->styleSelector()->getColorFromPrimitiveValue(stop.m_color.get()); > + CSSPrimitiveValue* color = stop.m_color.get(); > + if (color->getIdent() == CSSValueCurrentcolor) > + stops[i].color = style->visitedDependentColor(CSSPropertyColor); > + else > + stops[i].color = renderer->document()->styleSelector()->getColorFromPrimitiveValue(color);
I still don't get this part. getColorFromPrimitiveValue() handles currentCOlor already.
David Barr
Comment 5
2011-05-16 22:37:15 PDT
Comment on
attachment 93714
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=93714&action=review
>> Source/WebCore/css/CSSGradientValue.cpp:159 >> + stops[i].color = renderer->document()->styleSelector()->getColorFromPrimitiveValue(color); > > I still don't get this part. getColorFromPrimitiveValue() handles currentCOlor already.
In this context, CSSStyleSelector::m_style is NULL rather than equal to the local var 'style'. This change works around that issue pending a change in the path to getColorFromPrimitiveValue(). Maybe a FIXME is warranted? This feature addition exposes a lurking NULL-deref bug.
David Barr
Comment 6
2011-06-08 22:06:42 PDT
Created
attachment 96546
[details]
Revised patch
David Barr
Comment 7
2011-06-08 22:24:04 PDT
Comment on
attachment 96546
[details]
Revised patch Revised patch - force initialization of CSSStyleSelector rather than work around the lack thereof
Simon Fraser (smfr)
Comment 8
2011-06-08 23:15:36 PDT
Comment on
attachment 96546
[details]
Revised patch View in context:
https://bugs.webkit.org/attachment.cgi?id=96546&action=review
> Source/WebCore/css/CSSGradientValue.cpp:153 > + // FIXME Force initialization to support CSSValueCurrentcolor - should this happen earlier? > + renderer->document()->styleSelector()->setStyle(style);
It seems like the style selector needs "start using for style" and "stop using for style" methods. Are there other places that need to do the same thing?
David Barr
Comment 9
2011-06-08 23:53:19 PDT
I've just discovered that this is the tip of the iceberg - there are a issues with caching the computed image too. New patch soon to come. smfr: My feeling is that the proposed methods ought to be called in WebCore::StyleGeneratedImage::image() before and after the call to GeneratedImage::image(). I'm don't know about other callers.
David Barr
Comment 10
2011-06-09 00:07:39 PDT
Created
attachment 96557
[details]
Patch
David Barr
Comment 11
2011-06-09 00:10:50 PDT
Comment on
attachment 96557
[details]
Patch Ok, more an ice-cube than iceberg - moved initialization of CSSStyleSelector to WebCore::StyleGeneratedImage::image() and added additional constraint to CSSGradientValue::isCacheable().
David Barr
Comment 12
2011-06-09 00:20:46 PDT
Just noticed that the file summary in the WebCore ChangeLog is wrong, sorry. I'm surprised that webkit-patch doesn't warn about that.
David Barr
Comment 13
2011-06-09 17:36:58 PDT
Created
attachment 96672
[details]
Patch
David Barr
Comment 14
2011-06-09 17:40:24 PDT
Comment on
attachment 96672
[details]
Patch Re-generated ChangeLog entries to capture the methods affected.
Simon Fraser (smfr)
Comment 15
2011-06-28 10:41:49 PDT
Comment on
attachment 96672
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=96672&action=review
> Source/WebCore/ChangeLog:8 > + currentColor not supported in CSS gradients > +
https://bugs.webkit.org/show_bug.cgi?id=58730
> + > + Test: fast/css/linear-gradient-currentcolor.html
This needs to describe what was broken, and what you did to fix it.
David Barr
Comment 16
2011-06-28 11:37:49 PDT
The primary outstanding concern with this change is clarifying the contract with CSSStyleSelector. The patch implements the parsing and style logic for currentColor support in CSS gradient color stops.
David Barr
Comment 17
2011-09-28 22:34:39 PDT
Created
attachment 109122
[details]
Patch
David Barr
Comment 18
2011-09-28 22:37:30 PDT
Comment on
attachment 109122
[details]
Patch Updated changelog with active description.
WebKit Review Bot
Comment 19
2011-09-28 23:23:40 PDT
Comment on
attachment 109122
[details]
Patch Rejecting
attachment 109122
[details]
from commit-queue. Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 2 Last 500 characters of output: saving rejects to file LayoutTests/platform/chromium/test_expectations.txt.rej patching file Source/WebCore/ChangeLog Hunk #1 succeeded at 1 with fuzz 3. patching file Source/WebCore/css/CSSGradientValue.cpp patching file Source/WebCore/css/CSSParser.cpp Hunk #1 succeeded at 5903 (offset -2 lines). patching file Source/WebCore/rendering/style/StyleGeneratedImage.cpp Failed to run "[u'/mnt/git/webkit-commit-queue/Tools/Scripts/svn-apply', u'--reviewer', u'Simon Fraser', u'--for..." exit_code: 1 Full output:
http://queues.webkit.org/results/9888418
David Barr
Comment 20
2011-09-29 00:54:55 PDT
Created
attachment 109132
[details]
Patch
David Barr
Comment 21
2011-09-29 07:12:04 PDT
I added some detail to the ChangeLog and resolved the conflict encountered by the commit queue. However, it is likely to conflict again due to the high rate of appends to LayoutTests/platform/chromium/test_expectations.txt. Is it simply a matter of rebasing repeatedly until it lands? Maybe we could use a merge driver for test_expectations.txt.
David Barr
Comment 22
2011-09-29 18:35:30 PDT
Created
attachment 109233
[details]
Patch
David Barr
Comment 23
2011-09-29 18:36:52 PDT
Comment on
attachment 109233
[details]
Patch Updated test_expectations.txt change so that conflict is less likely to occur on the commit queue.
Adam Barth
Comment 24
2011-09-30 18:27:14 PDT
Comment on
attachment 109233
[details]
Patch Forwarding simon.fraser's r+
WebKit Review Bot
Comment 25
2011-09-30 18:42:26 PDT
Comment on
attachment 109233
[details]
Patch Clearing flags on attachment: 109233 Committed
r96449
: <
http://trac.webkit.org/changeset/96449
>
WebKit Review Bot
Comment 26
2011-09-30 18:42:32 PDT
All reviewed patches have been landed. Closing bug.
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