Diff
Modified: trunk/Source/WebCore/ChangeLog (90151 => 90152)
--- trunk/Source/WebCore/ChangeLog 2011-06-30 19:34:20 UTC (rev 90151)
+++ trunk/Source/WebCore/ChangeLog 2011-06-30 19:40:43 UTC (rev 90152)
@@ -1,3 +1,56 @@
+2011-06-30 Anders Carlsson <[email protected]>
+
+ Reviewed by Dan Bernstein.
+
+ More ScrollableArea scaffolding
+ https://bugs.webkit.org/show_bug.cgi?id=63678
+
+ Add a way to get the enclosing scrollable area for a given scrollable area.
+ Also, add ScrollableArea::isPinnedInDirectionOfScrollDelta.
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::enclosingScrollableArea):
+ Return 0 for now.
+
+ * page/FrameView.h:
+ Add FrameView::enclosingScrollableArea.
+
+ * platform/ScrollableArea.cpp:
+ (WebCore::ScrollableArea::isPinnedInDirectionOfScrollDelta):
+ Return whether the area is pinned in the direction of the scroll delta.
+
+ * platform/ScrollableArea.h:
+ Add new member functions.
+
+ * platform/chromium/FramelessScrollView.cpp:
+ (WebCore::FramelessScrollView::enclosingScrollableArea):
+ * platform/chromium/FramelessScrollView.h:
+ Add stub.
+
+ * platform/win/PopupMenuWin.h:
+ (WebCore::PopupMenuWin::enclosingScrollableArea):
+ Always return 0.
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::enclosingScrollableLayer):
+ Add helper function.
+
+ (WebCore::RenderLayer::scrollByRecursively):
+ Use the new enclosingScrollableLayer helper function.
+
+ (WebCore::RenderLayer::enclosingScrollableArea):
+ Return the enclosing scrollable area.
+
+ * rendering/RenderLayer.h:
+ Add new member function.
+
+ * rendering/RenderListBox.cpp:
+ (WebCore::RenderListBox::enclosingScrollableArea):
+ Return 0 for now.
+
+ * rendering/RenderListBox.h:
+ Add new member function.
+
2011-06-30 Martin Robinson <[email protected]>
Reviewed by Anders Carlsson.
Modified: trunk/Source/WebCore/page/FrameView.cpp (90151 => 90152)
--- trunk/Source/WebCore/page/FrameView.cpp 2011-06-30 19:34:20 UTC (rev 90151)
+++ trunk/Source/WebCore/page/FrameView.cpp 2011-06-30 19:40:43 UTC (rev 90152)
@@ -2238,6 +2238,12 @@
return !m_frame->document()->inPageCache();
}
+ScrollableArea* FrameView::enclosingScrollableArea() const
+{
+ // FIXME: Walk up the frame tree and look for a scrollable parent frame or RenderLayer.
+ return 0;
+}
+
bool FrameView::shouldSuspendScrollAnimations() const
{
return m_frame->loader()->state() != FrameStateComplete;
Modified: trunk/Source/WebCore/page/FrameView.h (90151 => 90152)
--- trunk/Source/WebCore/page/FrameView.h 2011-06-30 19:34:20 UTC (rev 90151)
+++ trunk/Source/WebCore/page/FrameView.h 2011-06-30 19:40:43 UTC (rev 90152)
@@ -336,6 +336,8 @@
virtual void didCompleteAnimatedScroll() const;
virtual void setVisibleScrollerThumbRect(const IntRect&);
virtual bool isOnActivePage() const;
+ virtual ScrollableArea* enclosingScrollableArea() const;
+
#if USE(ACCELERATED_COMPOSITING)
virtual GraphicsLayer* layerForHorizontalScrollbar() const;
virtual GraphicsLayer* layerForVerticalScrollbar() const;
Modified: trunk/Source/WebCore/platform/ScrollableArea.cpp (90151 => 90152)
--- trunk/Source/WebCore/platform/ScrollableArea.cpp 2011-06-30 19:34:20 UTC (rev 90151)
+++ trunk/Source/WebCore/platform/ScrollableArea.cpp 2011-06-30 19:40:43 UTC (rev 90152)
@@ -205,6 +205,21 @@
|| (horizontalScrollbar() && horizontalScrollbar()->isOverlayScrollbar());
}
+bool ScrollableArea::isPinnedInDirection(const IntSize& scrollDelta) const
+{
+ if (scrollDelta.width() < 0 && isHorizontalScrollerPinnedToMinimumPosition())
+ return true;
+ if (scrollDelta.width() > 0 && isHorizontalScrollerPinnedToMaximumPosition())
+ return true;
+
+ if (scrollDelta.height() < 0 && isVerticalScrollerPinnedToMinimumPosition())
+ return true;
+ if (scrollDelta.height() > 0 && isVerticalScrollerPinnedToMaximumPosition())
+ return true;
+
+ return false;
+}
+
void ScrollableArea::invalidateScrollbar(Scrollbar* scrollbar, const IntRect& rect)
{
#if USE(ACCELERATED_COMPOSITING)
Modified: trunk/Source/WebCore/platform/ScrollableArea.h (90151 => 90152)
--- trunk/Source/WebCore/platform/ScrollableArea.h 2011-06-30 19:34:20 UTC (rev 90151)
+++ trunk/Source/WebCore/platform/ScrollableArea.h 2011-06-30 19:40:43 UTC (rev 90152)
@@ -144,6 +144,11 @@
bool isVerticalScrollerPinnedToMinimumPosition() const { return !verticalScrollbar() || scrollPosition(verticalScrollbar()) <= minimumScrollPosition().y(); }
bool isVerticalScrollerPinnedToMaximumPosition() const { return !verticalScrollbar() || scrollPosition(verticalScrollbar()) >= maximumScrollPosition().y(); }
+ // Note that this only returns scrollable areas that can actually be scrolled.
+ virtual ScrollableArea* enclosingScrollableArea() const = 0;
+
+ bool isPinnedInDirection(const IntSize&) const;
+
virtual bool shouldRubberBandInDirection(ScrollDirection) const { return true; }
virtual void disconnectFromPage() { }
Modified: trunk/Source/WebCore/platform/chromium/FramelessScrollView.cpp (90151 => 90152)
--- trunk/Source/WebCore/platform/chromium/FramelessScrollView.cpp 2011-06-30 19:34:20 UTC (rev 90151)
+++ trunk/Source/WebCore/platform/chromium/FramelessScrollView.cpp 2011-06-30 19:40:43 UTC (rev 90152)
@@ -57,6 +57,12 @@
return true;
}
+ScrollableArea* FramelessScrollView::enclosingScrollableArea() const
+{
+ // FIXME: Look for an ancestor scrollable area that can be scrolled.
+ return 0;
+}
+
void FramelessScrollView::invalidateRect(const IntRect& rect)
{
if (HostWindow* h = hostWindow())
Modified: trunk/Source/WebCore/platform/chromium/FramelessScrollView.h (90151 => 90152)
--- trunk/Source/WebCore/platform/chromium/FramelessScrollView.h 2011-06-30 19:34:20 UTC (rev 90151)
+++ trunk/Source/WebCore/platform/chromium/FramelessScrollView.h 2011-06-30 19:40:43 UTC (rev 90152)
@@ -64,6 +64,7 @@
// ScrollableArea public methods:
virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&);
virtual bool isActive() const;
+ virtual ScrollableArea* enclosingScrollableArea() const;
// Widget public methods:
virtual void invalidateRect(const IntRect&);
Modified: trunk/Source/WebCore/platform/win/PopupMenuWin.h (90151 => 90152)
--- trunk/Source/WebCore/platform/win/PopupMenuWin.h 2011-06-30 19:34:20 UTC (rev 90151)
+++ trunk/Source/WebCore/platform/win/PopupMenuWin.h 2011-06-30 19:40:43 UTC (rev 90152)
@@ -97,6 +97,7 @@
virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&);
virtual void invalidateScrollCornerRect(const WebCore::IntRect&) { }
virtual bool isActive() const { return true; }
+ ScrollableArea* enclosingScrollableArea() const { return 0; }
virtual bool isScrollCornerVisible() const { return false; }
virtual WebCore::IntRect scrollCornerRect() const { return WebCore::IntRect(); }
virtual Scrollbar* verticalScrollbar() const { return m_scrollbar.get(); }
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (90151 => 90152)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2011-06-30 19:34:20 UTC (rev 90151)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2011-06-30 19:40:43 UTC (rev 90152)
@@ -783,6 +783,16 @@
return curr;
}
+RenderLayer* RenderLayer::enclosingScrollableLayer() const
+{
+ for (RenderObject* nextRenderer = renderer()->parent(); nextRenderer; nextRenderer = nextRenderer->parent()) {
+ if (nextRenderer->isBox() && toRenderBox(nextRenderer)->canBeScrolledAndHasScrollableArea())
+ return nextRenderer->enclosingLayer();
+ }
+
+ return 0;
+}
+
RenderLayer* RenderLayer::enclosingTransformedAncestor() const
{
RenderLayer* curr = parent();
@@ -1258,14 +1268,8 @@
int leftToScrollX = newOffsetX - scrollXOffset();
int leftToScrollY = newOffsetY - scrollYOffset();
if ((leftToScrollX || leftToScrollY) && renderer()->parent()) {
- RenderObject* nextRenderer = renderer()->parent();
- while (nextRenderer) {
- if (nextRenderer->isBox() && toRenderBox(nextRenderer)->canBeScrolledAndHasScrollableArea()) {
- nextRenderer->enclosingLayer()->scrollByRecursively(leftToScrollX, leftToScrollY);
- break;
- }
- nextRenderer = nextRenderer->parent();
- }
+ if (RenderLayer* scrollableLayer = enclosingScrollableLayer())
+ scrollableLayer->scrollByRecursively(leftToScrollX, leftToScrollY);
Frame* frame = renderer()->frame();
if (frame)
@@ -1986,6 +1990,16 @@
#endif
}
+ScrollableArea* RenderLayer::enclosingScrollableArea() const
+{
+ if (RenderLayer* scrollableLayer = enclosingScrollableLayer())
+ return scrollableLayer;
+
+ // FIXME: We should return the frame view here (or possibly an ancestor frame view,
+ // if the frame view isn't scrollable.
+ return 0;
+}
+
int RenderLayer::verticalScrollbarWidth(OverlayScrollbarSizeRelevancy relevancy) const
{
if (!m_vBar || (m_vBar->isOverlayScrollbar() && relevancy == IgnoreOverlayScrollbarSize))
Modified: trunk/Source/WebCore/rendering/RenderLayer.h (90151 => 90152)
--- trunk/Source/WebCore/rendering/RenderLayer.h 2011-06-30 19:34:20 UTC (rev 90151)
+++ trunk/Source/WebCore/rendering/RenderLayer.h 2011-06-30 19:40:43 UTC (rev 90152)
@@ -259,6 +259,7 @@
// ScrollableArea overrides
virtual Scrollbar* horizontalScrollbar() const { return m_hBar.get(); }
virtual Scrollbar* verticalScrollbar() const { return m_vBar.get(); }
+ virtual ScrollableArea* enclosingScrollableArea() const;
int verticalScrollbarWidth(OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const;
int horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const;
@@ -344,6 +345,9 @@
// the <html> layer and the root layer).
RenderLayer* enclosingPositionedAncestor() const;
+ // Returns the nearest enclosing layer that is scrollable.
+ RenderLayer* enclosingScrollableLayer() const;
+
// The layer relative to which clipping rects for this layer are computed.
RenderLayer* clippingRoot() const;
Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (90151 => 90152)
--- trunk/Source/WebCore/rendering/RenderListBox.cpp 2011-06-30 19:34:20 UTC (rev 90151)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp 2011-06-30 19:40:43 UTC (rev 90152)
@@ -808,6 +808,12 @@
return !document()->inPageCache();
}
+ScrollableArea* RenderListBox::enclosingScrollableArea() const
+{
+ // FIXME: Return a RenderLayer that's scrollable.
+ return 0;
+}
+
PassRefPtr<Scrollbar> RenderListBox::createScrollbar()
{
RefPtr<Scrollbar> widget;
Modified: trunk/Source/WebCore/rendering/RenderListBox.h (90151 => 90152)
--- trunk/Source/WebCore/rendering/RenderListBox.h 2011-06-30 19:34:20 UTC (rev 90151)
+++ trunk/Source/WebCore/rendering/RenderListBox.h 2011-06-30 19:40:43 UTC (rev 90152)
@@ -119,6 +119,8 @@
virtual bool shouldSuspendScrollAnimations() const;
virtual bool isOnActivePage() const;
+ virtual ScrollableArea* enclosingScrollableArea() const;
+
virtual void disconnectFromPage() { m_page = 0; }
// NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea.
Modified: trunk/Source/WebKit/chromium/ChangeLog (90151 => 90152)
--- trunk/Source/WebKit/chromium/ChangeLog 2011-06-30 19:34:20 UTC (rev 90151)
+++ trunk/Source/WebKit/chromium/ChangeLog 2011-06-30 19:40:43 UTC (rev 90152)
@@ -1,3 +1,16 @@
+2011-06-30 Anders Carlsson <[email protected]>
+
+ Reviewed by Dan Bernstein.
+
+ More ScrollableArea scaffolding
+ https://bugs.webkit.org/show_bug.cgi?id=63678
+
+ Add an enclosingScrollableArea stub.
+
+ * src/WebScrollbarImpl.cpp:
+ (WebKit::WebScrollbarImpl::enclosingScrollableArea):
+ * src/WebScrollbarImpl.h:
+
2011-06-28 Hans Wennborg <[email protected]>
Reviewed by Tony Chang.
Modified: trunk/Source/WebKit/chromium/src/WebScrollbarImpl.cpp (90151 => 90152)
--- trunk/Source/WebKit/chromium/src/WebScrollbarImpl.cpp 2011-06-30 19:34:20 UTC (rev 90151)
+++ trunk/Source/WebKit/chromium/src/WebScrollbarImpl.cpp 2011-06-30 19:40:43 UTC (rev 90152)
@@ -290,6 +290,12 @@
return true;
}
+ScrollableArea* WebScrollbarImpl::enclosingScrollableArea() const
+{
+ // FIXME: Return a parent scrollable area that can be scrolled.
+ return 0;
+}
+
bool WebScrollbarImpl::isScrollCornerVisible() const
{
return false;
Modified: trunk/Source/WebKit/chromium/src/WebScrollbarImpl.h (90151 => 90152)
--- trunk/Source/WebKit/chromium/src/WebScrollbarImpl.h 2011-06-30 19:34:20 UTC (rev 90151)
+++ trunk/Source/WebKit/chromium/src/WebScrollbarImpl.h 2011-06-30 19:40:43 UTC (rev 90152)
@@ -64,6 +64,7 @@
virtual void invalidateScrollbarRect(WebCore::Scrollbar*, const WebCore::IntRect&);
virtual void invalidateScrollCornerRect(const WebCore::IntRect&);
virtual bool isActive() const;
+ virtual ScrollableArea* enclosingScrollableArea() const;
virtual WebCore::IntRect scrollCornerRect() const { return WebCore::IntRect(); }
virtual bool isScrollCornerVisible() const;
virtual void getTickmarks(Vector<WebCore::IntRect>&) const;
Modified: trunk/Source/WebKit/win/ChangeLog (90151 => 90152)
--- trunk/Source/WebKit/win/ChangeLog 2011-06-30 19:34:20 UTC (rev 90151)
+++ trunk/Source/WebKit/win/ChangeLog 2011-06-30 19:40:43 UTC (rev 90152)
@@ -1,3 +1,14 @@
+2011-06-30 Anders Carlsson <[email protected]>
+
+ Reviewed by Dan Bernstein.
+
+ More ScrollableArea scaffolding
+ https://bugs.webkit.org/show_bug.cgi?id=63678
+
+ * WebScrollBar.h:
+ (WebScrollBar::enclosingScrollableArea):
+ Always return 0, WebScrollbar has no concept of an enclosing scrollable area.
+
2011-06-28 Ilya Sherman <[email protected]>
Reviewed by Adam Barth.
Modified: trunk/Source/WebKit/win/WebScrollBar.h (90151 => 90152)
--- trunk/Source/WebKit/win/WebScrollBar.h 2011-06-30 19:34:20 UTC (rev 90151)
+++ trunk/Source/WebKit/win/WebScrollBar.h 2011-06-30 19:40:43 UTC (rev 90152)
@@ -116,6 +116,7 @@
virtual void setScrollOffset(const WebCore::IntPoint&);
virtual void invalidateScrollbarRect(WebCore::Scrollbar*, const WebCore::IntRect&);
virtual void invalidateScrollCornerRect(const WebCore::IntRect&) { }
+ virtual WebCore::ScrollableArea* enclosingScrollableArea() const { return 0; }
// FIXME: We should provide a way to set this value.
virtual bool isActive() const { return true; }