Title: [234652] trunk/Source
Revision
234652
Author
pvol...@apple.com
Date
2018-08-07 09:15:26 -0700 (Tue, 07 Aug 2018)

Log Message

[macOS] Scrollbars are not visible when using 3rd party mouse
https://bugs.webkit.org/show_bug.cgi?id=188372

Reviewed by Simon Fraser.

Source/WebCore/PAL:

Added declaration of NSScrollerImpPair class method. This method updates all NSScrollerImpPairs
with a new recommended scroller style.

* pal/spi/mac/NSScrollerImpSPI.h:

Source/WebKit:

The scrollbars are not visible because they are not updated with the recommended scroller style
when a 3rd party mouse is used. They still have the overlay style, but the system is
recommending the legacy style in this case. The UI process is currently notifying the WebProcess
about changes in the scroller style, but the current style is not set in the WebProcess on
startup. This patch sets the initial scroller style in the WebProcess by passing it as part of
the WebProcess creation parameters. Also, to make sure hot-plugging of a 3rd party mouse is
is visually changing the scroller style of the current page, a class method in NSScrollerImpPair
is called to update all NSScrollerImpPairs with the new recommended style. This method was
previously called by AppKit, but after blocking WindowServer access, AppKit is no longer calling
this method. This has been manually tested by using a 3rd party mouse.

* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode const):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):
(WebKit::WebProcess::scrollerStylePreferenceChanged):

Modified Paths

Diff

Modified: trunk/Source/WebCore/PAL/ChangeLog (234651 => 234652)


--- trunk/Source/WebCore/PAL/ChangeLog	2018-08-07 16:08:48 UTC (rev 234651)
+++ trunk/Source/WebCore/PAL/ChangeLog	2018-08-07 16:15:26 UTC (rev 234652)
@@ -1,3 +1,15 @@
+2018-08-07  Per Arne Vollan  <pvol...@apple.com>
+
+        [macOS] Scrollbars are not visible when using 3rd party mouse
+        https://bugs.webkit.org/show_bug.cgi?id=188372
+
+        Reviewed by Simon Fraser.
+
+        Added declaration of NSScrollerImpPair class method. This method updates all NSScrollerImpPairs
+        with a new recommended scroller style.
+
+        * pal/spi/mac/NSScrollerImpSPI.h:
+
 2018-08-02  David Fenton  <david_fen...@apple.com>
 
         Unreviewed, rolling out r234489.

Modified: trunk/Source/WebCore/PAL/pal/spi/mac/NSScrollerImpSPI.h (234651 => 234652)


--- trunk/Source/WebCore/PAL/pal/spi/mac/NSScrollerImpSPI.h	2018-08-07 16:08:48 UTC (rev 234651)
+++ trunk/Source/WebCore/PAL/pal/spi/mac/NSScrollerImpSPI.h	2018-08-07 16:15:26 UTC (rev 234652)
@@ -38,6 +38,7 @@
 
 @interface NSScrollerImpPair ()
 + (NSUserInterfaceLayoutDirection)scrollerLayoutDirection;
++ (void)_updateAllScrollerImpPairsForNewRecommendedScrollerStyle:(NSScrollerStyle)newRecommendedScrollerStyle;
 @end
 
 #else
@@ -133,6 +134,7 @@
 - (void)endLiveResize;
 - (void)beginScrollGesture;
 - (void)endScrollGesture;
++ (void)_updateAllScrollerImpPairsForNewRecommendedScrollerStyle:(NSScrollerStyle)newRecommendedScrollerStyle;
 @end
 
 @protocol NSScrollerImpPairDelegate

Modified: trunk/Source/WebKit/ChangeLog (234651 => 234652)


--- trunk/Source/WebKit/ChangeLog	2018-08-07 16:08:48 UTC (rev 234651)
+++ trunk/Source/WebKit/ChangeLog	2018-08-07 16:15:26 UTC (rev 234652)
@@ -1,3 +1,31 @@
+2018-08-07  Per Arne Vollan  <pvol...@apple.com>
+
+        [macOS] Scrollbars are not visible when using 3rd party mouse
+        https://bugs.webkit.org/show_bug.cgi?id=188372
+
+        Reviewed by Simon Fraser.
+
+        The scrollbars are not visible because they are not updated with the recommended scroller style
+        when a 3rd party mouse is used. They still have the overlay style, but the system is
+        recommending the legacy style in this case. The UI process is currently notifying the WebProcess
+        about changes in the scroller style, but the current style is not set in the WebProcess on
+        startup. This patch sets the initial scroller style in the WebProcess by passing it as part of
+        the WebProcess creation parameters. Also, to make sure hot-plugging of a 3rd party mouse is
+        is visually changing the scroller style of the current page, a class method in NSScrollerImpPair
+        is called to update all NSScrollerImpPairs with the new recommended style. This method was
+        previously called by AppKit, but after blocking WindowServer access, AppKit is no longer calling
+        this method. This has been manually tested by using a 3rd party mouse.
+
+        * Shared/WebProcessCreationParameters.cpp:
+        (WebKit::WebProcessCreationParameters::encode const):
+        (WebKit::WebProcessCreationParameters::decode):
+        * Shared/WebProcessCreationParameters.h:
+        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+        (WebKit::WebProcessPool::platformInitializeWebProcess):
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        (WebKit::WebProcess::platformInitializeWebProcess):
+        (WebKit::WebProcess::scrollerStylePreferenceChanged):
+
 2018-08-06  Andy Estes  <aes...@apple.com>
 
         [Wi-Fi Assertions] suspendWiFiAssertions() should be able to delay sending ProcessReadyToSuspend

Modified: trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp (234651 => 234652)


--- trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp	2018-08-07 16:08:48 UTC (rev 234651)
+++ trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp	2018-08-07 16:15:26 UTC (rev 234652)
@@ -159,6 +159,7 @@
 
 #if PLATFORM(MAC)
     encoder << screenProperties;
+    encoder << useOverlayScrollbars;
 #endif
 }
 
@@ -417,6 +418,8 @@
     if (!screenProperties)
         return false;
     parameters.screenProperties = WTFMove(*screenProperties);
+    if (!decoder.decode(parameters.useOverlayScrollbars))
+        return false;
 #endif
 
     return true;

Modified: trunk/Source/WebKit/Shared/WebProcessCreationParameters.h (234651 => 234652)


--- trunk/Source/WebKit/Shared/WebProcessCreationParameters.h	2018-08-07 16:08:48 UTC (rev 234651)
+++ trunk/Source/WebKit/Shared/WebProcessCreationParameters.h	2018-08-07 16:15:26 UTC (rev 234652)
@@ -198,6 +198,7 @@
 
 #if PLATFORM(MAC)
     WebCore::ScreenProperties screenProperties;
+    bool useOverlayScrollbars { true };
 #endif
 };
 

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm (234651 => 234652)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2018-08-07 16:08:48 UTC (rev 234651)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2018-08-07 16:15:26 UTC (rev 234652)
@@ -286,6 +286,7 @@
 #if PLATFORM(MAC)
     auto screenProperties = WebCore::collectScreenProperties();
     parameters.screenProperties = WTFMove(screenProperties);
+    parameters.useOverlayScrollbars = ([NSScroller preferredScrollerStyle] == NSScrollerStyleOverlay);
 #endif
 }
 

Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (234651 => 234652)


--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2018-08-07 16:08:48 UTC (rev 234651)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2018-08-07 16:15:26 UTC (rev 234652)
@@ -87,6 +87,7 @@
 
 #if PLATFORM(MAC)
 #import <WebCore/ScrollbarThemeMac.h>
+#import <pal/spi/mac/NSScrollerImpSPI.h>
 #endif
 
 #if USE(OS_STATE)
@@ -197,7 +198,10 @@
 
 #if PLATFORM(MAC)
     WebCore::setScreenProperties(parameters.screenProperties);
+#if ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
+    scrollerStylePreferenceChanged(parameters.useOverlayScrollbars);
 #endif
+#endif
 }
 
 void WebProcess::initializeProcessName(const ChildProcessInitializationParameters& parameters)
@@ -592,6 +596,9 @@
         return;
 
     static_cast<ScrollbarThemeMac&>(theme).preferencesChanged();
+    
+    NSScrollerStyle style = useOverlayScrollbars ? NSScrollerStyleOverlay : NSScrollerStyleLegacy;
+    [NSScrollerImpPair _updateAllScrollerImpPairsForNewRecommendedScrollerStyle:style];
 }
 #endif    
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to