<!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>[174901] 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/174901">174901</a></dd>
<dt>Author</dt> <dd>dino@apple.com</dd>
<dt>Date</dt> <dd>2014-10-20 12:37:40 -0700 (Mon, 20 Oct 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Mac] Support &quot;inverted-colors&quot; and &quot;monochrome&quot; media feature.
https://bugs.webkit.org/show_bug.cgi?id=137535
&lt;rdar://problem/18586398&gt;

Reviewed by Brent Fulgham.

Source/WebCore:

Add a new media query from CSS Level 4, &quot;inverted-colors&quot;, and
implement the Apple backends for the &quot;monochrome&quot; media query.

The platform code went into PlatformScreenMac, which already
had a screenIsMonochrome method. This now calls into Core
Graphics via SPI. I added a screenHasInvertedColors
method which tests for inversion. On iOS, there is public API
for both queries. On Windows, we try to use CoreGraphics.

At the moment neither of these media queries re-evaluate
automatically if the user changes their mode. The page will
need to be reloaded. It is possible to detect a change on iOS,
but not OS X.
https://bugs.webkit.org/show_bug.cgi?id=137868

I decided to not add an ENABLE flag for this, mostly because it
is such an isolated feature and seems very unlikely to be
controversial. I don't expect the syntax to change. (I'm sure
this comment will come back to haunt me.)

Testing this automatically is slightly tricky. We'd need
to expose SPI to invert the user's screen, but then we get
inverted images from our testing which could interfere with concurrent
operations. Instead I've included some tests that exercise
the &quot;false&quot; parts of the media query, with explanations as
to why they would fail if the display is inverted.

Tests: fast/media/mq-inverted-colors.html
       fast/media/mq-monochrome.html

* css/CSSValueKeywords.in: Add the &quot;inverted&quot; keyword for &quot;inverted-colors&quot;.
* css/MediaFeatureNames.h: Add the &quot;inverted-colors&quot; feature name.
* css/MediaQueryEvaluator.cpp:
(WebCore::inverted_colorsMediaFeatureEval): Implementation of the new media query.
* css/MediaQueryExp.cpp:
(WebCore::featureWithCSSValueID): The new query takes an id...
(WebCore::featureWithoutValue): ... or no value.
* platform/PlatformScreen.h: Add &quot;screenHasInvertedColors&quot;.
* platform/efl/PlatformScreenEfl.cpp:
(WebCore::screenHasInvertedColors): Stub implementation.
* platform/gtk/PlatformScreenGtk.cpp:
(WebCore::screenHasInvertedColors): Ditto.
* platform/ios/PlatformScreenIOS.mm:
(WebCore::screenHasInvertedColors): Call into the platform accessibility API.
(WebCore::screenIsMonochrome): Ditto.
* platform/mac/PlatformScreenMac.mm:
(WebCore::screenIsMonochrome): Call into the CoreGraphics SPI.
(WebCore::screenHasInvertedColors): Call into the CoreGraphics SPI.
* platform/win/PlatformScreenWin.cpp:
(WebCore::screenHasInvertedColors): Call into CoreGraphics if we're using it.

LayoutTests:

Add tests for the new &quot;inverted-colors&quot; media feature, and
another test for the &quot;monochrome&quot; feature. Note that these
tests don't actually exercise the positive values of the
query, since that requires the screen to be changed and would
interfere with concurrent tests.

* fast/media/mq-inverted-colors.html: Added.
* fast/media/mq-monochrome.html: Added.
* fast/media/mq-inverted-colors-expected.html: Added.
* fast/media/mq-monochrome-expected.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSValueKeywordsin">trunk/Source/WebCore/css/CSSValueKeywords.in</a></li>
<li><a href="#trunkSourceWebCorecssMediaFeatureNamesh">trunk/Source/WebCore/css/MediaFeatureNames.h</a></li>
<li><a href="#trunkSourceWebCorecssMediaQueryEvaluatorcpp">trunk/Source/WebCore/css/MediaQueryEvaluator.cpp</a></li>
<li><a href="#trunkSourceWebCorecssMediaQueryExpcpp">trunk/Source/WebCore/css/MediaQueryExp.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformPlatformScreenh">trunk/Source/WebCore/platform/PlatformScreen.h</a></li>
<li><a href="#trunkSourceWebCoreplatformeflPlatformScreenEflcpp">trunk/Source/WebCore/platform/efl/PlatformScreenEfl.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgtkPlatformScreenGtkcpp">trunk/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformiosPlatformScreenIOSmm">trunk/Source/WebCore/platform/ios/PlatformScreenIOS.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformmacPlatformScreenMacmm">trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformwinPlatformScreenWincpp">trunk/Source/WebCore/platform/win/PlatformScreenWin.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastmediamqinvertedcolorsexpectedhtml">trunk/LayoutTests/fast/media/mq-inverted-colors-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastmediamqinvertedcolorshtml">trunk/LayoutTests/fast/media/mq-inverted-colors.html</a></li>
<li><a href="#trunkLayoutTestsfastmediamqmonochromeexpectedhtml">trunk/LayoutTests/fast/media/mq-monochrome-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastmediamqmonochromehtml">trunk/LayoutTests/fast/media/mq-monochrome.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (174900 => 174901)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-10-20 19:16:54 UTC (rev 174900)
+++ trunk/LayoutTests/ChangeLog        2014-10-20 19:37:40 UTC (rev 174901)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2014-10-20  Dean Jackson  &lt;dino@apple.com&gt;
+
+        [Mac] Support &quot;inverted-colors&quot; and &quot;monochrome&quot; media feature.
+        https://bugs.webkit.org/show_bug.cgi?id=137535
+        &lt;rdar://problem/18586398&gt;
+
+        Reviewed by Brent Fulgham.
+
+        Add tests for the new &quot;inverted-colors&quot; media feature, and
+        another test for the &quot;monochrome&quot; feature. Note that these
+        tests don't actually exercise the positive values of the
+        query, since that requires the screen to be changed and would
+        interfere with concurrent tests.
+
+        * fast/media/mq-inverted-colors.html: Added.
+        * fast/media/mq-monochrome.html: Added.
+        * fast/media/mq-inverted-colors-expected.html: Added.
+        * fast/media/mq-monochrome-expected.html: Added.
+
</ins><span class="cx"> 2014-10-20  Alexey Proskuryakov  &lt;ap@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Eight transitions tests are very flaky, frequently failing all at once
</span></span></pre></div>
<a id="trunkLayoutTestsfastmediamqinvertedcolorsexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/media/mq-inverted-colors-expected.html (0 => 174901)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/media/mq-inverted-colors-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/media/mq-inverted-colors-expected.html        2014-10-20 19:37:40 UTC (rev 174901)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;CSS4 media query test: inverted-colors.&lt;/title&gt;
+&lt;style type=&quot;text/css&quot;&gt;
+#a { color: green; }
+#b { color: black; }
+#c { color: green; }
+#d { color: black; }
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+  &lt;p id=&quot;a&quot;&gt;This text should be inverted black (white) if the screen is inverted. Green otherwise.&lt;/p&gt;
+  &lt;p id=&quot;b&quot;&gt;This text should be inverted green (puplish) if the screen is inverted. Black otherwise.&lt;/p&gt;
+  &lt;p id=&quot;c&quot;&gt;This text should be inverted black (white) if the screen is inverted. Green otherwise.&lt;/p&gt;
+  &lt;p id=&quot;d&quot;&gt;This text should be inverted green (purplish) if the screen is inverted. Black otherwise.&lt;/p&gt;
+  &lt;p&gt;Note that the expected results of this test assume a non-inverted display.&lt;/p&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">Property changes on: trunk/LayoutTests/fast/media/mq-inverted-colors-expected.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestsfastmediamqinvertedcolorshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/media/mq-inverted-colors.html (0 => 174901)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/media/mq-inverted-colors.html                                (rev 0)
+++ trunk/LayoutTests/fast/media/mq-inverted-colors.html        2014-10-20 19:37:40 UTC (rev 174901)
</span><span class="lines">@@ -0,0 +1,31 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;CSS4 media query test: inverted-colors.&lt;/title&gt;
+&lt;style type=&quot;text/css&quot;&gt;
+#a { color: green; }
+#b { color: black; }
+#c { color: black; }
+#d { color: black; }
+
+@media (inverted-colors) {
+#a { color: black; }
+#b { color: green; }
+}
+
+@media (inverted-colors: none) {
+#c { color: green; }
+}
+
+@media (inverted-colors: inverted) {
+#d { color: green; }
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+  &lt;p id=&quot;a&quot;&gt;This text should be inverted black (white) if the screen is inverted. Green otherwise.&lt;/p&gt;
+  &lt;p id=&quot;b&quot;&gt;This text should be inverted green (puplish) if the screen is inverted. Black otherwise.&lt;/p&gt;
+  &lt;p id=&quot;c&quot;&gt;This text should be inverted black (white) if the screen is inverted. Green otherwise.&lt;/p&gt;
+  &lt;p id=&quot;d&quot;&gt;This text should be inverted green (purplish) if the screen is inverted. Black otherwise.&lt;/p&gt;
+  &lt;p&gt;Note that the expected results of this test assume a non-inverted display.&lt;/p&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">Property changes on: trunk/LayoutTests/fast/media/mq-inverted-colors.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestsfastmediamqmonochromeexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/media/mq-monochrome-expected.html (0 => 174901)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/media/mq-monochrome-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/media/mq-monochrome-expected.html        2014-10-20 19:37:40 UTC (rev 174901)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;CSS4 media query test: monochrome.&lt;/title&gt;
+&lt;style type=&quot;text/css&quot;&gt;
+#a { color: black; }
+#b { color: #888; }
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+  &lt;p id=&quot;a&quot;&gt;This text should be middle grey if the screen is monochrome. Black otherwise.&lt;/p&gt;
+  &lt;p id=&quot;b&quot;&gt;This text should be black if the screen is monochrome. Middle grey otherwise.&lt;/p&gt;
+  &lt;p&gt;Note that the expected results of this test assume a non-monochrome display.&lt;/p&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">Property changes on: trunk/LayoutTests/fast/media/mq-monochrome-expected.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestsfastmediamqmonochromehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/media/mq-monochrome.html (0 => 174901)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/media/mq-monochrome.html                                (rev 0)
+++ trunk/LayoutTests/fast/media/mq-monochrome.html        2014-10-20 19:37:40 UTC (rev 174901)
</span><span class="lines">@@ -0,0 +1,20 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;CSS4 media query test: monochrome.&lt;/title&gt;
+&lt;style type=&quot;text/css&quot;&gt;
+#a { color: black; }
+#b { color: #888; }
+
+@media (monochrome) {
+#a { color: #888; }
+#b { color: black; }
+}
+
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+  &lt;p id=&quot;a&quot;&gt;This text should be middle grey if the screen is monochrome. Black otherwise.&lt;/p&gt;
+  &lt;p id=&quot;b&quot;&gt;This text should be black if the screen is monochrome. Middle grey otherwise.&lt;/p&gt;
+  &lt;p&gt;Note that the expected results of this test assume a non-monochrome display.&lt;/p&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">Property changes on: trunk/LayoutTests/fast/media/mq-monochrome.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (174900 => 174901)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-10-20 19:16:54 UTC (rev 174900)
+++ trunk/Source/WebCore/ChangeLog        2014-10-20 19:37:40 UTC (rev 174901)
</span><span class="lines">@@ -1,3 +1,62 @@
</span><ins>+2014-10-20  Dean Jackson  &lt;dino@apple.com&gt;
+
+        [Mac] Support &quot;inverted-colors&quot; and &quot;monochrome&quot; media feature.
+        https://bugs.webkit.org/show_bug.cgi?id=137535
+        &lt;rdar://problem/18586398&gt;
+
+        Reviewed by Brent Fulgham.
+
+        Add a new media query from CSS Level 4, &quot;inverted-colors&quot;, and
+        implement the Apple backends for the &quot;monochrome&quot; media query.
+
+        The platform code went into PlatformScreenMac, which already
+        had a screenIsMonochrome method. This now calls into Core
+        Graphics via SPI. I added a screenHasInvertedColors
+        method which tests for inversion. On iOS, there is public API
+        for both queries. On Windows, we try to use CoreGraphics.
+
+        At the moment neither of these media queries re-evaluate
+        automatically if the user changes their mode. The page will
+        need to be reloaded. It is possible to detect a change on iOS,
+        but not OS X.
+        https://bugs.webkit.org/show_bug.cgi?id=137868
+
+        I decided to not add an ENABLE flag for this, mostly because it
+        is such an isolated feature and seems very unlikely to be
+        controversial. I don't expect the syntax to change. (I'm sure
+        this comment will come back to haunt me.)
+
+        Testing this automatically is slightly tricky. We'd need
+        to expose SPI to invert the user's screen, but then we get
+        inverted images from our testing which could interfere with concurrent
+        operations. Instead I've included some tests that exercise
+        the &quot;false&quot; parts of the media query, with explanations as
+        to why they would fail if the display is inverted.
+
+        Tests: fast/media/mq-inverted-colors.html
+               fast/media/mq-monochrome.html
+
+        * css/CSSValueKeywords.in: Add the &quot;inverted&quot; keyword for &quot;inverted-colors&quot;.
+        * css/MediaFeatureNames.h: Add the &quot;inverted-colors&quot; feature name.
+        * css/MediaQueryEvaluator.cpp:
+        (WebCore::inverted_colorsMediaFeatureEval): Implementation of the new media query.
+        * css/MediaQueryExp.cpp:
+        (WebCore::featureWithCSSValueID): The new query takes an id...
+        (WebCore::featureWithoutValue): ... or no value.
+        * platform/PlatformScreen.h: Add &quot;screenHasInvertedColors&quot;.
+        * platform/efl/PlatformScreenEfl.cpp:
+        (WebCore::screenHasInvertedColors): Stub implementation.
+        * platform/gtk/PlatformScreenGtk.cpp:
+        (WebCore::screenHasInvertedColors): Ditto.
+        * platform/ios/PlatformScreenIOS.mm:
+        (WebCore::screenHasInvertedColors): Call into the platform accessibility API.
+        (WebCore::screenIsMonochrome): Ditto.
+        * platform/mac/PlatformScreenMac.mm:
+        (WebCore::screenIsMonochrome): Call into the CoreGraphics SPI.
+        (WebCore::screenHasInvertedColors): Call into the CoreGraphics SPI.
+        * platform/win/PlatformScreenWin.cpp:
+        (WebCore::screenHasInvertedColors): Call into CoreGraphics if we're using it.
+
</ins><span class="cx"> 2014-10-20  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Use is&lt;&gt;() / downcast&lt;&gt;() for Accessibility objects
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSValueKeywordsin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSValueKeywords.in (174900 => 174901)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSValueKeywords.in        2014-10-20 19:16:54 UTC (rev 174900)
+++ trunk/Source/WebCore/css/CSSValueKeywords.in        2014-10-20 19:37:40 UTC (rev 174901)
</span><span class="lines">@@ -455,6 +455,7 @@
</span><span class="cx"> hide
</span><span class="cx"> higher
</span><span class="cx"> invert
</span><ins>+inverted
</ins><span class="cx"> -webkit-isolate
</span><span class="cx"> -webkit-isolate-override
</span><span class="cx"> -webkit-plaintext
</span></span></pre></div>
<a id="trunkSourceWebCorecssMediaFeatureNamesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/MediaFeatureNames.h (174900 => 174901)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/MediaFeatureNames.h        2014-10-20 19:16:54 UTC (rev 174900)
+++ trunk/Source/WebCore/css/MediaFeatureNames.h        2014-10-20 19:37:40 UTC (rev 174901)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx">     macro(device_pixel_ratio, &quot;-webkit-device-pixel-ratio&quot;) \
</span><span class="cx">     macro(device_height, &quot;device-height&quot;) \
</span><span class="cx">     macro(device_width, &quot;device-width&quot;) \
</span><ins>+    macro(inverted_colors, &quot;inverted-colors&quot;) \
</ins><span class="cx">     macro(max_color, &quot;max-color&quot;) \
</span><span class="cx">     macro(max_color_index, &quot;max-color-index&quot;) \
</span><span class="cx">     macro(max_aspect_ratio, &quot;max-aspect-ratio&quot;) \
</span></span></pre></div>
<a id="trunkSourceWebCorecssMediaQueryEvaluatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/MediaQueryEvaluator.cpp (174900 => 174901)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/MediaQueryEvaluator.cpp        2014-10-20 19:16:54 UTC (rev 174900)
+++ trunk/Source/WebCore/css/MediaQueryEvaluator.cpp        2014-10-20 19:37:40 UTC (rev 174901)
</span><span class="lines">@@ -237,6 +237,17 @@
</span><span class="cx">     return colorMediaFeatureEval(value, conversionData, frame, op);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static bool inverted_colorsMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp;, Frame*, MediaFeaturePrefix)
+{
+    bool isInverted = screenHasInvertedColors();
+
+    if (!value)
+        return isInverted;
+
+    const CSSValueID id = downcast&lt;CSSPrimitiveValue&gt;(*value).getValueID();
+    return (isInverted &amp;&amp; id == CSSValueInverted) || (!isInverted &amp;&amp; id == CSSValueNone);
+}
+
</ins><span class="cx"> static bool orientationMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp;, Frame* frame, MediaFeaturePrefix)
</span><span class="cx"> {
</span><span class="cx">     FrameView* view = frame-&gt;view();
</span></span></pre></div>
<a id="trunkSourceWebCorecssMediaQueryExpcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/MediaQueryExp.cpp (174900 => 174901)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/MediaQueryExp.cpp        2014-10-20 19:16:54 UTC (rev 174900)
+++ trunk/Source/WebCore/css/MediaQueryExp.cpp        2014-10-20 19:37:40 UTC (rev 174901)
</span><span class="lines">@@ -47,6 +47,7 @@
</span><span class="cx"> #if ENABLE(VIEW_MODE_CSS_MEDIA)
</span><span class="cx">         || mediaFeature == MediaFeatureNames::view_modeMediaFeature
</span><span class="cx"> #endif // ENABLE(VIEW_MODE_CSS_MEDIA)
</span><ins>+        || mediaFeature == MediaFeatureNames::inverted_colorsMediaFeature
</ins><span class="cx">         || mediaFeature == MediaFeatureNames::pointerMediaFeature;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -146,6 +147,7 @@
</span><span class="cx">         || mediaFeature == MediaFeatureNames::transform_3dMediaFeature
</span><span class="cx">         || mediaFeature == MediaFeatureNames::transitionMediaFeature
</span><span class="cx">         || mediaFeature == MediaFeatureNames::animationMediaFeature
</span><ins>+        || mediaFeature == MediaFeatureNames::inverted_colorsMediaFeature
</ins><span class="cx"> #if ENABLE(VIEW_MODE_CSS_MEDIA)
</span><span class="cx">         || mediaFeature == MediaFeatureNames::view_modeMediaFeature
</span><span class="cx"> #endif // ENABLE(VIEW_MODE_CSS_MEDIA)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformPlatformScreenh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/PlatformScreen.h (174900 => 174901)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/PlatformScreen.h        2014-10-20 19:16:54 UTC (rev 174900)
+++ trunk/Source/WebCore/platform/PlatformScreen.h        2014-10-20 19:37:40 UTC (rev 174901)
</span><span class="lines">@@ -53,6 +53,8 @@
</span><span class="cx">     int screenDepthPerComponent(Widget*);
</span><span class="cx">     bool screenIsMonochrome(Widget*);
</span><span class="cx"> 
</span><ins>+    bool screenHasInvertedColors();
+
</ins><span class="cx">     FloatRect screenRect(Widget*);
</span><span class="cx">     FloatRect screenAvailableRect(Widget*);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformeflPlatformScreenEflcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/efl/PlatformScreenEfl.cpp (174900 => 174901)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/efl/PlatformScreenEfl.cpp        2014-10-20 19:16:54 UTC (rev 174900)
+++ trunk/Source/WebCore/platform/efl/PlatformScreenEfl.cpp        2014-10-20 19:37:40 UTC (rev 174901)
</span><span class="lines">@@ -83,6 +83,11 @@
</span><span class="cx">     return screenDepth(widget) &lt; 2;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool screenHasInvertedColors()
+{
+    return false;
+}
+
</ins><span class="cx"> FloatRect screenRect(Widget* widget)
</span><span class="cx"> {
</span><span class="cx"> #ifdef HAVE_ECORE_X
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgtkPlatformScreenGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp (174900 => 174901)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp        2014-10-20 19:16:54 UTC (rev 174900)
+++ trunk/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp        2014-10-20 19:37:40 UTC (rev 174901)
</span><span class="lines">@@ -83,6 +83,10 @@
</span><span class="cx">     return screenDepth(widget) &lt; 2;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool screenHasInvertedColors()
+{
+    return false;
+}
</ins><span class="cx"> 
</span><span class="cx"> static GdkScreen* getScreen(GtkWidget* widget)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosPlatformScreenIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/PlatformScreenIOS.mm (174900 => 174901)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/PlatformScreenIOS.mm        2014-10-20 19:16:54 UTC (rev 174900)
+++ trunk/Source/WebCore/platform/ios/PlatformScreenIOS.mm        2014-10-20 19:37:40 UTC (rev 174901)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006 Apple Inc.  All rights reserved.
</del><ins>+ * Copyright (C) 2006, 2014 Apple Inc.  All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -30,11 +30,16 @@
</span><span class="cx"> #import &quot;FrameView.h&quot;
</span><span class="cx"> #import &quot;HostWindow.h&quot;
</span><span class="cx"> #import &quot;IntRect.h&quot;
</span><ins>+#import &quot;SoftLinking.h&quot;
</ins><span class="cx"> #import &quot;WAKWindow.h&quot;
</span><span class="cx"> #import &quot;WebCoreSystemInterface.h&quot;
</span><span class="cx"> #import &quot;Widget.h&quot;
</span><span class="cx"> #import &lt;MobileGestalt.h&gt;
</span><span class="cx"> 
</span><ins>+SOFT_LINK_FRAMEWORK(UIKit)
+SOFT_LINK(UIKit, UIAccessibilityIsGrayscaleEnabled, bool, (void), ())
+SOFT_LINK(UIKit, UIAccessibilityIsInvertColorsEnabled, bool, (void), ())
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> int screenDepth(Widget*)
</span><span class="lines">@@ -51,9 +56,14 @@
</span><span class="cx"> 
</span><span class="cx"> bool screenIsMonochrome(Widget*)
</span><span class="cx"> {
</span><del>-    return false;
</del><ins>+    return UIAccessibilityIsGrayscaleEnabled();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool screenHasInvertedColors()
+{
+    return UIAccessibilityIsInvertColorsEnabled();
+}
+
</ins><span class="cx"> // These functions scale between screen and page coordinates because JavaScript/DOM operations
</span><span class="cx"> // assume that the screen and the page share the same coordinate system.
</span><span class="cx"> FloatRect screenRect(Widget* widget)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacPlatformScreenMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm (174900 => 174901)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm        2014-10-20 19:16:54 UTC (rev 174900)
+++ trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm        2014-10-20 19:37:40 UTC (rev 174901)
</span><span class="lines">@@ -30,6 +30,11 @@
</span><span class="cx"> #import &quot;FrameView.h&quot;
</span><span class="cx"> #import &quot;HostWindow.h&quot;
</span><span class="cx"> 
</span><ins>+extern &quot;C&quot; {
+bool CGDisplayUsesInvertedPolarity(void);
+bool CGDisplayUsesForceToGray(void);
+}
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> static PlatformDisplayID displayIDFromScreen(NSScreen *screen)
</span><span class="lines">@@ -58,10 +63,15 @@
</span><span class="cx"> 
</span><span class="cx"> bool screenIsMonochrome(Widget*)
</span><span class="cx"> {
</span><del>-    return false;
</del><ins>+    return CGDisplayUsesForceToGray();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-// These functions scale between screen and page coordinates because JavaScript/DOM operations 
</del><ins>+bool screenHasInvertedColors()
+{
+    return CGDisplayUsesInvertedPolarity();
+}
+
+// These functions scale between screen and page coordinates because JavaScript/DOM operations
</ins><span class="cx"> // assume that the screen and the page share the same coordinate system.
</span><span class="cx"> 
</span><span class="cx"> static PlatformDisplayID displayFromWidget(Widget* widget)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformwinPlatformScreenWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/win/PlatformScreenWin.cpp (174900 => 174901)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/win/PlatformScreenWin.cpp        2014-10-20 19:16:54 UTC (rev 174900)
+++ trunk/Source/WebCore/platform/win/PlatformScreenWin.cpp        2014-10-20 19:37:40 UTC (rev 174901)
</span><span class="lines">@@ -36,6 +36,12 @@
</span><span class="cx"> #include &quot;Page.h&quot;
</span><span class="cx"> #include &lt;windows.h&gt;
</span><span class="cx"> 
</span><ins>+#if USE(CG)
+extern &quot;C&quot; {
+bool CGDisplayUsesInvertedPolarity(void);
+}
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> // Returns info for the default monitor if widget is NULL
</span><span class="lines">@@ -84,6 +90,15 @@
</span><span class="cx">     return deviceInfo.dmColor == DMCOLOR_MONOCHROME;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool screenHasInvertedColors()
+{
+#if USE(CG)
+    return CGDisplayUsesInvertedPolarity();
+#else
+    return false;
+#endif
+}
+
</ins><span class="cx"> FloatRect screenRect(Widget* widget)
</span><span class="cx"> {
</span><span class="cx">     MONITORINFOEX monitorInfo = monitorInfoForWidget(widget);
</span></span></pre>
</div>
</div>

</body>
</html>