Update prefers-reduced-motion syntax
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Dec 2016 00:12:21 +0000 (00:12 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Dec 2016 00:12:21 +0000 (00:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=165880
<rdar://problems/29671807>

Reviewed by Sam Weinig.

Source/WebCore:

After discussion in:
https://github.com/w3c/csswg-drafts/issues/442
... the syntax of prefers-reduced-motion was changed
to accept "reduce" or "no-preference".

Updated the tests in fast/media.

* css/CSSValueKeywords.in: Add no-preference keyword.
* css/MediaQueryEvaluator.cpp:
(WebCore::prefersReducedMotionEvaluate):

LayoutTests:

* fast/media/mq-prefers-reduced-motion-forced-value.html:
* fast/media/mq-prefers-reduced-motion.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@209842 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/media/mq-prefers-reduced-motion-forced-value.html
LayoutTests/fast/media/mq-prefers-reduced-motion.html
Source/WebCore/ChangeLog
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/css/MediaQueryEvaluator.cpp

index f535d05..3272647 100644 (file)
@@ -1,3 +1,14 @@
+2016-12-14  Dean Jackson  <dino@apple.com>
+
+        Update prefers-reduced-motion syntax
+        https://bugs.webkit.org/show_bug.cgi?id=165880
+        <rdar://problems/29671807>
+
+        Reviewed by Sam Weinig.
+
+        * fast/media/mq-prefers-reduced-motion-forced-value.html:
+        * fast/media/mq-prefers-reduced-motion.html:
+
 2016-12-14  Sam Weinig  <sam@webkit.org>
 
         REGRESSION (204679): Google notifications never load (expecting DOMStringList rather than JS array for Location.ancestorOrigins)
index acc59b9..537ad52 100644 (file)
@@ -18,7 +18,7 @@ window.addEventListener("load", function () {
     window.internals.settings.forcedPrefersReducedMotionAccessibilityValue = "off";
     if (!window.matchMedia("(prefers-reduced-motion)").matches)
         document.getElementById("c").style.color = "green";
-    if (window.matchMedia("(prefers-reduced-motion: default)").matches)
+    if (window.matchMedia("(prefers-reduced-motion: no-preference)").matches)
         document.getElementById("d").style.color = "green";
 }, false);
 </script>
index 3f995ae..26a312b 100644 (file)
@@ -15,7 +15,7 @@
 #b { color: green; }
 }
 
-@media (prefers-reduced-motion: default) {
+@media (prefers-reduced-motion: no-preference) {
 #d { color: green; }
 }
 </style>
index 2756035..87b0345 100644 (file)
@@ -1,3 +1,22 @@
+2016-12-14  Dean Jackson  <dino@apple.com>
+
+        Update prefers-reduced-motion syntax
+        https://bugs.webkit.org/show_bug.cgi?id=165880
+        <rdar://problems/29671807>
+
+        Reviewed by Sam Weinig.
+
+        After discussion in:
+        https://github.com/w3c/csswg-drafts/issues/442
+        ... the syntax of prefers-reduced-motion was changed
+        to accept "reduce" or "no-preference".
+
+        Updated the tests in fast/media.
+
+        * css/CSSValueKeywords.in: Add no-preference keyword.
+        * css/MediaQueryEvaluator.cpp:
+        (WebCore::prefersReducedMotionEvaluate):
+
 2016-12-14  Sam Weinig  <sam@webkit.org>
 
         REGRESSION (204679): Google notifications never load (expecting DOMStringList rather than JS array for Location.ancestorOrigins)
index 5795bca..280f128 100644 (file)
@@ -1326,6 +1326,7 @@ display-p3
 
 // prefers-reduced-motion
 reduce
+no-preference
 
 #if defined(ENABLE_CSS_GRID_LAYOUT) && ENABLE_CSS_GRID_LAYOUT
 // auto-repeat
index d186274..4900f9a 100644 (file)
@@ -699,7 +699,7 @@ static bool prefersReducedMotionEvaluate(CSSValue* value, const CSSToLengthConve
     if (!value)
         return userPrefersReducedMotion;
 
-    return downcast<CSSPrimitiveValue>(*value).valueID() == (userPrefersReducedMotion ? CSSValueReduce : CSSValueDefault);
+    return downcast<CSSPrimitiveValue>(*value).valueID() == (userPrefersReducedMotion ? CSSValueReduce : CSSValueNoPreference);
 }
 
 // Use this function instead of calling add directly to avoid inlining.