WebKit Bugzilla
Attachment 348830 Details for
Bug 188379
: [macOS] Create a test for scrollbar visibility when 3rd party mouse is used.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188379-20180904111351.patch (text/plain), 10.92 KB, created by
Per Arne Vollan
on 2018-09-04 11:13:51 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Per Arne Vollan
Created:
2018-09-04 11:13:51 PDT
Size:
10.92 KB
patch
obsolete
>Index: Tools/ChangeLog >=================================================================== >--- Tools/ChangeLog (revision 235619) >+++ Tools/ChangeLog (working copy) >@@ -1,3 +1,30 @@ >+2018-09-04 Per Arne Vollan <pvollan@apple.com> >+ >+ [macOS] Create a test for scrollbar visibility when 3rd party mouse is used. >+ https://bugs.webkit.org/show_bug.cgi?id=188379 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ When a 3rd party mouse is plugged in, the UI process will receive a notification >+ (NSPreferredScrollerStyleDidChangeNotification), where the legacy scrollbar style >+ is the new preferred style. To simulate this in the test framework, a new WK C API >+ function is added which will notify all WebContent processes that the new preferred >+ scroller style is the legacy one. This API function can be invoked from JavaScript. >+ This test will validate that the layout actually changes when receiving this message >+ from the UI process, since it will force scrollbars to become visible. >+ >+ * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: >+ * WebKitTestRunner/InjectedBundle/TestRunner.cpp: >+ (WTR::TestRunner::setUseOverlayScrollbarsForTesting): >+ * WebKitTestRunner/InjectedBundle/TestRunner.h: >+ * WebKitTestRunner/TestController.h: >+ (WTR::TestController::usesOverlayScrollbarsForTesting const): >+ * WebKitTestRunner/TestInvocation.cpp: >+ (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): >+ * WebKitTestRunner/mac/TestControllerMac.mm: >+ (WTR::preferredScrollerStyle): >+ (WTR::TestController::setUseOverlayScrollbarsForTesting): >+ > 2018-09-04 Jer Noble <jer.noble@apple.com> > > REGRESSION (r234081): TestWebKitAPI.VideoControlsManager.VideoControlsManagerAudioElementFollowingUserInteraction is a flaky timeout >Index: Tools/WebKitTestRunner/TestController.h >=================================================================== >--- Tools/WebKitTestRunner/TestController.h (revision 235619) >+++ Tools/WebKitTestRunner/TestController.h (working copy) >@@ -251,6 +251,11 @@ public: > void injectUserScript(WKStringRef); > > void sendDisplayConfigurationChangedMessageForTesting(); >+ >+#if PLATFORM(MAC) >+ void setUseOverlayScrollbarsForTesting(bool); >+ bool useOverlayScrollbarsForTesting() const { return m_useOverlayScrollbars; } >+#endif > > private: > WKRetainPtr<WKPageConfigurationRef> generatePageConfiguration(WKContextConfigurationRef); >@@ -481,6 +486,10 @@ private: > > bool m_didReceiveServerRedirectForProvisionalNavigation { false }; > >+#if PLATFORM(MAC) >+ bool m_useOverlayScrollbars { false }; >+#endif >+ > WKRetainPtr<WKArrayRef> m_openPanelFileURLs; > > std::unique_ptr<EventSenderProxy> m_eventSenderProxy; >Index: Tools/WebKitTestRunner/TestInvocation.cpp >=================================================================== >--- Tools/WebKitTestRunner/TestInvocation.cpp (revision 235619) >+++ Tools/WebKitTestRunner/TestInvocation.cpp (working copy) >@@ -1417,6 +1417,15 @@ WKRetainPtr<WKTypeRef> TestInvocation::d > return nullptr; > } > >+#if PLATFORM(MAC) >+ if (WKStringIsEqualToUTF8CString(messageName, "SetUseOverlayScrollbarsForTesting")) { >+ ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID()); >+ WKBooleanRef value = static_cast<WKBooleanRef>(messageBody); >+ TestController::singleton().setUseOverlayScrollbarsForTesting(WKBooleanGetValue(value)); >+ return nullptr; >+ } >+#endif >+ > if (WKStringIsEqualToUTF8CString(messageName, "TerminateStorageProcess")) { > ASSERT(!messageBody); > TestController::singleton().terminateStorageProcess(); >Index: Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp >=================================================================== >--- Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (revision 235619) >+++ Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (working copy) >@@ -2328,4 +2328,13 @@ void TestRunner::sendDisplayConfiguratio > WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), nullptr, nullptr); > } > >+void TestRunner::setUseOverlayScrollbarsForTesting(bool useOverlayScrollbars) >+{ >+#if PLATFORM(MAC) >+ WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetUseOverlayScrollbarsForTesting")); >+ WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(useOverlayScrollbars)); >+ WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); >+#endif >+} >+ > } // namespace WTR >Index: Tools/WebKitTestRunner/InjectedBundle/TestRunner.h >=================================================================== >--- Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (revision 235619) >+++ Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (working copy) >@@ -465,6 +465,8 @@ public: > > void sendDisplayConfigurationChangedMessageForTesting(); > >+ void setUseOverlayScrollbarsForTesting(bool); >+ > private: > TestRunner(); > >Index: Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl >=================================================================== >--- Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (revision 235619) >+++ Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (working copy) >@@ -347,4 +347,6 @@ interface TestRunner { > readonly attribute unsigned long userScriptInjectedCount; > > void sendDisplayConfigurationChangedMessageForTesting(); >+ >+ void setUseOverlayScrollbarsForTesting(boolean useOverlayScrollbars); > }; >Index: Tools/WebKitTestRunner/mac/TestControllerMac.mm >=================================================================== >--- Tools/WebKitTestRunner/mac/TestControllerMac.mm (revision 235619) >+++ Tools/WebKitTestRunner/mac/TestControllerMac.mm (working copy) >@@ -350,4 +350,18 @@ const char* TestController::platformLibr > return [[@"~/Library/Application Support/DumpRenderTree" stringByExpandingTildeInPath] UTF8String]; > } > >+static NSScrollerStyle preferredScrollerStyle() >+{ >+ return TestController::singleton().useOverlayScrollbarsForTesting() ? NSScrollerStyleOverlay : NSScrollerStyleLegacy; >+} >+ >+void TestController::setUseOverlayScrollbarsForTesting(bool useOverlayScrollbars) >+{ >+ m_useOverlayScrollbars = useOverlayScrollbars; >+ Method preferredScrollerStyleMethod = class_getClassMethod(objc_getClass("NSScroller"), @selector(preferredScrollerStyle)); >+ IMP previousImplementation = method_setImplementation(preferredScrollerStyleMethod, reinterpret_cast<IMP>(preferredScrollerStyle)); >+ [[NSNotificationCenter defaultCenter] postNotificationName:NSPreferredScrollerStyleDidChangeNotification object:nil]; >+ method_setImplementation(preferredScrollerStyleMethod, previousImplementation); >+} >+ > } // namespace WTR >Index: LayoutTests/ChangeLog >=================================================================== >--- LayoutTests/ChangeLog (revision 235619) >+++ LayoutTests/ChangeLog (working copy) >@@ -1,3 +1,23 @@ >+2018-09-04 Per Arne Vollan <pvollan@apple.com> >+ >+ [macOS] Create a test for scrollbar visibility when 3rd party mouse is used. >+ https://bugs.webkit.org/show_bug.cgi?id=188379 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ When a 3rd party mouse is plugged in, the UI process will receive a notification >+ (NSPreferredScrollerStyleDidChangeNotification), where the legacy scrollbar style >+ is the new preferred style. To simulate this in the test framework, a new WK C API >+ function is added which will notify all WebContent processes that the new preferred >+ scroller style is the legacy one. This API function can be invoked from JavaScript. >+ This test will validate that the layout actually changes when receiving this message >+ from the UI process, since it will force scrollbars to become visible. >+ >+ * TestExpectations: >+ * fast/scrolling/scrollbar-style-external-mouse-expected.txt: Added. >+ * fast/scrolling/scrollbar-style-external-mouse.html: Added. >+ * platform/mac-wk2/TestExpectations: >+ > 2018-09-04 Per Arne Vollan <pvollan@apple.com> > > Add test for fix in https://bugs.webkit.org/show_bug.cgi?id=187922 >Index: LayoutTests/TestExpectations >=================================================================== >--- LayoutTests/TestExpectations (revision 235619) >+++ LayoutTests/TestExpectations (working copy) >@@ -404,6 +404,8 @@ fast/canvas/webgl/context-update-on-disp > > fast/misc/valid-primary-screen-displayID.html [ Skip ] > >+fast/scrolling/scrollbar-style-external-mouse.html [ Skip ] >+ > #////////////////////////////////////////////////////////////////////////////////////////// > # End platform-specific tests. > #////////////////////////////////////////////////////////////////////////////////////////// >Index: LayoutTests/fast/scrolling/scrollbar-style-external-mouse-expected.txt >=================================================================== >--- LayoutTests/fast/scrolling/scrollbar-style-external-mouse-expected.txt (nonexistent) >+++ LayoutTests/fast/scrolling/scrollbar-style-external-mouse-expected.txt (working copy) >@@ -0,0 +1,8 @@ >+layer at (0,0) size 1008x1016 >+ RenderView at (0,0) size 785x585 >+layer at (0,0) size 785x1016 >+ RenderBlock {HTML} at (0,0) size 785x1016 >+ RenderBody {BODY} at (8,8) size 769x1000 >+ RenderBlock {DIV} at (0,0) size 1000x1000 [bgcolor=#CCCCCC] >+ RenderText {#text} at (0,0) size 51x18 >+ text run at (0,0) width 51: "Test div" >Index: LayoutTests/fast/scrolling/scrollbar-style-external-mouse.html >=================================================================== >--- LayoutTests/fast/scrolling/scrollbar-style-external-mouse.html (nonexistent) >+++ LayoutTests/fast/scrolling/scrollbar-style-external-mouse.html (working copy) >@@ -0,0 +1,29 @@ >+<!DOCTYPE html><!-- webkit-test-runner [ useMockScrollbars=false ] --> >+<html> >+<head> >+<style> >+.div { >+ width: 1000px; >+ height: 1000px; >+ background-color: #ccc; >+} >+</style> >+</head> >+<script> >+if (window.testRunner) { >+ testRunner.waitUntilDone(); >+} >+ >+function onLoad() >+{ >+ if (window.testRunner) { >+ testRunner.setUseOverlayScrollbarsForTesting(false); >+ setTimeout(function(){ testRunner.notifyDone(); }, 10); >+ } >+} >+</script> >+ >+<body onload="onLoad()"> >+<div class="div">Test div</div> >+</body> >+</html> >Index: LayoutTests/platform/mac-wk2/TestExpectations >=================================================================== >--- LayoutTests/platform/mac-wk2/TestExpectations (revision 235619) >+++ LayoutTests/platform/mac-wk2/TestExpectations (working copy) >@@ -57,6 +57,8 @@ webkit.org/b/187183 http/tests/security/ > > fast/misc/valid-primary-screen-displayID.html [ Pass ] > >+[ Mojave+ ] fast/scrolling/scrollbar-style-external-mouse.html [ Pass ] >+ > #////////////////////////////////////////////////////////////////////////////////////////// > # End platform-specific directories. > #//////////////////////////////////////////////////////////////////////////////////////////
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188379
:
347852
|
347853
|
347857
|
347864
|
347865
|
347867
|
347874
|
347890
|
347891
|
347892
|
347917
|
347930
|
348030
|
348152
|
348830
|
348863
|
348945
|
349479