WebKit Bugzilla
Attachment 349479 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-20180911154704.patch (text/plain), 10.03 KB, created by
Per Arne Vollan
on 2018-09-11 15:47:05 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Per Arne Vollan
Created:
2018-09-11 15:47:05 PDT
Size:
10.03 KB
patch
obsolete
>Index: Tools/ChangeLog >=================================================================== >--- Tools/ChangeLog (revision 235916) >+++ Tools/ChangeLog (working copy) >@@ -1,3 +1,30 @@ >+2018-09-11 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 test >+ runner method is added which will post a NSPreferredScrollerStyleDidChangeNotification, >+ and make [NSScroller preferredScrollerStyle] return the legacy scroller style by >+ swizzling. 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-11 Wenson Hsieh <wenson_hsieh@apple.com> > > [macOS] [WK2] Support changing foreground colors via color panel >Index: Tools/WebKitTestRunner/TestController.h >=================================================================== >--- Tools/WebKitTestRunner/TestController.h (revision 235916) >+++ Tools/WebKitTestRunner/TestController.h (working copy) >@@ -252,6 +252,10 @@ public: > void injectUserScript(WKStringRef); > > void sendDisplayConfigurationChangedMessageForTesting(); >+ >+#if PLATFORM(MAC) >+ void setUseLegacyScrollbarsForTesting(); >+#endif > > private: > WKRetainPtr<WKPageConfigurationRef> generatePageConfiguration(WKContextConfigurationRef); >Index: Tools/WebKitTestRunner/TestInvocation.cpp >=================================================================== >--- Tools/WebKitTestRunner/TestInvocation.cpp (revision 235916) >+++ Tools/WebKitTestRunner/TestInvocation.cpp (working copy) >@@ -1427,6 +1427,13 @@ WKRetainPtr<WKTypeRef> TestInvocation::d > return nullptr; > } > >+#if PLATFORM(MAC) >+ if (WKStringIsEqualToUTF8CString(messageName, "SetUseLegacyScrollbarsForTesting")) { >+ TestController::singleton().setUseLegacyScrollbarsForTesting(); >+ return nullptr; >+ } >+#endif >+ > if (WKStringIsEqualToUTF8CString(messageName, "TerminateStorageProcess")) { > ASSERT(!messageBody); > TestController::singleton().terminateStorageProcess(); >Index: Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp >=================================================================== >--- Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (revision 235916) >+++ Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (working copy) >@@ -2341,4 +2341,12 @@ void TestRunner::sendDisplayConfiguratio > WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), nullptr, nullptr); > } > >+void TestRunner::setUseLegacyScrollbarsForTesting() >+{ >+#if PLATFORM(MAC) >+ WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetUseLegacyScrollbarsForTesting")); >+ WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), nullptr, nullptr); >+#endif >+} >+ > } // namespace WTR >Index: Tools/WebKitTestRunner/InjectedBundle/TestRunner.h >=================================================================== >--- Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (revision 235916) >+++ Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (working copy) >@@ -467,6 +467,8 @@ public: > > void sendDisplayConfigurationChangedMessageForTesting(); > >+ void setUseLegacyScrollbarsForTesting(); >+ > private: > TestRunner(); > >Index: Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl >=================================================================== >--- Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (revision 235916) >+++ Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (working copy) >@@ -350,4 +350,6 @@ interface TestRunner { > readonly attribute unsigned long userScriptInjectedCount; > > void sendDisplayConfigurationChangedMessageForTesting(); >+ >+ void setUseLegacyScrollbarsForTesting(); > }; >Index: Tools/WebKitTestRunner/mac/TestControllerMac.mm >=================================================================== >--- Tools/WebKitTestRunner/mac/TestControllerMac.mm (revision 235916) >+++ Tools/WebKitTestRunner/mac/TestControllerMac.mm (working copy) >@@ -350,4 +350,17 @@ const char* TestController::platformLibr > return [[@"~/Library/Application Support/DumpRenderTree" stringByExpandingTildeInPath] UTF8String]; > } > >+static NSScrollerStyle preferredScrollerStyle() >+{ >+ return NSScrollerStyleLegacy; >+} >+ >+void TestController::setUseLegacyScrollbarsForTesting() >+{ >+ 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 235916) >+++ LayoutTests/ChangeLog (working copy) >@@ -1,3 +1,23 @@ >+2018-09-11 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 test >+ runner method is added which will post a NSPreferredScrollerStyleDidChangeNotification, >+ and make [NSScroller preferredScrollerStyle] return the legacy scroller style by >+ swizzling. 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-11 Ryosuke Niwa <rniwa@webkit.org> > > Updated the test expectation as this test also causes a crash in release builds. >Index: LayoutTests/TestExpectations >=================================================================== >--- LayoutTests/TestExpectations (revision 235916) >+++ LayoutTests/TestExpectations (working copy) >@@ -403,6 +403,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.setUseLegacyScrollbarsForTesting(); >+ 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 235916) >+++ LayoutTests/platform/mac-wk2/TestExpectations (working copy) >@@ -59,6 +59,8 @@ fast/misc/valid-primary-screen-displayID > > webkit.org/b/187773 http/tests/webAPIStatistics [ 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