Chromium: Add a layer for rubber-band overhang painting to the hardware path.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Sep 2011 04:06:49 +0000 (04:06 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Sep 2011 04:06:49 +0000 (04:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=66969

Also, add layout tests for rubber-band overhang drawing for compositing path.

Patch by Alexei Svitkine <asvitkine@chromium.org> on 2011-09-14
Reviewed by James Robinson.

* page/FrameView.cpp:
(WebCore::FrameView::layerForOverhangAreas):
* page/FrameView.h:
* platform/ScrollView.cpp:
(WebCore::ScrollView::scrollContents):
(WebCore::ScrollView::wheelEvent):
* platform/ScrollView.h:
* platform/ScrollableArea.h:
(WebCore::ScrollableArea::layerForOverhangAreas):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::frameViewDidChangeSize):
(WebCore::RenderLayerCompositor::paintContents):
(WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
(WebCore::RenderLayerCompositor::destroyRootLayer):
* rendering/RenderLayerCompositor.h:
(WebCore::RenderLayerCompositor::layerForOverhangAreas):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@95158 268f45cc-cd09-0410-ab3c-d52691b4dbfc

33 files changed:
LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-e-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-e-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-e.html [new file with mode: 0644]
LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-n-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-n-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-n.html [new file with mode: 0644]
LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-ne-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-ne-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-ne.html [new file with mode: 0644]
LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-nw-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-nw-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-nw.html [new file with mode: 0644]
LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-s-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-s-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-s.html [new file with mode: 0644]
LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-se-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-se-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-se.html [new file with mode: 0644]
LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-sw-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-sw-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-sw.html [new file with mode: 0644]
LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-w-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-w-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-w.html [new file with mode: 0644]
LayoutTests/platform/chromium/test_expectations.txt
Source/WebCore/ChangeLog
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/FrameView.h
Source/WebCore/platform/ScrollView.cpp
Source/WebCore/platform/ScrollView.h
Source/WebCore/platform/ScrollableArea.h
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebCore/rendering/RenderLayerCompositor.h

diff --git a/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-e-expected.png b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-e-expected.png
new file mode 100644 (file)
index 0000000..3fc11ea
Binary files /dev/null and b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-e-expected.png differ
diff --git a/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-e-expected.txt b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-e-expected.txt
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-e.html b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-e.html
new file mode 100644 (file)
index 0000000..bcd65c1
--- /dev/null
@@ -0,0 +1,17 @@
+<html>
+<head><title>Test rubber banding overhang drawing in compositing path</title></head>
+<body>
+<div style="height:30px; background-color:black; width:100%">
+<b style="-webkit-transform:translateZ(0); position:absolute"></b>
+</div>
+
+<div id="info">This test requires DRT.</div>
+<script>
+    if (window.internals) {
+        layoutTestController.dumpAsText(true);
+        document.getElementById('info').style.visibility = "hidden";
+        internals.setScrollViewPosition(document, 50, 0);
+    }
+</script>
+</body>
+</html>
diff --git a/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-n-expected.png b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-n-expected.png
new file mode 100644 (file)
index 0000000..0806f8e
Binary files /dev/null and b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-n-expected.png differ
diff --git a/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-n-expected.txt b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-n-expected.txt
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-n.html b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-n.html
new file mode 100644 (file)
index 0000000..b3ce2c5
--- /dev/null
@@ -0,0 +1,17 @@
+<html>
+<head><title>Test rubber banding overhang drawing in compositing path</title></head>
+<body>
+<div style="height:30px; background-color:black; width:100%">
+<b style="-webkit-transform:translateZ(0); position:absolute"></b>
+</div>
+
+<div id="info">This test requires DRT.</div>
+<script>
+    if (window.internals) {
+        layoutTestController.dumpAsText(true);
+        document.getElementById('info').style.visibility = "hidden";
+        internals.setScrollViewPosition(document, 0, -50);
+    }
+</script>
+</body>
+</html>
diff --git a/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-ne-expected.png b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-ne-expected.png
new file mode 100644 (file)
index 0000000..a371bf4
Binary files /dev/null and b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-ne-expected.png differ
diff --git a/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-ne-expected.txt b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-ne-expected.txt
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-ne.html b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-ne.html
new file mode 100644 (file)
index 0000000..8e2373f
--- /dev/null
@@ -0,0 +1,17 @@
+<html>
+<head><title>Test rubber banding overhang drawing in compositing path</title></head>
+<body>
+<div style="height:30px; background-color:black; width:100%">
+<b style="-webkit-transform:translateZ(0); position:absolute"></b>
+</div>
+
+<div id="info">This test requires DRT.</div>
+<script>
+    if (window.internals) {
+        layoutTestController.dumpAsText(true);
+        document.getElementById('info').style.visibility = "hidden";
+        internals.setScrollViewPosition(document, 50, -50);
+    }
+</script>
+</body>
+</html>
diff --git a/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-nw-expected.png b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-nw-expected.png
new file mode 100644 (file)
index 0000000..d3e0cda
Binary files /dev/null and b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-nw-expected.png differ
diff --git a/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-nw-expected.txt b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-nw-expected.txt
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-nw.html b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-nw.html
new file mode 100644 (file)
index 0000000..0f1771b
--- /dev/null
@@ -0,0 +1,17 @@
+<html>
+<head><title>Test rubber banding overhang drawing in compositing path</title></head>
+<body>
+<div style="height:30px; background-color:black; width:100%">
+<b style="-webkit-transform:translateZ(0); position:absolute"></b>
+</div>
+
+<div id="info">This test requires DRT.</div>
+<script>
+    if (window.internals) {
+        layoutTestController.dumpAsText(true);
+        document.getElementById('info').style.visibility = "hidden";
+        internals.setScrollViewPosition(document, -50, -50);
+    }
+</script>
+</body>
+</html>
diff --git a/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-s-expected.png b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-s-expected.png
new file mode 100644 (file)
index 0000000..2ca92da
Binary files /dev/null and b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-s-expected.png differ
diff --git a/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-s-expected.txt b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-s-expected.txt
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-s.html b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-s.html
new file mode 100644 (file)
index 0000000..60487d0
--- /dev/null
@@ -0,0 +1,17 @@
+<html>
+<head><title>Test rubber banding overhang drawing in compositing path</title></head>
+<body>
+<div style="height:30px; background-color:black; width:100%">
+<b style="-webkit-transform:translateZ(0); position:absolute"></b>
+</div>
+
+<div id="info">This test requires DRT.</div>
+<script>
+    if (window.internals) {
+        layoutTestController.dumpAsText(true);
+        document.getElementById('info').style.visibility = "hidden";
+        internals.setScrollViewPosition(document, 0, 50);
+    }
+</script>
+</body>
+</html>
diff --git a/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-se-expected.png b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-se-expected.png
new file mode 100644 (file)
index 0000000..ef7d8e9
Binary files /dev/null and b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-se-expected.png differ
diff --git a/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-se-expected.txt b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-se-expected.txt
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-se.html b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-se.html
new file mode 100644 (file)
index 0000000..aa0b183
--- /dev/null
@@ -0,0 +1,17 @@
+<html>
+<head><title>Test rubber banding overhang drawing in compositing path</title></head>
+<body>
+<div style="height:30px; background-color:black; width:100%">
+<b style="-webkit-transform:translateZ(0); position:absolute"></b>
+</div>
+
+<div id="info">This test requires DRT.</div>
+<script>
+    if (window.internals) {
+        layoutTestController.dumpAsText(true);
+        document.getElementById('info').style.visibility = "hidden";
+        internals.setScrollViewPosition(document, 50, 50);
+    }
+</script>
+</body>
+</html>
diff --git a/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-sw-expected.png b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-sw-expected.png
new file mode 100644 (file)
index 0000000..5ab7a04
Binary files /dev/null and b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-sw-expected.png differ
diff --git a/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-sw-expected.txt b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-sw-expected.txt
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-sw.html b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-sw.html
new file mode 100644 (file)
index 0000000..a86671a
--- /dev/null
@@ -0,0 +1,17 @@
+<html>
+<head><title>Test rubber banding overhang drawing in compositing path</title></head>
+<body>
+<div style="height:30px; background-color:black; width:100%">
+<b style="-webkit-transform:translateZ(0); position:absolute"></b>
+</div>
+
+<div id="info">This test requires DRT.</div>
+<script>
+    if (window.internals) {
+        layoutTestController.dumpAsText(true);
+        document.getElementById('info').style.visibility = "hidden";
+        internals.setScrollViewPosition(document, -50, 50);
+    }
+</script>
+</body>
+</html>
diff --git a/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-w-expected.png b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-w-expected.png
new file mode 100644 (file)
index 0000000..8006937
Binary files /dev/null and b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-w-expected.png differ
diff --git a/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-w-expected.txt b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-w-expected.txt
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-w.html b/LayoutTests/platform/chromium-gpu/compositing/rubberbanding/transform-overhang-w.html
new file mode 100644 (file)
index 0000000..87cfcb8
--- /dev/null
@@ -0,0 +1,17 @@
+<html>
+<head><title>Test rubber banding overhang drawing in compositing path</title></head>
+<body>
+<div style="height:30px; background-color:black; width:100%">
+<b style="-webkit-transform:translateZ(0); position:absolute"></b>
+</div>
+
+<div id="info">This test requires DRT.</div>
+<script>
+    if (window.internals) {
+        layoutTestController.dumpAsText(true);
+        document.getElementById('info').style.visibility = "hidden";
+        internals.setScrollViewPosition(document, -50, 0);
+    }
+</script>
+</body>
+</html>
index 6133a0c..96efe13 100644 (file)
@@ -479,6 +479,7 @@ WONTFIX SKIP : fast/js/reparsing-semicolon-insertion.html = FAIL
 
 // Rubber-banding is currently a Mac only feature.
 WONTFIX WIN LINUX : platform/chromium/rubberbanding = FAIL
+WONTFIX WIN LINUX : platform/chromium-gpu/compositing/rubberbanding = IMAGE
 
 // -----------------------------------------------------------------
 // LIGHTTPD
index 3044104..6e8a0b4 100644 (file)
@@ -1,3 +1,29 @@
+2011-09-14  Alexei Svitkine  <asvitkine@chromium.org>
+
+        Chromium: Add a layer for rubber-band overhang painting to the hardware path.
+        https://bugs.webkit.org/show_bug.cgi?id=66969
+
+        Also, add layout tests for rubber-band overhang drawing for compositing path.
+
+        Reviewed by James Robinson.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::layerForOverhangAreas):
+        * page/FrameView.h:
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::scrollContents):
+        (WebCore::ScrollView::wheelEvent):
+        * platform/ScrollView.h:
+        * platform/ScrollableArea.h:
+        (WebCore::ScrollableArea::layerForOverhangAreas):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::frameViewDidChangeSize):
+        (WebCore::RenderLayerCompositor::paintContents):
+        (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
+        (WebCore::RenderLayerCompositor::destroyRootLayer):
+        * rendering/RenderLayerCompositor.h:
+        (WebCore::RenderLayerCompositor::layerForOverhangAreas):
+
 2011-09-14  Antoine Labour  <piman@chromium.org>
 
         Remove the dependency on GraphicsLayer from CCLayerTreeHost.
index 4db9fa9..47a84ff 100644 (file)
@@ -685,6 +685,16 @@ GraphicsLayer* FrameView::layerForScrollCorner() const
     return view->compositor()->layerForScrollCorner();
 }
 
+#if PLATFORM(CHROMIUM) && ENABLE(RUBBER_BANDING)
+GraphicsLayer* FrameView::layerForOverhangAreas() const
+{
+    RenderView* view = m_frame->contentRenderer();
+    if (!view)
+        return 0;
+    return view->compositor()->layerForOverhangAreas();
+}
+#endif
+
 bool FrameView::syncCompositingStateForThisFrame(Frame* rootFrameForSync)
 {
     ASSERT(m_frame->view() == this);
index 7be6641..8649811 100644 (file)
@@ -349,6 +349,9 @@ private:
     virtual GraphicsLayer* layerForHorizontalScrollbar() const;
     virtual GraphicsLayer* layerForVerticalScrollbar() const;
     virtual GraphicsLayer* layerForScrollCorner() const;
+#if PLATFORM(CHROMIUM) && ENABLE(RUBBER_BANDING)
+    virtual GraphicsLayer* layerForOverhangAreas() const;
+#endif
 #endif
 
     virtual void notifyPageThatContentAreaWillPaint() const;
index 041e382..608bc51 100644 (file)
@@ -644,6 +644,12 @@ void ScrollView::scrollContents(const IntSize& scrollDelta)
     IntRect horizontalOverhangRect;
     IntRect verticalOverhangRect;
     calculateOverhangAreasForPainting(horizontalOverhangRect, verticalOverhangRect);
+#if USE(ACCELERATED_COMPOSITING) && PLATFORM(CHROMIUM) && ENABLE(RUBBER_BANDING)
+    if (GraphicsLayer* overhangLayer = layerForOverhangAreas()) {
+        bool hasOverhangArea = !horizontalOverhangRect.isEmpty() || !verticalOverhangRect.isEmpty();
+        overhangLayer->setDrawsContent(hasOverhangArea);
+    }
+#endif
     if (!horizontalOverhangRect.isEmpty())
         hostWindow()->invalidateContentsAndWindow(horizontalOverhangRect, false /*immediate*/);
     if (!verticalOverhangRect.isEmpty())
@@ -1025,12 +1031,12 @@ void ScrollView::paint(GraphicsContext* context, const IntRect& rect)
         paintContents(context, documentDirtyRect);
     }
 
-    IntRect horizontalOverhangRect;
-    IntRect verticalOverhangRect;
-    calculateOverhangAreasForPainting(horizontalOverhangRect, verticalOverhangRect);
-
-    if (rect.intersects(horizontalOverhangRect) || rect.intersects(verticalOverhangRect))
-        paintOverhangAreas(context, horizontalOverhangRect, verticalOverhangRect, rect);
+#if USE(ACCELERATED_COMPOSITING) && PLATFORM(CHROMIUM) && ENABLE(RUBBER_BANDING)
+    if (!layerForOverhangAreas())
+        calculateAndPaintOverhangAreas(context, rect);
+#else
+    calculateAndPaintOverhangAreas(context, rect);
+#endif
 
     // Now paint the scrollbars.
     if (!m_scrollbarsSuppressed && (m_horizontalScrollbar || m_verticalScrollbar)) {
@@ -1092,6 +1098,16 @@ void ScrollView::paintOverhangAreas(GraphicsContext* context, const IntRect& hor
     ScrollbarTheme::nativeTheme()->paintOverhangAreas(this, context, horizontalOverhangRect, verticalOverhangRect, dirtyRect);
 }
 
+void ScrollView::calculateAndPaintOverhangAreas(GraphicsContext* context, const IntRect& dirtyRect)
+{
+    IntRect horizontalOverhangRect;
+    IntRect verticalOverhangRect;
+    calculateOverhangAreasForPainting(horizontalOverhangRect, verticalOverhangRect);
+
+    if (dirtyRect.intersects(horizontalOverhangRect) || dirtyRect.intersects(verticalOverhangRect))
+        paintOverhangAreas(context, horizontalOverhangRect, verticalOverhangRect, dirtyRect);
+}
+
 bool ScrollView::isPointInScrollbarCorner(const IntPoint& windowPoint)
 {
     if (!scrollbarCornerPresent())
index d7d08b1..2283b85 100644 (file)
@@ -286,6 +286,8 @@ public:
     bool containsScrollableAreaWithOverlayScrollbars() const { return m_containsScrollableAreaWithOverlayScrollbars; }
     void setContainsScrollableAreaWithOverlayScrollbars(bool contains) { m_containsScrollableAreaWithOverlayScrollbars = contains; }
 
+    void calculateAndPaintOverhangAreas(GraphicsContext*, const IntRect& dirtyRect);
+
 protected:
     ScrollView();
 
index c39e15c..12a3523 100644 (file)
@@ -184,6 +184,9 @@ protected:
     virtual GraphicsLayer* layerForHorizontalScrollbar() const { return 0; }
     virtual GraphicsLayer* layerForVerticalScrollbar() const { return 0; }
     virtual GraphicsLayer* layerForScrollCorner() const { return 0; }
+#if PLATFORM(CHROMIUM) && ENABLE(RUBBER_BANDING)
+    virtual GraphicsLayer* layerForOverhangAreas() const { return 0; }
+#endif
 #endif
     bool hasLayerForHorizontalScrollbar() const;
     bool hasLayerForVerticalScrollbar() const;
index efcd9e0..7be9940 100644 (file)
@@ -956,6 +956,11 @@ void RenderLayerCompositor::frameViewDidChangeSize()
         LayoutPoint scrollPosition = frameView->scrollPosition();
         m_scrollLayer->setPosition(FloatPoint(-scrollPosition.x(), -scrollPosition.y()));
         updateOverflowControlsLayers();
+
+#if PLATFORM(CHROMIUM) && ENABLE(RUBBER_BANDING)
+        if (m_layerForOverhangAreas)
+            m_layerForOverhangAreas->setSize(frameView->frameRect().size());
+#endif
     }
 }
 
@@ -1544,6 +1549,11 @@ void RenderLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, Gr
         transformedClip.moveBy(scrollCorner.location());
         m_renderView->frameView()->paintScrollCorner(&context, transformedClip);
         context.restore();
+#if PLATFORM(CHROMIUM) && ENABLE(RUBBER_BANDING)
+    } else if (graphicsLayer == layerForOverhangAreas()) {
+        ScrollView* view = m_renderView->frameView();
+        view->calculateAndPaintOverhangAreas(&context, clip);
+#endif
     }
 }
 
@@ -1609,9 +1619,36 @@ bool RenderLayerCompositor::requiresScrollCornerLayer() const
     return shouldCompositeOverflowControls(view) && view->isScrollCornerVisible();
 }
 
+#if PLATFORM(CHROMIUM) && ENABLE(RUBBER_BANDING)
+bool RenderLayerCompositor::requiresOverhangAreasLayer() const
+{
+    // Only if this is a top level frame (not iframe).
+    return !m_renderView->document()->ownerElement();
+}
+#endif
+
 void RenderLayerCompositor::updateOverflowControlsLayers()
 {
     bool layersChanged = false;
+  
+#if PLATFORM(CHROMIUM) && ENABLE(RUBBER_BANDING)
+    if (requiresOverhangAreasLayer()) {
+        if (!m_layerForOverhangAreas) {
+            m_layerForOverhangAreas = GraphicsLayer::create(this);
+#ifndef NDEBUG
+            m_layerForOverhangAreas->setName("overhang areas");
+#endif
+            m_layerForOverhangAreas->setDrawsContent(false);
+            m_layerForOverhangAreas->setSize(m_renderView->frameView()->frameRect().size());
+            m_overflowControlsHostLayer->addChild(m_layerForOverhangAreas.get());
+            layersChanged = true;
+        }
+    } else if (m_layerForOverhangAreas) {
+        m_layerForOverhangAreas->removeFromParent();
+        m_layerForOverhangAreas = nullptr;
+        layersChanged = true;
+    }
+#endif
 
     if (requiresHorizontalScrollbarLayer()) {
         m_layerForHorizontalScrollbar = GraphicsLayer::create(this);
@@ -1727,6 +1764,13 @@ void RenderLayerCompositor::destroyRootLayer()
 
     detachRootLayer();
 
+#if PLATFORM(CHROMIUM) && ENABLE(RUBBER_BANDING)
+    if (m_layerForOverhangAreas) {
+        m_layerForOverhangAreas->removeFromParent();
+        m_layerForOverhangAreas = nullptr;
+    }
+#endif
+
     if (m_layerForHorizontalScrollbar) {
         m_layerForHorizontalScrollbar->removeFromParent();
         m_layerForHorizontalScrollbar = nullptr;
index ad00814..72108fe 100644 (file)
@@ -196,6 +196,9 @@ public:
     GraphicsLayer* layerForHorizontalScrollbar() const { return m_layerForHorizontalScrollbar.get(); }
     GraphicsLayer* layerForVerticalScrollbar() const { return m_layerForVerticalScrollbar.get(); }
     GraphicsLayer* layerForScrollCorner() const { return m_layerForScrollCorner.get(); }
+#if PLATFORM(CHROMIUM) && ENABLE(RUBBER_BANDING)
+    GraphicsLayer* layerForOverhangAreas() const { return m_layerForOverhangAreas.get(); }
+#endif
 
 private:
     // GraphicsLayerClient Implementation
@@ -275,6 +278,9 @@ private:
     bool requiresHorizontalScrollbarLayer() const;
     bool requiresVerticalScrollbarLayer() const;
     bool requiresScrollCornerLayer() const;
+#if PLATFORM(CHROMIUM) && ENABLE(RUBBER_BANDING)
+    bool requiresOverhangAreasLayer() const;
+#endif
 
 private:
     RenderView* m_renderView;
@@ -311,6 +317,9 @@ private:
     OwnPtr<GraphicsLayer> m_layerForHorizontalScrollbar;
     OwnPtr<GraphicsLayer> m_layerForVerticalScrollbar;
     OwnPtr<GraphicsLayer> m_layerForScrollCorner;
+#if PLATFORM(CHROMIUM) && ENABLE(RUBBER_BANDING)
+    OwnPtr<GraphicsLayer> m_layerForOverhangAreas;
+#endif
 #if PROFILE_LAYER_REBUILD
     int m_rootLayerUpdateCount;
 #endif