Changeset 180607 in webkit


Ignore:
Timestamp:
Feb 24, 2015 8:07:06 PM (9 years ago)
Author:
Simon Fraser
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:
Location:
trunk/Source
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r180605 r180607  
     12015-02-24  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Use an enum for scrollbar style
     4        https://bugs.webkit.org/show_bug.cgi?id=141985
     5
     6        Reviewed by Beth Dakin.
     7
     8        Switch to an enum class for the scrollbar style (normal or overlay).
     9
     10        * page/ChromeClient.h:
     11        * page/FrameView.cpp:
     12        (WebCore::FrameView::scrollbarStyleChanged):
     13        * page/FrameView.h:
     14        * platform/ScrollTypes.h:
     15        * platform/ScrollView.cpp:
     16        (WebCore::ScrollView::scrollbarStyleChanged):
     17        * platform/ScrollView.h:
     18        * platform/ScrollableArea.h:
     19        (WebCore::ScrollableArea::scrollbarStyleChanged):
     20        * platform/mac/ScrollAnimatorMac.mm:
     21        (WebCore::ScrollAnimatorMac::updateScrollerStyle):
     22
    1232015-02-24  Commit Queue  <commit-queue@webkit.org>
    224
  • trunk/Source/WebCore/page/ChromeClient.h

    r178575 r180607  
    387387
    388388    virtual void notifyScrollerThumbIsVisibleInRect(const IntRect&) { }
    389     virtual void recommendedScrollbarStyleDidChange(int /*newStyle*/) { }
     389    virtual void recommendedScrollbarStyleDidChange(ScrollbarStyle) { }
    390390
    391391    enum DialogType {
  • trunk/Source/WebCore/page/FrameView.cpp

    r180574 r180607  
    34873487}
    34883488
    3489 void FrameView::scrollbarStyleChanged(int newStyle, bool forceUpdate)
     3489void FrameView::scrollbarStyleChanged(ScrollbarStyle newStyle, bool forceUpdate)
    34903490{
    34913491    if (!frame().isMainFrame())
  • trunk/Source/WebCore/page/FrameView.h

    r180574 r180607  
    425425
    426426    virtual bool shouldSuspendScrollAnimations() const override;
    427     virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate) override;
     427    virtual void scrollbarStyleChanged(ScrollbarStyle, bool forceUpdate) override;
    428428
    429429    RenderBox* embeddedContentBox() const;
  • trunk/Source/WebCore/platform/ScrollTypes.h

    r173034 r180607  
    155155        ScrollbarButtonsDoubleBoth
    156156    };
     157
     158    enum class ScrollbarStyle {
     159        AlwaysVisible,
     160        Overlay
     161    };
    157162   
    158163    enum ScrollbarOverlayStyle {
  • trunk/Source/WebCore/platform/ScrollView.cpp

    r180474 r180607  
    11631163}
    11641164
    1165 void ScrollView::scrollbarStyleChanged(int, bool forceUpdate)
     1165void ScrollView::scrollbarStyleChanged(ScrollbarStyle, bool forceUpdate)
    11661166{
    11671167    if (!forceUpdate)
  • trunk/Source/WebCore/platform/ScrollView.h

    r179886 r180607  
    7474    WEBCORE_EXPORT virtual void setScrollOffset(const IntPoint&) override;
    7575    virtual bool isScrollCornerVisible() const override;
    76     virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate) override;
     76    virtual void scrollbarStyleChanged(ScrollbarStyle, bool forceUpdate) override;
    7777
    7878    virtual void notifyPageThatContentAreaWillPaint() const;
  • trunk/Source/WebCore/platform/ScrollableArea.h

    r180474 r180607  
    202202
    203203    virtual bool shouldSuspendScrollAnimations() const { return true; }
    204     virtual void scrollbarStyleChanged(int /*newStyle*/, bool /*forceUpdate*/) { }
     204    virtual void scrollbarStyleChanged(ScrollbarStyle, bool /*forceUpdate*/) { }
    205205    virtual void setVisibleScrollerThumbRect(const IntRect&) { }
    206206   
  • trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm

    r180596 r180607  
    13431343    // If m_needsScrollerStyleUpdate is true, then the page is restoring from the page cache, and
    13441344    // a relayout will happen on its own. Otherwise, we must initiate a re-layout ourselves.
    1345     scrollableArea().scrollbarStyleChanged(newStyle, !m_needsScrollerStyleUpdate);
     1345    scrollableArea().scrollbarStyleChanged(newStyle == NSScrollerStyleOverlay ? ScrollbarStyle::Overlay : ScrollbarStyle::AlwaysVisible, !m_needsScrollerStyleUpdate);
    13461346
    13471347    m_needsScrollerStyleUpdate = false;
  • trunk/Source/WebKit2/ChangeLog

    r180606 r180607  
     12015-02-24  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Use an enum for scrollbar style
     4        https://bugs.webkit.org/show_bug.cgi?id=141985
     5
     6        Reviewed by Beth Dakin.
     7       
     8        Switch to an enum class for the scrollbar style (normal or overlay).
     9       
     10        Sadly it still has to be passed as an int across the process boundary.
     11
     12        * UIProcess/PageClient.h:
     13        * UIProcess/WebPageProxy.cpp:
     14        (WebKit::WebPageProxy::recommendedScrollbarStyleDidChange):
     15        * UIProcess/mac/PageClientImpl.h:
     16        * UIProcess/mac/PageClientImpl.mm:
     17        (WebKit::PageClientImpl::recommendedScrollbarStyleDidChange):
     18        * WebProcess/Plugins/PDF/PDFPlugin.h:
     19        * WebProcess/Plugins/PDF/PDFPlugin.mm:
     20        (WebKit::PDFPlugin::scrollbarStyleChanged):
     21        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
     22        (WebKit::WebChromeClient::recommendedScrollbarStyleDidChange):
     23        * WebProcess/WebCoreSupport/WebChromeClient.h:
     24
    1252015-02-24  Chris Dumez  <cdumez@apple.com>
    226
  • trunk/Source/WebKit2/UIProcess/PageClient.h

    r180465 r180607  
    234234    virtual String dismissCorrectionPanelSoon(WebCore::ReasonForDismissingAlternativeText) = 0;
    235235    virtual void recordAutocorrectionResponse(WebCore::AutocorrectionResponseType, const String& replacedString, const String& replacementString) = 0;
    236     virtual void recommendedScrollbarStyleDidChange(int32_t newStyle) = 0;
     236    virtual void recommendedScrollbarStyleDidChange(WebCore::ScrollbarStyle) = 0;
    237237    virtual void removeNavigationGestureSnapshot() = 0;
    238238
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r180565 r180607  
    50255025{
    50265026#if USE(APPKIT)
    5027     m_pageClient.recommendedScrollbarStyleDidChange(newStyle);
     5027    m_pageClient.recommendedScrollbarStyleDidChange(static_cast<WebCore::ScrollbarStyle>(newStyle));
    50285028#else
    50295029    UNUSED_PARAM(newStyle);
  • trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h

    r180473 r180607  
    149149    virtual void recordAutocorrectionResponse(WebCore::AutocorrectionResponseType, const String& replacedString, const String& replacementString) override;
    150150
    151     virtual void recommendedScrollbarStyleDidChange(int32_t newStyle) override;
     151    virtual void recommendedScrollbarStyleDidChange(WebCore::ScrollbarStyle) override;
    152152
    153153    virtual WKView* wkView() const override { return m_wkView; }
  • trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm

    r180465 r180607  
    609609}
    610610
    611 void PageClientImpl::recommendedScrollbarStyleDidChange(int32_t newStyle)
     611void PageClientImpl::recommendedScrollbarStyleDidChange(ScrollbarStyle newStyle)
    612612{
    613613    // Now re-create a tracking area with the appropriate options given the new scrollbar style
    614614    NSTrackingAreaOptions options = NSTrackingMouseMoved | NSTrackingMouseEnteredAndExited | NSTrackingInVisibleRect;
    615     if (newStyle == NSScrollerStyleLegacy)
     615    if (newStyle == ScrollbarStyle::AlwaysVisible)
    616616        options |= NSTrackingActiveAlways;
    617617    else
  • trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.h

    r179236 r180607  
    195195    virtual WebCore::Scrollbar* verticalScrollbar() const override { return m_verticalScrollbar.get(); }
    196196    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.
    197     virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate) override;
     197    virtual void scrollbarStyleChanged(WebCore::ScrollbarStyle, bool forceUpdate) override;
    198198    virtual WebCore::IntRect convertFromScrollbarToContainingView(const WebCore::Scrollbar*, const WebCore::IntRect& scrollbarRect) const override;
    199199    virtual WebCore::IntRect convertFromContainingViewToScrollbar(const WebCore::Scrollbar*, const WebCore::IntRect& parentRect) const override;
  • trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm

    r180474 r180607  
    789789}
    790790
    791 void PDFPlugin::scrollbarStyleChanged(int, bool forceUpdate)
     791void PDFPlugin::scrollbarStyleChanged(ScrollbarStyle style, bool forceUpdate)
    792792{
    793793    if (!forceUpdate)
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp

    r179744 r180607  
    972972}
    973973
    974 void WebChromeClient::recommendedScrollbarStyleDidChange(int32_t newStyle)
    975 {
    976     m_page->send(Messages::WebPageProxy::RecommendedScrollbarStyleDidChange(newStyle));
     974void WebChromeClient::recommendedScrollbarStyleDidChange(ScrollbarStyle newStyle)
     975{
     976    m_page->send(Messages::WebPageProxy::RecommendedScrollbarStyleDidChange(static_cast<int32_t>(newStyle)));
    977977}
    978978
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h

    r178575 r180607  
    275275
    276276    virtual void notifyScrollerThumbIsVisibleInRect(const WebCore::IntRect&) override;
    277     virtual void recommendedScrollbarStyleDidChange(int32_t newStyle) override;
     277    virtual void recommendedScrollbarStyleDidChange(WebCore::ScrollbarStyle newStyle) override;
    278278
    279279    virtual WebCore::Color underlayColor() const override;
Note: See TracChangeset for help on using the changeset viewer.