[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198
simon.fraser at apple.com
simon.fraser at apple.com
Sun Feb 20 22:51:46 UTC 2011
The following commit has been merged in the webkit-1.3 branch:
commit 427e135e653dc0b1d23bbc7dbcb66b701e73ecc2
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Jan 12 17:09:57 2011 +0000
2011-01-12 Simon Fraser <simon.fraser at apple.com>
Reviewed by Eric Seidel.
[CSS Gradients] One color stop should not paint anything for linear-gradient
https://bugs.webkit.org/show_bug.cgi?id=52259
Share color stop parsing code between linear and radial gradients.
Consider the gradient invalid if it has less than two color stops.
* css/CSSParser.cpp:
(WebCore::CSSParser::parseLinearGradient):
(WebCore::CSSParser::parseRadialGradient):
(WebCore::CSSParser::parseGradientColorStops):
* css/CSSParser.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75615 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 7229352..f6704f4 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2011-01-12 Simon Fraser <simon.fraser at apple.com>
+
+ Reviewed by Eric Seidel.
+
+ [CSS Gradients] One color stop should not paint anything for linear-gradient
+ https://bugs.webkit.org/show_bug.cgi?id=52259
+
+ Update test results given that single-stop gradients are invalid.
+
+ * fast/gradients/css3-gradient-parsing-expected.txt:
+ * fast/gradients/css3-gradient-parsing.html:
+ * platform/mac/fast/gradients/css3-color-stops-expected.checksum:
+ * platform/mac/fast/gradients/css3-color-stops-expected.png:
+
2011-01-12 Csaba Osztrogonác <ossy at webkit.org>
Unreviewed.
diff --git a/LayoutTests/fast/gradients/css3-gradient-parsing-expected.txt b/LayoutTests/fast/gradients/css3-gradient-parsing-expected.txt
index 005d30b..fd9b1cf 100644
--- a/LayoutTests/fast/gradients/css3-gradient-parsing-expected.txt
+++ b/LayoutTests/fast/gradients/css3-gradient-parsing-expected.txt
@@ -9,14 +9,16 @@ PASS testGradient("background-image: -webkit-linear-gradient(10px 20%, black 0%)
PASS testGradient("background-image: -webkit-linear-gradient(left left)", "background-image") is "none"
PASS testGradient("background-image: -webkit-linear-gradient(left center)", "background-image") is "none"
PASS testGradient("background-image: -webkit-linear-gradient(left 10deg, black 0%)", "background-image") is "none"
-PASS testGradient("background-image: -webkit-linear-gradient(black 0)", "background-image") is "-webkit-linear-gradient(top, black 0px)"
-PASS testGradient("background-image: -webkit-linear-gradient(black 0%)", "background-image") is "-webkit-linear-gradient(top, black 0%)"
-PASS testGradient("background-image: -webkit-linear-gradient(black 0%)", "background-image") is "-webkit-linear-gradient(top, black 0%)"
+PASS testGradient("background-image: -webkit-linear-gradient(black)", "background-image") is "none"
+PASS testGradient("background-image: -webkit-linear-gradient(black, white)", "background-image") is "-webkit-linear-gradient(top, black, white)"
+PASS testGradient("background-image: -webkit-linear-gradient(black 0, white)", "background-image") is "-webkit-linear-gradient(top, black 0px, white)"
+PASS testGradient("background-image: -webkit-linear-gradient(black 0%, white)", "background-image") is "-webkit-linear-gradient(top, black 0%, white)"
+PASS testGradient("background-image: -webkit-linear-gradient(black 0%, white)", "background-image") is "-webkit-linear-gradient(top, black 0%, white)"
PASS testGradient("background-image: -webkit-linear-gradient(black, white)", "background-image") is "-webkit-linear-gradient(top, black, white)"
PASS testGradient("background-image: -webkit-linear-gradient(black 10px, white 20px)", "background-image") is "-webkit-linear-gradient(top, black 10px, white 20px)"
-PASS testGradient("background-image: -webkit-linear-gradient(top left, black 0%)", "background-image") is "-webkit-linear-gradient(left top, black 0%)"
-PASS testGradient("background-image: -webkit-linear-gradient(top, black 0%)", "background-image") is "-webkit-linear-gradient(top, black 0%)"
-PASS testGradient("background-image: -webkit-linear-gradient(10deg, black 0%)", "background-image") is "-webkit-linear-gradient(10deg, black 0%)"
+PASS testGradient("background-image: -webkit-linear-gradient(top left, black 0%, white)", "background-image") is "-webkit-linear-gradient(left top, black 0%, white)"
+PASS testGradient("background-image: -webkit-linear-gradient(top, black 0%, white)", "background-image") is "-webkit-linear-gradient(top, black 0%, white)"
+PASS testGradient("background-image: -webkit-linear-gradient(10deg, black 0%, white)", "background-image") is "-webkit-linear-gradient(10deg, black 0%, white)"
-webkit-repeating-linear-gradient
diff --git a/LayoutTests/fast/gradients/css3-gradient-parsing.html b/LayoutTests/fast/gradients/css3-gradient-parsing.html
index e193efc..aab413c 100644
--- a/LayoutTests/fast/gradients/css3-gradient-parsing.html
+++ b/LayoutTests/fast/gradients/css3-gradient-parsing.html
@@ -39,14 +39,16 @@ shouldBe('testGradient("background-image: -webkit-linear-gradient(10px 20%, blac
shouldBe('testGradient("background-image: -webkit-linear-gradient(left left)", "background-image")', '"none"');
shouldBe('testGradient("background-image: -webkit-linear-gradient(left center)", "background-image")', '"none"');
shouldBe('testGradient("background-image: -webkit-linear-gradient(left 10deg, black 0%)", "background-image")', '"none"');
-shouldBe('testGradient("background-image: -webkit-linear-gradient(black 0)", "background-image")', '"-webkit-linear-gradient(top, black 0px)"');
-shouldBe('testGradient("background-image: -webkit-linear-gradient(black 0%)", "background-image")', '"-webkit-linear-gradient(top, black 0%)"');
-shouldBe('testGradient("background-image: -webkit-linear-gradient(black 0%)", "background-image")', '"-webkit-linear-gradient(top, black 0%)"');
+shouldBe('testGradient("background-image: -webkit-linear-gradient(black)", "background-image")', '"none"');
+shouldBe('testGradient("background-image: -webkit-linear-gradient(black, white)", "background-image")', '"-webkit-linear-gradient(top, black, white)"');
+shouldBe('testGradient("background-image: -webkit-linear-gradient(black 0, white)", "background-image")', '"-webkit-linear-gradient(top, black 0px, white)"');
+shouldBe('testGradient("background-image: -webkit-linear-gradient(black 0%, white)", "background-image")', '"-webkit-linear-gradient(top, black 0%, white)"');
+shouldBe('testGradient("background-image: -webkit-linear-gradient(black 0%, white)", "background-image")', '"-webkit-linear-gradient(top, black 0%, white)"');
shouldBe('testGradient("background-image: -webkit-linear-gradient(black, white)", "background-image")', '"-webkit-linear-gradient(top, black, white)"');
shouldBe('testGradient("background-image: -webkit-linear-gradient(black 10px, white 20px)", "background-image")', '"-webkit-linear-gradient(top, black 10px, white 20px)"');
-shouldBe('testGradient("background-image: -webkit-linear-gradient(top left, black 0%)", "background-image")', '"-webkit-linear-gradient(left top, black 0%)"');
-shouldBe('testGradient("background-image: -webkit-linear-gradient(top, black 0%)", "background-image")', '"-webkit-linear-gradient(top, black 0%)"');
-shouldBe('testGradient("background-image: -webkit-linear-gradient(10deg, black 0%)", "background-image")', '"-webkit-linear-gradient(10deg, black 0%)"');
+shouldBe('testGradient("background-image: -webkit-linear-gradient(top left, black 0%, white)", "background-image")', '"-webkit-linear-gradient(left top, black 0%, white)"');
+shouldBe('testGradient("background-image: -webkit-linear-gradient(top, black 0%, white)", "background-image")', '"-webkit-linear-gradient(top, black 0%, white)"');
+shouldBe('testGradient("background-image: -webkit-linear-gradient(10deg, black 0%, white)", "background-image")', '"-webkit-linear-gradient(10deg, black 0%, white)"');
debug('<p>-webkit-repeating-linear-gradient</p>');
shouldBe('testGradient("background-image: -webkit-repeating-linear-gradient(black, white)", "background-image")', '"-webkit-repeating-linear-gradient(top, black, white)"');
diff --git a/LayoutTests/platform/mac/fast/gradients/css3-color-stops-expected.checksum b/LayoutTests/platform/mac/fast/gradients/css3-color-stops-expected.checksum
index 1b56ad6..213fdf0 100644
--- a/LayoutTests/platform/mac/fast/gradients/css3-color-stops-expected.checksum
+++ b/LayoutTests/platform/mac/fast/gradients/css3-color-stops-expected.checksum
@@ -1 +1 @@
-8a00529ff6bbdb22a5b1e1c9ca03c501
\ No newline at end of file
+4619a84a2f19b3e119b8c1d7deebb9ca
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/gradients/css3-color-stops-expected.png b/LayoutTests/platform/mac/fast/gradients/css3-color-stops-expected.png
index 03acfe0..80e7de6 100644
Binary files a/LayoutTests/platform/mac/fast/gradients/css3-color-stops-expected.png and b/LayoutTests/platform/mac/fast/gradients/css3-color-stops-expected.png differ
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 9111ba4..accf8aa 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2011-01-12 Simon Fraser <simon.fraser at apple.com>
+
+ Reviewed by Eric Seidel.
+
+ [CSS Gradients] One color stop should not paint anything for linear-gradient
+ https://bugs.webkit.org/show_bug.cgi?id=52259
+
+ Share color stop parsing code between linear and radial gradients.
+ Consider the gradient invalid if it has less than two color stops.
+
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::parseLinearGradient):
+ (WebCore::CSSParser::parseRadialGradient):
+ (WebCore::CSSParser::parseGradientColorStops):
+ * css/CSSParser.h:
+
2011-01-12 Mikhail Naganov <mnaganov at chromium.org>
Reviewed by Pavel Feldman.
diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp
index ff7c34d..6aa53cc 100644
--- a/Source/WebCore/css/CSSParser.cpp
+++ b/Source/WebCore/css/CSSParser.cpp
@@ -4911,7 +4911,6 @@ bool CSSParser::parseLinearGradient(RefPtr<CSSValue>& gradient, CSSGradientRepea
a = args->next();
expectComma = true;
} else {
-
// Look one or two optional keywords that indicate a side or corner.
RefPtr<CSSPrimitiveValue> startX, startY;
@@ -4950,35 +4949,8 @@ bool CSSParser::parseLinearGradient(RefPtr<CSSValue>& gradient, CSSGradientRepea
result->setFirstY(startY.release());
}
- // Now look for 0 or more color stops.
- while (a) {
- // Look for the comma before the next stop.
- if (expectComma) {
- if (a->unit != CSSParserValue::Operator || a->iValue != ',')
- return false;
-
- a = args->next();
- if (!a)
- return false;
- }
-
- // <color-stop> = <color> [ <percentage> | <length> ]?
- CSSGradientColorStop stop;
- stop.m_color = parseGradientColorOrKeyword(this, a);
- if (!stop.m_color)
- return false;
-
- a = args->next();
- if (a) {
- if (validUnit(a, FLength | FPercent, m_strict)) {
- stop.m_position = CSSPrimitiveValue::create(a->fValue, (CSSPrimitiveValue::UnitTypes)a->unit);
- a = args->next();
- }
- }
-
- result->addStop(stop);
- expectComma = true;
- }
+ if (!parseGradientColorStops(args, result.get(), expectComma))
+ return false;
Vector<CSSGradientColorStop>& stops = result->stops();
if (stops.isEmpty())
@@ -5098,14 +5070,25 @@ bool CSSParser::parseRadialGradient(RefPtr<CSSValue>& gradient, CSSGradientRepea
result->setEndHorizontalSize(horizontalSize);
result->setEndVerticalSize(verticalSize);
- // Now look for 0 or more color stops.
+ if (!parseGradientColorStops(args, result.get(), expectComma))
+ return false;
+
+ gradient = result.release();
+ return true;
+}
+
+bool CSSParser::parseGradientColorStops(CSSParserValueList* valueList, CSSGradientValue* gradient, bool expectComma)
+{
+ CSSParserValue* a = valueList->current();
+
+ // Now look for color stops.
while (a) {
// Look for the comma before the next stop.
if (expectComma) {
if (a->unit != CSSParserValue::Operator || a->iValue != ',')
return false;
- a = args->next();
+ a = valueList->next();
if (!a)
return false;
}
@@ -5116,24 +5099,20 @@ bool CSSParser::parseRadialGradient(RefPtr<CSSValue>& gradient, CSSGradientRepea
if (!stop.m_color)
return false;
- a = args->next();
+ a = valueList->next();
if (a) {
if (validUnit(a, FLength | FPercent, m_strict)) {
stop.m_position = CSSPrimitiveValue::create(a->fValue, (CSSPrimitiveValue::UnitTypes)a->unit);
- a = args->next();
+ a = valueList->next();
}
}
- result->addStop(stop);
+ gradient->addStop(stop);
expectComma = true;
}
- Vector<CSSGradientColorStop>& stops = result->stops();
- if (stops.isEmpty())
- return false;
-
- gradient = result.release();
- return true;
+ // Must have 2 or more stops to be valid.
+ return gradient->stops().size() > 1;
}
bool CSSParser::isGeneratedImageValue(CSSParserValue* val) const
diff --git a/Source/WebCore/css/CSSParser.h b/Source/WebCore/css/CSSParser.h
index a196e58..496a21a 100644
--- a/Source/WebCore/css/CSSParser.h
+++ b/Source/WebCore/css/CSSParser.h
@@ -160,6 +160,7 @@ namespace WebCore {
bool parseDeprecatedGradient(RefPtr<CSSValue>&);
bool parseLinearGradient(RefPtr<CSSValue>&, CSSGradientRepeat repeating);
bool parseRadialGradient(RefPtr<CSSValue>&, CSSGradientRepeat repeating);
+ bool parseGradientColorStops(CSSParserValueList*, CSSGradientValue*, bool expectComma);
PassRefPtr<CSSValueList> parseTransform();
bool parseTransformOrigin(int propId, int& propId1, int& propId2, int& propId3, RefPtr<CSSValue>&, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list