Changeset 156201 in webkit


Ignore:
Timestamp:
Sep 20, 2013, 2:47:47 PM (12 years ago)
Author:
Simon Fraser
Message:

Scrollbars don't appear on long pages after r155660
https://bugs.webkit.org/show_bug.cgi?id=121714
<rdar://problem/15042478>

Reviewed by Beth Dakin.

After r155660, we don't do any additional layouts when scrollbars are
added or removed. That caused us to not enter the code that creates or
destroys composting layers for scrollbars in RenderLayerCompositor, resulting
in missing scrollbars.

Fix by having ScrollView::updateScrollbars() call addedOrRemovedScrollbar()
when a scrollbar was added or removed, which is overridden in FrameView
to call through to RenderLayerCompositor::frameViewDidAddOrRemoveScrollbars().

Not testable since scrollbar layers aren't contained in layer tree dumps
(to reduce diffs between platforms).

  • page/FrameView.cpp:

(WebCore::FrameView::addedOrRemovedScrollbar): New function to tell the compositor
that scrollbars changed.

  • page/FrameView.h:
  • platform/ScrollView.cpp:

(WebCore::ScrollView::setHasHorizontalScrollbar): Change the meaning of the return
value to say if the scrollbar was added or removed. Add an out param that indicates
whether the scrollbar change affects content size (not true for overlay scrollbars).
(WebCore::ScrollView::setHasVerticalScrollbar): Ditto.
(WebCore::ScrollView::updateScrollbars): Keep track of whether scrollbars were
added or removed, and call addedOrRemovedScrollbar() if true.

  • platform/ScrollView.h:
  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::frameViewDidAddOrRemoveScrollbars): Call updateOverflowControlsLayers().
(WebCore::RenderLayerCompositor::updateOverflowControlsLayers):

  • rendering/RenderLayerCompositor.h:
Location:
trunk/Source/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r156200 r156201  
     12013-09-20  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Scrollbars don't appear on long pages after r155660
     4        https://bugs.webkit.org/show_bug.cgi?id=121714
     5        <rdar://problem/15042478>
     6
     7        Reviewed by Beth Dakin.
     8       
     9        After r155660, we don't do any additional layouts when scrollbars are
     10        added or removed. That caused us to not enter the code that creates or
     11        destroys composting layers for scrollbars in RenderLayerCompositor, resulting
     12        in missing scrollbars.
     13       
     14        Fix by having ScrollView::updateScrollbars() call addedOrRemovedScrollbar()
     15        when a scrollbar was added or removed, which is overridden in FrameView
     16        to call through to RenderLayerCompositor::frameViewDidAddOrRemoveScrollbars().
     17
     18        Not testable since scrollbar layers aren't contained in layer tree dumps
     19        (to reduce diffs between platforms).
     20
     21        * page/FrameView.cpp:
     22        (WebCore::FrameView::addedOrRemovedScrollbar): New function to tell the compositor
     23        that scrollbars changed.
     24        * page/FrameView.h:
     25        * platform/ScrollView.cpp:
     26        (WebCore::ScrollView::setHasHorizontalScrollbar): Change the meaning of the return
     27        value to say if the scrollbar was added or removed. Add an out param that indicates
     28        whether the scrollbar change affects content size (not true for overlay scrollbars).
     29        (WebCore::ScrollView::setHasVerticalScrollbar): Ditto.
     30        (WebCore::ScrollView::updateScrollbars): Keep track of whether scrollbars were
     31        added or removed, and call addedOrRemovedScrollbar() if true.
     32        * platform/ScrollView.h:
     33        * rendering/RenderLayerCompositor.cpp:
     34        (WebCore::RenderLayerCompositor::frameViewDidAddOrRemoveScrollbars): Call updateOverflowControlsLayers().
     35        (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
     36        * rendering/RenderLayerCompositor.h:
     37
    1382013-09-20  Simon Fraser  <simon.fraser@apple.com>
    239
  • trunk/Source/WebCore/page/FrameView.cpp

    r155894 r156201  
    21822182}
    21832183
     2184void FrameView::addedOrRemovedScrollbar()
     2185{
     2186#if USE(ACCELERATED_COMPOSITING)
     2187    if (RenderView* renderView = this->renderView()) {
     2188        if (renderView->usesCompositing())
     2189            renderView->compositor().frameViewDidAddOrRemoveScrollbars();
     2190    }
     2191#endif
     2192}
     2193
    21842194void FrameView::beginDeferredRepaints()
    21852195{
  • trunk/Source/WebCore/page/FrameView.h

    r155798 r156201  
    484484    virtual void contentsResized() OVERRIDE;
    485485    virtual void visibleContentsResized() OVERRIDE;
     486    virtual void addedOrRemovedScrollbar() OVERRIDE;
    486487    virtual void fixedLayoutSizeChanged() OVERRIDE;
    487488
  • trunk/Source/WebCore/platform/ScrollView.cpp

    r155660 r156201  
    8585}
    8686
    87 bool ScrollView::setHasHorizontalScrollbar(bool hasBar)
     87bool ScrollView::setHasHorizontalScrollbar(bool hasBar, bool* contentSizeAffected)
    8888{
    8989    ASSERT(!hasBar || !avoidScrollbarCreation());
     
    9393        didAddScrollbar(m_horizontalScrollbar.get(), HorizontalScrollbar);
    9494        m_horizontalScrollbar->styleChanged();
    95         return !m_horizontalScrollbar->isOverlayScrollbar();
     95        if (contentSizeAffected)
     96            *contentSizeAffected = !m_horizontalScrollbar->isOverlayScrollbar();
     97        return true;
    9698    }
    9799   
     
    101103        removeChild(m_horizontalScrollbar.get());
    102104        m_horizontalScrollbar = 0;
    103         return !wasOverlayScrollbar;
     105        if (contentSizeAffected)
     106            *contentSizeAffected = !wasOverlayScrollbar;
     107        return true;
    104108    }
    105109
     
    107111}
    108112
    109 bool ScrollView::setHasVerticalScrollbar(bool hasBar)
     113bool ScrollView::setHasVerticalScrollbar(bool hasBar, bool* contentSizeAffected)
    110114{
    111115    ASSERT(!hasBar || !avoidScrollbarCreation());
     
    115119        didAddScrollbar(m_verticalScrollbar.get(), VerticalScrollbar);
    116120        m_verticalScrollbar->styleChanged();
    117         return !m_verticalScrollbar->isOverlayScrollbar();
     121        if (contentSizeAffected)
     122            *contentSizeAffected = !m_verticalScrollbar->isOverlayScrollbar();
     123        return true;
    118124    }
    119125   
     
    123129        removeChild(m_verticalScrollbar.get());
    124130        m_verticalScrollbar = 0;
    125         return !wasOverlayScrollbar;
     131        if (contentSizeAffected)
     132            *contentSizeAffected = !wasOverlayScrollbar;
     133        return true;
    126134    }
    127135
     
    523531        newHasVerticalScrollbar = (vScroll == ScrollbarAlwaysOn);
    524532
     533    bool scrollbarAddedOrRemoved = false;
     534
    525535    if (m_scrollbarsSuppressed || (hScroll != ScrollbarAuto && vScroll != ScrollbarAuto)) {
    526         if (hasHorizontalScrollbar != newHasHorizontalScrollbar && (hasHorizontalScrollbar || !avoidScrollbarCreation()))
    527             setHasHorizontalScrollbar(newHasHorizontalScrollbar);
    528         if (hasVerticalScrollbar != newHasVerticalScrollbar && (hasVerticalScrollbar || !avoidScrollbarCreation()))
    529             setHasVerticalScrollbar(newHasVerticalScrollbar);
     536        if (hasHorizontalScrollbar != newHasHorizontalScrollbar && (hasHorizontalScrollbar || !avoidScrollbarCreation())) {
     537            if (setHasHorizontalScrollbar(newHasHorizontalScrollbar))
     538                scrollbarAddedOrRemoved = true;
     539        }
     540
     541        if (hasVerticalScrollbar != newHasVerticalScrollbar && (hasVerticalScrollbar || !avoidScrollbarCreation())) {
     542            if (setHasVerticalScrollbar(newHasVerticalScrollbar))
     543                scrollbarAddedOrRemoved = true;
     544        }
    530545    } else {
    531546        bool sendContentResizedNotification = false;
     
    558573                m_horizontalScrollbar->invalidate();
    559574
    560             sendContentResizedNotification = setHasHorizontalScrollbar(newHasHorizontalScrollbar);
     575            bool changeAffectsContentSize = false;
     576            if (setHasHorizontalScrollbar(newHasHorizontalScrollbar, &changeAffectsContentSize)) {
     577                scrollbarAddedOrRemoved = true;
     578                sendContentResizedNotification |= changeAffectsContentSize;
     579            }
    561580        }
    562581
     
    567586                m_verticalScrollbar->invalidate();
    568587
    569             sendContentResizedNotification = setHasVerticalScrollbar(newHasVerticalScrollbar);
     588            bool changeAffectsContentSize = false;
     589            if (setHasVerticalScrollbar(newHasVerticalScrollbar, &changeAffectsContentSize)) {
     590                scrollbarAddedOrRemoved = true;
     591                sendContentResizedNotification |= changeAffectsContentSize;
     592            }
    570593        }
    571594
     
    583606            m_updateScrollbarsPass--;
    584607        }
     608
     609        if (scrollbarAddedOrRemoved)
     610            addedOrRemovedScrollbar();
    585611    }
    586612   
  • trunk/Source/WebCore/platform/ScrollView.h

    r155660 r156201  
    312312
    313313    virtual void visibleContentsResized() = 0;
     314    virtual void addedOrRemovedScrollbar() = 0;
    314315    virtual void delegatesScrollingDidChange() { }
    315316    virtual void fixedLayoutSizeChanged();
    316317
    317318    // These functions are used to create/destroy scrollbars.
    318     // They return true if the space taken up by the scrollbar changed.
    319     bool setHasHorizontalScrollbar(bool);
    320     bool setHasVerticalScrollbar(bool);
     319    // They return true if the scrollbar was added or removed.
     320    bool setHasHorizontalScrollbar(bool, bool* contentSizeAffected = 0);
     321    bool setHasVerticalScrollbar(bool, bool* contentSizeAffected = 0);
    321322
    322323    virtual void updateScrollCorner();
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r156200 r156201  
    13411341}
    13421342
     1343void RenderLayerCompositor::frameViewDidAddOrRemoveScrollbars()
     1344{
     1345    updateOverflowControlsLayers();
     1346}
     1347
    13431348void RenderLayerCompositor::frameViewDidLayout()
    13441349{
     
    27412746#endif
    27422747#if PLATFORM(MAC) && USE(CA)
    2743         m_layerForVerticalScrollbar->setAcceleratesDrawing(acceleratedDrawingEnabled());
     2748            m_layerForVerticalScrollbar->setAcceleratesDrawing(acceleratedDrawingEnabled());
    27442749#endif
    27452750            m_overflowControlsHostLayer->addChild(m_layerForVerticalScrollbar.get());
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.h

    r155591 r156201  
    236236    void frameViewDidChangeSize();
    237237    void frameViewDidScroll();
     238    void frameViewDidAddOrRemoveScrollbars();
    238239    void frameViewDidLayout();
    239240    void rootFixedBackgroundsChanged();
Note: See TracChangeset for help on using the changeset viewer.