<!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>[207265] trunk</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/207265">207265</a></dd>
<dt>Author</dt> <dd>dino@apple.com</dd>
<dt>Date</dt> <dd>2016-10-12 18:14:15 -0700 (Wed, 12 Oct 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add preliminary support for extended colors to WebCore::Color
https://bugs.webkit.org/show_bug.cgi?id=162878
<rdar://problem/28596413>
Reviewed by Darin Adler.
Source/WebCore:
Add an ExtendedColor class that will hold the data necessary
for wider-than-sRGB (and more precise) colors. In order to
avoid increasing the size of Color, implement a tagged
pointer that is either referencing an ExtendedColor, or
is a 64-bit number with the top 32-bits being the RGBA, and
the bottom 2 bits indicating an invalid RGBA or a valid RGBA,
plus the tag.
Add copy constructors and operator= so that the new Color objects
are correctly copied.
There isn't yet a way to create an ExtendedColor. That's coming
in a followup patch (and will require changes to the CSS parser).
Covered by existing tests, and new API tests in Color.
* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj: Add new files.
* platform/graphics/Color.cpp: Update everything to use m_rgbaAndFlags
instead of m_color + m_valid.
(WebCore::Color::Color):
(WebCore::Color::~Color):
(WebCore::Color::operator=):
(WebCore::Color::nameForRenderTreeAsText):
(WebCore::Color::setNamedColor):
(WebCore::Color::light):
(WebCore::Color::dark):
(WebCore::Color::setValid):
(WebCore::Color::setExtended):
(WebCore::Color::isExtended):
(WebCore::Color::asExtended):
* platform/graphics/Color.h: Implement the tagged union.
(WebCore::Color::Color):
(WebCore::Color::isValid):
(WebCore::Color::red):
(WebCore::Color::green):
(WebCore::Color::blue):
(WebCore::Color::alpha):
(WebCore::Color::rgb):
(WebCore::Color::setRGB):
(WebCore::operator==):
* platform/graphics/ExtendedColor.cpp: New file. Holds floating point
red, green, blue and alpha, plus a color space.
(WebCore::ExtendedColor::create):
(WebCore::ExtendedColor::~ExtendedColor):
(WebCore::ExtendedColor::ref):
(WebCore::ExtendedColor::deref):
* platform/graphics/ExtendedColor.h:
(WebCore::ExtendedColor::red):
(WebCore::ExtendedColor::green):
(WebCore::ExtendedColor::blue):
(WebCore::ExtendedColor::alpha):
(WebCore::ExtendedColor::colorSpace):
(WebCore::ExtendedColor::ExtendedColor):
* platform/graphics/cg/ColorCG.cpp: Update the constructors for
the platform specific color classes.
(WebCore::Color::Color):
* platform/graphics/gtk/ColorGtk.cpp:
(WebCore::Color::Color):
* platform/graphics/win/ColorDirect2D.cpp:
(WebCore::Color::Color):
* rendering/RenderEmbeddedObject.cpp: Use NeverDestroyed.
(WebCore::replacementTextRoundedRectPressedColor):
(WebCore::replacementTextRoundedRectColor):
(WebCore::replacementTextColor):
(WebCore::unavailablePluginBorderColor):
* rendering/RenderFrameSet.cpp: Ditto.
(WebCore::borderStartEdgeColor):
(WebCore::borderEndEdgeColor):
(WebCore::borderFillColor):
* rendering/RenderTableCell.cpp: This grows in size slightly
because it can no longer pack bits.
Tools:
A new API test for Colors.
* TestWebKitAPI/Tests/WebCore/Color.cpp:
(TestWebKitAPI::TEST):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<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="#trunkSourceWebCoreplatformgraphicsColorcpp">trunk/Source/WebCore/platform/graphics/Color.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsColorh">trunk/Source/WebCore/platform/graphics/Color.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscaGraphicsLayerCAcpp">trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscgColorCGcpp">trunk/Source/WebCore/platform/graphics/cg/ColorCG.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgtkColorGtkcpp">trunk/Source/WebCore/platform/graphics/gtk/ColorGtk.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicswinColorDirect2Dcpp">trunk/Source/WebCore/platform/graphics/win/ColorDirect2D.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderEmbeddedObjectcpp">trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderFrameSetcpp">trunk/Source/WebCore/rendering/RenderFrameSet.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTableCellcpp">trunk/Source/WebCore/rendering/RenderTableCell.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderThemeIOSmm">trunk/Source/WebCore/rendering/RenderThemeIOS.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebIndicateLayermm">trunk/Source/WebKit/mac/WebView/WebIndicateLayer.mm</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebCoreColorcpp">trunk/Tools/TestWebKitAPI/Tests/WebCore/Color.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformgraphicsExtendedColorcpp">trunk/Source/WebCore/platform/graphics/ExtendedColor.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsExtendedColorh">trunk/Source/WebCore/platform/graphics/ExtendedColor.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (207264 => 207265)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2016-10-13 00:07:28 UTC (rev 207264)
+++ trunk/Source/WebCore/CMakeLists.txt        2016-10-13 01:14:15 UTC (rev 207265)
</span><span class="lines">@@ -2203,6 +2203,7 @@
</span><span class="cx"> platform/graphics/Color.cpp
</span><span class="cx"> platform/graphics/CrossfadeGeneratedImage.cpp
</span><span class="cx"> platform/graphics/DisplayRefreshMonitorClient.cpp
</span><ins>+ platform/graphics/ExtendedColor.cpp
</ins><span class="cx"> platform/graphics/FloatPoint.cpp
</span><span class="cx"> platform/graphics/FloatPoint3D.cpp
</span><span class="cx"> platform/graphics/FloatPolygon.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (207264 => 207265)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-10-13 00:07:28 UTC (rev 207264)
+++ trunk/Source/WebCore/ChangeLog        2016-10-13 01:14:15 UTC (rev 207265)
</span><span class="lines">@@ -1,3 +1,90 @@
</span><ins>+2016-10-11 Dean Jackson <dino@apple.com>
+
+ Add preliminary support for extended colors to WebCore::Color
+ https://bugs.webkit.org/show_bug.cgi?id=162878
+ <rdar://problem/28596413>
+
+ Reviewed by Darin Adler.
+
+ Add an ExtendedColor class that will hold the data necessary
+ for wider-than-sRGB (and more precise) colors. In order to
+ avoid increasing the size of Color, implement a tagged
+ pointer that is either referencing an ExtendedColor, or
+ is a 64-bit number with the top 32-bits being the RGBA, and
+ the bottom 2 bits indicating an invalid RGBA or a valid RGBA,
+ plus the tag.
+
+ Add copy constructors and operator= so that the new Color objects
+ are correctly copied.
+
+ There isn't yet a way to create an ExtendedColor. That's coming
+ in a followup patch (and will require changes to the CSS parser).
+
+ Covered by existing tests, and new API tests in Color.
+
+ * CMakeLists.txt:
+ * WebCore.xcodeproj/project.pbxproj: Add new files.
+
+ * platform/graphics/Color.cpp: Update everything to use m_rgbaAndFlags
+ instead of m_color + m_valid.
+ (WebCore::Color::Color):
+ (WebCore::Color::~Color):
+ (WebCore::Color::operator=):
+ (WebCore::Color::nameForRenderTreeAsText):
+ (WebCore::Color::setNamedColor):
+ (WebCore::Color::light):
+ (WebCore::Color::dark):
+ (WebCore::Color::setValid):
+ (WebCore::Color::setExtended):
+ (WebCore::Color::isExtended):
+ (WebCore::Color::asExtended):
+ * platform/graphics/Color.h: Implement the tagged union.
+ (WebCore::Color::Color):
+ (WebCore::Color::isValid):
+ (WebCore::Color::red):
+ (WebCore::Color::green):
+ (WebCore::Color::blue):
+ (WebCore::Color::alpha):
+ (WebCore::Color::rgb):
+ (WebCore::Color::setRGB):
+ (WebCore::operator==):
+
+ * platform/graphics/ExtendedColor.cpp: New file. Holds floating point
+ red, green, blue and alpha, plus a color space.
+ (WebCore::ExtendedColor::create):
+ (WebCore::ExtendedColor::~ExtendedColor):
+ (WebCore::ExtendedColor::ref):
+ (WebCore::ExtendedColor::deref):
+ * platform/graphics/ExtendedColor.h:
+ (WebCore::ExtendedColor::red):
+ (WebCore::ExtendedColor::green):
+ (WebCore::ExtendedColor::blue):
+ (WebCore::ExtendedColor::alpha):
+ (WebCore::ExtendedColor::colorSpace):
+ (WebCore::ExtendedColor::ExtendedColor):
+
+ * platform/graphics/cg/ColorCG.cpp: Update the constructors for
+ the platform specific color classes.
+ (WebCore::Color::Color):
+ * platform/graphics/gtk/ColorGtk.cpp:
+ (WebCore::Color::Color):
+ * platform/graphics/win/ColorDirect2D.cpp:
+ (WebCore::Color::Color):
+
+ * rendering/RenderEmbeddedObject.cpp: Use NeverDestroyed.
+ (WebCore::replacementTextRoundedRectPressedColor):
+ (WebCore::replacementTextRoundedRectColor):
+ (WebCore::replacementTextColor):
+ (WebCore::unavailablePluginBorderColor):
+
+ * rendering/RenderFrameSet.cpp: Ditto.
+ (WebCore::borderStartEdgeColor):
+ (WebCore::borderEndEdgeColor):
+ (WebCore::borderFillColor):
+
+ * rendering/RenderTableCell.cpp: This grows in size slightly
+ because it can no longer pack bits.
+
</ins><span class="cx"> 2016-10-12 Antoine Quint <graouts@apple.com>
</span><span class="cx">
</span><span class="cx"> [Modern Media Controls] Sliders: scrubber and volume
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (207264 => 207265)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-10-13 00:07:28 UTC (rev 207264)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-10-13 01:14:15 UTC (rev 207265)
</span><span class="lines">@@ -1381,6 +1381,8 @@
</span><span class="cx">                 31C422461D74EB9A00F12342 /* JSPerformanceTimingCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31C422451D74EB9A00F12342 /* JSPerformanceTimingCustom.cpp */; };
</span><span class="cx">                 31D591B316697A6C00E6BF02 /* PlugInClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 31D591B116697A6C00E6BF02 /* PlugInClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 31DCD29D1AB4FBDE0072E817 /* AnimationTrigger.h in Headers */ = {isa = PBXBuildFile; fileRef = 31DCD29C1AB4FBDE0072E817 /* AnimationTrigger.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                31DCDF431DA1C45400EA5B93 /* ExtendedColor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31DCDF411DA1C45400EA5B93 /* ExtendedColor.cpp */; };
+                31DCDF441DA1C45400EA5B93 /* ExtendedColor.h in Headers */ = {isa = PBXBuildFile; fileRef = 31DCDF421DA1C45400EA5B93 /* ExtendedColor.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 31DEA4551B39F4D900F77178 /* WebSystemBackdropLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 31DEA4531B39F4D900F77178 /* WebSystemBackdropLayer.mm */; };
</span><span class="cx">                 31DEA4561B39F4D900F77178 /* WebSystemBackdropLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 31DEA4541B39F4D900F77178 /* WebSystemBackdropLayer.h */; };
</span><span class="cx">                 31DF63571AF187DD0078FD91 /* NSColorSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 31DF63561AF187DD0078FD91 /* NSColorSPI.h */; };
</span><span class="lines">@@ -8349,6 +8351,8 @@
</span><span class="cx">                 31C422451D74EB9A00F12342 /* JSPerformanceTimingCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPerformanceTimingCustom.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 31D591B116697A6C00E6BF02 /* PlugInClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlugInClient.h; sourceTree = "<group>"; };
</span><span class="cx">                 31DCD29C1AB4FBDE0072E817 /* AnimationTrigger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnimationTrigger.h; sourceTree = "<group>"; };
</span><ins>+                31DCDF411DA1C45400EA5B93 /* ExtendedColor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExtendedColor.cpp; sourceTree = "<group>"; };
+                31DCDF421DA1C45400EA5B93 /* ExtendedColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExtendedColor.h; sourceTree = "<group>"; };
</ins><span class="cx">                 31DEA4531B39F4D900F77178 /* WebSystemBackdropLayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebSystemBackdropLayer.mm; sourceTree = "<group>"; };
</span><span class="cx">                 31DEA4541B39F4D900F77178 /* WebSystemBackdropLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSystemBackdropLayer.h; sourceTree = "<group>"; };
</span><span class="cx">                 31DF63561AF187DD0078FD91 /* NSColorSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSColorSPI.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -20733,6 +20737,8 @@
</span><span class="cx">                                 CDDE02E918B3DFC700CF7FF1 /* CDMSession.h */,
</span><span class="cx">                                 B27535380B053814002CE64F /* Color.cpp */,
</span><span class="cx">                                 B27535390B053814002CE64F /* Color.h */,
</span><ins>+                                31DCDF411DA1C45400EA5B93 /* ExtendedColor.cpp */,
+                                31DCDF421DA1C45400EA5B93 /* ExtendedColor.h */,
</ins><span class="cx">                                 9382DF5710A8D5C900925652 /* ColorSpace.h */,
</span><span class="cx">                                 2D2FC0541460CD6F00263633 /* CrossfadeGeneratedImage.cpp */,
</span><span class="cx">                                 2D2FC0551460CD6F00263633 /* CrossfadeGeneratedImage.h */,
</span><span class="lines">@@ -24928,6 +24934,7 @@
</span><span class="cx">                                 510192D618B6B9B7007FC7A1 /* ImageControlsRootElement.h in Headers */,
</span><span class="cx">                                 510192D218B6B9AB007FC7A1 /* ImageControlsRootElementMac.h in Headers */,
</span><span class="cx">                                 A779791A0D6B9D0C003851B9 /* ImageData.h in Headers */,
</span><ins>+                                31DCDF441DA1C45400EA5B93 /* ExtendedColor.h in Headers */,
</ins><span class="cx">                                 555B87ED1CAAF0AB00349425 /* ImageDecoderCG.h in Headers */,
</span><span class="cx">                                 97205AB61239291000B17380 /* ImageDocument.h in Headers */,
</span><span class="cx">                                 F55B3DC21251F12D003EF269 /* ImageInputType.h in Headers */,
</span><span class="lines">@@ -30376,6 +30383,7 @@
</span><span class="cx">                                 B2227AEF0D00BF220071B782 /* SVGViewElement.cpp in Sources */,
</span><span class="cx">                                 B2227AF20D00BF220071B782 /* SVGViewSpec.cpp in Sources */,
</span><span class="cx">                                 8485228A1190173C006EDC7F /* SVGVKernElement.cpp in Sources */,
</span><ins>+                                31DCDF431DA1C45400EA5B93 /* ExtendedColor.cpp in Sources */,
</ins><span class="cx">                                 B2227AF50D00BF220071B782 /* SVGZoomAndPan.cpp in Sources */,
</span><span class="cx">                                 B2E4EC970D00C22B00432643 /* SVGZoomEvent.cpp in Sources */,
</span><span class="cx">                                 E180811216FCF42F00B80D07 /* SynchronousLoaderClient.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsColorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/Color.cpp (207264 => 207265)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/Color.cpp        2016-10-13 00:07:28 UTC (rev 207264)
+++ trunk/Source/WebCore/platform/graphics/Color.cpp        2016-10-13 01:14:15 UTC (rev 207265)
</span><span class="lines">@@ -225,10 +225,16 @@
</span><span class="cx"> Color::Color(const String& name)
</span><span class="cx"> {
</span><span class="cx"> if (name[0] == '#') {
</span><ins>+ RGBA32 color;
+ bool valid;
+
</ins><span class="cx"> if (name.is8Bit())
</span><del>- m_valid = parseHexColor(name.characters8() + 1, name.length() - 1, m_color);
</del><ins>+ valid = parseHexColor(name.characters8() + 1, name.length() - 1, color);
</ins><span class="cx"> else
</span><del>- m_valid = parseHexColor(name.characters16() + 1, name.length() - 1, m_color);
</del><ins>+ valid = parseHexColor(name.characters16() + 1, name.length() - 1, color);
+
+ if (valid)
+ setRGB(color);
</ins><span class="cx"> } else
</span><span class="cx"> setNamedColor(name);
</span><span class="cx"> }
</span><span class="lines">@@ -235,15 +241,64 @@
</span><span class="cx">
</span><span class="cx"> Color::Color(const char* name)
</span><span class="cx"> {
</span><ins>+ RGBA32 color;
+ bool valid;
</ins><span class="cx"> if (name[0] == '#')
</span><del>- m_valid = parseHexColor((String)&name[1], m_color);
</del><ins>+ valid = parseHexColor((String)&name[1], color);
</ins><span class="cx"> else {
</span><span class="cx"> const NamedColor* foundColor = findColor(name, strlen(name));
</span><del>- m_color = foundColor ? foundColor->ARGBValue : 0;
- m_valid = foundColor;
</del><ins>+ color = foundColor ? foundColor->ARGBValue : 0;
+ valid = foundColor;
</ins><span class="cx"> }
</span><ins>+
+ if (valid)
+ setRGB(color);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+Color::Color(const Color& other)
+ : m_colorData(other.m_colorData)
+{
+ if (isExtended())
+ m_colorData.extendedColor->ref();
+}
+
+Color::Color(Color&& other)
+{
+ *this = WTFMove(other);
+}
+
+Color::~Color()
+{
+ if (isExtended())
+ m_colorData.extendedColor->deref();
+}
+
+Color& Color::operator=(const Color& other)
+{
+ if (*this == other)
+ return *this;
+
+ if (isExtended())
+ m_colorData.extendedColor->deref();
+
+ m_colorData = other.m_colorData;
+
+ if (isExtended())
+ m_colorData.extendedColor->ref();
+ return *this;
+}
+
+Color& Color::operator=(Color&& other)
+{
+ if (*this == other)
+ return *this;
+
+ m_colorData = other.m_colorData;
+ other.m_colorData.rgbaAndFlags = invalidRGBAColor;
+
+ return *this;
+}
+
</ins><span class="cx"> String Color::serialized() const
</span><span class="cx"> {
</span><span class="cx"> if (!hasAlpha()) {
</span><span class="lines">@@ -291,6 +346,7 @@
</span><span class="cx">
</span><span class="cx"> String Color::nameForRenderTreeAsText() const
</span><span class="cx"> {
</span><ins>+ // FIXME: Handle ExtendedColors.
</ins><span class="cx"> if (alpha() < 0xFF)
</span><span class="cx"> return String::format("#%02X%02X%02X%02X", red(), green(), blue(), alpha());
</span><span class="cx"> return String::format("#%02X%02X%02X", red(), green(), blue());
</span><span class="lines">@@ -315,14 +371,16 @@
</span><span class="cx"> void Color::setNamedColor(const String& name)
</span><span class="cx"> {
</span><span class="cx"> const NamedColor* foundColor = findNamedColor(name);
</span><del>- m_color = foundColor ? foundColor->ARGBValue : 0;
- m_valid = foundColor;
</del><ins>+ if (foundColor)
+ setRGB(foundColor->ARGBValue);
+ else
+ m_colorData.rgbaAndFlags = invalidRGBAColor;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Color Color::light() const
</span><span class="cx"> {
</span><span class="cx"> // Hardcode this common case for speed.
</span><del>- if (m_color == black)
</del><ins>+ if (rgb() == black)
</ins><span class="cx"> return lightenedBlack;
</span><span class="cx">
</span><span class="cx"> const float scaleFactor = nextafterf(256.0f, 0.0f);
</span><span class="lines">@@ -347,7 +405,7 @@
</span><span class="cx"> Color Color::dark() const
</span><span class="cx"> {
</span><span class="cx"> // Hardcode this common case for speed.
</span><del>- if (m_color == white)
</del><ins>+ if (rgb() == white)
</ins><span class="cx"> return darkenedWhite;
</span><span class="cx">
</span><span class="cx"> const float scaleFactor = nextafterf(256.0f, 0.0f);
</span><span class="lines">@@ -561,4 +619,30 @@
</span><span class="cx"> return ts << color.nameForRenderTreeAsText();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void Color::tagAsValid()
+{
+ m_colorData.rgbaAndFlags |= validRGBAColor;
+}
+
+void Color::tagAsExtended()
+{
+ // FIXME: Is this method necessary? Will colors ever change from RGBA32 to Extended?
+ // Valid colors should not change type.
+ ASSERT(!isValid());
+ m_colorData.rgbaAndFlags &= ~(invalidRGBAColor);
+}
+
+bool Color::isExtended() const
+{
+ return !(m_colorData.rgbaAndFlags & invalidRGBAColor);
+}
+
+ExtendedColor* Color::asExtended() const
+{
+ ASSERT(isExtended());
+ if (!isExtended())
+ return nullptr;
+ return m_colorData.extendedColor;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsColorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/Color.h (207264 => 207265)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/Color.h        2016-10-13 00:07:28 UTC (rev 207264)
+++ trunk/Source/WebCore/platform/graphics/Color.h        2016-10-13 01:14:15 UTC (rev 207265)
</span><span class="lines">@@ -23,10 +23,10 @@
</span><span class="cx"> * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef Color_h
-#define Color_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><span class="cx"> #include "ColorSpace.h"
</span><ins>+#include "ExtendedColor.h"
</ins><span class="cx"> #include "PlatformExportMacros.h"
</span><span class="cx"> #include <algorithm>
</span><span class="cx"> #include <cmath>
</span><span class="lines">@@ -107,19 +107,48 @@
</span><span class="cx"> class Color {
</span><span class="cx"> WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>- Color() : m_color(0), m_valid(false) { }
- Color(RGBA, ColorSpace);
</del><ins>+ Color() { }
</ins><span class="cx">
</span><span class="cx"> // FIXME: Remove all these constructors and creation functions and replace the ones that are still needed with free functions.
</span><del>- Color(RGBA32 color, bool valid = true) : m_color(color), m_valid(valid) { ASSERT(!m_color || m_valid); }
- Color(int r, int g, int b) : m_color(makeRGB(r, g, b)), m_valid(true) { }
- Color(int r, int g, int b, int a) : m_color(makeRGBA(r, g, b, a)), m_valid(true) { }
- // Color is currently limited to 32bit RGBA, perhaps some day we'll support better colors
- Color(float r, float g, float b, float a) : m_color(makeRGBA32FromFloats(r, g, b, a)), m_valid(true) { }
</del><ins>+
+ Color(RGBA32 color, bool valid = true)
+ {
+ if (valid)
+ setRGB(color);
+ }
+
+ Color(int r, int g, int b)
+ {
+ setRGB(r, g, b);
+ }
+
+ Color(int r, int g, int b, int a)
+ {
+ setRGB(makeRGBA(r, g, b, a));
+ }
+
+ Color(float r, float g, float b, float a)
+ {
+ setRGB(makeRGBA32FromFloats(r, g, b, a));
+ }
+
</ins><span class="cx"> // Creates a new color from the specific CMYK and alpha values.
</span><del>- Color(float c, float m, float y, float k, float a) : m_color(makeRGBAFromCMYKA(c, m, y, k, a)), m_valid(true) { }
</del><ins>+ Color(float c, float m, float y, float k, float a)
+ {
+ setRGB(makeRGBAFromCMYKA(c, m, y, k, a));
+ }
+
</ins><span class="cx"> WEBCORE_EXPORT explicit Color(const String&);
</span><span class="cx"> explicit Color(const char*);
</span><ins>+
+ // FIXME: Add constructor for ExtendedColor type.
+
+ Color(RGBA, ColorSpace);
+ WEBCORE_EXPORT Color(const Color&);
+ WEBCORE_EXPORT Color(Color&&);
+
+ WEBCORE_EXPORT ~Color();
+
</ins><span class="cx"> static Color createUnchecked(int r, int g, int b)
</span><span class="cx"> {
</span><span class="cx"> RGBA32 color = 0xFF000000 | r << 16 | g << 8 | b;
</span><span class="lines">@@ -143,19 +172,19 @@
</span><span class="cx">
</span><span class="cx"> void setNamedColor(const String&);
</span><span class="cx">
</span><del>- // FIXME: Remove this after moving clients to all use OptionalColor instead.
- bool isValid() const { return m_valid; }
</del><ins>+ bool isValid() const { return m_colorData.rgbaAndFlags & validRGBAColorBit; }
</ins><span class="cx">
</span><span class="cx"> bool hasAlpha() const { return alpha() < 255; }
</span><span class="cx">
</span><del>- int red() const { return redChannel(m_color); }
- int green() const { return greenChannel(m_color); }
- int blue() const { return blueChannel(m_color); }
- int alpha() const { return alphaChannel(m_color); }
</del><ins>+ int red() const { return redChannel(rgb()); }
+ int green() const { return greenChannel(rgb()); }
+ int blue() const { return blueChannel(rgb()); }
+ int alpha() const { return alphaChannel(rgb()); }
</ins><span class="cx">
</span><del>- RGBA32 rgb() const { return m_color; } // Preserve the alpha.
- void setRGB(int r, int g, int b) { m_color = makeRGB(r, g, b); m_valid = true; }
- void setRGB(RGBA32 rgb) { m_color = rgb; m_valid = true; }
</del><ins>+ RGBA32 rgb() const { ASSERT(!isExtended()); return static_cast<RGBA32>(m_colorData.rgbaAndFlags >> 32); }
+ void setRGB(int r, int g, int b) { setRGB(makeRGB(r, g, b)); }
+ void setRGB(RGBA32);
+
</ins><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 class="cx"> WEBCORE_EXPORT void getHSL(double& h, double& s, double& l) const;
</span><span class="lines">@@ -208,9 +237,31 @@
</span><span class="cx"> static const RGBA32 compositionFill = 0xFFE1DD55;
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+ WEBCORE_EXPORT bool isExtended() const;
+ WEBCORE_EXPORT ExtendedColor* asExtended() const;
+
+ WEBCORE_EXPORT Color& operator=(const Color&);
+ WEBCORE_EXPORT Color& operator=(Color&&);
+
+ friend bool operator==(const Color& a, const Color& b);
+
</ins><span class="cx"> private:
</span><del>- RGBA32 m_color;
- bool m_valid;
</del><ins>+
+ // 0x_______00 is an ExtendedColor pointer.
+ // 0x_______01 is an invalid RGBA32.
+ // 0x_______11 is a valid RGBA32.
+ static const uint64_t extendedColor = 0x0;
+ static const uint64_t invalidRGBAColor = 0x1;
+ static const uint64_t validRGBAColorBit = 0x2;
+ static const uint64_t validRGBAColor = 0x3;
+
+ WEBCORE_EXPORT void tagAsValid();
+ void tagAsExtended();
+
+ union {
+ uint64_t rgbaAndFlags { invalidRGBAColor };
+ ExtendedColor* extendedColor;
+ } m_colorData;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> bool operator==(const Color&, const Color&);
</span><span class="lines">@@ -270,15 +321,14 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> inline Color::Color(RGBA color, ColorSpace space)
</span><del>- : m_color(color.m_integer)
- , m_valid(true)
</del><span class="cx"> {
</span><ins>+ setRGB(color.m_integer);
</ins><span class="cx"> ASSERT_UNUSED(space, space == ColorSpaceSRGB);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> inline bool operator==(const Color& a, const Color& b)
</span><span class="cx"> {
</span><del>- return a.rgb() == b.rgb() && a.isValid() == b.isValid();
</del><ins>+ return a.m_colorData.rgbaAndFlags == b.m_colorData.rgbaAndFlags;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> inline bool operator!=(const Color& a, const Color& b)
</span><span class="lines">@@ -315,8 +365,12 @@
</span><span class="cx"> return overrideAlpha ? colorWithOverrideAlpha(color, overrideAlpha.value()) : color;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+inline void Color::setRGB(RGBA32 rgb)
+{
+ m_colorData.rgbaAndFlags = static_cast<uint64_t>(rgb) << 32;
+ tagAsValid();
+}
+
</ins><span class="cx"> WEBCORE_EXPORT TextStream& operator<<(TextStream&, const Color&);
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // Color_h
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsExtendedColorcppfromrev207263trunkSourceWebCoreplatformgraphicswinColorDirect2Dcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/graphics/ExtendedColor.cpp (from rev 207263, trunk/Source/WebCore/platform/graphics/win/ColorDirect2D.cpp) (0 => 207265)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ExtendedColor.cpp         (rev 0)
+++ trunk/Source/WebCore/platform/graphics/ExtendedColor.cpp        2016-10-13 01:14:15 UTC (rev 207265)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+/*
+ * 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 INC. ``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 INC. OR
+ * 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.
+ */
+
+#include "config.h"
+#include "ExtendedColor.h"
+
+#include "ColorSpace.h"
+
+namespace WebCore {
+
+Ref<ExtendedColor> ExtendedColor::create(float r, float g, float b, float a, ColorSpace colorSpace)
+{
+ return adoptRef(*new ExtendedColor(r, g, b, a, colorSpace));
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsExtendedColorhfromrev207263trunkSourceWebCoreplatformgraphicswinColorDirect2Dcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/graphics/ExtendedColor.h (from rev 207263, trunk/Source/WebCore/platform/graphics/win/ColorDirect2D.cpp) (0 => 207265)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ExtendedColor.h         (rev 0)
+++ trunk/Source/WebCore/platform/graphics/ExtendedColor.h        2016-10-13 01:14:15 UTC (rev 207265)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+/*
+ * 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 INC. ``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 INC. OR
+ * 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 "ColorSpace.h"
+
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class ExtendedColor : public RefCounted<ExtendedColor> {
+public:
+ static Ref<ExtendedColor> create(float r, float g, float b, float a, ColorSpace = ColorSpace::ColorSpaceSRGB);
+
+ float red() const { return m_red; }
+ float green() const { return m_green; }
+ float blue() const { return m_blue; }
+ float alpha() const { return m_alpha; }
+
+ ColorSpace colorSpace() const { return m_colorSpace; }
+
+private:
+ ExtendedColor(float r, float g, float b, float a, ColorSpace colorSpace)
+ : m_red(r)
+ , m_green(g)
+ , m_blue(b)
+ , m_alpha(a)
+ , m_colorSpace(colorSpace)
+ { }
+
+ float m_red { 0 };
+ float m_green { 0 };
+ float m_blue { 0 };
+ float m_alpha { 0 };
+
+ ColorSpace m_colorSpace { ColorSpace::ColorSpaceSRGB };
+};
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscaGraphicsLayerCAcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (207264 => 207265)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp        2016-10-13 00:07:28 UTC (rev 207264)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp        2016-10-13 01:14:15 UTC (rev 207265)
</span><span class="lines">@@ -1371,8 +1371,8 @@
</span><span class="cx"> // Use having a transform as a key to making the tile wash layer. If every layer gets a wash,
</span><span class="cx"> // they start to obscure useful information.
</span><span class="cx"> if ((!m_transform.isIdentity() || m_usingTiledBacking) && !m_visibleTileWashLayer) {
</span><del>- static Color washFillColor(255, 0, 0, 50);
- static Color washBorderColor(255, 0, 0, 100);
</del><ins>+ static NeverDestroyed<Color> washFillColor(255, 0, 0, 50);
+ static NeverDestroyed<Color> washBorderColor(255, 0, 0, 100);
</ins><span class="cx">
</span><span class="cx"> m_visibleTileWashLayer = createPlatformCALayer(PlatformCALayer::LayerTypeLayer, this);
</span><span class="cx"> String name = String::format("Visible Tile Wash Layer %p", m_visibleTileWashLayer->platformLayer());
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscgColorCGcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cg/ColorCG.cpp (207264 => 207265)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cg/ColorCG.cpp        2016-10-13 00:07:28 UTC (rev 207264)
+++ trunk/Source/WebCore/platform/graphics/cg/ColorCG.cpp        2016-10-13 01:14:15 UTC (rev 207265)
</span><span class="lines">@@ -73,8 +73,7 @@
</span><span class="cx"> Color::Color(CGColorRef color)
</span><span class="cx"> {
</span><span class="cx"> if (!color) {
</span><del>- m_color = 0;
- m_valid = false;
</del><ins>+ m_colorData.rgbaAndFlags = invalidRGBAColor;
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -111,8 +110,7 @@
</span><span class="cx"> ASSERT_NOT_REACHED();
</span><span class="cx"> }
</span><span class="cx">
</span><del>- m_color = makeRGBA(r * 255, g * 255, b * 255, a * 255);
- m_valid = true;
</del><ins>+ setRGB(makeRGBA(r * 255, g * 255, b * 255, a * 255));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static CGColorRef leakCGColor(const Color& color)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgtkColorGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gtk/ColorGtk.cpp (207264 => 207265)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gtk/ColorGtk.cpp        2016-10-13 00:07:28 UTC (rev 207264)
+++ trunk/Source/WebCore/platform/graphics/gtk/ColorGtk.cpp        2016-10-13 01:14:15 UTC (rev 207265)
</span><span class="lines">@@ -26,19 +26,17 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> Color::Color(const GdkColor& c)
</span><del>- : m_color(makeRGB(c.red >> 8, c.green >> 8, c.blue >> 8))
- , m_valid(true)
</del><span class="cx"> {
</span><ins>+ setRGB(makeRGB(c.red >> 8, c.green >> 8, c.blue >> 8));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #ifndef GTK_API_VERSION_2
</span><span class="cx"> Color::Color(const GdkRGBA& c)
</span><del>- : m_color(makeRGBA(static_cast<int>(c.red * 255),
- static_cast<int>(c.green * 255),
- static_cast<int>(c.blue * 255),
- static_cast<int>(c.alpha * 255)))
- , m_valid(true)
</del><span class="cx"> {
</span><ins>+ setRGB(makeRGBA(static_cast<int>(c.red * 255),
+ static_cast<int>(c.green * 255),
+ static_cast<int>(c.blue * 255),
+ static_cast<int>(c.alpha * 255)));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Color::operator GdkRGBA() const
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicswinColorDirect2Dcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/win/ColorDirect2D.cpp (207264 => 207265)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/win/ColorDirect2D.cpp        2016-10-13 00:07:28 UTC (rev 207264)
+++ trunk/Source/WebCore/platform/graphics/win/ColorDirect2D.cpp        2016-10-13 01:14:15 UTC (rev 207265)
</span><span class="lines">@@ -35,8 +35,7 @@
</span><span class="cx">
</span><span class="cx"> Color::Color(D2D1_COLOR_F color)
</span><span class="cx"> {
</span><del>- m_color = makeRGBA(color.r * 255, color.g * 255, color.b * 255, color.a * 255);
- m_valid = true;
</del><ins>+ setRGB(makeRGBA(color.r * 255, color.g * 255, color.b * 255, color.a * 255));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Color::operator D2D1_COLOR_F() const
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderEmbeddedObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp (207264 => 207265)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp        2016-10-13 00:07:28 UTC (rev 207264)
+++ trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp        2016-10-13 01:14:15 UTC (rev 207265)
</span><span class="lines">@@ -75,25 +75,25 @@
</span><span class="cx">
</span><span class="cx"> static const Color& replacementTextRoundedRectPressedColor()
</span><span class="cx"> {
</span><del>- static const Color pressed(105, 105, 105, 242);
</del><ins>+ static NeverDestroyed<Color> pressed(105, 105, 105, 242);
</ins><span class="cx"> return pressed;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static const Color& replacementTextRoundedRectColor()
</span><span class="cx"> {
</span><del>- static const Color standard(125, 125, 125, 242);
</del><ins>+ static NeverDestroyed<Color> standard(125, 125, 125, 242);
</ins><span class="cx"> return standard;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static const Color& replacementTextColor()
</span><span class="cx"> {
</span><del>- static const Color standard(240, 240, 240, 255);
</del><ins>+ static NeverDestroyed<Color> standard(240, 240, 240, 255);
</ins><span class="cx"> return standard;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static const Color& unavailablePluginBorderColor()
</span><span class="cx"> {
</span><del>- static const Color standard(255, 255, 255, 216);
</del><ins>+ static NeverDestroyed<Color> standard(255, 255, 255, 216);
</ins><span class="cx"> return standard;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderFrameSetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderFrameSet.cpp (207264 => 207265)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderFrameSet.cpp        2016-10-13 00:07:28 UTC (rev 207264)
+++ trunk/Source/WebCore/rendering/RenderFrameSet.cpp        2016-10-13 01:14:15 UTC (rev 207265)
</span><span class="lines">@@ -69,19 +69,19 @@
</span><span class="cx">
</span><span class="cx"> static const Color& borderStartEdgeColor()
</span><span class="cx"> {
</span><del>- static const Color color(170, 170, 170);
</del><ins>+ static NeverDestroyed<Color> color(170, 170, 170);
</ins><span class="cx"> return color;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static const Color& borderEndEdgeColor()
</span><span class="cx"> {
</span><del>- static const Color color = Color::black;
</del><ins>+ static NeverDestroyed<Color> color = Color::black;
</ins><span class="cx"> return color;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static const Color& borderFillColor()
</span><span class="cx"> {
</span><del>- static const Color color(208, 208, 208);
</del><ins>+ static NeverDestroyed<Color> color(208, 208, 208);
</ins><span class="cx"> return color;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTableCellcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTableCell.cpp (207264 => 207265)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTableCell.cpp        2016-10-13 00:07:28 UTC (rev 207264)
+++ trunk/Source/WebCore/rendering/RenderTableCell.cpp        2016-10-13 01:14:15 UTC (rev 207265)
</span><span class="lines">@@ -52,7 +52,7 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> COMPILE_ASSERT(sizeof(RenderTableCell) == sizeof(SameSizeAsRenderTableCell), RenderTableCell_should_stay_small);
</span><del>-COMPILE_ASSERT(sizeof(CollapsedBorderValue) == 16, CollapsedBorderValue_should_stay_small);
</del><ins>+COMPILE_ASSERT(sizeof(CollapsedBorderValue) <= 24, CollapsedBorderValue_should_stay_small);
</ins><span class="cx">
</span><span class="cx"> RenderTableCell::RenderTableCell(Element& element, RenderStyle&& style)
</span><span class="cx"> : RenderBlockFlow(element, WTFMove(style))
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemeIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (207264 => 207265)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm        2016-10-13 00:07:28 UTC (rev 207264)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm        2016-10-13 01:14:15 UTC (rev 207265)
</span><span class="lines">@@ -325,7 +325,7 @@
</span><span class="cx">
</span><span class="cx"> const Color& RenderThemeIOS::shadowColor() const
</span><span class="cx"> {
</span><del>- static Color color(0.0f, 0.0f, 0.0f, 0.7f);
</del><ins>+ static NeverDestroyed<Color> color(0.0f, 0.0f, 0.0f, 0.7f);
</ins><span class="cx"> return color;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebIndicateLayermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebIndicateLayer.mm (207264 => 207265)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebIndicateLayer.mm        2016-10-13 00:07:28 UTC (rev 207264)
+++ trunk/Source/WebKit/mac/WebView/WebIndicateLayer.mm        2016-10-13 01:14:15 UTC (rev 207265)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #import <WebCore/ColorMac.h>
</span><span class="cx"> #import <WebCore/QuartzCoreSPI.h>
</span><span class="cx"> #import <WebCore/WAKWindow.h>
</span><ins>+#import <wtf/NeverDestroyed.h>
</ins><span class="cx">
</span><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><span class="lines">@@ -49,7 +50,7 @@
</span><span class="cx"> self.contentsScale = [[_webView window] screenScale];
</span><span class="cx">
</span><span class="cx"> // Blue highlight color.
</span><del>- static Color highlightColor(111.0f / 255.0f, 168.0f / 255.0f, 220.0f / 255.0f, 0.66f);
</del><ins>+ static NeverDestroyed<Color> highlightColor(111.0f / 255.0f, 168.0f / 255.0f, 220.0f / 255.0f, 0.66f);
</ins><span class="cx"> self.backgroundColor = cachedCGColor(highlightColor);
</span><span class="cx">
</span><span class="cx"> return self;
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (207264 => 207265)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-10-13 00:07:28 UTC (rev 207264)
+++ trunk/Tools/ChangeLog        2016-10-13 01:14:15 UTC (rev 207265)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-10-11 Dean Jackson <dino@apple.com>
+
+ Add preliminary support for extended colors to WebCore::Color
+ https://bugs.webkit.org/show_bug.cgi?id=162878
+ <rdar://problem/28596413>
+
+ Reviewed by Darin Adler.
+
+ A new API test for Colors.
+
+ * TestWebKitAPI/Tests/WebCore/Color.cpp:
+ (TestWebKitAPI::TEST):
+
</ins><span class="cx"> 2016-10-12 Ryan Haddad <ryanhaddad@apple.com>
</span><span class="cx">
</span><span class="cx"> Unreviewed, rolling out r207225.
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebCoreColorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/Color.cpp (207264 => 207265)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebCore/Color.cpp        2016-10-13 00:07:28 UTC (rev 207264)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/Color.cpp        2016-10-13 01:14:15 UTC (rev 207265)
</span><span class="lines">@@ -144,4 +144,47 @@
</span><span class="cx"> EXPECT_DOUBLE_EQ(0.75294117647058822, v);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+TEST(Color, Validity)
+{
+ Color invalidColor;
+ EXPECT_FALSE(invalidColor.isValid());
+ EXPECT_FALSE(invalidColor.isExtended());
+
+ Color otherInvalidColor = invalidColor;
+ EXPECT_FALSE(otherInvalidColor.isValid());
+ EXPECT_FALSE(otherInvalidColor.isExtended());
+
+ Color validColor(255, 0, 0);
+ EXPECT_TRUE(validColor.isValid());
+ EXPECT_FALSE(validColor.isExtended());
+
+ Color otherValidColor = validColor;
+ EXPECT_TRUE(otherValidColor.isValid());
+ EXPECT_FALSE(otherValidColor.isExtended());
+
+ validColor = Color(1, 2, 3, 4);
+ EXPECT_TRUE(validColor.isValid());
+ EXPECT_FALSE(validColor.isExtended());
+ EXPECT_EQ(validColor.red(), 1);
+ EXPECT_EQ(validColor.green(), 2);
+ EXPECT_EQ(validColor.blue(), 3);
+ EXPECT_EQ(validColor.alpha(), 4);
+
+ Color yetAnotherValidColor(WTFMove(validColor));
+ EXPECT_TRUE(yetAnotherValidColor.isValid());
+ EXPECT_FALSE(yetAnotherValidColor.isExtended());
+ EXPECT_EQ(yetAnotherValidColor.red(), 1);
+ EXPECT_EQ(yetAnotherValidColor.green(), 2);
+ EXPECT_EQ(yetAnotherValidColor.blue(), 3);
+ EXPECT_EQ(yetAnotherValidColor.alpha(), 4);
+
+ otherValidColor = WTFMove(yetAnotherValidColor);
+ EXPECT_TRUE(otherValidColor.isValid());
+ EXPECT_FALSE(otherValidColor.isExtended());
+ EXPECT_EQ(otherValidColor.red(), 1);
+ EXPECT_EQ(otherValidColor.green(), 2);
+ EXPECT_EQ(otherValidColor.blue(), 3);
+ EXPECT_EQ(otherValidColor.alpha(), 4);
+}
+
</ins><span class="cx"> } // namespace TestWebKitAPI
</span></span></pre>
</div>
</div>
</body>
</html>