| Index: third_party/WebKit/Source/core/html/HTMLElement.cpp
|
| diff --git a/third_party/WebKit/Source/core/html/HTMLElement.cpp b/third_party/WebKit/Source/core/html/HTMLElement.cpp
|
| index fd68fa31ba72fa0ed183a71a9b33b27b5f67b11e..df381a0effb796c49a57a2a5c10f331036b934c2 100644
|
| --- a/third_party/WebKit/Source/core/html/HTMLElement.cpp
|
| +++ b/third_party/WebKit/Source/core/html/HTMLElement.cpp
|
| @@ -915,23 +915,31 @@ static RGBA32 parseColorStringWithCrazyLegacyRules(const String& colorString)
|
| }
|
|
|
| // Color parsing that matches HTML's "rules for parsing a legacy color value"
|
| -void HTMLElement::addHTMLColorToStyle(MutableStylePropertySet* style, CSSPropertyID propertyID, const String& attributeValue)
|
| +bool HTMLElement::parseColorWithLegacyRules(const String& attributeValue, Color& parsedColor)
|
| {
|
| // An empty string doesn't apply a color. (One containing only whitespace does, which is why this check occurs before stripping.)
|
| if (attributeValue.isEmpty())
|
| - return;
|
| + return false;
|
|
|
| String colorString = attributeValue.stripWhiteSpace();
|
|
|
| // "transparent" doesn't apply a color either.
|
| if (equalIgnoringCase(colorString, "transparent"))
|
| - return;
|
| + return false;
|
|
|
| // If the string is a named CSS color or a 3/6-digit hex color, use that.
|
| - Color parsedColor;
|
| if (!parsedColor.setFromString(colorString))
|
| parsedColor.setRGB(parseColorStringWithCrazyLegacyRules(colorString));
|
|
|
| + return true;
|
| +}
|
| +
|
| +void HTMLElement::addHTMLColorToStyle(MutableStylePropertySet* style, CSSPropertyID propertyID, const String& attributeValue)
|
| +{
|
| + Color parsedColor;
|
| + if (!parseColorWithLegacyRules(attributeValue, parsedColor))
|
| + return;
|
| +
|
| style->setProperty(propertyID, cssValuePool().createColorValue(parsedColor.rgb()));
|
| }
|
|
|
|
|