Log Message
Implement currentColor support for CSS gradients https://bugs.webkit.org/show_bug.cgi?id=58730
Patch by David Barr <davidb...@chromium.org> on 2011-09-30 Reviewed by Adam Barth. Source/WebCore: Allow currentColor as a CSS3 gradient color-stop. Test: fast/css/linear-gradient-currentcolor.html * css/CSSGradientValue.cpp: (WebCore::CSSGradientValue::isCacheable): Make currentColor uncacheable since the background image may be invalidated if currentColor is used as a gradient stop and the value of the 'color' property changes. * css/CSSParser.cpp: (WebCore::parseGradientColorOrKeyword): Accept the currentColor keyword. * rendering/style/StyleGeneratedImage.cpp: (WebCore::StyleGeneratedImage::image): Initialize document styleSelector so that currentColor may be computed for a StyleGeneratedImage. LayoutTests: * fast/css/linear-gradient-currentcolor-expected.txt: Added. * fast/css/linear-gradient-currentcolor.html: Added. * platform/chromium/test_expectations.txt: * platform/mac/fast/css/linear-gradient-currentcolor-expected.png: Added.
Modified Paths
- trunk/LayoutTests/ChangeLog
- trunk/LayoutTests/platform/chromium/test_expectations.txt
- trunk/Source/WebCore/ChangeLog
- trunk/Source/WebCore/css/CSSGradientValue.cpp
- trunk/Source/WebCore/css/CSSParser.cpp
- trunk/Source/WebCore/rendering/style/StyleGeneratedImage.cpp
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (96448 => 96449)
--- trunk/LayoutTests/ChangeLog 2011-10-01 01:40:31 UTC (rev 96448)
+++ trunk/LayoutTests/ChangeLog 2011-10-01 01:43:20 UTC (rev 96449)
@@ -1,3 +1,15 @@
+2011-09-30 David Barr <davidb...@chromium.org>
+
+ Implement currentColor support for CSS gradients
+ https://bugs.webkit.org/show_bug.cgi?id=58730
+
+ Reviewed by Adam Barth.
+
+ * fast/css/linear-gradient-currentcolor-expected.txt: Added.
+ * fast/css/linear-gradient-currentcolor.html: Added.
+ * platform/chromium/test_expectations.txt:
+ * platform/mac/fast/css/linear-gradient-currentcolor-expected.png: Added.
+
2011-09-30 Adam Barth <aba...@webkit.org>
Update baseline for this test on Leopard.
Added: trunk/LayoutTests/fast/css/linear-gradient-currentcolor-expected.txt (0 => 96449)
--- trunk/LayoutTests/fast/css/linear-gradient-currentcolor-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/linear-gradient-currentcolor-expected.txt 2011-10-01 01:43:20 UTC (rev 96449)
@@ -0,0 +1 @@
+
Added: trunk/LayoutTests/fast/css/linear-gradient-currentcolor.html (0 => 96449)
--- trunk/LayoutTests/fast/css/linear-gradient-currentcolor.html (rev 0)
+++ trunk/LayoutTests/fast/css/linear-gradient-currentcolor.html 2011-10-01 01:43:20 UTC (rev 96449)
@@ -0,0 +1,24 @@
+<html>
+<head>
+<style>
+div {
+ background-color: red;
+ background-image: -moz-linear-gradient(gray 50px, currentColor 50px);
+ background-image: -ms-linear-gradient(gray 50px, currentColor 50px);
+ background-image: -o-linear-gradient(gray 50px, currentColor 50px);
+ background-image: -webkit-linear-gradient(gray 50px, currentColor 50px);
+ background-image: linear-gradient(gray 50px, currentColor 50px);
+ width: 100px;
+ height: 100px;
+}
+</style>
+</head>
+<script>
+if (window.layoutTestController)
+ window.layoutTestController.dumpAsText(true);
+</script>
+<body>
+ <div style="color: green"></div>
+ <div style="color: blue"></div>
+</body>
+</html>
Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (96448 => 96449)
--- trunk/LayoutTests/platform/chromium/test_expectations.txt 2011-10-01 01:40:31 UTC (rev 96448)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt 2011-10-01 01:43:20 UTC (rev 96449)
@@ -2531,6 +2531,9 @@
BUGWK55745 MAC : fast/gradients/css3-radial-gradients3.html = IMAGE
BUGWK55745 MAC : fast/gradients/css3-repeating-radial-gradients.html = IMAGE
+// New pixel tests added for bug 58730, rebaseline when webkit 58730 rolls.
+BUGWK58730 WIN LINUX: fast/css/linear-gradient-currentcolor.html = IMAGE
+
// This was introduced by r75077.
BUGWK52082 LEOPARD : fast/text/basic/014.html = IMAGE
BUGWK52082 LEOPARD : fast/text/midword-break-after-breakable-char.html = IMAGE
Added: trunk/LayoutTests/platform/mac/fast/css/linear-gradient-currentcolor-expected.png (0 => 96449)
--- trunk/LayoutTests/platform/mac/fast/css/linear-gradient-currentcolor-expected.png (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/css/linear-gradient-currentcolor-expected.png 2011-10-01 01:43:20 UTC (rev 96449)
@@ -0,0 +1,9 @@
+\x89PNG
+
+
+IHDR X ' )tEXtchecksum b8f62dd168fa0953d133be0f8eb66d91\xB9\x906f \xEEiCCPICC Profile x\x85T\xCFkA\xFE6n\xA9\xD0"Zk\xB2x\x90"IY\xABhE\xD46\xFDbk\xDB\xB6E\x90d3I\xD6n6\xEB\xEE&\xB5\xA5\x88\xE4\xE2\xD1*\xDEE\xED\xA1\xFF\x80z\xF0d/J\x85ZE(ޫ(b\xA1-\xF1\xCDnL\xB6\xA5\xEA\xC0\xCE~\xF3\xDE7\xEF}ov\xDF
+r\xD24\xF5\x80\xE4
+\xC7R\xA2il|Bj\xFC\x88 \x8E\xA2 A4%U\xDB\xECN$A\x83s\xF9{\xE7\xD8z\x81[V\xC3{\xFBw\xB2w\xAD\x9AҶ\x9A\x84\xFD@\xE0G\x9A\xD9*\xB0\xEFq
+Y\x88<ߡ)\xC7t\xDF\xE3\xD8\xF2\xEC\x8F9Nyx\xC1\xB5+=\xC4Y"|@5-\xCEM\xB8S\xCD%\xD3@\x83H8\x94\xF5qR>\x9C\x94\xD7inf\xC6\xC8\xBDO\x90\xA6\xBB\xCC\xEE\xABb\xA1\x9CN\xF6\x90\xBD\x9D\xF4~N\xB3\xDE>\xC2!\xC2\xAD?F\xB8\x8D\x9E\xF5\x8C\xD5?\xE2a\xE1\xA4\xE6Ć=5\xF4\xF8`\xB7\xA9\xF85\xC2_M'\xA2Tq\xD9.
+\xF1\x98\xAE\xFDV\xF2J\x82p\x908\xCAda\x80sZHO\xD7Ln\xF8\xBA\x87}&\xD7\xAF\xE2wVQ\xE1y\x8Fg\xDE\xD4\xDD\xEFE\xDA\xAF0\x9A
+HPEa\x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 \xB0 @` , \x80\xC0 X , \x81 \xB0 X @` , \x80\xC0 X , \x81 \xB0 X @` P-\xC9\xFDa6\xEBlʈ \x80\x8B \x80\xC0 X \x81 \xB0 @` , \x80\xC0 X \x81 \xB0 @` , \x80\xC0 X , \x81 \xB0 @` , \x80\xC0 X , \x81 \xB0 X @` , \x80\xC0 X , \x81 \xB0 X @` P}u8\xEB\xB4 \xC0>X @` , \x80\xC0 X , \x81 \xB0 X @` , \x80\xC0 X , \x81 \xB0 X @` \xB0 \x80\xC0 X , \x81 \xB0 X @` \xB0 \x80\xC0 @` , \x81 \xB0 X @` \xB0 \x80\xC0 @` , \x81 @\xB5$\xF7\x87f\x9C]\x8B \x80?\xE5\x83 \xB0 \x80\xC0 @` , \x81 \x80\xC0 X \x81 \xB0 \x80\xC0 @` , \x81 \x80\xC0 X \x81 \xB0 @` , \x81 \x80\xC0 X \x81 \xB0 @` , \x80\xC0 X \x81 \xB0 @` , \x80\xC0 X T_\xE3 <\xE1\x83 \xB0 \x80\xC0 @` , \x81 \x80\xC0 X \x81 \xB0 \x80\xC0 @` , \x81 \x80\xC0 X \x81 \xB0 @` , \x81 \x80\xC0 X \x81 \xB0 @` , \x80\xC0 X \x81 \xB0 @` , \x80\xC0 X , \x81 \xB0 @` , \x80\xC0 X , \x81 \xB0 @` , \x80\xC0 X , \x81 \xB0 X @` , \x80\xC0 X , \x81 \xB0 X @` \xB0 \x80\xC0 X , \x81 \xB0 X @` \xB0 \x80\xC0 @` , \x81 \xB0 X @` \xB0 \x80\xC0 @` , \x81 \xB0 X @` \xB0 \x80\xC0 @` , \x81 \x80\xC0 X @` \xB0 \x80\xC0 @` , \x81 \x80\xC0 X \x81 \xB0 \x80\xC0 @` , \x81 \x80\xC0 X \x81 \xB0 @` , \x81 \x80\xC0 X \x81 \xB0 @` , \x81 \x80\xC0 X \x81 \xB0 @` , \x80\xC0 X \x81 \xB0 @` , \x80\xC0 X , \x81 \xB0 @` , \x80\xC0 X , \x81 \xB0 X @` , \x80\xC0 X , \x81 \xB0 X @` , , \x81 \xB0 X @` \xB0 \x80\xC0 @` , \x81 \xB0 X @` \xB0 \x80\xC0 @` , \x81 \x80\xC0 X @` \xB0 \x80\xC0 @` , \x81 \x80\xC0 X \x81 \xB0 \x80\xC0 @` , \x81 \x80\xC0 X \x81 \xB0 @` , \x81 \x80\xC0 X \x81 \xB0 @` , \x81 \x80\xC0 X \x81 \xB0 @` , \x80\xC0 X \x81 \xB0 @` , \x80\xC0 X , \x81 \xB0 @` , \x80\xC0 X , \x81 \xB0 X @` , \x80\xC0 X , \x81 \xB0 X @` , \x80\xC0 X , \x81 \xB0 X @` \xB0 \x80\xC0 X , \x81 \xB0 X @` \xB0 \x80\xC0 @` , \x81 \xB0 X @` \xB0 \x80\xC0 @` , \x81 \x80\xC0 X @` \xB0 \x80\xC0 @` , \x81 \x80\xC0 X @` \xB0 \x80\xC0 @` , \x81 \x80\xC0 X \x81 \xB0 \x80\xC0 @` , \x81 \x80\xC0 X \x81 \xB0 >\xECZ\xB6\xA9\xE29\x94B IEND\xAEB`\x82
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (96448 => 96449)
--- trunk/Source/WebCore/ChangeLog 2011-10-01 01:40:31 UTC (rev 96448)
+++ trunk/Source/WebCore/ChangeLog 2011-10-01 01:43:20 UTC (rev 96449)
@@ -1,3 +1,24 @@
+2011-09-30 David Barr <davidb...@chromium.org>
+
+ Implement currentColor support for CSS gradients
+ https://bugs.webkit.org/show_bug.cgi?id=58730
+
+ Reviewed by Adam Barth.
+
+ Allow currentColor as a CSS3 gradient color-stop.
+
+ Test: fast/css/linear-gradient-currentcolor.html
+
+ * css/CSSGradientValue.cpp:
+ (WebCore::CSSGradientValue::isCacheable): Make currentColor uncacheable since the
+ background image may be invalidated if currentColor is used as a gradient stop and
+ the value of the 'color' property changes.
+ * css/CSSParser.cpp:
+ (WebCore::parseGradientColorOrKeyword): Accept the currentColor keyword.
+ * rendering/style/StyleGeneratedImage.cpp:
+ (WebCore::StyleGeneratedImage::image): Initialize document styleSelector so that
+ currentColor may be computed for a StyleGeneratedImage.
+
2011-09-30 Gavin Barraclough <barraclo...@apple.com>
Remove toStrictThisObject, toThisString, toThisJSString
Modified: trunk/Source/WebCore/css/CSSGradientValue.cpp (96448 => 96449)
--- trunk/Source/WebCore/css/CSSGradientValue.cpp 2011-10-01 01:40:31 UTC (rev 96448)
+++ trunk/Source/WebCore/css/CSSGradientValue.cpp 2011-10-01 01:43:20 UTC (rev 96449)
@@ -412,6 +412,11 @@
{
for (size_t i = 0; i < m_stops.size(); ++i) {
const CSSGradientColorStop& stop = m_stops[i];
+
+ CSSPrimitiveValue* color = stop.m_color.get();
+ if (color->getIdent() == CSSValueCurrentcolor)
+ return false;
+
if (!stop.m_position)
continue;
Modified: trunk/Source/WebCore/css/CSSParser.cpp (96448 => 96449)
--- trunk/Source/WebCore/css/CSSParser.cpp 2011-10-01 01:40:31 UTC (rev 96448)
+++ trunk/Source/WebCore/css/CSSParser.cpp 2011-10-01 01:43:20 UTC (rev 96449)
@@ -5915,7 +5915,7 @@
static PassRefPtr<CSSPrimitiveValue> parseGradientColorOrKeyword(CSSParser* p, CSSParserValue* value)
{
int id = value->id;
- if (id == CSSValueWebkitText || (id >= CSSValueAqua && id <= CSSValueWindowtext) || id == CSSValueMenu)
+ if (id == CSSValueWebkitText || (id >= CSSValueAqua && id <= CSSValueWindowtext) || id == CSSValueMenu || id == CSSValueCurrentcolor)
return p->primitiveValueCache()->createIdentifierValue(id);
return p->parseColor(value);
Modified: trunk/Source/WebCore/rendering/style/StyleGeneratedImage.cpp (96448 => 96449)
--- trunk/Source/WebCore/rendering/style/StyleGeneratedImage.cpp 2011-10-01 01:40:31 UTC (rev 96448)
+++ trunk/Source/WebCore/rendering/style/StyleGeneratedImage.cpp 2011-10-01 01:43:20 UTC (rev 96449)
@@ -25,6 +25,7 @@
#include "StyleGeneratedImage.h"
#include "CSSImageGeneratorValue.h"
+#include "CSSStyleSelector.h"
#include "RenderObject.h"
namespace WebCore {
@@ -74,6 +75,7 @@
PassRefPtr<Image> StyleGeneratedImage::image(RenderObject* renderer, const IntSize& size) const
{
+ renderer->document()->styleSelector()->setStyle(renderer->style());
return m_generator->image(renderer, size);
}
_______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes