Media Query (-webkit-video-playable-inline) is failing as an invalid media query...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Jan 2016 22:28:03 +0000 (22:28 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Jan 2016 22:28:03 +0000 (22:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=153111

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-01-15
Reviewed by Dean Jackson.

Source/WebCore:

Test: fast/media/video-playable-inline-media-query.html

* css/MediaQueryEvaluator.cpp:
(WebCore::video_playable_inlineMediaFeatureEval):
(WebCore::isRunningOnIPhoneOrIPod): Deleted.
Make the media query work regardless of the platform.
It should just check the web view's settings.

* css/MediaQueryExp.cpp:
(WebCore::featureWithoutValue):
This media query expects no value, include it in the list
so it is not treated as invalid.

LayoutTests:

* fast/media/video-playable-inline-media-query-expected.txt: Added.
* fast/media/video-playable-inline-media-query.html: Added.
* platform/ios-simulator/ios/fast/media/video-inline-expected.txt: Removed.
* platform/ios-simulator/ios/fast/media/video-inline.html: Removed.

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

LayoutTests/ChangeLog
LayoutTests/fast/media/video-playable-inline-media-query-expected.txt [new file with mode: 0644]
LayoutTests/fast/media/video-playable-inline-media-query.html [new file with mode: 0644]
LayoutTests/platform/ios-simulator/ios/fast/media/video-inline-expected.txt [deleted file]
LayoutTests/platform/ios-simulator/ios/fast/media/video-inline.html [deleted file]
Source/WebCore/ChangeLog
Source/WebCore/css/MediaQueryEvaluator.cpp
Source/WebCore/css/MediaQueryExp.cpp

index dc98871..0eb0f5f 100644 (file)
@@ -1,5 +1,17 @@
 2016-01-15  Joseph Pecoraro  <pecoraro@apple.com>
 
+        Media Query (-webkit-video-playable-inline) is failing as an invalid media query expression
+        https://bugs.webkit.org/show_bug.cgi?id=153111
+
+        Reviewed by Dean Jackson.
+
+        * fast/media/video-playable-inline-media-query-expected.txt: Added.
+        * fast/media/video-playable-inline-media-query.html: Added.
+        * platform/ios-simulator/ios/fast/media/video-inline-expected.txt: Removed.
+        * platform/ios-simulator/ios/fast/media/video-inline.html: Removed.
+
+2016-01-15  Joseph Pecoraro  <pecoraro@apple.com>
+
         LayoutTest inspector/script-profiler/event-type-Other.html is flaky
         https://bugs.webkit.org/show_bug.cgi?id=153016
         <rdar://problem/24192919>
diff --git a/LayoutTests/fast/media/video-playable-inline-media-query-expected.txt b/LayoutTests/fast/media/video-playable-inline-media-query-expected.txt
new file mode 100644 (file)
index 0000000..d3dc4aa
--- /dev/null
@@ -0,0 +1,7 @@
+Tests the (-webkit-video-playable-inline) media query.
+
+Enabling Inline Media Playback
+PASS: "(-webkit-video-playable-inline)" evaluates to true
+Disabling Inline Media Playback
+PASS: "(-webkit-video-playable-inline)" evaluates to false
+
diff --git a/LayoutTests/fast/media/video-playable-inline-media-query.html b/LayoutTests/fast/media/video-playable-inline-media-query.html
new file mode 100644 (file)
index 0000000..3a91f9e
--- /dev/null
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+
+function log(m) {
+    var results = document.getElementById('results');
+    results.innerHTML += m + '<br>';
+}
+
+function testQuery(query, expected) {
+    var isTrue = window.styleMedia.matchMedium(query);
+    var message = '\"' + query + '\" evaluates to ' + (isTrue ? 'true' : 'false');
+    message = ((isTrue === expected) ? 'PASS: ' : 'FAIL: ') + message;
+    log(message);
+}
+
+function runTests() {
+    log("Enabling Inline Media Playback");
+    internals.settings.setAllowsInlineMediaPlayback(true);
+    testQuery('(-webkit-video-playable-inline)', true);
+
+    log("Disabling Inline Media Playback");
+    internals.settings.setAllowsInlineMediaPlayback(false);
+    testQuery('(-webkit-video-playable-inline)', false);
+}
+</script>
+</head>
+<body onload="runTests()">
+<p>Tests the (-webkit-video-playable-inline) media query.</p>
+<div id="results"></div>
+</body>
+</html>
diff --git a/LayoutTests/platform/ios-simulator/ios/fast/media/video-inline-expected.txt b/LayoutTests/platform/ios-simulator/ios/fast/media/video-inline-expected.txt
deleted file mode 100644 (file)
index 9aca25e..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-Testing iOS-specific media query for inline video. When run inside MobileSafari on iPhone, the query should evaluate as false (and the test will indicate that it has failed). In all other places, including the test framework and DRT, the query should evaluate as true.
-
-FAIL: "(-webkit-video-playable-inline)" evaluates to false
-
diff --git a/LayoutTests/platform/ios-simulator/ios/fast/media/video-inline.html b/LayoutTests/platform/ios-simulator/ios/fast/media/video-inline.html
deleted file mode 100644 (file)
index e81d5e9..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-<html>
-<head>
-    <title>Test iOS-specific media query for inline video</title>
-    <meta name="viewport" content="width=device-width">
-    <script>
-        if (window.testRunner)
-            testRunner.dumpAsText();
-  
-        function log(m) {
-            var results = document.getElementById('results');
-            results.innerHTML += m + '<br>';
-        }
-  
-        function testQuery(query, expected) {
-            var isTrue = window.styleMedia.matchMedium(query);
-
-            var message = '\"' + query + '\" evaluates to ' + (isTrue ? 'true' : 'false');
-            message = ((isTrue == expected) ? 'PASS: ' : 'FAIL: ') + message;
-            log(message);
-        }
-  
-        function runTests() {
-            testQuery('(-webkit-video-playable-inline)', true);
-        }
-    </script>
-</head>
-<body onload="runTests()">
-    <p>
-        Testing iOS-specific media query for inline video.
-        When run inside MobileSafari on iPhone, the query should evaluate
-        as false (and the test will indicate that it has failed).
-        In all other places, including the test framework and DRT, the
-        query should evaluate as true.
-    </p>
-    <div id="results"></div>
-</body>
-</html>
index 87fe541..af052ad 100644 (file)
@@ -1,3 +1,23 @@
+2016-01-15  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Media Query (-webkit-video-playable-inline) is failing as an invalid media query expression
+        https://bugs.webkit.org/show_bug.cgi?id=153111
+
+        Reviewed by Dean Jackson.
+
+        Test: fast/media/video-playable-inline-media-query.html
+
+        * css/MediaQueryEvaluator.cpp:
+        (WebCore::video_playable_inlineMediaFeatureEval):
+        (WebCore::isRunningOnIPhoneOrIPod): Deleted.
+        Make the media query work regardless of the platform.
+        It should just check the web view's settings.
+
+        * css/MediaQueryExp.cpp:
+        (WebCore::featureWithoutValue):
+        This media query expects no value, include it in the list
+        so it is not treated as invalid.
+
 2016-01-15  Zalan Bujtas  <zalan@apple.com>
 
         ASSERTION FAILED: canHaveChildren() || canHaveGeneratedChildren() in WebCore::RenderElement::insertChildInternal
index b07b92e..49ff022 100644 (file)
 #include "RenderLayerCompositor.h"
 #endif
 
-#if PLATFORM(IOS)
-#include "Device.h"
-#endif
-
 namespace WebCore {
 
 using namespace MediaFeatureNames;
@@ -661,20 +657,9 @@ static bool view_modeMediaFeatureEval(CSSValue* value, const CSSToLengthConversi
 }
 #endif // ENABLE(VIEW_MODE_CSS_MEDIA)
 
-// FIXME: Find a better place for this function. Maybe ChromeClient?
-static inline bool isRunningOnIPhoneOrIPod()
-{
-#if PLATFORM(IOS)
-    static bool runningOnIPhoneOrIPod = deviceClass() == MGDeviceClassiPhone || deviceClass() == MGDeviceClassiPod;
-    return runningOnIPhoneOrIPod;
-#else
-    return false;
-#endif
-}
-
 static bool video_playable_inlineMediaFeatureEval(CSSValue*, const CSSToLengthConversionData&, Frame* frame, MediaFeaturePrefix)
 {
-    return !isRunningOnIPhoneOrIPod() || frame->settings().allowsInlineMediaPlayback();
+    return frame->settings().allowsInlineMediaPlayback();
 }
 
 static bool hoverMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&, Frame*, MediaFeaturePrefix)
index 28e754e..066258d 100644 (file)
@@ -155,7 +155,8 @@ static inline bool featureWithoutValue(const AtomicString& mediaFeature)
 #endif // ENABLE(VIEW_MODE_CSS_MEDIA)
         || mediaFeature == MediaFeatureNames::pointerMediaFeature
         || mediaFeature == MediaFeatureNames::device_pixel_ratioMediaFeature
-        || mediaFeature == MediaFeatureNames::resolutionMediaFeature;
+        || mediaFeature == MediaFeatureNames::resolutionMediaFeature
+        || mediaFeature == MediaFeatureNames::video_playable_inlineMediaFeature;
 }
 
 MediaQueryExp::MediaQueryExp(const AtomicString& mediaFeature, CSSParserValueList* valueList)