Diff
Modified: trunk/LayoutTests/ChangeLog (140228 => 140229)
--- trunk/LayoutTests/ChangeLog 2013-01-19 02:10:41 UTC (rev 140228)
+++ trunk/LayoutTests/ChangeLog 2013-01-19 02:22:41 UTC (rev 140229)
@@ -1,3 +1,13 @@
+2013-01-18 Beth Dakin <[email protected]>
+
+ https://bugs.webkit.org/show_bug.cgi?id=106946
+ Sticky-position elements can jump around/hide on rubber-banding
+
+ Reviewed by Simon Fraser.
+
+ * platform/mac/tiled-drawing/sticky/negative-scroll-offset-expected.txt: Added.
+ * platform/mac/tiled-drawing/sticky/negative-scroll-offset.html: Added.
+
2013-01-18 Sheriff Bot <[email protected]>
Unreviewed, rolling out r140206.
Added: trunk/LayoutTests/platform/mac/tiled-drawing/sticky/negative-scroll-offset-expected.txt (0 => 140229)
--- trunk/LayoutTests/platform/mac/tiled-drawing/sticky/negative-scroll-offset-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/tiled-drawing/sticky/negative-scroll-offset-expected.txt 2013-01-19 02:22:41 UTC (rev 140229)
@@ -0,0 +1,19 @@
+(Scrolling node
+ (viewport rect 0 0 785 600)
+ (contents size 785 2216)
+ (requested scroll position 0 -20)
+ (children 1
+ (Sticky node
+ (anchor edges: AnchorEdgeLeft AnchorEdgeRight AnchorEdgeBottom)
+ (left offset 0.00)
+ (right offset 0.00)
+ (bottom offset 0.00)
+ (containing block rect 8.00, 8.00 769.00 x 2200.00)
+ (sticky box rect 8.00 8.00 773.00 54.00)
+ (sticky box rect 8.00 8.00 773.00 54.00)
+ (sticky offset at last layout 0.00 0.00)
+ (layer position at last layout 8.00 8.00)
+ )
+ )
+)
+
Added: trunk/LayoutTests/platform/mac/tiled-drawing/sticky/negative-scroll-offset.html (0 => 140229)
--- trunk/LayoutTests/platform/mac/tiled-drawing/sticky/negative-scroll-offset.html (rev 0)
+++ trunk/LayoutTests/platform/mac/tiled-drawing/sticky/negative-scroll-offset.html 2013-01-19 02:22:41 UTC (rev 140229)
@@ -0,0 +1,49 @@
+<html>
+<head>
+ <style type="text/css" media="screen">
+ body {
+ height: 2200px;
+ }
+
+ .sticky {
+ position: -webkit-sticky;
+ width: 100%;
+ height: 50px;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background-color: rgba(0, 128, 0, 0.8);
+ border: 2px solid black;
+ }
+
+ </style>
+ <script type="text/_javascript_" charset="utf-8">
+ if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+ }
+
+ function doScroll()
+ {
+ window.setTimeout(function() {
+ window.scrollTo(0, -20);
+ if (window.testRunner) {
+ document.getElementById('results').innerText = window.internals.scrollingStateTreeAsText(document);
+ testRunner.notifyDone();
+ }
+ }, 10);
+ }
+
+ window.addEventListener('load', doScroll, false);
+ </script>
+
+
+</head>
+<body>
+
+<pre id="results"></pre>
+
+<div class="sticky"></div>
+
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (140228 => 140229)
--- trunk/Source/WebCore/ChangeLog 2013-01-19 02:10:41 UTC (rev 140228)
+++ trunk/Source/WebCore/ChangeLog 2013-01-19 02:22:41 UTC (rev 140229)
@@ -1,3 +1,28 @@
+2013-01-18 Beth Dakin <[email protected]>
+
+ https://bugs.webkit.org/show_bug.cgi?id=106946
+ Sticky-position elements can jump around/hide on rubber-banding
+
+ Reviewed by Simon Fraser.
+
+ This patch adds a new function called viewportConstrainedVisibleContentRect()
+ since there are a number of places where we need a visibleContectRect() that does
+ not allow scroll offsets that indicate the rubber-banding that is happening. And
+ this patch fixes the bug for sticky by calling this function in two new places.
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::viewportConstrainedVisibleContentRect):
+ (WebCore):
+ * page/FrameView.h:
+ (FrameView):
+ * page/scrolling/ScrollingCoordinator.cpp:
+ (WebCore::ScrollingCoordinator::updateMainFrameScrollPosition):
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelObject::stickyPositionOffset):
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::computeFixedViewportConstraints):
+ (WebCore::RenderLayerCompositor::computeStickyViewportConstraints):
+
2013-01-18 Sheriff Bot <[email protected]>
Unreviewed, rolling out r140206.
Modified: trunk/Source/WebCore/page/FrameView.cpp (140228 => 140229)
--- trunk/Source/WebCore/page/FrameView.cpp 2013-01-19 02:10:41 UTC (rev 140228)
+++ trunk/Source/WebCore/page/FrameView.cpp 2013-01-19 02:22:41 UTC (rev 140229)
@@ -1494,6 +1494,13 @@
}
}
+LayoutRect FrameView::viewportConstrainedVisibleContentRect() const
+{
+ LayoutRect viewportRect = visibleContentRect();
+ viewportRect.setLocation(toPoint(scrollOffsetForFixedPosition()));
+ return viewportRect;
+}
+
IntSize FrameView::scrollOffsetForFixedPosition() const
{
IntRect visibleContentRect = this->visibleContentRect();
Modified: trunk/Source/WebCore/page/FrameView.h (140228 => 140229)
--- trunk/Source/WebCore/page/FrameView.h 2013-01-19 02:10:41 UTC (rev 140228)
+++ trunk/Source/WebCore/page/FrameView.h 2013-01-19 02:22:41 UTC (rev 140229)
@@ -191,6 +191,10 @@
virtual bool shouldRubberBandInDirection(ScrollDirection) const;
virtual bool requestScrollPositionUpdate(const IntPoint&) OVERRIDE;
+ // This is different than visibleContentRect() in that it ignores negative (or overly positive)
+ // offsets from rubber-banding, and it takes zooming into account.
+ LayoutRect viewportConstrainedVisibleContentRect() const;
+
String mediaType() const;
void setMediaType(const String&);
void adjustMediaTypeForPrinting(bool printing);
Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (140228 => 140229)
--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp 2013-01-19 02:10:41 UTC (rev 140228)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp 2013-01-19 02:22:41 UTC (rev 140229)
@@ -392,8 +392,7 @@
if (counterScrollingLayer)
counterScrollingLayer->syncPosition(IntPoint(frameView->scrollOffsetForFixedPosition()));
- LayoutRect viewportRect = frameView->visibleContentRect();
- viewportRect.setLocation(IntPoint(frameView->scrollOffsetForFixedPosition()));
+ LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect();
syncChildPositions(viewportRect);
}
}
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (140228 => 140229)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2013-01-19 02:10:41 UTC (rev 140228)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2013-01-19 02:22:41 UTC (rev 140229)
@@ -509,7 +509,7 @@
LayoutSize RenderBoxModelObject::stickyPositionOffset() const
{
- LayoutRect viewportRect = view()->frameView()->visibleContentRect();
+ LayoutRect viewportRect = view()->frameView()->viewportConstrainedVisibleContentRect();
float scale = 1;
if (Frame* frame = view()->frameView()->frame())
scale = frame->frameScaleFactor();
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (140228 => 140229)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2013-01-19 02:10:41 UTC (rev 140228)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2013-01-19 02:22:41 UTC (rev 140229)
@@ -2728,10 +2728,8 @@
ASSERT(layer->isComposited());
FrameView* frameView = m_renderView->frameView();
+ LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect();
- LayoutRect viewportRect = frameView->visibleContentRect();
- viewportRect.setLocation(toPoint(frameView->scrollOffsetForFixedPosition()));
-
FixedPositionViewportConstraints constraints = FixedPositionViewportConstraints();
GraphicsLayer* graphicsLayer = layer->backing()->graphicsLayer();
@@ -2768,7 +2766,7 @@
ASSERT(layer->isComposited());
FrameView* frameView = m_renderView->frameView();
- LayoutRect viewportRect = frameView->visibleContentRect();
+ LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect();
StickyPositionViewportConstraints constraints = StickyPositionViewportConstraints();