Modified: trunk/Source/WebCore/ChangeLog (205923 => 205924)
--- trunk/Source/WebCore/ChangeLog 2016-09-14 19:56:03 UTC (rev 205923)
+++ trunk/Source/WebCore/ChangeLog 2016-09-14 20:12:14 UTC (rev 205924)
@@ -1,3 +1,22 @@
+2016-09-13 Dean Jackson <[email protected]>
+
+ Rename parseColorParameters and clean up conditional
+ https://bugs.webkit.org/show_bug.cgi?id=161941
+ <rdar://problem/28292750>
+
+ Reviewed by Dan Bates.
+
+ In preparation for adding color() support, rename the existing
+ parseColorParameters to parseRGBParameters.
+
+ Also clean up the logic in the parseColorFromValue function.
+
+ * css/parser/CSSParser.cpp:
+ (WebCore::CSSParser::parseRGBParameters):
+ (WebCore::CSSParser::parseColorFromValue):
+ (WebCore::CSSParser::parseColorParameters): Deleted.
+ * css/parser/CSSParser.h:
+
2016-09-14 Chris Dumez <[email protected]>
Add support hr.color IDL attribute
Modified: trunk/Source/WebCore/css/parser/CSSParser.cpp (205923 => 205924)
--- trunk/Source/WebCore/css/parser/CSSParser.cpp 2016-09-14 19:56:03 UTC (rev 205923)
+++ trunk/Source/WebCore/css/parser/CSSParser.cpp 2016-09-14 20:12:14 UTC (rev 205924)
@@ -7600,7 +7600,7 @@
return static_cast<int>(doubleValue);
}
-bool CSSParser::parseColorParameters(CSSParserValue& value, int* colorArray, bool parseAlpha)
+bool CSSParser::parseRGBParameters(CSSParserValue& value, int* colorArray, bool parseAlpha)
{
CSSParserValueList* args = value.function->args.get();
ValueWithCalculation firstArgumentWithCalculation(*args->current());
@@ -7699,37 +7699,35 @@
&& value.function->args->size() == 5 /* rgb + two commas */
&& equalLettersIgnoringASCIICase(value.function->name, "rgb(")) {
int colorValues[3];
- if (!parseColorParameters(value, colorValues, false))
+ if (!parseRGBParameters(value, colorValues, false))
return false;
c = makeRGB(colorValues[0], colorValues[1], colorValues[2]);
- } else {
- if (value.unit == CSSParserValue::Function
- && value.function->args
- && value.function->args->size() == 7 /* rgba + three commas */
- && equalLettersIgnoringASCIICase(value.function->name, "rgba(")) {
- int colorValues[4];
- if (!parseColorParameters(value, colorValues, true))
- return false;
- c = makeRGBA(colorValues[0], colorValues[1], colorValues[2], colorValues[3]);
- } else if (value.unit == CSSParserValue::Function
- && value.function->args
- && value.function->args->size() == 5 /* hsl + two commas */
- && equalLettersIgnoringASCIICase(value.function->name, "hsl(")) {
- double colorValues[3];
- if (!parseHSLParameters(value, colorValues, false))
- return false;
- c = makeRGBAFromHSLA(colorValues[0], colorValues[1], colorValues[2], 1.0);
- } else if (value.unit == CSSParserValue::Function
- && value.function->args
- && value.function->args->size() == 7 /* hsla + three commas */
- && equalLettersIgnoringASCIICase(value.function->name, "hsla(")) {
- double colorValues[4];
- if (!parseHSLParameters(value, colorValues, true))
- return false;
- c = makeRGBAFromHSLA(colorValues[0], colorValues[1], colorValues[2], colorValues[3]);
- } else
+ } else if (value.unit == CSSParserValue::Function
+ && value.function->args
+ && value.function->args->size() == 7 /* rgba + three commas */
+ && equalLettersIgnoringASCIICase(value.function->name, "rgba(")) {
+ int colorValues[4];
+ if (!parseRGBParameters(value, colorValues, true))
return false;
- }
+ c = makeRGBA(colorValues[0], colorValues[1], colorValues[2], colorValues[3]);
+ } else if (value.unit == CSSParserValue::Function
+ && value.function->args
+ && value.function->args->size() == 5 /* hsl + two commas */
+ && equalLettersIgnoringASCIICase(value.function->name, "hsl(")) {
+ double colorValues[3];
+ if (!parseHSLParameters(value, colorValues, false))
+ return false;
+ c = makeRGBAFromHSLA(colorValues[0], colorValues[1], colorValues[2], 1.0);
+ } else if (value.unit == CSSParserValue::Function
+ && value.function->args
+ && value.function->args->size() == 7 /* hsla + three commas */
+ && equalLettersIgnoringASCIICase(value.function->name, "hsla(")) {
+ double colorValues[4];
+ if (!parseHSLParameters(value, colorValues, true))
+ return false;
+ c = makeRGBAFromHSLA(colorValues[0], colorValues[1], colorValues[2], colorValues[3]);
+ } else
+ return false;
return true;
}
Modified: trunk/Source/WebCore/css/parser/CSSParser.h (205923 => 205924)
--- trunk/Source/WebCore/css/parser/CSSParser.h 2016-09-14 19:56:03 UTC (rev 205923)
+++ trunk/Source/WebCore/css/parser/CSSParser.h 2016-09-14 20:12:14 UTC (rev 205924)
@@ -275,7 +275,7 @@
bool parseCounter(CSSPropertyID, int defaultValue, bool important);
RefPtr<CSSPrimitiveValue> parseCounterContent(CSSParserValueList& args, bool counters);
- bool parseColorParameters(CSSParserValue&, int* colorValues, bool parseAlpha);
+ bool parseRGBParameters(CSSParserValue&, int* colorValues, bool parseAlpha);
bool parseHSLParameters(CSSParserValue&, double* colorValues, bool parseAlpha);
RefPtr<CSSPrimitiveValue> parseColor(CSSParserValue* = nullptr);
bool parseColorFromValue(CSSParserValue&, RGBA32&);