Title: [180607] trunk/Source
Revision
180607
Author
simon.fra...@apple.com
Date
2015-02-24 20:07:06 -0800 (Tue, 24 Feb 2015)

Log Message

Use an enum for scrollbar style
https://bugs.webkit.org/show_bug.cgi?id=141985

Reviewed by Beth Dakin.
Source/WebCore:

Switch to an enum class for the scrollbar style (normal or overlay).

* page/ChromeClient.h:
* page/FrameView.cpp:
(WebCore::FrameView::scrollbarStyleChanged):
* page/FrameView.h:
* platform/ScrollTypes.h:
* platform/ScrollView.cpp:
(WebCore::ScrollView::scrollbarStyleChanged):
* platform/ScrollView.h:
* platform/ScrollableArea.h:
(WebCore::ScrollableArea::scrollbarStyleChanged):
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::updateScrollerStyle):

Source/WebKit2:

Switch to an enum class for the scrollbar style (normal or overlay).

Sadly it still has to be passed as an int across the process boundary.

* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::recommendedScrollbarStyleDidChange):
* UIProcess/mac/PageClientImpl.h:
* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::recommendedScrollbarStyleDidChange):
* WebProcess/Plugins/PDF/PDFPlugin.h:
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::scrollbarStyleChanged):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::recommendedScrollbarStyleDidChange):
* WebProcess/WebCoreSupport/WebChromeClient.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (180606 => 180607)


--- trunk/Source/WebCore/ChangeLog	2015-02-25 03:52:40 UTC (rev 180606)
+++ trunk/Source/WebCore/ChangeLog	2015-02-25 04:07:06 UTC (rev 180607)
@@ -1,3 +1,25 @@
+2015-02-24  Simon Fraser  <simon.fra...@apple.com>
+
+        Use an enum for scrollbar style
+        https://bugs.webkit.org/show_bug.cgi?id=141985
+
+        Reviewed by Beth Dakin.
+
+        Switch to an enum class for the scrollbar style (normal or overlay).
+
+        * page/ChromeClient.h:
+        * page/FrameView.cpp:
+        (WebCore::FrameView::scrollbarStyleChanged):
+        * page/FrameView.h:
+        * platform/ScrollTypes.h:
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::scrollbarStyleChanged):
+        * platform/ScrollView.h:
+        * platform/ScrollableArea.h:
+        (WebCore::ScrollableArea::scrollbarStyleChanged):
+        * platform/mac/ScrollAnimatorMac.mm:
+        (WebCore::ScrollAnimatorMac::updateScrollerStyle):
+
 2015-02-24  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r180599.

Modified: trunk/Source/WebCore/page/ChromeClient.h (180606 => 180607)


--- trunk/Source/WebCore/page/ChromeClient.h	2015-02-25 03:52:40 UTC (rev 180606)
+++ trunk/Source/WebCore/page/ChromeClient.h	2015-02-25 04:07:06 UTC (rev 180607)
@@ -386,7 +386,7 @@
     virtual void postAccessibilityNotification(AccessibilityObject*, AXObjectCache::AXNotification) { }
 
     virtual void notifyScrollerThumbIsVisibleInRect(const IntRect&) { }
-    virtual void recommendedScrollbarStyleDidChange(int /*newStyle*/) { }
+    virtual void recommendedScrollbarStyleDidChange(ScrollbarStyle) { }
 
     enum DialogType {
         AlertDialog = 0,

Modified: trunk/Source/WebCore/page/FrameView.cpp (180606 => 180607)


--- trunk/Source/WebCore/page/FrameView.cpp	2015-02-25 03:52:40 UTC (rev 180606)
+++ trunk/Source/WebCore/page/FrameView.cpp	2015-02-25 04:07:06 UTC (rev 180607)
@@ -3486,7 +3486,7 @@
     return frame().loader().state() != FrameStateComplete;
 }
 
-void FrameView::scrollbarStyleChanged(int newStyle, bool forceUpdate)
+void FrameView::scrollbarStyleChanged(ScrollbarStyle newStyle, bool forceUpdate)
 {
     if (!frame().isMainFrame())
         return;

Modified: trunk/Source/WebCore/page/FrameView.h (180606 => 180607)


--- trunk/Source/WebCore/page/FrameView.h	2015-02-25 03:52:40 UTC (rev 180606)
+++ trunk/Source/WebCore/page/FrameView.h	2015-02-25 04:07:06 UTC (rev 180607)
@@ -424,7 +424,7 @@
     void flushAnyPendingPostLayoutTasks();
 
     virtual bool shouldSuspendScrollAnimations() const override;
-    virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate) override;
+    virtual void scrollbarStyleChanged(ScrollbarStyle, bool forceUpdate) override;
 
     RenderBox* embeddedContentBox() const;
     

Modified: trunk/Source/WebCore/platform/ScrollTypes.h (180606 => 180607)


--- trunk/Source/WebCore/platform/ScrollTypes.h	2015-02-25 03:52:40 UTC (rev 180606)
+++ trunk/Source/WebCore/platform/ScrollTypes.h	2015-02-25 04:07:06 UTC (rev 180607)
@@ -154,6 +154,11 @@
         ScrollbarButtonsDoubleEnd,
         ScrollbarButtonsDoubleBoth
     };
+
+    enum class ScrollbarStyle {
+        AlwaysVisible,
+        Overlay
+    };
     
     enum ScrollbarOverlayStyle {
         ScrollbarOverlayStyleDefault,

Modified: trunk/Source/WebCore/platform/ScrollView.cpp (180606 => 180607)


--- trunk/Source/WebCore/platform/ScrollView.cpp	2015-02-25 03:52:40 UTC (rev 180606)
+++ trunk/Source/WebCore/platform/ScrollView.cpp	2015-02-25 04:07:06 UTC (rev 180607)
@@ -1162,7 +1162,7 @@
     return !scrollCornerRect().isEmpty();
 }
 
-void ScrollView::scrollbarStyleChanged(int, bool forceUpdate)
+void ScrollView::scrollbarStyleChanged(ScrollbarStyle, bool forceUpdate)
 {
     if (!forceUpdate)
         return;

Modified: trunk/Source/WebCore/platform/ScrollView.h (180606 => 180607)


--- trunk/Source/WebCore/platform/ScrollView.h	2015-02-25 03:52:40 UTC (rev 180606)
+++ trunk/Source/WebCore/platform/ScrollView.h	2015-02-25 04:07:06 UTC (rev 180607)
@@ -73,7 +73,7 @@
     virtual int scrollPosition(Scrollbar*) const override;
     WEBCORE_EXPORT virtual void setScrollOffset(const IntPoint&) override;
     virtual bool isScrollCornerVisible() const override;
-    virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate) override;
+    virtual void scrollbarStyleChanged(ScrollbarStyle, bool forceUpdate) override;
 
     virtual void notifyPageThatContentAreaWillPaint() const;
 

Modified: trunk/Source/WebCore/platform/ScrollableArea.h (180606 => 180607)


--- trunk/Source/WebCore/platform/ScrollableArea.h	2015-02-25 03:52:40 UTC (rev 180606)
+++ trunk/Source/WebCore/platform/ScrollableArea.h	2015-02-25 04:07:06 UTC (rev 180607)
@@ -201,7 +201,7 @@
     WEBCORE_EXPORT IntSize totalContentsSize() const;
 
     virtual bool shouldSuspendScrollAnimations() const { return true; }
-    virtual void scrollbarStyleChanged(int /*newStyle*/, bool /*forceUpdate*/) { }
+    virtual void scrollbarStyleChanged(ScrollbarStyle, bool /*forceUpdate*/) { }
     virtual void setVisibleScrollerThumbRect(const IntRect&) { }
     
     // Note that this only returns scrollable areas that can actually be scrolled.

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (180606 => 180607)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2015-02-25 03:52:40 UTC (rev 180606)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2015-02-25 04:07:06 UTC (rev 180607)
@@ -1342,7 +1342,7 @@
 
     // If m_needsScrollerStyleUpdate is true, then the page is restoring from the page cache, and 
     // a relayout will happen on its own. Otherwise, we must initiate a re-layout ourselves.
-    scrollableArea().scrollbarStyleChanged(newStyle, !m_needsScrollerStyleUpdate);
+    scrollableArea().scrollbarStyleChanged(newStyle == NSScrollerStyleOverlay ? ScrollbarStyle::Overlay : ScrollbarStyle::AlwaysVisible, !m_needsScrollerStyleUpdate);
 
     m_needsScrollerStyleUpdate = false;
 }

Modified: trunk/Source/WebKit2/ChangeLog (180606 => 180607)


--- trunk/Source/WebKit2/ChangeLog	2015-02-25 03:52:40 UTC (rev 180606)
+++ trunk/Source/WebKit2/ChangeLog	2015-02-25 04:07:06 UTC (rev 180607)
@@ -1,3 +1,27 @@
+2015-02-24  Simon Fraser  <simon.fra...@apple.com>
+
+        Use an enum for scrollbar style
+        https://bugs.webkit.org/show_bug.cgi?id=141985
+
+        Reviewed by Beth Dakin.
+        
+        Switch to an enum class for the scrollbar style (normal or overlay).
+        
+        Sadly it still has to be passed as an int across the process boundary.
+
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::recommendedScrollbarStyleDidChange):
+        * UIProcess/mac/PageClientImpl.h:
+        * UIProcess/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::recommendedScrollbarStyleDidChange):
+        * WebProcess/Plugins/PDF/PDFPlugin.h:
+        * WebProcess/Plugins/PDF/PDFPlugin.mm:
+        (WebKit::PDFPlugin::scrollbarStyleChanged):
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::recommendedScrollbarStyleDidChange):
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+
 2015-02-24  Chris Dumez  <cdu...@apple.com>
 
         [Mac][WK2] ASSERTION FAILED: m_sendPort in IPC::Connection::open()

Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (180606 => 180607)


--- trunk/Source/WebKit2/UIProcess/PageClient.h	2015-02-25 03:52:40 UTC (rev 180606)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h	2015-02-25 04:07:06 UTC (rev 180607)
@@ -233,7 +233,7 @@
     virtual void dismissCorrectionPanel(WebCore::ReasonForDismissingAlternativeText) = 0;
     virtual String dismissCorrectionPanelSoon(WebCore::ReasonForDismissingAlternativeText) = 0;
     virtual void recordAutocorrectionResponse(WebCore::AutocorrectionResponseType, const String& replacedString, const String& replacementString) = 0;
-    virtual void recommendedScrollbarStyleDidChange(int32_t newStyle) = 0;
+    virtual void recommendedScrollbarStyleDidChange(WebCore::ScrollbarStyle) = 0;
     virtual void removeNavigationGestureSnapshot() = 0;
 
     virtual CGRect boundsOfLayerInLayerBackedWindowCoordinates(CALayer *) const = 0;

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (180606 => 180607)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2015-02-25 03:52:40 UTC (rev 180606)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2015-02-25 04:07:06 UTC (rev 180607)
@@ -5024,7 +5024,7 @@
 void WebPageProxy::recommendedScrollbarStyleDidChange(int32_t newStyle)
 {
 #if USE(APPKIT)
-    m_pageClient.recommendedScrollbarStyleDidChange(newStyle);
+    m_pageClient.recommendedScrollbarStyleDidChange(static_cast<WebCore::ScrollbarStyle>(newStyle));
 #else
     UNUSED_PARAM(newStyle);
 #endif

Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h (180606 => 180607)


--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h	2015-02-25 03:52:40 UTC (rev 180606)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h	2015-02-25 04:07:06 UTC (rev 180607)
@@ -148,7 +148,7 @@
     virtual String dismissCorrectionPanelSoon(WebCore::ReasonForDismissingAlternativeText) override;
     virtual void recordAutocorrectionResponse(WebCore::AutocorrectionResponseType, const String& replacedString, const String& replacementString) override;
 
-    virtual void recommendedScrollbarStyleDidChange(int32_t newStyle) override;
+    virtual void recommendedScrollbarStyleDidChange(WebCore::ScrollbarStyle) override;
 
     virtual WKView* wkView() const override { return m_wkView; }
     virtual void intrinsicContentSizeDidChange(const WebCore::IntSize& intrinsicContentSize) override;

Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (180606 => 180607)


--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm	2015-02-25 03:52:40 UTC (rev 180606)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm	2015-02-25 04:07:06 UTC (rev 180607)
@@ -608,11 +608,11 @@
     CorrectionPanel::recordAutocorrectionResponse(m_wkView, response, replacedString, replacementString);
 }
 
-void PageClientImpl::recommendedScrollbarStyleDidChange(int32_t newStyle)
+void PageClientImpl::recommendedScrollbarStyleDidChange(ScrollbarStyle newStyle)
 {
     // Now re-create a tracking area with the appropriate options given the new scrollbar style
     NSTrackingAreaOptions options = NSTrackingMouseMoved | NSTrackingMouseEnteredAndExited | NSTrackingInVisibleRect;
-    if (newStyle == NSScrollerStyleLegacy)
+    if (newStyle == ScrollbarStyle::AlwaysVisible)
         options |= NSTrackingActiveAlways;
     else
         options |= NSTrackingActiveInKeyWindow;

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.h (180606 => 180607)


--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.h	2015-02-25 03:52:40 UTC (rev 180606)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.h	2015-02-25 04:07:06 UTC (rev 180607)
@@ -194,7 +194,7 @@
     virtual WebCore::Scrollbar* horizontalScrollbar() const override { return m_horizontalScrollbar.get(); }
     virtual WebCore::Scrollbar* verticalScrollbar() const override { return m_verticalScrollbar.get(); }
     virtual bool shouldSuspendScrollAnimations() const override { return false; } // If we return true, ScrollAnimatorMac will keep cycling a timer forever, waiting for a good time to animate.
-    virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate) override;
+    virtual void scrollbarStyleChanged(WebCore::ScrollbarStyle, bool forceUpdate) override;
     virtual WebCore::IntRect convertFromScrollbarToContainingView(const WebCore::Scrollbar*, const WebCore::IntRect& scrollbarRect) const override;
     virtual WebCore::IntRect convertFromContainingViewToScrollbar(const WebCore::Scrollbar*, const WebCore::IntRect& parentRect) const override;
     virtual WebCore::IntPoint convertFromScrollbarToContainingView(const WebCore::Scrollbar*, const WebCore::IntPoint& scrollbarPoint) const override;

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm (180606 => 180607)


--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm	2015-02-25 03:52:40 UTC (rev 180606)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm	2015-02-25 04:07:06 UTC (rev 180607)
@@ -788,7 +788,7 @@
     return maximumOffset;
 }
 
-void PDFPlugin::scrollbarStyleChanged(int, bool forceUpdate)
+void PDFPlugin::scrollbarStyleChanged(ScrollbarStyle style, bool forceUpdate)
 {
     if (!forceUpdate)
         return;

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (180606 => 180607)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2015-02-25 03:52:40 UTC (rev 180606)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2015-02-25 04:07:06 UTC (rev 180607)
@@ -971,9 +971,9 @@
     m_page->send(Messages::WebPageProxy::NotifyScrollerThumbIsVisibleInRect(scrollerThumb));
 }
 
-void WebChromeClient::recommendedScrollbarStyleDidChange(int32_t newStyle)
+void WebChromeClient::recommendedScrollbarStyleDidChange(ScrollbarStyle newStyle)
 {
-    m_page->send(Messages::WebPageProxy::RecommendedScrollbarStyleDidChange(newStyle));
+    m_page->send(Messages::WebPageProxy::RecommendedScrollbarStyleDidChange(static_cast<int32_t>(newStyle)));
 }
 
 Color WebChromeClient::underlayColor() const

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (180606 => 180607)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2015-02-25 03:52:40 UTC (rev 180606)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2015-02-25 04:07:06 UTC (rev 180607)
@@ -274,7 +274,7 @@
     virtual void dispatchViewportPropertiesDidChange(const WebCore::ViewportArguments&) const override;
 
     virtual void notifyScrollerThumbIsVisibleInRect(const WebCore::IntRect&) override;
-    virtual void recommendedScrollbarStyleDidChange(int32_t newStyle) override;
+    virtual void recommendedScrollbarStyleDidChange(WebCore::ScrollbarStyle newStyle) override;
 
     virtual WebCore::Color underlayColor() const override;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to