https://bugs.webkit.org/show_bug.cgi?id=58730
Patch by David Barr <davidbarr@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.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96449
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-09-30 David Barr <davidbarr@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 <abarth@webkit.org>
Update baseline for this test on Leopard.
--- /dev/null
+<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>
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
+2011-09-30 David Barr <davidbarr@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 <barraclough@apple.com>
Remove toStrictThisObject, toThisString, toThisJSString
{
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;
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);
#include "StyleGeneratedImage.h"
#include "CSSImageGeneratorValue.h"
+#include "CSSStyleSelector.h"
#include "RenderObject.h"
namespace WebCore {
PassRefPtr<Image> StyleGeneratedImage::image(RenderObject* renderer, const IntSize& size) const
{
+ renderer->document()->styleSelector()->setStyle(renderer->style());
return m_generator->image(renderer, size);
}