Commit 6c3da667 authored by andersca@apple.com's avatar andersca@apple.com

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.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107001 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e7812f3d
2012-02-07 Anders Carlsson <andersca@apple.com>
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.
2012-02-07 Levi Weintraub <leviw@chromium.org>
unicode-bidi:plaintext is supposed to be effective on display:inline elements too
......@@ -2549,6 +2549,12 @@ ScrollableArea* FrameView::enclosingScrollableArea() const
return 0;
}
IntRect FrameView::scrollableAreaBoundingBox() const
{
// FIXME: This isn't correct for transformed frames. We probably need to ask the renderer instead.
return frameRect();
}
bool FrameView::shouldSuspendScrollAnimations() const
{
return m_frame->loader()->state() != FrameStateComplete;
......
......@@ -371,6 +371,7 @@ private:
virtual void setVisibleScrollerThumbRect(const IntRect&);
virtual bool isOnActivePage() const;
virtual ScrollableArea* enclosingScrollableArea() const;
virtual IntRect scrollableAreaBoundingBox() const OVERRIDE;
#if USE(ACCELERATED_COMPOSITING)
virtual GraphicsLayer* layerForHorizontalScrollbar() const OVERRIDE;
......
......@@ -34,6 +34,7 @@
#include "IntRect.h"
#include "Page.h"
#include "PlatformWheelEvent.h"
#include "Region.h"
#include "ScrollAnimator.h"
#include "ScrollingThread.h"
#include "ScrollingTree.h"
......@@ -98,6 +99,22 @@ void ScrollingCoordinator::frameViewLayoutUpdated(FrameView* frameView)
if (!coordinatesScrollingForFrameView(frameView))
return;
// Compute the region of the page that we can't do fast scrolling for. This currently includes
// all scrollable areas, such as subframes, overflow divs and list boxes.
Region nonScrollableRegion;
if (const FrameView::ScrollableAreaSet* scrollableAreas = frameView->scrollableAreas()) {
for (FrameView::ScrollableAreaSet::const_iterator it = scrollableAreas->begin(), end = scrollableAreas->end(); it != end; ++it) {
ScrollableArea* scrollableArea = *it;
// Check if this area can be scrolled at all.
if ((!scrollableArea->horizontalScrollbar() || !scrollableArea->horizontalScrollbar()->enabled())
&& (!scrollableArea->verticalScrollbar() || !scrollableArea->verticalScrollbar()->enabled()))
continue;
nonScrollableRegion.unite(scrollableArea->scrollableAreaBoundingBox());
}
}
m_scrollingTreeState->setViewportRect(IntRect(IntPoint(), frameView->visibleContentRect().size()));
m_scrollingTreeState->setContentsSize(frameView->contentsSize());
scheduleTreeStateCommit();
......
......@@ -89,10 +89,13 @@ void ScrollingTree::commitNewTreeState(PassOwnPtr<ScrollingTreeState> scrollingT
{
ASSERT(ScrollingThread::isCurrentThread());
if (scrollingTreeState->changedProperties() & ScrollingTreeState::WheelEventHandlerCount) {
if (scrollingTreeState->changedProperties() & (ScrollingTreeState::WheelEventHandlerCount | ScrollingTreeState::NonFastScrollableRegion)) {
MutexLocker lock(m_mutex);
m_hasWheelEventHandlers = scrollingTreeState->wheelEventHandlerCount();
if (scrollingTreeState->changedProperties() & ScrollingTreeState::WheelEventHandlerCount)
m_hasWheelEventHandlers = scrollingTreeState->wheelEventHandlerCount();
if (scrollingTreeState->changedProperties() & ScrollingTreeState::NonFastScrollableRegion)
m_nonFastScrollableRegion = scrollingTreeState->nonFastScrollableRegion();
}
m_rootNode->update(scrollingTreeState.get());
......
......@@ -28,6 +28,7 @@
#if ENABLE(THREADED_SCROLLING)
#include "Region.h"
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/PassRefPtr.h>
......@@ -71,6 +72,7 @@ private:
OwnPtr<ScrollingTreeNode> m_rootNode;
Mutex m_mutex;
Region m_nonFastScrollableRegion;
bool m_hasWheelEventHandlers;
};
......
......@@ -63,6 +63,15 @@ void ScrollingTreeState::setContentsSize(const IntSize& contentsSize)
m_changedProperties |= ContentsSize;
}
void ScrollingTreeState::setNonFastScrollableRegion(const Region& nonFastScrollableRegion)
{
if (m_nonFastScrollableRegion == nonFastScrollableRegion)
return;
m_nonFastScrollableRegion = nonFastScrollableRegion;
m_changedProperties |= NonFastScrollableRegion;
}
void ScrollingTreeState::setWheelEventHandlerCount(unsigned wheelEventHandlerCount)
{
if (m_wheelEventHandlerCount == wheelEventHandlerCount)
......
......@@ -30,6 +30,7 @@
#include "GraphicsLayer.h"
#include "IntRect.h"
#include "Region.h"
#include <wtf/PassOwnPtr.h>
#if PLATFORM(MAC)
......@@ -50,8 +51,9 @@ public:
enum ChangedProperty {
ViewportRect = 1 << 0,
ContentsSize = 1 << 1,
WheelEventHandlerCount = 1 << 2,
ScrollLayer = 1 << 3,
NonFastScrollableRegion = 1 << 2,
WheelEventHandlerCount = 1 << 3,
ScrollLayer = 1 << 4,
};
bool hasChangedProperties() const { return m_changedProperties; }
......@@ -63,6 +65,9 @@ public:
const IntSize& contentsSize() const { return m_contentsSize; }
void setContentsSize(const IntSize&);
const Region& nonFastScrollableRegion() const { return m_nonFastScrollableRegion; }
void setNonFastScrollableRegion(const Region&);
unsigned wheelEventHandlerCount() const { return m_wheelEventHandlerCount; }
void setWheelEventHandlerCount(unsigned);
......@@ -80,6 +85,8 @@ private:
IntRect m_viewportRect;
IntSize m_contentsSize;
Region m_nonFastScrollableRegion;
unsigned m_wheelEventHandlerCount;
#if PLATFORM(MAC)
......
......@@ -155,6 +155,9 @@ public:
// Note that this only returns scrollable areas that can actually be scrolled.
virtual ScrollableArea* enclosingScrollableArea() const = 0;
// Returns the bounding box of this scrollable area, in the coordinate system of the enclosing scroll view.
virtual IntRect scrollableAreaBoundingBox() const { ASSERT_NOT_REACHED(); }
bool isPinnedInBothDirections(const IntSize&) const;
bool isPinnedHorizontallyInDirection(int horizontalScrollDelta) const;
bool isPinnedVerticallyInDirection(int verticalScrollDelta) const;
......
......@@ -886,6 +886,11 @@ RenderLayer* RenderLayer::enclosingScrollableLayer() const
return 0;
}
IntRect RenderLayer::scrollableAreaBoundingBox() const
{
return renderer()->absoluteBoundingBoxRect();
}
RenderLayer* RenderLayer::enclosingTransformedAncestor() const
{
RenderLayer* curr = parent();
......
......@@ -664,6 +664,7 @@ private:
virtual IntPoint currentMousePosition() const;
virtual bool shouldSuspendScrollAnimations() const;
virtual bool isOnActivePage() const;
virtual IntRect scrollableAreaBoundingBox() const OVERRIDE;
// Rectangle encompassing the scroll corner and resizer rect.
IntRect scrollCornerAndResizerRect() const;
......
......@@ -821,6 +821,11 @@ ScrollableArea* RenderListBox::enclosingScrollableArea() const
return 0;
}
IntRect RenderListBox::scrollableAreaBoundingBox() const
{
return absoluteBoundingBoxRect();
}
PassRefPtr<Scrollbar> RenderListBox::createScrollbar()
{
RefPtr<Scrollbar> widget;
......
......@@ -120,6 +120,7 @@ private:
virtual bool isOnActivePage() const;
virtual ScrollableArea* enclosingScrollableArea() const;
virtual IntRect scrollableAreaBoundingBox() const OVERRIDE;
// NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea.
void scrollTo(int newOffset);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment