[Modern Media Controls] Add an HTML comment flag to turn the feature on
authorgraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Dec 2016 00:10:28 +0000 (00:10 +0000)
committergraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Dec 2016 00:10:28 +0000 (00:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=165226

Reviewed by Dean Jackson.

Source/WebKit2:

* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetModernMediaControlsEnabled):
(WKPreferencesGetModernMediaControlsEnabled):
* UIProcess/API/C/WKPreferencesRefPrivate.h:

Tools:

* DumpRenderTree/TestOptions.h:
* DumpRenderTree/TestOptions.mm:
(TestOptions::TestOptions):
* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebPreferencesToConsistentValues):
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::beginTesting):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetPreferencesToConsistentValues):
(WTR::updateTestOptionsFromTestHeader):
* WebKitTestRunner/TestOptions.h:
* WebKitTestRunner/ios/PlatformWebViewIOS.mm:
(WTR::PlatformWebView::viewSupportsOptions):
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::viewSupportsOptions):

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

12 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h
Tools/ChangeLog
Tools/DumpRenderTree/TestOptions.h
Tools/DumpRenderTree/TestOptions.mm
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestOptions.h
Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm
Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm

index f2b5ab1..63f07c8 100644 (file)
@@ -1,3 +1,17 @@
+2016-11-30  Antoine Quint  <graouts@apple.com>
+
+        [Modern Media Controls] Add an HTML comment flag to turn the feature on
+        https://bugs.webkit.org/show_bug.cgi?id=165226
+
+        Reviewed by Dean Jackson.
+
+        Add new methods to set the Modern Media Controls preference.
+
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetModernMediaControlsEnabled):
+        (WKPreferencesGetModernMediaControlsEnabled):
+        * UIProcess/API/C/WKPreferencesRefPrivate.h:
+
 2016-11-30  Said Abou-Hallawa  <sabouhallawa@apple.com>
 
         Add separate settings and preferences to enable/disable async decoding for large images and animated images
index 7c6d30a..76e9b4d 100644 (file)
@@ -822,6 +822,16 @@ bool WKPreferencesGetMediaControlsScaleWithPageZoom(WKPreferencesRef preferences
     return toImpl(preferencesRef)->mediaControlsScaleWithPageZoom();
 }
 
+void WKPreferencesSetModernMediaControlsEnabled(WKPreferencesRef preferencesRef, bool flag)
+{
+    toImpl(preferencesRef)->setModernMediaControlsEnabled(flag);
+}
+
+bool WKPreferencesGetModernMediaControlsEnabled(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->modernMediaControlsEnabled();
+}
+
 void WKPreferencesSetShowsToolTipOverTruncatedText(WKPreferencesRef preferencesRef, bool flag)
 {
     toImpl(preferencesRef)->setShowsToolTipOverTruncatedText(flag);
index f17f71b..6cd3cbf 100644 (file)
@@ -205,6 +205,10 @@ WK_EXPORT void WKPreferencesSetMediaControlsScaleWithPageZoom(WKPreferencesRef p
 WK_EXPORT bool WKPreferencesGetMediaControlsScaleWithPageZoom(WKPreferencesRef preferencesRef);
 
 // Defaults to false.
+WK_EXPORT void WKPreferencesSetModernMediaControlsEnabled(WKPreferencesRef preferencesRef, bool flag);
+WK_EXPORT bool WKPreferencesGetModernMediaControlsEnabled(WKPreferencesRef preferencesRef);
+
+// Defaults to false.
 WK_EXPORT void WKPreferencesSetShowsToolTipOverTruncatedText(WKPreferencesRef preferencesRef, bool flag);
 WK_EXPORT bool WKPreferencesGetShowsToolTipOverTruncatedText(WKPreferencesRef preferencesRef);
 
index 316d468..b3aff1c 100644 (file)
@@ -1,3 +1,28 @@
+2016-11-30  Antoine Quint  <graouts@apple.com>
+
+        [Modern Media Controls] Add an HTML comment flag to turn the feature on
+        https://bugs.webkit.org/show_bug.cgi?id=165226
+
+        Reviewed by Dean Jackson.
+
+        Add a new flag to turn Modern Media Controls on in the test runners.
+
+        * DumpRenderTree/TestOptions.h:
+        * DumpRenderTree/TestOptions.mm:
+        (TestOptions::TestOptions):
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (resetWebPreferencesToConsistentValues):
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+        (WTR::InjectedBundle::beginTesting):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::resetPreferencesToConsistentValues):
+        (WTR::updateTestOptionsFromTestHeader):
+        * WebKitTestRunner/TestOptions.h:
+        * WebKitTestRunner/ios/PlatformWebViewIOS.mm:
+        (WTR::PlatformWebView::viewSupportsOptions):
+        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
+        (WTR::PlatformWebView::viewSupportsOptions):
+
 2016-11-30  Said Abou-Hallawa  <sabouhallawa@apple.com>
 
         Add separate settings and preferences to enable/disable async decoding for large images and animated images
index a7cbb45..d68dab1 100644 (file)
@@ -29,6 +29,7 @@
 
 struct TestOptions {
     bool enableIntersectionObserver { false };
+    bool enableModernMediaControls { false };
 
     TestOptions(NSURL *testURL);
 };
index 4da1f42..e05a4bf 100644 (file)
@@ -78,6 +78,8 @@ TestOptions::TestOptions(NSURL *testURL)
         auto value = pairString.substr(equalsLocation + 1, pairEnd - (equalsLocation + 1));
         if (key == "enableIntersectionObserver")
             this->enableIntersectionObserver = parseBooleanTestHeaderValue(value);
+        else if (key == "enableModernMediaControls")
+            this->enableModernMediaControls = parseBooleanTestHeaderValue(value);
         pairStart = pairEnd + 1;
     }
 }
index 2d76c04..98b915e 100644 (file)
@@ -995,12 +995,11 @@ static void resetWebPreferencesToConsistentValues(const TestOptions& options)
 
     [preferences setES6ModulesEnabled:YES];
 
-    [preferences setModernMediaControlsEnabled:NO];
-
     [preferences setHiddenPageDOMTimerThrottlingEnabled:NO];
     [preferences setHiddenPageCSSAnimationSuspensionEnabled:NO];
 
     preferences.intersectionObserverEnabled = options.enableIntersectionObserver;
+    preferences.modernMediaControlsEnabled = options.enableModernMediaControls;
 
     [WebPreferences _clearNetworkLoaderSession];
     [WebPreferences _setCurrentNetworkLoaderSessionCookieAcceptPolicy:NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain];
index 8636fa0..27e2ade 100644 (file)
@@ -322,8 +322,6 @@ void InjectedBundle::beginTesting(WKDictionaryRef settings)
 
     m_testRunner->setWebGL2Enabled(true);
 
-    m_testRunner->setModernMediaControlsEnabled(false);
-
     m_testRunner->setFetchAPIEnabled(true);
 
     m_testRunner->setDownloadAttributeEnabled(true);
index 214e4fd..1210076 100644 (file)
@@ -651,6 +651,7 @@ void TestController::resetPreferencesToConsistentValues(const TestOptions& optio
     WKPreferencesSetMockScrollbarsEnabled(preferences, options.useMockScrollbars);
     WKPreferencesSetNeedsSiteSpecificQuirks(preferences, options.needsSiteSpecificQuirks);
     WKPreferencesSetIntersectionObserverEnabled(preferences, options.enableIntersectionObserver);
+    WKPreferencesSetModernMediaControlsEnabled(preferences, options.enableModernMediaControls);
 
     static WKStringRef defaultTextEncoding = WKStringCreateWithUTF8CString("ISO-8859-1");
     WKPreferencesSetDefaultTextEncodingName(preferences, defaultTextEncoding);
@@ -960,6 +961,8 @@ static void updateTestOptionsFromTestHeader(TestOptions& testOptions, const std:
             testOptions.useCharacterSelectionGranularity = parseBooleanTestHeaderValue(value);
         if (key == "enableIntersectionObserver")
             testOptions.enableIntersectionObserver = parseBooleanTestHeaderValue(value);
+        if (key == "enableModernMediaControls")
+            testOptions.enableModernMediaControls = parseBooleanTestHeaderValue(value);
         pairStart = pairEnd + 1;
     }
 }
index 052ff20..d06f817 100644 (file)
@@ -44,6 +44,7 @@ struct TestOptions {
     bool ignoresViewportScaleLimits { false };
     bool useCharacterSelectionGranularity { false };
     bool enableIntersectionObserver { false };
+    bool enableModernMediaControls { false };
 
     float deviceScaleFactor { 1 };
     Vector<String> overrideLanguages;
index 0d009c4..860e7a1 100644 (file)
@@ -281,7 +281,8 @@ bool PlatformWebView::viewSupportsOptions(const TestOptions& options) const
     if (m_options.overrideLanguages != options.overrideLanguages
         || m_options.needsSiteSpecificQuirks != options.needsSiteSpecificQuirks
         || m_options.useCharacterSelectionGranularity != options.useCharacterSelectionGranularity
-        || m_options.enableIntersectionObserver != options.enableIntersectionObserver)
+        || m_options.enableIntersectionObserver != options.enableIntersectionObserver
+        || m_options.enableModernMediaControls != options.enableModernMediaControls)
         return false;
 
     return true;
index 025873a..e31d823 100644 (file)
@@ -277,7 +277,8 @@ bool PlatformWebView::viewSupportsOptions(const TestOptions& options) const
         || m_options.overrideLanguages != options.overrideLanguages
         || m_options.useMockScrollbars != options.useMockScrollbars
         || m_options.needsSiteSpecificQuirks != options.needsSiteSpecificQuirks
-        || m_options.enableIntersectionObserver != options.enableIntersectionObserver)
+        || m_options.enableIntersectionObserver != options.enableIntersectionObserver
+        || m_options.enableModernMediaControls != options.enableModernMediaControls)
         return false;
 
     return true;