Changeset 107001 in webkit


Ignore:
Timestamp:
Feb 7, 2012 3:47:59 PM (12 years ago)
Author:
andersca@apple.com
Message:

Scrolling tree should keep track of region we can't do fast scrolling for
https://bugs.webkit.org/show_bug.cgi?id=78050

Reviewed by Dan Bernstein.

We currently won't do fast scrolling for subframes and other types of scrollable areas.
Because of this, we'll have the scrolling tree keep a region of the page for which we can't
do fast scrolling. This region will be updated after layout.

  • page/FrameView.cpp:

(WebCore::FrameView::scrollableAreaBoundingBox):
Return the bounding box.

  • page/scrolling/ScrollingCoordinator.cpp:

(WebCore::ScrollingCoordinator::frameViewLayoutUpdated):
Go through all the scrollable areas in this frame view and compute the region which we can't do
fast scrolling for.

  • page/scrolling/ScrollingTree.cpp:

(WebCore::ScrollingTree::commitNewTreeState):
Update the non-fast-scrollable region.

  • page/scrolling/ScrollingTreeState.cpp:

(WebCore::ScrollingTreeState::setNonFastScrollableRegion):
Set the non-fast-scrollable region if it's changed.

  • platform/ScrollableArea.h:

Add scrollableAreaBoundingBox member function.

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::scrollableAreaBoundingBox):
Return the bounding box.

  • rendering/RenderListBox.cpp:

(WebCore::RenderListBox::scrollableAreaBoundingBox):
Return the bounding box.

Location:
trunk/Source/WebCore
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r107000 r107001  
     12012-02-07  Anders Carlsson  <andersca@apple.com>
     2
     3        Scrolling tree should keep track of region we can't do fast scrolling for
     4        https://bugs.webkit.org/show_bug.cgi?id=78050
     5
     6        Reviewed by Dan Bernstein.
     7
     8        We currently won't do fast scrolling for subframes and other types of scrollable areas.
     9        Because of this, we'll have the scrolling tree keep a region of the page for which we can't
     10        do fast scrolling. This region will be updated after layout.
     11
     12        * page/FrameView.cpp:
     13        (WebCore::FrameView::scrollableAreaBoundingBox):
     14        Return the bounding box.
     15
     16        * page/scrolling/ScrollingCoordinator.cpp:
     17        (WebCore::ScrollingCoordinator::frameViewLayoutUpdated):
     18        Go through all the scrollable areas in this frame view and compute the region which we can't do
     19        fast scrolling for.
     20
     21        * page/scrolling/ScrollingTree.cpp:
     22        (WebCore::ScrollingTree::commitNewTreeState):
     23        Update the non-fast-scrollable region.
     24
     25        * page/scrolling/ScrollingTreeState.cpp:
     26        (WebCore::ScrollingTreeState::setNonFastScrollableRegion):
     27        Set the non-fast-scrollable region if it's changed.
     28
     29        * platform/ScrollableArea.h:
     30        Add scrollableAreaBoundingBox member function.
     31
     32        * rendering/RenderLayer.cpp:
     33        (WebCore::RenderLayer::scrollableAreaBoundingBox):
     34        Return the bounding box.
     35
     36        * rendering/RenderListBox.cpp:
     37        (WebCore::RenderListBox::scrollableAreaBoundingBox):
     38        Return the bounding box.
     39
    1402012-02-07  Levi Weintraub  <leviw@chromium.org>
    241
  • trunk/Source/WebCore/page/FrameView.cpp

    r106977 r107001  
    25502550}
    25512551
     2552IntRect FrameView::scrollableAreaBoundingBox() const
     2553{
     2554    // FIXME: This isn't correct for transformed frames. We probably need to ask the renderer instead.
     2555    return frameRect();
     2556}
     2557
    25522558bool FrameView::shouldSuspendScrollAnimations() const
    25532559{
  • trunk/Source/WebCore/page/FrameView.h

    r106977 r107001  
    372372    virtual bool isOnActivePage() const;
    373373    virtual ScrollableArea* enclosingScrollableArea() const;
     374    virtual IntRect scrollableAreaBoundingBox() const OVERRIDE;
    374375
    375376#if USE(ACCELERATED_COMPOSITING)
  • trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp

    r106766 r107001  
    3535#include "Page.h"
    3636#include "PlatformWheelEvent.h"
     37#include "Region.h"
    3738#include "ScrollAnimator.h"
    3839#include "ScrollingThread.h"
     
    9899    if (!coordinatesScrollingForFrameView(frameView))
    99100        return;
     101
     102    // Compute the region of the page that we can't do fast scrolling for. This currently includes
     103    // all scrollable areas, such as subframes, overflow divs and list boxes.
     104    Region nonScrollableRegion;
     105    if (const FrameView::ScrollableAreaSet* scrollableAreas = frameView->scrollableAreas()) {
     106        for (FrameView::ScrollableAreaSet::const_iterator it = scrollableAreas->begin(), end = scrollableAreas->end(); it != end; ++it) {
     107            ScrollableArea* scrollableArea = *it;
     108
     109            // Check if this area can be scrolled at all.
     110            if ((!scrollableArea->horizontalScrollbar() || !scrollableArea->horizontalScrollbar()->enabled())
     111                && (!scrollableArea->verticalScrollbar() || !scrollableArea->verticalScrollbar()->enabled()))
     112                continue;
     113
     114            nonScrollableRegion.unite(scrollableArea->scrollableAreaBoundingBox());
     115        }
     116    }
    100117
    101118    m_scrollingTreeState->setViewportRect(IntRect(IntPoint(), frameView->visibleContentRect().size()));
  • trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp

    r106766 r107001  
    9090    ASSERT(ScrollingThread::isCurrentThread());
    9191
    92     if (scrollingTreeState->changedProperties() & ScrollingTreeState::WheelEventHandlerCount) {
     92    if (scrollingTreeState->changedProperties() & (ScrollingTreeState::WheelEventHandlerCount | ScrollingTreeState::NonFastScrollableRegion)) {
    9393        MutexLocker lock(m_mutex);
    9494
    95         m_hasWheelEventHandlers = scrollingTreeState->wheelEventHandlerCount();
     95        if (scrollingTreeState->changedProperties() & ScrollingTreeState::WheelEventHandlerCount)
     96            m_hasWheelEventHandlers = scrollingTreeState->wheelEventHandlerCount();
     97        if (scrollingTreeState->changedProperties() & ScrollingTreeState::NonFastScrollableRegion)
     98            m_nonFastScrollableRegion = scrollingTreeState->nonFastScrollableRegion();
    9699    }
    97100
  • trunk/Source/WebCore/page/scrolling/ScrollingTree.h

    r106766 r107001  
    2929#if ENABLE(THREADED_SCROLLING)
    3030
     31#include "Region.h"
    3132#include <wtf/OwnPtr.h>
    3233#include <wtf/PassOwnPtr.h>
     
    7273
    7374    Mutex m_mutex;
     75    Region m_nonFastScrollableRegion;
    7476    bool m_hasWheelEventHandlers;
    7577};
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeState.cpp

    r106766 r107001  
    6464}
    6565
     66void ScrollingTreeState::setNonFastScrollableRegion(const Region& nonFastScrollableRegion)
     67{
     68    if (m_nonFastScrollableRegion == nonFastScrollableRegion)
     69        return;
     70
     71    m_nonFastScrollableRegion = nonFastScrollableRegion;
     72    m_changedProperties |= NonFastScrollableRegion;
     73}
     74
    6675void ScrollingTreeState::setWheelEventHandlerCount(unsigned wheelEventHandlerCount)
    6776{
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeState.h

    r106766 r107001  
    3131#include "GraphicsLayer.h"
    3232#include "IntRect.h"
     33#include "Region.h"
    3334#include <wtf/PassOwnPtr.h>
    3435
     
    5152        ViewportRect = 1 << 0,
    5253        ContentsSize = 1 << 1,
    53         WheelEventHandlerCount = 1 << 2,
    54         ScrollLayer = 1 << 3,
     54        NonFastScrollableRegion = 1 << 2,
     55        WheelEventHandlerCount = 1 << 3,
     56        ScrollLayer = 1 << 4,
    5557    };
    5658
     
    6365    const IntSize& contentsSize() const { return m_contentsSize; }
    6466    void setContentsSize(const IntSize&);
     67
     68    const Region& nonFastScrollableRegion() const { return m_nonFastScrollableRegion; }
     69    void setNonFastScrollableRegion(const Region&);
    6570
    6671    unsigned wheelEventHandlerCount() const { return m_wheelEventHandlerCount; }
     
    8186    IntSize m_contentsSize;
    8287
     88    Region m_nonFastScrollableRegion;
     89
    8390    unsigned m_wheelEventHandlerCount;
    8491
  • trunk/Source/WebCore/platform/ScrollableArea.h

    r106977 r107001  
    156156    virtual ScrollableArea* enclosingScrollableArea() const = 0;
    157157
     158    // Returns the bounding box of this scrollable area, in the coordinate system of the enclosing scroll view.
     159    virtual IntRect scrollableAreaBoundingBox() const { ASSERT_NOT_REACHED(); }
     160
    158161    bool isPinnedInBothDirections(const IntSize&) const;
    159162    bool isPinnedHorizontallyInDirection(int horizontalScrollDelta) const;
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r106977 r107001  
    887887}
    888888
     889IntRect RenderLayer::scrollableAreaBoundingBox() const
     890{
     891    return renderer()->absoluteBoundingBoxRect();
     892}
     893
    889894RenderLayer* RenderLayer::enclosingTransformedAncestor() const
    890895{
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r106977 r107001  
    665665    virtual bool shouldSuspendScrollAnimations() const;
    666666    virtual bool isOnActivePage() const;
     667    virtual IntRect scrollableAreaBoundingBox() const OVERRIDE;
    667668
    668669    // Rectangle encompassing the scroll corner and resizer rect.
  • trunk/Source/WebCore/rendering/RenderListBox.cpp

    r106977 r107001  
    822822}
    823823
     824IntRect RenderListBox::scrollableAreaBoundingBox() const
     825{
     826    return absoluteBoundingBoxRect();
     827}
     828
    824829PassRefPtr<Scrollbar> RenderListBox::createScrollbar()
    825830{
  • trunk/Source/WebCore/rendering/RenderListBox.h

    r106977 r107001  
    121121
    122122    virtual ScrollableArea* enclosingScrollableArea() const;
     123    virtual IntRect scrollableAreaBoundingBox() const OVERRIDE;
    123124
    124125    // NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea.
Note: See TracChangeset for help on using the changeset viewer.