<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[207342] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/207342">207342</a></dd>
<dt>Author</dt> <dd>ryanhaddad@apple.com</dd>
<dt>Date</dt> <dd>2016-10-14 09:17:47 -0700 (Fri, 14 Oct 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Unreviewed, rolling out <a href="http://trac.webkit.org/projects/webkit/changeset/207317">r207317</a>.
https://bugs.webkit.org/show_bug.cgi?id=163448
This change caused an existing LayoutTest to fail on all
platforms (Requested by ryanhaddad on #webkit).
Reverted changeset:
"CSS parsing should use Color not RGBA32"
https://bugs.webkit.org/show_bug.cgi?id=163423
http://trac.webkit.org/changeset/207317
Patch by Commit Queue <commit-queue@webkit.org> on 2016-10-14</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorecssCSSPrimitiveValuecpp">trunk/Source/WebCore/css/CSSPrimitiveValue.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSPrimitiveValueh">trunk/Source/WebCore/css/CSSPrimitiveValue.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSPrimitiveValueMappingsh">trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSValuePoolcpp">trunk/Source/WebCore/css/CSSValuePool.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSValuePoolh">trunk/Source/WebCore/css/CSSValuePool.h</a></li>
<li><a href="#trunkSourceWebCorecssStyleResolvercpp">trunk/Source/WebCore/css/StyleResolver.cpp</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSParsercpp">trunk/Source/WebCore/css/parser/CSSParser.cpp</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSParserh">trunk/Source/WebCore/css/parser/CSSParser.h</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSParserFastPathscpp">trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSPropertyParserHelperscpp">trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp</a></li>
<li><a href="#trunkSourceWebCorecssparserSVGCSSParsercpp">trunk/Source/WebCore/css/parser/SVGCSSParser.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingEditingStylecpp">trunk/Source/WebCore/editing/EditingStyle.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingcocoaHTMLConvertermm">trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLBodyElementcpp">trunk/Source/WebCore/html/HTMLBodyElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasCanvasGradientcpp">trunk/Source/WebCore/html/canvas/CanvasGradient.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasCanvasRenderingContext2Dcpp">trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasCanvasStylecpp">trunk/Source/WebCore/html/canvas/CanvasStyle.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasCanvasStyleh">trunk/Source/WebCore/html/canvas/CanvasStyle.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsColorh">trunk/Source/WebCore/platform/graphics/Color.h</a></li>
<li><a href="#trunkSourceWebCoresvgSVGColorcpp">trunk/Source/WebCore/svg/SVGColor.cpp</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformgraphicsColorHashh">trunk/Source/WebCore/platform/graphics/ColorHash.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (207341 => 207342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-10-14 15:58:16 UTC (rev 207341)
+++ trunk/Source/WebCore/ChangeLog        2016-10-14 16:17:47 UTC (rev 207342)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-10-14 Commit Queue <commit-queue@webkit.org>
+
+ Unreviewed, rolling out r207317.
+ https://bugs.webkit.org/show_bug.cgi?id=163448
+
+ This change caused an existing LayoutTest to fail on all
+ platforms (Requested by ryanhaddad on #webkit).
+
+ Reverted changeset:
+
+ "CSS parsing should use Color not RGBA32"
+ https://bugs.webkit.org/show_bug.cgi?id=163423
+ http://trac.webkit.org/changeset/207317
+
</ins><span class="cx"> 2016-10-14 Antti Koivisto <antti@apple.com>
</span><span class="cx">
</span><span class="cx"> Share inline stylesheets between shadow trees
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (207341 => 207342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-10-14 15:58:16 UTC (rev 207341)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-10-14 16:17:47 UTC (rev 207342)
</span><span class="lines">@@ -1297,7 +1297,6 @@
</span><span class="cx">                 2EF1BFEA121C9F4200C27627 /* FileStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2EF1BFE8121C9F4200C27627 /* FileStream.cpp */; };
</span><span class="cx">                 2EF1BFEB121C9F4200C27627 /* FileStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EF1BFE9121C9F4200C27627 /* FileStream.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 2EF1BFF9121CB0CE00C27627 /* FileStreamClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EF1BFF8121CB0CE00C27627 /* FileStreamClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                3103B7DF1DB01567008BB890 /* ColorHash.h in Headers */ = {isa = PBXBuildFile; fileRef = 3103B7DE1DB01556008BB890 /* ColorHash.h */; settings = {ATTRIBUTES = (Private, ); }; };
</del><span class="cx">                 3106036F14327D2E00ABF4BA /* WebKitCSSFilterValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3106036C14327D2E00ABF4BA /* WebKitCSSFilterValue.cpp */; };
</span><span class="cx">                 3106037014327D2E00ABF4BA /* WebKitCSSFilterValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 3106036D14327D2E00ABF4BA /* WebKitCSSFilterValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 310603741432819C00ABF4BA /* JSWebKitCSSFilterValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 310603721432819C00ABF4BA /* JSWebKitCSSFilterValue.cpp */; };
</span><span class="lines">@@ -8262,7 +8261,6 @@
</span><span class="cx">                 2EF1BFE8121C9F4200C27627 /* FileStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileStream.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 2EF1BFE9121C9F4200C27627 /* FileStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileStream.h; sourceTree = "<group>"; };
</span><span class="cx">                 2EF1BFF8121CB0CE00C27627 /* FileStreamClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileStreamClient.h; sourceTree = "<group>"; };
</span><del>-                3103B7DE1DB01556008BB890 /* ColorHash.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ColorHash.h; sourceTree = "<group>"; };
</del><span class="cx">                 3106036C14327D2E00ABF4BA /* WebKitCSSFilterValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitCSSFilterValue.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 3106036D14327D2E00ABF4BA /* WebKitCSSFilterValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitCSSFilterValue.h; sourceTree = "<group>"; };
</span><span class="cx">                 3106036E14327D2E00ABF4BA /* WebKitCSSFilterValue.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebKitCSSFilterValue.idl; sourceTree = "<group>"; };
</span><span class="lines">@@ -20736,7 +20734,6 @@
</span><span class="cx">                                 CDDE02E918B3DFC700CF7FF1 /* CDMSession.h */,
</span><span class="cx">                                 B27535380B053814002CE64F /* Color.cpp */,
</span><span class="cx">                                 B27535390B053814002CE64F /* Color.h */,
</span><del>-                                3103B7DE1DB01556008BB890 /* ColorHash.h */,
</del><span class="cx">                                 31DCDF411DA1C45400EA5B93 /* ExtendedColor.cpp */,
</span><span class="cx">                                 31DCDF421DA1C45400EA5B93 /* ExtendedColor.h */,
</span><span class="cx">                                 9382DF5710A8D5C900925652 /* ColorSpace.h */,
</span><span class="lines">@@ -25389,7 +25386,6 @@
</span><span class="cx">                                 BCEC01C30C274DDD009F4EC9 /* JSScreen.h in Headers */,
</span><span class="cx">                                 FDA15ECE12B03F61003A583A /* JSScriptProcessorNode.h in Headers */,
</span><span class="cx">                                 CED06AD11C77754800FDFAF1 /* JSSecurityPolicyViolationEvent.h in Headers */,
</span><del>-                                3103B7DF1DB01567008BB890 /* ColorHash.h in Headers */,
</del><span class="cx">                                 9BDA64D81B975CF2009C4387 /* JSShadowRoot.h in Headers */,
</span><span class="cx">                                 CD9DE17B17AAC75B00EA386D /* JSSourceBuffer.h in Headers */,
</span><span class="cx">                                 CD9DE17D17AAC75B00EA386D /* JSSourceBufferList.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSPrimitiveValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.cpp (207341 => 207342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSPrimitiveValue.cpp        2016-10-14 15:58:16 UTC (rev 207341)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.cpp        2016-10-14 16:17:47 UTC (rev 207342)
</span><span class="lines">@@ -350,11 +350,11 @@
</span><span class="cx"> m_value.string->ref();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-CSSPrimitiveValue::CSSPrimitiveValue(const Color& color)
</del><ins>+CSSPrimitiveValue::CSSPrimitiveValue(RGBA32 color)
</ins><span class="cx"> : CSSValue(PrimitiveClass)
</span><span class="cx"> {
</span><span class="cx"> m_primitiveUnitType = CSS_RGBCOLOR;
</span><del>- m_value.color = new Color(color);
</del><ins>+ m_value.rgbcolor = color;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> CSSPrimitiveValue::CSSPrimitiveValue(const Length& length)
</span><span class="lines">@@ -574,11 +574,6 @@
</span><span class="cx"> delete m_value.fontFamily;
</span><span class="cx"> m_value.fontFamily = nullptr;
</span><span class="cx"> break;
</span><del>- case CSS_RGBCOLOR:
- ASSERT(m_value.color);
- delete m_value.color;
- m_value.color = nullptr;
- break;
</del><span class="cx"> case CSS_NUMBER:
</span><span class="cx"> case CSS_PARSER_INTEGER:
</span><span class="cx"> case CSS_PERCENTAGE:
</span><span class="lines">@@ -610,6 +605,7 @@
</span><span class="cx"> case CSS_DPCM:
</span><span class="cx"> case CSS_FR:
</span><span class="cx"> case CSS_IDENT:
</span><ins>+ case CSS_RGBCOLOR:
</ins><span class="cx"> case CSS_UNKNOWN:
</span><span class="cx"> case CSS_UNICODE_RANGE:
</span><span class="cx"> case CSS_PARSER_OPERATOR:
</span><span class="lines">@@ -1032,7 +1028,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // FIMXE: This should not return a new object for each invocation.
</span><del>- return RGBColor::create(m_value.color->rgb());
</del><ins>+ return RGBColor::create(m_value.rgbcolor);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Pair* CSSPrimitiveValue::getPairValue(ExceptionCode& ec) const
</span><span class="lines">@@ -1179,13 +1175,13 @@
</span><span class="cx"> case CSS_LENGTH_REPEAT:
</span><span class="cx"> return getLengthRepeatValue()->cssText();
</span><span class="cx"> #endif
</span><ins>+ case CSS_RGBCOLOR:
</ins><span class="cx"> case CSS_PARSER_HEXCOLOR: {
</span><del>- RGBA32 rgb;
- Color::parseHexColor((String)m_value.string, rgb);
- return Color(rgb).cssText();
</del><ins>+ RGBA32 rgbColor = m_value.rgbcolor;
+ if (m_primitiveUnitType == CSS_PARSER_HEXCOLOR)
+ Color::parseHexColor((String)m_value.string, rgbColor);
+ return Color(rgbColor).cssText();
</ins><span class="cx"> }
</span><del>- case CSS_RGBCOLOR:
- return color().cssText();
</del><span class="cx"> case CSS_PAIR:
</span><span class="cx"> return getPairValue()->cssText();
</span><span class="cx"> #if ENABLE(DASHBOARD_SUPPORT)
</span><span class="lines">@@ -1355,7 +1351,7 @@
</span><span class="cx"> result = CSSPrimitiveValue::createIdentifier(m_value.valueID);
</span><span class="cx"> break;
</span><span class="cx"> case CSS_RGBCOLOR:
</span><del>- result = CSSPrimitiveValue::create(*m_value.color);
</del><ins>+ result = CSSPrimitiveValue::createColor(m_value.rgbcolor);
</ins><span class="cx"> break;
</span><span class="cx"> case CSS_DIMENSION:
</span><span class="cx"> case CSS_UNKNOWN:
</span><span class="lines">@@ -1434,7 +1430,7 @@
</span><span class="cx"> return m_value.lengthRepeat && other.m_value.lengthRepeat && m_value.lengthRepeat->equals(*other.m_value.lengthRepeat);
</span><span class="cx"> #endif
</span><span class="cx"> case CSS_RGBCOLOR:
</span><del>- return color() == other.color();
</del><ins>+ return m_value.rgbcolor == other.m_value.rgbcolor;
</ins><span class="cx"> case CSS_PAIR:
</span><span class="cx"> return m_value.pair && other.m_value.pair && m_value.pair->equals(*other.m_value.pair);
</span><span class="cx"> #if ENABLE(DASHBOARD_SUPPORT)
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSPrimitiveValueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.h (207341 => 207342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSPrimitiveValue.h        2016-10-14 15:58:16 UTC (rev 207341)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.h        2016-10-14 16:17:47 UTC (rev 207342)
</span><span class="lines">@@ -253,6 +253,7 @@
</span><span class="cx"> static Ref<CSSPrimitiveValue> createIdentifier(CSSPropertyID propertyID) { return adoptRef(*new CSSPrimitiveValue(propertyID)); }
</span><span class="cx"> static Ref<CSSPrimitiveValue> createParserOperator(int parserOperator) { return adoptRef(*new CSSPrimitiveValue(parserOperator)); }
</span><span class="cx">
</span><ins>+ static Ref<CSSPrimitiveValue> createColor(unsigned rgbValue) { return adoptRef(*new CSSPrimitiveValue(rgbValue)); }
</ins><span class="cx"> static Ref<CSSPrimitiveValue> create(double value, UnitTypes type) { return adoptRef(*new CSSPrimitiveValue(value, type)); }
</span><span class="cx"> static Ref<CSSPrimitiveValue> create(const String& value, UnitTypes type) { return adoptRef(*new CSSPrimitiveValue(value, type)); }
</span><span class="cx"> static Ref<CSSPrimitiveValue> create(const Length& value, const RenderStyle& style) { return adoptRef(*new CSSPrimitiveValue(value, style)); }
</span><span class="lines">@@ -341,21 +342,21 @@
</span><span class="cx"> WEBCORE_EXPORT String getStringValue() const;
</span><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT Counter* getCounterValue(ExceptionCode&) const;
</span><del>- Counter* getCounterValue() const { return m_primitiveUnitType != CSS_COUNTER ? nullptr : m_value.counter; }
</del><ins>+ Counter* getCounterValue() const { return m_primitiveUnitType != CSS_COUNTER ? 0 : m_value.counter; }
</ins><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT Rect* getRectValue(ExceptionCode&) const;
</span><del>- Rect* getRectValue() const { return m_primitiveUnitType != CSS_RECT ? nullptr : m_value.rect; }
</del><ins>+ Rect* getRectValue() const { return m_primitiveUnitType != CSS_RECT ? 0 : m_value.rect; }
</ins><span class="cx">
</span><span class="cx"> Quad* getQuadValue(ExceptionCode&) const;
</span><del>- Quad* getQuadValue() const { return m_primitiveUnitType != CSS_QUAD ? nullptr : m_value.quad; }
</del><ins>+ Quad* getQuadValue() const { return m_primitiveUnitType != CSS_QUAD ? 0 : m_value.quad; }
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(CSS_SCROLL_SNAP)
</span><span class="cx"> LengthRepeat* getLengthRepeatValue(ExceptionCode&) const;
</span><del>- LengthRepeat* getLengthRepeatValue() const { return m_primitiveUnitType != CSS_LENGTH_REPEAT ? nullptr : m_value.lengthRepeat; }
</del><ins>+ LengthRepeat* getLengthRepeatValue() const { return m_primitiveUnitType != CSS_LENGTH_REPEAT ? 0 : m_value.lengthRepeat; }
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT RefPtr<RGBColor> getRGBColorValue(ExceptionCode&) const;
</span><del>- const Color& color() const { ASSERT(m_primitiveUnitType == CSS_RGBCOLOR); return *m_value.color; }
</del><ins>+ RGBA32 getRGBA32Value() const { return m_primitiveUnitType != CSS_RGBCOLOR ? 0 : m_value.rgbcolor; }
</ins><span class="cx">
</span><span class="cx"> Pair* getPairValue(ExceptionCode&) const;
</span><span class="cx"> Pair* getPairValue() const { return m_primitiveUnitType != CSS_PAIR ? nullptr : m_value.pair; }
</span><span class="lines">@@ -403,7 +404,7 @@
</span><span class="cx"> CSSPrimitiveValue(CSSPropertyID);
</span><span class="cx"> // FIXME: int vs. unsigned overloading is too subtle to distinguish the color and operator cases.
</span><span class="cx"> CSSPrimitiveValue(int parserOperator);
</span><del>- CSSPrimitiveValue(const Color&);
</del><ins>+ CSSPrimitiveValue(unsigned color); // RGB value
</ins><span class="cx"> CSSPrimitiveValue(const Length&);
</span><span class="cx"> CSSPrimitiveValue(const Length&, const RenderStyle&);
</span><span class="cx"> CSSPrimitiveValue(const LengthSize&, const RenderStyle&);
</span><span class="lines">@@ -463,7 +464,7 @@
</span><span class="cx"> #if ENABLE(CSS_SCROLL_SNAP)
</span><span class="cx"> LengthRepeat* lengthRepeat;
</span><span class="cx"> #endif
</span><del>- const Color* color;
</del><ins>+ unsigned rgbcolor;
</ins><span class="cx"> Pair* pair;
</span><span class="cx"> DashboardRegion* region;
</span><span class="cx"> CSSBasicShape* shape;
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSPrimitiveValueMappingsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (207341 => 207342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h        2016-10-14 15:58:16 UTC (rev 207341)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h        2016-10-14 16:17:47 UTC (rev 207342)
</span><span class="lines">@@ -4939,13 +4939,6 @@
</span><span class="cx"> return WM_LRTB;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-template<> inline CSSPrimitiveValue::CSSPrimitiveValue(const Color& color)
- : CSSValue(PrimitiveClass)
-{
- m_primitiveUnitType = CSS_RGBCOLOR;
- m_value.color = new Color(color);
-}
-
</del><span class="cx"> template<> inline CSSPrimitiveValue::CSSPrimitiveValue(CSSFontFamily fontFamily)
</span><span class="cx"> : CSSValue(PrimitiveClass)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSValuePoolcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSValuePool.cpp (207341 => 207342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSValuePool.cpp        2016-10-14 15:58:16 UTC (rev 207341)
+++ trunk/Source/WebCore/css/CSSValuePool.cpp        2016-10-14 16:17:47 UTC (rev 207342)
</span><span class="lines">@@ -48,9 +48,9 @@
</span><span class="cx"> m_unsetValue.construct();
</span><span class="cx"> m_revertValue.construct();
</span><span class="cx">
</span><del>- m_transparentColor.construct(Color(Color::transparent));
- m_whiteColor.construct(Color(Color::white));
- m_blackColor.construct(Color(Color::black));
</del><ins>+ m_transparentColor.construct(Color::transparent);
+ m_whiteColor.construct(Color::white);
+ m_blackColor.construct(Color::black);
</ins><span class="cx">
</span><span class="cx"> for (unsigned i = 0; i < numCSSValueKeywords; ++i)
</span><span class="cx"> m_identifierValues[i].construct(static_cast<CSSValueID>(i));
</span><span class="lines">@@ -73,15 +73,15 @@
</span><span class="cx"> return CSSPrimitiveValue::createIdentifier(ident);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Ref<CSSPrimitiveValue> CSSValuePool::createColorValue(const Color& color)
</del><ins>+Ref<CSSPrimitiveValue> CSSValuePool::createColorValue(unsigned rgbValue)
</ins><span class="cx"> {
</span><span class="cx"> // These are the empty and deleted values of the hash table.
</span><del>- if (color == Color::transparent)
</del><ins>+ if (rgbValue == Color::transparent)
</ins><span class="cx"> return m_transparentColor.get();
</span><del>- if (color == Color::white)
</del><ins>+ if (rgbValue == Color::white)
</ins><span class="cx"> return m_whiteColor.get();
</span><span class="cx"> // Just because it is common.
</span><del>- if (color == Color::black)
</del><ins>+ if (rgbValue == Color::black)
</ins><span class="cx"> return m_blackColor.get();
</span><span class="cx">
</span><span class="cx"> // Remove one entry at random if the cache grows too large.
</span><span class="lines">@@ -89,9 +89,9 @@
</span><span class="cx"> if (m_colorValueCache.size() >= maximumColorCacheSize)
</span><span class="cx"> m_colorValueCache.remove(m_colorValueCache.begin());
</span><span class="cx">
</span><del>- ColorValueCache::AddResult entry = m_colorValueCache.add(color, nullptr);
</del><ins>+ ColorValueCache::AddResult entry = m_colorValueCache.add(rgbValue, nullptr);
</ins><span class="cx"> if (entry.isNewEntry)
</span><del>- entry.iterator->value = CSSPrimitiveValue::create(color);
</del><ins>+ entry.iterator->value = CSSPrimitiveValue::createColor(rgbValue);
</ins><span class="cx"> return *entry.iterator->value;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSValuePoolh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSValuePool.h (207341 => 207342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSValuePool.h        2016-10-14 15:58:16 UTC (rev 207341)
+++ trunk/Source/WebCore/css/CSSValuePool.h        2016-10-14 16:17:47 UTC (rev 207342)
</span><span class="lines">@@ -34,7 +34,6 @@
</span><span class="cx"> #include "CSSRevertValue.h"
</span><span class="cx"> #include "CSSUnsetValue.h"
</span><span class="cx"> #include "CSSValueKeywords.h"
</span><del>-#include "ColorHash.h"
</del><span class="cx"> #include <utility>
</span><span class="cx"> #include <wtf/HashMap.h>
</span><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="lines">@@ -61,7 +60,7 @@
</span><span class="cx"> Ref<CSSRevertValue> createRevertValue() { return m_revertValue.get(); }
</span><span class="cx"> Ref<CSSPrimitiveValue> createIdentifierValue(CSSValueID identifier);
</span><span class="cx"> Ref<CSSPrimitiveValue> createIdentifierValue(CSSPropertyID identifier);
</span><del>- Ref<CSSPrimitiveValue> createColorValue(const Color&);
</del><ins>+ Ref<CSSPrimitiveValue> createColorValue(unsigned rgbValue);
</ins><span class="cx"> Ref<CSSPrimitiveValue> createValue(double value, CSSPrimitiveValue::UnitTypes);
</span><span class="cx"> Ref<CSSPrimitiveValue> createValue(const String& value, CSSPrimitiveValue::UnitTypes type) { return CSSPrimitiveValue::create(value, type); }
</span><span class="cx"> Ref<CSSPrimitiveValue> createValue(const Length& value, const RenderStyle& style) { return CSSPrimitiveValue::create(value, style); }
</span><span class="lines">@@ -73,7 +72,7 @@
</span><span class="cx"> private:
</span><span class="cx"> CSSValuePool();
</span><span class="cx">
</span><del>- typedef HashMap<Color, RefPtr<CSSPrimitiveValue>> ColorValueCache;
</del><ins>+ typedef HashMap<unsigned, RefPtr<CSSPrimitiveValue>> ColorValueCache;
</ins><span class="cx"> ColorValueCache m_colorValueCache;
</span><span class="cx">
</span><span class="cx"> typedef HashMap<AtomicString, RefPtr<CSSValueList>> FontFaceValueCache;
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.cpp (207341 => 207342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.cpp        2016-10-14 15:58:16 UTC (rev 207341)
+++ trunk/Source/WebCore/css/StyleResolver.cpp        2016-10-14 16:17:47 UTC (rev 207342)
</span><span class="lines">@@ -1831,7 +1831,7 @@
</span><span class="cx"> Color StyleResolver::colorFromPrimitiveValue(const CSSPrimitiveValue& value, bool forVisitedLink) const
</span><span class="cx"> {
</span><span class="cx"> if (value.isRGBColor())
</span><del>- return value.color();
</del><ins>+ return Color(value.getRGBA32Value());
</ins><span class="cx">
</span><span class="cx"> const State& state = m_state;
</span><span class="cx"> CSSValueID ident = value.getValueID();
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSParser.cpp (207341 => 207342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParser.cpp        2016-10-14 15:58:16 UTC (rev 207341)
+++ trunk/Source/WebCore/css/parser/CSSParser.cpp        2016-10-14 16:17:47 UTC (rev 207342)
</span><span class="lines">@@ -494,8 +494,8 @@
</span><span class="cx"> auto value = CSSValuePool::singleton().createIdentifierValue(valueID);
</span><span class="cx"> return declaration.addParsedProperty(CSSProperty(propertyId, WTFMove(value), important)) ? CSSParser::ParseResult::Changed : CSSParser::ParseResult::Unchanged;
</span><span class="cx"> }
</span><del>- Color color = CSSParser::fastParseColor(string, strict && string[0] != '#');
- if (!color.isValid())
</del><ins>+ RGBA32 color;
+ if (!CSSParser::fastParseColor(color, string, strict && string[0] != '#'))
</ins><span class="cx"> return CSSParser::ParseResult::Error;
</span><span class="cx">
</span><span class="cx"> auto value = CSSValuePool::singleton().createColorValue(color);
</span><span class="lines">@@ -1370,34 +1370,36 @@
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Color CSSParser::parseColor(const String& string, bool strict)
</del><ins>+// The color will only be changed when string contains a valid CSS color, so callers
+// can set it to a default color and ignore the boolean result.
+bool CSSParser::parseColor(RGBA32& color, const String& string, bool strict)
</ins><span class="cx"> {
</span><span class="cx"> if (string.isEmpty())
</span><del>- return Color();
</del><ins>+ return false;
</ins><span class="cx">
</span><span class="cx"> // First try creating a color specified by name, rgba(), rgb() or "#" syntax.
</span><del>- Color color = fastParseColor(string, strict);
- if (color.isValid())
- return color;
</del><ins>+ if (fastParseColor(color, string, strict))
+ return true;
</ins><span class="cx">
</span><span class="cx"> CSSParser parser(HTMLStandardMode);
</span><span class="cx">
</span><span class="cx"> // In case the fast-path parser didn't understand the color, try the full parser.
</span><del>- if (!parser.parseColorFromString(string))
- return Color();
</del><ins>+ if (!parser.parseColor(string))
+ return false;
</ins><span class="cx">
</span><span class="cx"> CSSValue& value = *parser.m_parsedProperties.first().value();
</span><span class="cx"> if (!is<CSSPrimitiveValue>(value))
</span><del>- return Color();
</del><ins>+ return false;
</ins><span class="cx">
</span><span class="cx"> CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(value);
</span><span class="cx"> if (!primitiveValue.isRGBColor())
</span><del>- return Color();
</del><ins>+ return false;
</ins><span class="cx">
</span><del>- return primitiveValue.color();
</del><ins>+ color = primitiveValue.getRGBA32Value();
+ return true;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool CSSParser::parseColorFromString(const String& string)
</del><ins>+bool CSSParser::parseColor(const String& string)
</ins><span class="cx"> {
</span><span class="cx"> setupParser("@-webkit-decls{color:", string, "} ");
</span><span class="cx"> cssyyparse(this);
</span><span class="lines">@@ -1406,18 +1408,23 @@
</span><span class="cx"> return !m_parsedProperties.isEmpty() && m_parsedProperties.first().id() == CSSPropertyColor;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Color CSSParser::parseSystemColor(const String& string, Document* document)
</del><ins>+bool CSSParser::parseSystemColor(RGBA32& color, const String& string, Document* document)
</ins><span class="cx"> {
</span><span class="cx"> if (!document || !document->page())
</span><del>- return Color();
</del><ins>+ return false;
</ins><span class="cx">
</span><span class="cx"> CSSParserString cssColor;
</span><span class="cx"> cssColor.init(string);
</span><span class="cx"> CSSValueID id = cssValueKeywordID(cssColor);
</span><span class="cx"> if (!validPrimitiveValueColor(id))
</span><del>- return Color();
</del><ins>+ return false;
</ins><span class="cx">
</span><del>- return document->page()->theme().systemColor(id);
</del><ins>+ Color parsedColor = document->page()->theme().systemColor(id);
+ if (!parsedColor.isValid())
+ return false;
+
+ color = parsedColor.rgb();
+ return true;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void CSSParser::parseSelector(const String& string, CSSSelectorList& selectorList)
</span><span class="lines">@@ -7474,18 +7481,17 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> template <typename CharacterType>
</span><del>-static inline Color fastParseColorInternal(const CharacterType* characters, unsigned length , bool strict)
</del><ins>+static inline bool fastParseColorInternal(RGBA32& rgb, const CharacterType* characters, unsigned length , bool strict)
</ins><span class="cx"> {
</span><span class="cx"> CSSPrimitiveValue::UnitTypes expect = CSSPrimitiveValue::CSS_UNKNOWN;
</span><del>-
</del><ins>+
</ins><span class="cx"> if (!strict && length >= 3) {
</span><del>- RGBA32 rgb;
</del><span class="cx"> if (characters[0] == '#') {
</span><span class="cx"> if (Color::parseHexColor(characters + 1, length - 1, rgb))
</span><del>- return Color(rgb);
</del><ins>+ return true;
</ins><span class="cx"> } else {
</span><span class="cx"> if (Color::parseHexColor(characters, length, rgb))
</span><del>- return Color(rgb);
</del><ins>+ return true;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -7499,16 +7505,17 @@
</span><span class="cx"> int alpha;
</span><span class="cx">
</span><span class="cx"> if (!parseColorIntOrPercentage(current, end, ',', expect, red))
</span><del>- return Color();
</del><ins>+ return false;
</ins><span class="cx"> if (!parseColorIntOrPercentage(current, end, ',', expect, green))
</span><del>- return Color();
</del><ins>+ return false;
</ins><span class="cx"> if (!parseColorIntOrPercentage(current, end, ',', expect, blue))
</span><del>- return Color();
</del><ins>+ return false;
</ins><span class="cx"> if (!parseAlphaValue(current, end, ')', alpha))
</span><del>- return Color();
</del><ins>+ return false;
</ins><span class="cx"> if (current != end)
</span><del>- return Color();
- return Color(makeRGBA(red, green, blue, alpha));
</del><ins>+ return false;
+ rgb = makeRGBA(red, green, blue, alpha);
+ return true;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Try rgb() syntax.
</span><span class="lines">@@ -7519,39 +7526,45 @@
</span><span class="cx"> int green;
</span><span class="cx"> int blue;
</span><span class="cx"> if (!parseColorIntOrPercentage(current, end, ',', expect, red))
</span><del>- return Color();
</del><ins>+ return false;
</ins><span class="cx"> if (!parseColorIntOrPercentage(current, end, ',', expect, green))
</span><del>- return Color();
</del><ins>+ return false;
</ins><span class="cx"> if (!parseColorIntOrPercentage(current, end, ')', expect, blue))
</span><del>- return Color();
</del><ins>+ return false;
</ins><span class="cx"> if (current != end)
</span><del>- return Color();
- return Color(makeRGB(red, green, blue));
</del><ins>+ return false;
+ rgb = makeRGB(red, green, blue);
+ return true;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- return Color();
</del><ins>+ return false;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> template<typename StringType>
</span><del>-Color CSSParser::fastParseColor(const StringType& name, bool strict)
</del><ins>+bool CSSParser::fastParseColor(RGBA32& rgb, const StringType& name, bool strict)
</ins><span class="cx"> {
</span><span class="cx"> unsigned length = name.length();
</span><ins>+ bool parseResult;
</ins><span class="cx">
</span><span class="cx"> if (!length)
</span><del>- return Color();
</del><ins>+ return false;
</ins><span class="cx">
</span><del>- Color color;
</del><span class="cx"> if (name.is8Bit())
</span><del>- color = fastParseColorInternal(name.characters8(), length, strict);
</del><ins>+ parseResult = fastParseColorInternal(rgb, name.characters8(), length, strict);
</ins><span class="cx"> else
</span><del>- color = fastParseColorInternal(name.characters16(), length, strict);
</del><ins>+ parseResult = fastParseColorInternal(rgb, name.characters16(), length, strict);
</ins><span class="cx">
</span><del>- if (color.isValid())
- return color;
</del><ins>+ if (parseResult)
+ return true;
</ins><span class="cx">
</span><span class="cx"> // Try named colors.
</span><del>- color.setNamedColor(name);
- return color;
</del><ins>+ Color tc;
+ tc.setNamedColor(name);
+ if (tc.isValid()) {
+ rgb = tc.rgb();
+ return true;
+ }
+ return false;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> inline double CSSParser::parsedDouble(ValueWithCalculation& valueWithCalculation)
</span><span class="lines">@@ -7667,23 +7680,25 @@
</span><span class="cx">
</span><span class="cx"> RefPtr<CSSPrimitiveValue> CSSParser::parseColor(CSSParserValue* value)
</span><span class="cx"> {
</span><del>- Color color = parseColorFromValue(value ? *value : *m_valueList->current());
- if (!color.isValid())
</del><ins>+ RGBA32 c = Color::transparent;
+ if (!parseColorFromValue(value ? *value : *m_valueList->current(), c))
</ins><span class="cx"> return nullptr;
</span><del>- return CSSValuePool::singleton().createColorValue(color);
</del><ins>+ return CSSValuePool::singleton().createColorValue(c);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-Color CSSParser::parseColorFromValue(CSSParserValue& value)
</del><ins>+bool CSSParser::parseColorFromValue(CSSParserValue& value, RGBA32& c)
</ins><span class="cx"> {
</span><span class="cx"> if (inQuirksMode() && value.unit == CSSPrimitiveValue::CSS_NUMBER
</span><span class="cx"> && value.fValue >= 0. && value.fValue < 1000000.) {
</span><span class="cx"> String str = String::format("%06d", static_cast<int>((value.fValue+.5)));
</span><span class="cx"> // FIXME: This should be strict parsing for SVG as well.
</span><del>- return fastParseColor(str, inStrictMode());
</del><ins>+ if (!fastParseColor(c, str, inStrictMode()))
+ return false;
</ins><span class="cx"> } else if (value.unit == CSSPrimitiveValue::CSS_PARSER_HEXCOLOR
</span><span class="cx"> || value.unit == CSSPrimitiveValue::CSS_IDENT
</span><span class="cx"> || (inQuirksMode() && value.unit == CSSPrimitiveValue::CSS_DIMENSION)) {
</span><del>- return fastParseColor(value.string, inStrictMode() && value.unit == CSSPrimitiveValue::CSS_IDENT);
</del><ins>+ if (!fastParseColor(c, value.string, inStrictMode() && value.unit == CSSPrimitiveValue::CSS_IDENT))
+ return false;
</ins><span class="cx"> } else if (value.unit == CSSParserValue::Function
</span><span class="cx"> && value.function->args
</span><span class="cx"> && value.function->args->size() == 5 /* rgb + two commas */
</span><span class="lines">@@ -7690,8 +7705,8 @@
</span><span class="cx"> && equalLettersIgnoringASCIICase(value.function->name, "rgb(")) {
</span><span class="cx"> int colorValues[3];
</span><span class="cx"> if (!parseRGBParameters(value, colorValues, false))
</span><del>- return Color();
- return Color(makeRGB(colorValues[0], colorValues[1], colorValues[2]));
</del><ins>+ return false;
+ c = makeRGB(colorValues[0], colorValues[1], colorValues[2]);
</ins><span class="cx"> } else if (value.unit == CSSParserValue::Function
</span><span class="cx"> && value.function->args
</span><span class="cx"> && value.function->args->size() == 7 /* rgba + three commas */
</span><span class="lines">@@ -7698,8 +7713,8 @@
</span><span class="cx"> && equalLettersIgnoringASCIICase(value.function->name, "rgba(")) {
</span><span class="cx"> int colorValues[4];
</span><span class="cx"> if (!parseRGBParameters(value, colorValues, true))
</span><del>- return Color();
- return Color(makeRGBA(colorValues[0], colorValues[1], colorValues[2], colorValues[3]));
</del><ins>+ return false;
+ c = makeRGBA(colorValues[0], colorValues[1], colorValues[2], colorValues[3]);
</ins><span class="cx"> } else if (value.unit == CSSParserValue::Function
</span><span class="cx"> && value.function->args
</span><span class="cx"> && value.function->args->size() == 5 /* hsl + two commas */
</span><span class="lines">@@ -7706,8 +7721,8 @@
</span><span class="cx"> && equalLettersIgnoringASCIICase(value.function->name, "hsl(")) {
</span><span class="cx"> double colorValues[3];
</span><span class="cx"> if (!parseHSLParameters(value, colorValues, false))
</span><del>- return Color();
- return Color(makeRGBAFromHSLA(colorValues[0], colorValues[1], colorValues[2], 1.0));
</del><ins>+ return false;
+ c = makeRGBAFromHSLA(colorValues[0], colorValues[1], colorValues[2], 1.0);
</ins><span class="cx"> } else if (value.unit == CSSParserValue::Function
</span><span class="cx"> && value.function->args
</span><span class="cx"> && value.function->args->size() == 7 /* hsla + three commas */
</span><span class="lines">@@ -7714,11 +7729,12 @@
</span><span class="cx"> && equalLettersIgnoringASCIICase(value.function->name, "hsla(")) {
</span><span class="cx"> double colorValues[4];
</span><span class="cx"> if (!parseHSLParameters(value, colorValues, true))
</span><del>- return Color();
- return Color(makeRGBAFromHSLA(colorValues[0], colorValues[1], colorValues[2], colorValues[3]));
- }
</del><ins>+ return false;
+ c = makeRGBAFromHSLA(colorValues[0], colorValues[1], colorValues[2], colorValues[3]);
+ } else
+ return false;
</ins><span class="cx">
</span><del>- return Color();
</del><ins>+ return true;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // This class tracks parsing state for shadow values. If it goes out of scope (e.g., due to an early return)
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSParser.h (207341 => 207342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParser.h        2016-10-14 15:58:16 UTC (rev 207341)
+++ trunk/Source/WebCore/css/parser/CSSParser.h        2016-10-14 16:17:47 UTC (rev 207342)
</span><span class="lines">@@ -134,9 +134,9 @@
</span><span class="cx"> static ParseResult parseValue(MutableStyleProperties&, CSSPropertyID, const String&, bool important, const CSSParserContext&, StyleSheetContents*);
</span><span class="cx"> static ParseResult parseCustomPropertyValue(MutableStyleProperties&, const AtomicString& propertyName, const String&, bool important, const CSSParserContext&, StyleSheetContents* contextStyleSheet);
</span><span class="cx">
</span><del>- static Color parseColor(const String&, bool strict = false);
</del><ins>+ static bool parseColor(RGBA32& color, const String&, bool strict = false);
</ins><span class="cx"> static bool isValidSystemColorValue(CSSValueID);
</span><del>- static Color parseSystemColor(const String&, Document*);
</del><ins>+ static bool parseSystemColor(RGBA32& color, const String&, Document*);
</ins><span class="cx"> static RefPtr<CSSValueList> parseFontFaceValue(const AtomicString&);
</span><span class="cx"> RefPtr<CSSPrimitiveValue> parseValidPrimitive(CSSValueID ident, ValueWithCalculation&);
</span><span class="cx">
</span><span class="lines">@@ -278,11 +278,11 @@
</span><span class="cx"> bool parseRGBParameters(CSSParserValue&, int* colorValues, bool parseAlpha);
</span><span class="cx"> bool parseHSLParameters(CSSParserValue&, double* colorValues, bool parseAlpha);
</span><span class="cx"> RefPtr<CSSPrimitiveValue> parseColor(CSSParserValue* = nullptr);
</span><del>- Color parseColorFromValue(CSSParserValue&);
</del><ins>+ bool parseColorFromValue(CSSParserValue&, RGBA32&);
</ins><span class="cx"> void parseSelector(const String&, CSSSelectorList&);
</span><span class="cx">
</span><span class="cx"> template<typename StringType>
</span><del>- static Color fastParseColor(const StringType&, bool strict);
</del><ins>+ static bool fastParseColor(RGBA32&, const StringType&, bool strict);
</ins><span class="cx">
</span><span class="cx"> bool parseLineHeight(bool important);
</span><span class="cx"> bool parseFontSize(bool important);
</span><span class="lines">@@ -618,7 +618,7 @@
</span><span class="cx"> bool parseFontFaceSrcURI(CSSValueList&);
</span><span class="cx"> bool parseFontFaceSrcLocal(CSSValueList&);
</span><span class="cx">
</span><del>- bool parseColorFromString(const String&);
</del><ins>+ bool parseColor(const String&);
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(CSS_GRID_LAYOUT)
</span><span class="cx"> bool parseIntegerOrCustomIdentFromGridPosition(RefPtr<CSSPrimitiveValue>& numericValue, RefPtr<CSSPrimitiveValue>& gridLineName);
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParserFastPathscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp (207341 => 207342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp        2016-10-14 15:58:16 UTC (rev 207341)
+++ trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp        2016-10-14 16:17:47 UTC (rev 207342)
</span><span class="lines">@@ -411,21 +411,16 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> template <typename CharacterType>
</span><del>-static Color fastParseColorInternal(const CharacterType* characters, unsigned length, bool quirksMode)
</del><ins>+static bool fastParseColorInternal(RGBA32& rgb, const CharacterType* characters, unsigned length, bool quirksMode)
</ins><span class="cx"> {
</span><span class="cx"> CSSPrimitiveValue::UnitTypes expect = CSSPrimitiveValue::UnitTypes::CSS_UNKNOWN;
</span><span class="cx">
</span><del>- if (length >= 4 && characters[0] == '#') {
- // FIXME: Why doesn't this check if the parse worked? Is the fallback black?
- RGBA32 rgb;
- Color::parseHexColor(characters + 1, length - 1, rgb);
- return Color(rgb);
- }
</del><ins>+ if (length >= 4 && characters[0] == '#')
+ return Color::parseHexColor(characters + 1, length - 1, rgb);
</ins><span class="cx">
</span><span class="cx"> if (quirksMode && (length == 3 || length == 6)) {
</span><del>- RGBA32 rgb;
</del><span class="cx"> if (Color::parseHexColor(characters, length, rgb))
</span><del>- return Color(rgb);
</del><ins>+ return true;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Try rgba() syntax.
</span><span class="lines">@@ -438,16 +433,17 @@
</span><span class="cx"> int alpha;
</span><span class="cx">
</span><span class="cx"> if (!parseColorIntOrPercentage(current, end, ',', expect, red))
</span><del>- return Color();
</del><ins>+ return false;
</ins><span class="cx"> if (!parseColorIntOrPercentage(current, end, ',', expect, green))
</span><del>- return Color();
</del><ins>+ return false;
</ins><span class="cx"> if (!parseColorIntOrPercentage(current, end, ',', expect, blue))
</span><del>- return Color();
</del><ins>+ return false;
</ins><span class="cx"> if (!parseAlphaValue(current, end, ')', alpha))
</span><del>- return Color();
</del><ins>+ return false;
</ins><span class="cx"> if (current != end)
</span><del>- return Color();
- return Color(makeRGBA(red, green, blue, alpha));
</del><ins>+ return false;
+ rgb = makeRGBA(red, green, blue, alpha);
+ return true;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Try rgb() syntax.
</span><span class="lines">@@ -458,17 +454,18 @@
</span><span class="cx"> int green;
</span><span class="cx"> int blue;
</span><span class="cx"> if (!parseColorIntOrPercentage(current, end, ',', expect, red))
</span><del>- return Color();
</del><ins>+ return false;
</ins><span class="cx"> if (!parseColorIntOrPercentage(current, end, ',', expect, green))
</span><del>- return Color();
</del><ins>+ return false;
</ins><span class="cx"> if (!parseColorIntOrPercentage(current, end, ')', expect, blue))
</span><del>- return Color();
</del><ins>+ return false;
</ins><span class="cx"> if (current != end)
</span><del>- return Color();
- return Color(makeRGB(red, green, blue));
</del><ins>+ return false;
+ rgb = makeRGB(red, green, blue);
+ return true;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- return Color();
</del><ins>+ return false;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RefPtr<CSSValue> CSSParserFastPaths::parseColor(const String& string, CSSParserMode parserMode)
</span><span class="lines">@@ -481,15 +478,16 @@
</span><span class="cx"> return CSSPrimitiveValue::createIdentifier(valueID);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ RGBA32 color;
</ins><span class="cx"> bool quirksMode = isQuirksModeBehavior(parserMode);
</span><span class="cx">
</span><span class="cx"> // Fast path for hex colors and rgb()/rgba() colors
</span><del>- Color color;
</del><ins>+ bool parseResult;
</ins><span class="cx"> if (string.is8Bit())
</span><del>- color = fastParseColorInternal(string.characters8(), string.length(), quirksMode);
</del><ins>+ parseResult = fastParseColorInternal(color, string.characters8(), string.length(), quirksMode);
</ins><span class="cx"> else
</span><del>- color = fastParseColorInternal(string.characters16(), string.length(), quirksMode);
- if (!color.isValid())
</del><ins>+ parseResult = fastParseColorInternal(color, string.characters16(), string.length(), quirksMode);
+ if (!parseResult)
</ins><span class="cx"> return nullptr;
</span><span class="cx"> return CSSValuePool::singleton().createColorValue(color);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSPropertyParserHelperscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp (207341 => 207342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp        2016-10-14 15:58:16 UTC (rev 207341)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp        2016-10-14 16:17:47 UTC (rev 207342)
</span><span class="lines">@@ -509,7 +509,7 @@
</span><span class="cx"> RGBA32 color = Color::transparent;
</span><span class="cx"> if (!parseHexColor(range, color, acceptQuirkyColors) && !parseColorFunction(range, color))
</span><span class="cx"> return nullptr;
</span><del>- return CSSPrimitiveValue::create(Color(color));
</del><ins>+ return CSSPrimitiveValue::createColor(color);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static RefPtr<CSSPrimitiveValue> consumePositionComponent(CSSParserTokenRange& range, CSSParserMode cssParserMode, UnitlessQuirk unitless)
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserSVGCSSParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/SVGCSSParser.cpp (207341 => 207342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/SVGCSSParser.cpp        2016-10-14 15:58:16 UTC (rev 207341)
+++ trunk/Source/WebCore/css/parser/SVGCSSParser.cpp        2016-10-14 16:17:47 UTC (rev 207342)
</span><span class="lines">@@ -131,10 +131,10 @@
</span><span class="cx"> else if (isValidSystemControlColorValue(id) || id == CSSValueMenu)
</span><span class="cx"> parsedValue = SVGPaint::createColor(RenderTheme::defaultTheme()->systemColor(id));
</span><span class="cx"> else if (valueWithCalculation.value().unit == CSSPrimitiveValue::CSS_URI) {
</span><ins>+ RGBA32 c = Color::transparent;
</ins><span class="cx"> if (m_valueList->next()) {
</span><del>- Color color = parseColorFromValue(*m_valueList->current());
- if (color.isValid())
- parsedValue = SVGPaint::createURIAndColor(valueWithCalculation.value().string, color);
</del><ins>+ if (parseColorFromValue(*m_valueList->current(), c))
+ parsedValue = SVGPaint::createURIAndColor(valueWithCalculation.value().string, c);
</ins><span class="cx"> else if (m_valueList->current()->id == CSSValueNone)
</span><span class="cx"> parsedValue = SVGPaint::createURIAndNone(valueWithCalculation.value().string);
</span><span class="cx"> }
</span><span class="lines">@@ -286,18 +286,18 @@
</span><span class="cx">
</span><span class="cx"> RefPtr<SVGPaint> CSSParser::parseSVGPaint()
</span><span class="cx"> {
</span><del>- Color color = parseColorFromValue(*m_valueList->current());
- if (!color.isValid())
</del><ins>+ RGBA32 c = Color::transparent;
+ if (!parseColorFromValue(*m_valueList->current(), c))
</ins><span class="cx"> return nullptr;
</span><del>- return SVGPaint::createColor(color);
</del><ins>+ return SVGPaint::createColor(Color(c));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RefPtr<SVGColor> CSSParser::parseSVGColor()
</span><span class="cx"> {
</span><del>- Color color = parseColorFromValue(*m_valueList->current());
- if (!color.isValid())
</del><ins>+ RGBA32 c = Color::transparent;
+ if (!parseColorFromValue(*m_valueList->current(), c))
</ins><span class="cx"> return nullptr;
</span><del>- return SVGColor::createFromColor(color);
</del><ins>+ return SVGColor::createFromColor(Color(c));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RefPtr<CSSValueList> CSSParser::parsePaintOrder()
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingEditingStylecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/EditingStyle.cpp (207341 => 207342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/EditingStyle.cpp        2016-10-14 15:58:16 UTC (rev 207341)
+++ trunk/Source/WebCore/editing/EditingStyle.cpp        2016-10-14 16:17:47 UTC (rev 207342)
</span><span class="lines">@@ -382,7 +382,7 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static Color cssValueToColor(CSSValue* colorValue)
</del><ins>+static RGBA32 cssValueToRGBA(CSSValue* colorValue)
</ins><span class="cx"> {
</span><span class="cx"> if (!is<CSSPrimitiveValue>(colorValue))
</span><span class="cx"> return Color::transparent;
</span><span class="lines">@@ -389,26 +389,28 @@
</span><span class="cx">
</span><span class="cx"> CSSPrimitiveValue& primitiveColor = downcast<CSSPrimitiveValue>(*colorValue);
</span><span class="cx"> if (primitiveColor.isRGBColor())
</span><del>- return primitiveColor.color();
</del><ins>+ return primitiveColor.getRGBA32Value();
</ins><span class="cx">
</span><del>- return CSSParser::parseColor(colorValue->cssText());
</del><ins>+ RGBA32 rgba = 0;
+ CSSParser::parseColor(rgba, colorValue->cssText());
+ return rgba;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> template<typename T>
</span><del>-static inline Color textColorFromStyle(T& style)
</del><ins>+static inline RGBA32 textColorFromStyle(T& style)
</ins><span class="cx"> {
</span><del>- return cssValueToColor(extractPropertyValue(style, CSSPropertyColor).get());
</del><ins>+ return cssValueToRGBA(extractPropertyValue(style, CSSPropertyColor).get());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> template<typename T>
</span><del>-static inline Color backgroundColorFromStyle(T& style)
</del><ins>+static inline RGBA32 backgroundColorFromStyle(T& style)
</ins><span class="cx"> {
</span><del>- return cssValueToColor(extractPropertyValue(style, CSSPropertyBackgroundColor).get());
</del><ins>+ return cssValueToRGBA(extractPropertyValue(style, CSSPropertyBackgroundColor).get());
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-static inline Color rgbaBackgroundColorInEffect(Node* node)
</del><ins>+static inline RGBA32 rgbaBackgroundColorInEffect(Node* node)
</ins><span class="cx"> {
</span><del>- return cssValueToColor(backgroundColorInEffect(node).get());
</del><ins>+ return cssValueToRGBA(backgroundColorInEffect(node).get());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static int textAlignResolvingStartAndEnd(int textAlign, int direction)
</span><span class="lines">@@ -1094,7 +1096,7 @@
</span><span class="cx"> m_mutableStyle->removeProperty(CSSPropertyColor);
</span><span class="cx">
</span><span class="cx"> if (hasTransparentBackgroundColor(m_mutableStyle.get())
</span><del>- || cssValueToColor(m_mutableStyle->getPropertyCSSValue(CSSPropertyBackgroundColor).get()) == rgbaBackgroundColorInEffect(position.containerNode()))
</del><ins>+ || cssValueToRGBA(m_mutableStyle->getPropertyCSSValue(CSSPropertyBackgroundColor).get()) == rgbaBackgroundColorInEffect(position.containerNode()))
</ins><span class="cx"> m_mutableStyle->removeProperty(CSSPropertyBackgroundColor);
</span><span class="cx">
</span><span class="cx"> if (is<CSSPrimitiveValue>(unicodeBidi.get())) {
</span><span class="lines">@@ -1838,7 +1840,7 @@
</span><span class="cx"> return false;
</span><span class="cx"> CSSPrimitiveValue& value = downcast<CSSPrimitiveValue>(*cssValue);
</span><span class="cx"> if (value.isRGBColor())
</span><del>- return value.color().hasAlpha();
</del><ins>+ return !alphaChannel(value.getRGBA32Value());
</ins><span class="cx"> return value.getValueID() == CSSValueTransparent;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingcocoaHTMLConvertermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm (207341 => 207342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm        2016-10-14 15:58:16 UTC (rev 207341)
+++ trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm        2016-10-14 16:17:47 UTC (rev 207342)
</span><span class="lines">@@ -989,13 +989,13 @@
</span><span class="cx"> Element& element = downcast<Element>(node);
</span><span class="cx"> if (RefPtr<CSSValue> value = computedStylePropertyForElement(element, propertyId)) {
</span><span class="cx"> if (is<CSSPrimitiveValue>(*value) && downcast<CSSPrimitiveValue>(*value).isRGBColor())
</span><del>- return normalizedColor(Color(downcast<CSSPrimitiveValue>(*value).color().rgb()), propertyId == CSSPropertyColor);
</del><ins>+ return normalizedColor(Color(downcast<CSSPrimitiveValue>(*value).getRGBA32Value()), propertyId == CSSPropertyColor);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool inherit = false;
</span><span class="cx"> if (RefPtr<CSSValue> value = inlineStylePropertyForElement(element, propertyId)) {
</span><span class="cx"> if (is<CSSPrimitiveValue>(*value) && downcast<CSSPrimitiveValue>(*value).isRGBColor())
</span><del>- return normalizedColor(Color(downcast<CSSPrimitiveValue>(*value).color().rgb()), propertyId == CSSPropertyColor);
</del><ins>+ return normalizedColor(Color(downcast<CSSPrimitiveValue>(*value).getRGBA32Value()), propertyId == CSSPropertyColor);
</ins><span class="cx"> if (value->isInheritedValue())
</span><span class="cx"> inherit = true;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLBodyElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLBodyElement.cpp (207341 => 207342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLBodyElement.cpp        2016-10-14 15:58:16 UTC (rev 207341)
+++ trunk/Source/WebCore/html/HTMLBodyElement.cpp        2016-10-14 16:17:47 UTC (rev 207342)
</span><span class="lines">@@ -158,8 +158,8 @@
</span><span class="cx"> else
</span><span class="cx"> document().resetActiveLinkColor();
</span><span class="cx"> } else {
</span><del>- Color color = CSSParser::parseColor(value, !document().inQuirksMode());
- if (color.isValid()) {
</del><ins>+ RGBA32 color;
+ if (CSSParser::parseColor(color, value, !document().inQuirksMode())) {
</ins><span class="cx"> if (name == linkAttr)
</span><span class="cx"> document().setLinkColor(color);
</span><span class="cx"> else if (name == vlinkAttr)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasCanvasGradientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/CanvasGradient.cpp (207341 => 207342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/CanvasGradient.cpp        2016-10-14 15:58:16 UTC (rev 207341)
+++ trunk/Source/WebCore/html/canvas/CanvasGradient.cpp        2016-10-14 16:17:47 UTC (rev 207342)
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void CanvasGradient::addColorStop(float value, const String& colorString, ExceptionCode& ec)
</del><ins>+void CanvasGradient::addColorStop(float value, const String& color, ExceptionCode& ec)
</ins><span class="cx"> {
</span><span class="cx"> if (!(value >= 0 && value <= 1.0f)) {
</span><span class="cx"> ec = INDEX_SIZE_ERR;
</span><span class="lines">@@ -57,8 +57,8 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- Color color = parseColorOrCurrentColor(colorString, 0 /*canvas*/);
- if (!color.isValid()) {
</del><ins>+ RGBA32 rgba = 0;
+ if (!parseColorOrCurrentColor(rgba, color, 0 /*canvas*/)) {
</ins><span class="cx"> #if ENABLE(DASHBOARD_SUPPORT)
</span><span class="cx"> if (!m_dashboardCompatibilityMode)
</span><span class="cx"> ec = SYNTAX_ERR;
</span><span class="lines">@@ -68,7 +68,7 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- m_gradient->addColorStop(value, color);
</del><ins>+ m_gradient->addColorStop(value, Color(rgba));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasCanvasRenderingContext2Dcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (207341 => 207342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp        2016-10-14 15:58:16 UTC (rev 207341)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp        2016-10-14 16:17:47 UTC (rev 207342)
</span><span class="lines">@@ -404,10 +404,9 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (style.isCurrentColor()) {
</span><del>- if (style.hasOverrideAlpha()) {
- // FIXME: Should not use RGBA32 here.
- style = CanvasStyle(colorWithOverrideAlpha(currentColor(canvas()).rgb(), style.overrideAlpha()));
- } else
</del><ins>+ if (style.hasOverrideAlpha())
+ style = CanvasStyle(colorWithOverrideAlpha(currentColor(canvas()), style.overrideAlpha()));
+ else
</ins><span class="cx"> style = CanvasStyle(currentColor(canvas()));
</span><span class="cx"> } else
</span><span class="cx"> checkOrigin(style.canvasPattern());
</span><span class="lines">@@ -431,10 +430,9 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (style.isCurrentColor()) {
</span><del>- if (style.hasOverrideAlpha()) {
- // FIXME: Should not use RGBA32 here.
- style = CanvasStyle(colorWithOverrideAlpha(currentColor(canvas()).rgb(), style.overrideAlpha()));
- } else
</del><ins>+ if (style.hasOverrideAlpha())
+ style = CanvasStyle(colorWithOverrideAlpha(currentColor(canvas()), style.overrideAlpha()));
+ else
</ins><span class="cx"> style = CanvasStyle(currentColor(canvas()));
</span><span class="cx"> } else
</span><span class="cx"> checkOrigin(style.canvasPattern());
</span><span class="lines">@@ -580,15 +578,15 @@
</span><span class="cx"> return Color(state().shadowColor).serialized();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void CanvasRenderingContext2D::setShadowColor(const String& colorString)
</del><ins>+void CanvasRenderingContext2D::setShadowColor(const String& color)
</ins><span class="cx"> {
</span><del>- Color color = parseColorOrCurrentColor(colorString, canvas());
- if (!color.isValid())
</del><ins>+ RGBA32 rgba;
+ if (!parseColorOrCurrentColor(rgba, color, canvas()))
</ins><span class="cx"> return;
</span><del>- if (state().shadowColor == color)
</del><ins>+ if (state().shadowColor == rgba)
</ins><span class="cx"> return;
</span><span class="cx"> realizeSaves();
</span><del>- modifiableState().shadowColor = color;
</del><ins>+ modifiableState().shadowColor = rgba;
</ins><span class="cx"> applyShadow();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1250,15 +1248,12 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void CanvasRenderingContext2D::setShadow(float width, float height, float blur, const String& colorString, Optional<float> alpha)
</del><ins>+void CanvasRenderingContext2D::setShadow(float width, float height, float blur, const String& color, Optional<float> alpha)
</ins><span class="cx"> {
</span><del>- Color color = parseColorOrCurrentColor(colorString, canvas());
- if (!colorString.isNull() && !color.isValid())
</del><ins>+ RGBA32 rgba = Color::transparent;
+ if (!color.isNull() && !parseColorOrCurrentColor(rgba, color, canvas()))
</ins><span class="cx"> return;
</span><del>- if (!color.isValid())
- color = Color::transparent;
- // FIXME: Should not use RGBA32 here.
- setShadow(FloatSize(width, height), blur, colorWithOverrideAlpha(color.rgb(), alpha));
</del><ins>+ setShadow(FloatSize(width, height), blur, colorWithOverrideAlpha(rgba, alpha));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void CanvasRenderingContext2D::setShadow(float width, float height, float blur, float grayLevel, float alpha)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasCanvasStylecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/CanvasStyle.cpp (207341 => 207342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/CanvasStyle.cpp        2016-10-14 15:58:16 UTC (rev 207341)
+++ trunk/Source/WebCore/html/canvas/CanvasStyle.cpp        2016-10-14 16:17:47 UTC (rev 207342)
</span><span class="lines">@@ -43,36 +43,44 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-static bool isCurrentColorString(const String& colorString)
-{
- return equalLettersIgnoringASCIICase(colorString, "currentcolor");
-}
</del><ins>+enum ColorParseResult { ParsedRGBA, ParsedCurrentColor, ParsedSystemColor, ParseFailed };
</ins><span class="cx">
</span><del>-static Color parseColor(const String& colorString, Document* document = nullptr)
</del><ins>+static ColorParseResult parseColor(RGBA32& parsedColor, const String& colorString, Document* document = nullptr)
</ins><span class="cx"> {
</span><del>- Color color = CSSParser::parseColor(colorString);
- if (color.isValid())
- return color;
-
- return CSSParser::parseSystemColor(colorString, document);
</del><ins>+ if (equalLettersIgnoringASCIICase(colorString, "currentcolor"))
+ return ParsedCurrentColor;
+ if (CSSParser::parseColor(parsedColor, colorString))
+ return ParsedRGBA;
+ if (CSSParser::parseSystemColor(parsedColor, colorString, document))
+ return ParsedSystemColor;
+ return ParseFailed;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-Color currentColor(HTMLCanvasElement* canvas)
</del><ins>+RGBA32 currentColor(HTMLCanvasElement* canvas)
</ins><span class="cx"> {
</span><span class="cx"> if (!canvas || !canvas->inDocument() || !canvas->inlineStyle())
</span><span class="cx"> return Color::black;
</span><del>- Color color = CSSParser::parseColor(canvas->inlineStyle()->getPropertyValue(CSSPropertyColor));
- if (!color.isValid())
- return Color::black;
- return color;
</del><ins>+ RGBA32 rgba = Color::black;
+ CSSParser::parseColor(rgba, canvas->inlineStyle()->getPropertyValue(CSSPropertyColor));
+ return rgba;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-Color parseColorOrCurrentColor(const String& colorString, HTMLCanvasElement* canvas)
</del><ins>+bool parseColorOrCurrentColor(RGBA32& parsedColor, const String& colorString, HTMLCanvasElement* canvas)
</ins><span class="cx"> {
</span><del>- if (isCurrentColorString(colorString))
- return currentColor(canvas);
-
- return parseColor(colorString, canvas ? &canvas->document() : nullptr);
</del><ins>+ ColorParseResult parseResult = parseColor(parsedColor, colorString, canvas ? &canvas->document() : 0);
+ switch (parseResult) {
+ case ParsedRGBA:
+ case ParsedSystemColor:
+ return true;
+ case ParsedCurrentColor:
+ parsedColor = currentColor(canvas);
+ return true;
+ case ParseFailed:
+ return false;
+ default:
+ ASSERT_NOT_REACHED();
+ return false;
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> CanvasStyle::CanvasStyle(Color color)
</span><span class="lines">@@ -125,28 +133,39 @@
</span><span class="cx"> delete m_cmyka;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-CanvasStyle CanvasStyle::createFromString(const String& colorString, Document* document)
</del><ins>+CanvasStyle CanvasStyle::createFromString(const String& color, Document* document)
</ins><span class="cx"> {
</span><del>- if (isCurrentColorString(colorString))
</del><ins>+ RGBA32 rgba;
+ ColorParseResult parseResult = parseColor(rgba, color, document);
+ switch (parseResult) {
+ case ParsedRGBA:
+ case ParsedSystemColor:
+ return CanvasStyle(rgba);
+ case ParsedCurrentColor:
</ins><span class="cx"> return CanvasStyle(ConstructCurrentColor);
</span><del>-
- Color color = parseColor(colorString, document);
- if (color.isValid())
- return CanvasStyle(color);
-
- return CanvasStyle();
</del><ins>+ case ParseFailed:
+ return CanvasStyle();
+ default:
+ ASSERT_NOT_REACHED();
+ return CanvasStyle();
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-CanvasStyle CanvasStyle::createFromStringWithOverrideAlpha(const String& colorString, float alpha)
</del><ins>+CanvasStyle CanvasStyle::createFromStringWithOverrideAlpha(const String& color, float alpha)
</ins><span class="cx"> {
</span><del>- if (isCurrentColorString(colorString))
</del><ins>+ RGBA32 rgba;
+ ColorParseResult parseResult = parseColor(rgba, color);
+ switch (parseResult) {
+ case ParsedRGBA:
+ return CanvasStyle(colorWithOverrideAlpha(rgba, alpha));
+ case ParsedCurrentColor:
</ins><span class="cx"> return CanvasStyle(CurrentColorWithOverrideAlpha, alpha);
</span><del>-
- Color color = parseColor(colorString);
- if (color.isValid())
- return CanvasStyle(colorWithOverrideAlpha(color.rgb(), alpha));
-
- return CanvasStyle();
</del><ins>+ case ParseFailed:
+ return CanvasStyle();
+ default:
+ ASSERT_NOT_REACHED();
+ return CanvasStyle();
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool CanvasStyle::isEquivalentColor(const CanvasStyle& other) const
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasCanvasStyleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/CanvasStyle.h (207341 => 207342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/CanvasStyle.h        2016-10-14 15:58:16 UTC (rev 207341)
+++ trunk/Source/WebCore/html/canvas/CanvasStyle.h        2016-10-14 16:17:47 UTC (rev 207342)
</span><span class="lines">@@ -113,8 +113,8 @@
</span><span class="cx"> Type m_type;
</span><span class="cx"> };
</span><span class="cx">
</span><del>- Color currentColor(HTMLCanvasElement*);
- Color parseColorOrCurrentColor(const String& colorString, HTMLCanvasElement*);
</del><ins>+ RGBA32 currentColor(HTMLCanvasElement*);
+ bool parseColorOrCurrentColor(RGBA32& parsedColor, const String& colorString, HTMLCanvasElement*);
</ins><span class="cx">
</span><span class="cx"> inline CanvasStyle::CanvasStyle()
</span><span class="cx"> : m_type(Invalid)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsColorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/Color.h (207341 => 207342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/Color.h        2016-10-14 15:58:16 UTC (rev 207341)
+++ trunk/Source/WebCore/platform/graphics/Color.h        2016-10-14 16:17:47 UTC (rev 207342)
</span><span class="lines">@@ -141,23 +141,6 @@
</span><span class="cx"> WEBCORE_EXPORT explicit Color(const String&);
</span><span class="cx"> explicit Color(const char*);
</span><span class="cx">
</span><del>- explicit Color(WTF::HashTableDeletedValueType)
- {
- m_colorData.rgbaAndFlags = 0xfffffffffffffffd;
- ASSERT(!isExtended());
- }
-
- bool isHashTableDeletedValue() const
- {
- return m_colorData.rgbaAndFlags == 0xfffffffffffffffd;
- }
-
- explicit Color(WTF::HashTableEmptyValueType)
- {
- m_colorData.rgbaAndFlags = 0xffffffffffffffb;
- ASSERT(!isExtended());
- }
-
</del><span class="cx"> // FIXME: Add constructor for ExtendedColor type.
</span><span class="cx">
</span><span class="cx"> Color(RGBA, ColorSpace);
</span><span class="lines">@@ -201,7 +184,6 @@
</span><span class="cx"> RGBA32 rgb() const { ASSERT(!isExtended()); return static_cast<RGBA32>(m_colorData.rgbaAndFlags >> 32); }
</span><span class="cx"> void setRGB(int r, int g, int b) { setRGB(makeRGB(r, g, b)); }
</span><span class="cx"> void setRGB(RGBA32);
</span><del>- uint64_t asUint64() const { return m_colorData.rgbaAndFlags; }
</del><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT void getRGBA(float& r, float& g, float& b, float& a) const;
</span><span class="cx"> WEBCORE_EXPORT void getRGBA(double& r, double& g, double& b, double& a) const;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsColorHashh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/graphics/ColorHash.h (207341 => 207342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ColorHash.h        2016-10-14 15:58:16 UTC (rev 207341)
+++ trunk/Source/WebCore/platform/graphics/ColorHash.h        2016-10-14 16:17:47 UTC (rev 207342)
</span><span class="lines">@@ -1,51 +0,0 @@
</span><del>-/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "Color.h"
-#include <wtf/HashTraits.h>
-
-namespace WTF {
-
-struct ColorHash {
- static unsigned hash(const WebCore::Color& key) { return intHash(key.asUint64()); }
- static bool equal(const WebCore::Color& a, const WebCore::Color& b) { return a == b; }
- static const bool safeToCompareToEmptyOrDeleted = true;
-};
-
-template<> struct DefaultHash<WebCore::Color> {
- typedef ColorHash Hash;
-};
-
-template<> struct HashTraits<WebCore::Color> : GenericHashTraits<WebCore::Color> {
- static const bool emptyValueIsZero = false;
- static WebCore::Color emptyValue() { return WebCore::Color(HashTableEmptyValue); }
-
- static void constructDeletedValue(WebCore::Color& slot) { new (NotNull, &slot) WebCore::Color(HashTableDeletedValue); }
- static bool isDeletedValue(const WebCore::Color& value) { return value.isHashTableDeletedValue(); }
-};
-
-} // namespace WTF
</del></span></pre></div>
<a id="trunkSourceWebCoresvgSVGColorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGColor.cpp (207341 => 207342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGColor.cpp        2016-10-14 15:58:16 UTC (rev 207341)
+++ trunk/Source/WebCore/svg/SVGColor.cpp        2016-10-14 16:17:47 UTC (rev 207342)
</span><span class="lines">@@ -51,7 +51,10 @@
</span><span class="cx"> // FIXME: Rework CSS parser so it exactly matches what the SVG specification requires?
</span><span class="cx"> // FIXME: Move this out of the SVGColor class?
</span><span class="cx"> // FIXME: Is it really OK to do stripWhitespace here instead of stripLeadingAndTrailingHTMLSpaces?
</span><del>- return CSSParser::parseColor(colorString.stripWhiteSpace());
</del><ins>+ RGBA32 color;
+ if (CSSParser::parseColor(color, colorString.stripWhiteSpace()))
+ return color;
+ return Color();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void SVGColor::setRGBColor(const String&, ExceptionCode& ec)
</span></span></pre>
</div>
</div>
</body>
</html>