Index: Source/core/rendering/RenderLayer.cpp |
diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp |
index 957df9c1bf388fec56c0767215b5535b1c098bbc..3395e61cbaa20995f573baca2864da587f1ee776 100644 |
--- a/Source/core/rendering/RenderLayer.cpp |
+++ b/Source/core/rendering/RenderLayer.cpp |
@@ -1360,9 +1360,9 @@ RenderLayer* RenderLayer::enclosingPositionedAncestor() const |
RenderLayer* RenderLayer::enclosingScrollableLayer() const |
{ |
- for (RenderObject* nextRenderer = renderer()->parent(); nextRenderer; nextRenderer = nextRenderer->parent()) { |
- if (nextRenderer->isBox() && toRenderBox(nextRenderer)->canBeScrolledAndHasScrollableArea()) |
- return nextRenderer->enclosingLayer(); |
+ for (RenderLayer* nextLayer = parent(); nextLayer; nextLayer = nextLayer->parent()) { |
+ if (nextLayer->renderer()->isBox() && toRenderBox(nextLayer->renderer())->canBeScrolledAndHasScrollableArea()) |
+ return nextLayer; |
} |
return 0; |
@@ -2292,6 +2292,9 @@ void RenderLayer::scrollRectToVisible(const LayoutRect& rect, const ScrollAlignm |
} |
} |
+ if (renderer()->frame()->page()->autoscrollInProgress()) |
+ parentLayer = enclosingScrollableLayer(); |
+ |
if (parentLayer) |
parentLayer->scrollRectToVisible(newRect, alignX, alignY); |