[Win][DRT] Implement setSpatialNavigationEnabled.
authorross.kirsling@sony.com <ross.kirsling@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Mar 2018 21:50:41 +0000 (21:50 +0000)
committerross.kirsling@sony.com <ross.kirsling@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Mar 2018 21:50:41 +0000 (21:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=183166

Reviewed by Per Arne Vollan.

Source/WebKitLegacy/win:

Create a non-dummy implementation of the private preference in Win WKL to support layout tests.

* Interfaces/IWebPreferencesPrivate.idl:
* WebPreferenceKeysPrivate.h:
* WebPreferences.cpp:
(WebPreferences::initializeDefaultSettings):
(WebPreferences::spatialNavigationEnabled):
(WebPreferences::setSpatialNavigationEnabled):
* WebPreferences.h:
* WebView.cpp:
(WebView::notifyPreferencesChanged):

Tools:

* DumpRenderTree/TestRunner.cpp:
(setSpatialNavigationEnabledCallback):
* DumpRenderTree/win/DumpRenderTree.cpp:
(resetWebPreferencesToConsistentValues):
* DumpRenderTree/win/TestRunnerWin.cpp:
(TestRunner::setSpatialNavigationEnabled):

LayoutTests:

* platform/win/fast/spatial-navigation/snav-multiple-select-focusring-expected.txt:
* platform/wincairo/fast/spatial-navigation/snav-multiple-select-focusring-expected.txt: Added.
This test requires an expectation for every platform. AppleWin had one but it must've been a copy-paste job?

* platform/win/TestExpectations:
Enable fast/spatial-navigation tests on AppleWin too.

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

14 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/win/TestExpectations
LayoutTests/platform/win/fast/spatial-navigation/snav-multiple-select-focusring-expected.txt
LayoutTests/platform/wincairo/fast/spatial-navigation/snav-multiple-select-focusring-expected.txt [new file with mode: 0644]
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/Interfaces/IWebPreferencesPrivate.idl
Source/WebKitLegacy/win/WebPreferenceKeysPrivate.h
Source/WebKitLegacy/win/WebPreferences.cpp
Source/WebKitLegacy/win/WebPreferences.h
Source/WebKitLegacy/win/WebView.cpp
Tools/ChangeLog
Tools/DumpRenderTree/TestRunner.cpp
Tools/DumpRenderTree/win/DumpRenderTree.cpp
Tools/DumpRenderTree/win/TestRunnerWin.cpp

index 81d8d90..85197b8 100644 (file)
@@ -1,3 +1,17 @@
+2018-03-01  Ross Kirsling  <ross.kirsling@sony.com>
+
+        [Win][DRT] Implement setSpatialNavigationEnabled.
+        https://bugs.webkit.org/show_bug.cgi?id=183166
+
+        Reviewed by Per Arne Vollan.
+
+        * platform/win/fast/spatial-navigation/snav-multiple-select-focusring-expected.txt:
+        * platform/wincairo/fast/spatial-navigation/snav-multiple-select-focusring-expected.txt: Added.
+        This test requires an expectation for every platform. AppleWin had one but it must've been a copy-paste job?
+
+        * platform/win/TestExpectations:
+        Enable fast/spatial-navigation tests on AppleWin too.
+
 2018-03-01  Chris Dumez  <cdumez@apple.com>
 
         imported/w3c/web-platform-tests/html/browsers/windows/browsing-context.html fails with async policy delegates
index fe29983..b866296 100644 (file)
@@ -225,9 +225,6 @@ fast/events/mouseover-button.html [ Skip ]
 # TODO Accept header is handled by the browser
 http/tests/misc/image-checks-for-accept.html [ Skip ]
 
-# TODO Need to add functionality to DumpRenderTree to handle enable/disable Spatial Navigation
-fast/spatial-navigation/ [ Skip ]
-
 # Need to implement AccessibilityUIElement::clearSelectedChildren()
 accessibility/aria-listbox-clear-selection-crash.html [ Skip ]
 accessibility/listbox-clear-selection.html [ Skip ]
index 4bab9ca..7dba26d 100644 (file)
@@ -1,8 +1,8 @@
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
-layer at (0,0) size 800x77
-  RenderBlock {HTML} at (0,0) size 800x77
-    RenderBody {BODY} at (8,8) size 784x61
-      RenderListBox {SELECT} at (2,2) size 377x57 [bgcolor=#FFFFFF] [border: (1px inset #808080)]
+layer at (0,0) size 800x85
+  RenderBlock {HTML} at (0,0) size 800x85
+    RenderBody {BODY} at (8,8) size 784x69
+      RenderListBox {SELECT} at (2,2) size 372x65 [bgcolor=#FFFFFF] [border: (1px inset #808080)]
       RenderText {#text} at (0,0) size 0x0
       RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/wincairo/fast/spatial-navigation/snav-multiple-select-focusring-expected.txt b/LayoutTests/platform/wincairo/fast/spatial-navigation/snav-multiple-select-focusring-expected.txt
new file mode 100644 (file)
index 0000000..6049fb6
--- /dev/null
@@ -0,0 +1,8 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x89
+  RenderBlock {HTML} at (0,0) size 800x89
+    RenderBody {BODY} at (8,8) size 784x73
+      RenderListBox {SELECT} at (2,2) size 384x69 [bgcolor=#FFFFFF] [border: (1px inset #808080)]
+      RenderText {#text} at (0,0) size 0x0
+      RenderText {#text} at (0,0) size 0x0
index 5c38d81..0f1f6d2 100644 (file)
@@ -1,3 +1,22 @@
+2018-03-01  Ross Kirsling  <ross.kirsling@sony.com>
+
+        [Win][DRT] Implement setSpatialNavigationEnabled.
+        https://bugs.webkit.org/show_bug.cgi?id=183166
+
+        Reviewed by Per Arne Vollan.
+
+        Create a non-dummy implementation of the private preference in Win WKL to support layout tests.
+
+        * Interfaces/IWebPreferencesPrivate.idl:
+        * WebPreferenceKeysPrivate.h:
+        * WebPreferences.cpp:
+        (WebPreferences::initializeDefaultSettings):
+        (WebPreferences::spatialNavigationEnabled):
+        (WebPreferences::setSpatialNavigationEnabled):
+        * WebPreferences.h:
+        * WebView.cpp:
+        (WebView::notifyPreferencesChanged):
+
 2018-02-28  Alex Christensen  <achristensen@webkit.org>
 
         Reduce use of NetworkingContext in WebKit
index 12ecec0..7f3214c 100644 (file)
@@ -221,4 +221,6 @@ interface IWebPreferencesPrivate6 : IWebPreferencesPrivate5
     HRESULT setVisualViewportAPIEnabled([in] BOOL enabled);
     HRESULT fetchAPIKeepAliveEnabled([out, retval] BOOL* enabled);
     HRESULT setFetchAPIKeepAliveEnabled([in] BOOL enabled);
+    HRESULT spatialNavigationEnabled([out, retval] BOOL *enabled);
+    HRESULT setSpatialNavigationEnabled([in] BOOL enabled);
 }
index 3d94796..a16ee1c 100644 (file)
 
 #define WebKitCustomDragCursorsEnabledPreferenceKey "WebKitCustomDragCursorsEnabled"
 
+#define WebKitSpatialNavigationEnabledPreferenceKey "WebKitSpatialNavigationEnabled"
+
 #define WebKitDNSPrefetchingEnabledPreferenceKey "WebKitDNSPrefetchingEnabled"
 
 #define WebKitFullScreenEnabledPreferenceKey "WebKitFullScreenEnabled"
index be3eb31..cb047c5 100644 (file)
@@ -285,6 +285,8 @@ void WebPreferences::initializeDefaultSettings()
 
     CFDictionaryAddValue(defaults, CFSTR(WebKitShowDebugBordersPreferenceKey), kCFBooleanFalse);
 
+    CFDictionaryAddValue(defaults, CFSTR(WebKitSpatialNavigationEnabledPreferenceKey), kCFBooleanFalse);
+
     CFDictionaryAddValue(defaults, CFSTR(WebKitDNSPrefetchingEnabledPreferenceKey), kCFBooleanFalse);
 
     CFDictionaryAddValue(defaults, CFSTR(WebKitHyperlinkAuditingEnabledPreferenceKey), kCFBooleanTrue);
@@ -1728,6 +1730,20 @@ HRESULT WebPreferences::customDragCursorsEnabled(_Out_ BOOL* enabled)
     return S_OK;
 }
 
+HRESULT WebPreferences::spatialNavigationEnabled(_Out_ BOOL* enabled)
+{
+    if (!enabled)
+        return E_POINTER;
+    *enabled = boolValueForKey(WebKitSpatialNavigationEnabledPreferenceKey);
+    return S_OK;
+}
+
+HRESULT WebPreferences::setSpatialNavigationEnabled(BOOL enabled)
+{
+    setBoolValue(WebKitSpatialNavigationEnabledPreferenceKey, enabled);
+    return S_OK;
+}
+
 HRESULT WebPreferences::setDNSPrefetchingEnabled(BOOL enabled)
 {
     setBoolValue(WebKitDNSPrefetchingEnabledPreferenceKey, enabled);
index 59a5025..b77a557 100644 (file)
@@ -269,6 +269,8 @@ public:
     virtual HRESULT STDMETHODCALLTYPE setVisualViewportAPIEnabled(BOOL);
     virtual HRESULT STDMETHODCALLTYPE fetchAPIKeepAliveEnabled(_Out_ BOOL*);
     virtual HRESULT STDMETHODCALLTYPE setFetchAPIKeepAliveEnabled(BOOL);
+    virtual HRESULT STDMETHODCALLTYPE spatialNavigationEnabled(_Out_ BOOL*);
+    virtual HRESULT STDMETHODCALLTYPE setSpatialNavigationEnabled(BOOL);
 
     // WebPreferences
 
index e4c6002..08bbc6c 100644 (file)
@@ -5474,6 +5474,11 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification)
     settings.setWebGLEnabled(true);
 #endif // ENABLE(WEBGL)
 
+    hr = prefsPrivate->spatialNavigationEnabled(&enabled);
+    if (FAILED(hr))
+        return hr;
+    settings.setSpatialNavigationEnabled(!!enabled);
+
     hr = prefsPrivate->isDNSPrefetchingEnabled(&enabled);
     if (FAILED(hr))
         return hr;
index 3fd933c..101fb29 100644 (file)
@@ -1,3 +1,17 @@
+2018-03-01  Ross Kirsling  <ross.kirsling@sony.com>
+
+        [Win][DRT] Implement setSpatialNavigationEnabled.
+        https://bugs.webkit.org/show_bug.cgi?id=183166
+
+        Reviewed by Per Arne Vollan.
+
+        * DumpRenderTree/TestRunner.cpp:
+        (setSpatialNavigationEnabledCallback):
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (resetWebPreferencesToConsistentValues):
+        * DumpRenderTree/win/TestRunnerWin.cpp:
+        (TestRunner::setSpatialNavigationEnabled):
+
 2018-03-01  Basuke Suzuki  <Basuke.Suzuki@sony.com>
 
         [webkitpy] Use shell=False to launch apache http server.
index 72c645c..e2b489c 100644 (file)
@@ -1184,7 +1184,7 @@ static JSValueRef setXSSAuditorEnabledCallback(JSContextRef context, JSObjectRef
 
 static JSValueRef setSpatialNavigationEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
-    // Has mac implementation.
+    // Has mac & windows implementation.
     if (argumentCount < 1)
         return JSValueMakeUndefined(context);
 
index 8cc9cb7..06cd990 100644 (file)
@@ -856,7 +856,7 @@ static void resetWebPreferencesToConsistentValues(IWebPreferences* preferences)
     preferences->setLoadsImagesAutomatically(TRUE);
     prefsPrivate->setLoadsSiteIconsIgnoringImageLoadingPreference(FALSE);
     prefsPrivate->setFrameFlatteningEnabled(FALSE);
-    // Set spatial navigation enabled: NO
+    prefsPrivate->setSpatialNavigationEnabled(FALSE);
     if (persistentUserStyleSheetLocation) {
         size_t stringLength = CFStringGetLength(persistentUserStyleSheetLocation.get());
         Vector<UniChar> urlCharacters(stringLength + 1, 0);
index 14f71e9..69c3514 100644 (file)
@@ -534,8 +534,19 @@ void TestRunner::setXSSAuditorEnabled(bool enabled)
 
 void TestRunner::setSpatialNavigationEnabled(bool enabled)
 {
-    // FIXME: Implement for SpatialNavigation layout tests.
-    fprintf(testResult, "ERROR: TestRunner::setSpatialNavigationEnabled(bool) not implemented\n");
+    COMPtr<IWebView> webView;
+    if (FAILED(frame->webView(&webView)))
+        return;
+
+    COMPtr<IWebPreferences> preferences;
+    if (FAILED(webView->preferences(&preferences)))
+        return;
+
+    COMPtr<IWebPreferencesPrivate6> prefsPrivate(Query, preferences);
+    if (!prefsPrivate)
+        return;
+
+    prefsPrivate->setSpatialNavigationEnabled(enabled);
 }
 
 void TestRunner::setAllowUniversalAccessFromFileURLs(bool enabled)