Ensure iOS layout traits are used for media controls in modern compatibility mode
authorgraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Apr 2019 07:11:11 +0000 (07:11 +0000)
committergraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Apr 2019 07:11:11 +0000 (07:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196812
<rdar://problem/47460637>

Reviewed by Dean Jackson.

Source/WebCore:

Test: media/modern-media-controls/media-controller/ios/media-controller-ios-layout-traits-modern-compatibility-mode.html

Instead of looking at the UA string, check whether we support touches which is the correct indicator of whether we should
be using the iOS layout traits for media controls.

* Modules/modern-media-controls/media/media-controller.js:
(MediaController.prototype.get layoutTraits):

LayoutTests:

Add a new test that enforces modern compatibility mode and checks that the iOS controls are used.

* media/modern-media-controls/media-controller/ios/media-controller-ios-layout-traits-modern-compatibility-mode-expected.txt: Added.
* media/modern-media-controls/media-controller/ios/media-controller-ios-layout-traits-modern-compatibility-mode.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/media/modern-media-controls/media-controller/ios/media-controller-ios-layout-traits-modern-compatibility-mode-expected.txt [new file with mode: 0644]
LayoutTests/media/modern-media-controls/media-controller/ios/media-controller-ios-layout-traits-modern-compatibility-mode.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/modern-media-controls/media/media-controller.js

index 3b14697..aeb95e9 100644 (file)
@@ -1,3 +1,16 @@
+2019-04-11  Antoine Quint  <graouts@apple.com>
+
+        Ensure iOS layout traits are used for media controls in modern compatibility mode
+        https://bugs.webkit.org/show_bug.cgi?id=196812
+        <rdar://problem/47460637>
+
+        Reviewed by Dean Jackson.
+
+        Add a new test that enforces modern compatibility mode and checks that the iOS controls are used.
+
+        * media/modern-media-controls/media-controller/ios/media-controller-ios-layout-traits-modern-compatibility-mode-expected.txt: Added.
+        * media/modern-media-controls/media-controller/ios/media-controller-ios-layout-traits-modern-compatibility-mode.html: Added.
+
 2019-04-14  Fujii Hironori  <Hironori.Fujii@sony.com>
 
         [WinCairo][WKL] Unreviewed test gardening.
diff --git a/LayoutTests/media/modern-media-controls/media-controller/ios/media-controller-ios-layout-traits-modern-compatibility-mode-expected.txt b/LayoutTests/media/modern-media-controls/media-controller/ios/media-controller-ios-layout-traits-modern-compatibility-mode-expected.txt
new file mode 100644 (file)
index 0000000..671e6f9
--- /dev/null
@@ -0,0 +1,10 @@
+Testing we use the iOS media controls when in modern compatibility mode on iOS.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS window.internals.shadowRoot(media).querySelector('.media-controls').classList.contains('ios') is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/media/modern-media-controls/media-controller/ios/media-controller-ios-layout-traits-modern-compatibility-mode.html b/LayoutTests/media/modern-media-controls/media-controller/ios/media-controller-ios-layout-traits-modern-compatibility-mode.html
new file mode 100644 (file)
index 0000000..dee8346
--- /dev/null
@@ -0,0 +1,20 @@
+<!DOCTYPE html><!-- webkit-test-runner [ shouldUseModernCompatibilityMode=true ] -->
+<script src="../../../../resources/js-test-pre.js"></script>
+<script src="../../resources/media-controls-utils.js" type="text/javascript"></script>
+<body>
+<video src="../../../content/test.mp4" style="width: 320px; height: 240px;" controls autoplay plays-inline></video>
+<script type="text/javascript">
+
+window.jsTestIsAsync = true;
+
+description("Testing we use the iOS media controls when in modern compatibility mode on iOS.");
+
+const media = document.querySelector("video");
+media.addEventListener("play", () => {
+    shouldBeTrue("window.internals.shadowRoot(media).querySelector('.media-controls').classList.contains('ios')");
+    finishJSTest();
+});
+
+</script>
+<script src="../../../../resources/js-test-post.js"></script>
+</body>
index ab7a5e3..f8e0431 100644 (file)
@@ -1,3 +1,19 @@
+2019-04-11  Antoine Quint  <graouts@apple.com>
+
+        Ensure iOS layout traits are used for media controls in modern compatibility mode
+        https://bugs.webkit.org/show_bug.cgi?id=196812
+        <rdar://problem/47460637>
+
+        Reviewed by Dean Jackson.
+
+        Test: media/modern-media-controls/media-controller/ios/media-controller-ios-layout-traits-modern-compatibility-mode.html
+
+        Instead of looking at the UA string, check whether we support touches which is the correct indicator of whether we should
+        be using the iOS layout traits for media controls.
+
+        * Modules/modern-media-controls/media/media-controller.js:
+        (MediaController.prototype.get layoutTraits):
+
 2019-04-14  Rob Buis  <rbuis@igalia.com>
 
         Link prefetch not useful for top-level navigation
index 6753ba9..d01ae23 100644 (file)
@@ -99,7 +99,7 @@ class MediaController
         if (this.host && this.host.compactMode)
             return LayoutTraits.Compact;
 
-        let traits = window.navigator.platform === "MacIntel" ? LayoutTraits.macOS : LayoutTraits.iOS;
+        let traits = GestureRecognizer.SupportsTouches ? LayoutTraits.iOS : LayoutTraits.macOS;
         if (this.isFullscreen)
             return traits | LayoutTraits.Fullscreen;
         return traits;