Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1511)

Unified Diff: Source/core/rendering/RenderLayer.cpp

Issue 268813005: Fix bug in RenderLayer::scrollsWithRespectTo. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/compositing/overflow/scrolls-with-respect-to-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderLayer.cpp
diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp
index 922e1a0ac76c8457a90283c6a378e9e52580d84b..18e6c98024aa4ffa81209a36960c7ae22485de67 100644
--- a/Source/core/rendering/RenderLayer.cpp
+++ b/Source/core/rendering/RenderLayer.cpp
@@ -416,6 +416,7 @@ bool RenderLayer::scrollsWithRespectTo(const RenderLayer* other) const
const bool isRootFixedPos = position == FixedPosition && containingBlock->enclosingLayer() == rootLayer;
const bool otherIsRootFixedPos = otherPosition == FixedPosition && otherContainingBlock->enclosingLayer() == rootLayer;
+ // FIXME: some of these cases don't look quite right.
if (isRootFixedPos && otherIsRootFixedPos)
return false;
if (isRootFixedPos || otherIsRootFixedPos)
@@ -428,8 +429,13 @@ bool RenderLayer::scrollsWithRespectTo(const RenderLayer* other) const
// closest scrollable ancestor.
HashSet<const RenderObject*> containingBlocks;
while (containingBlock) {
- if (containingBlock->enclosingLayer()->scrollsOverflow())
+ if (containingBlock->enclosingLayer()->scrollsOverflow()) {
break;
+ }
+ if (containingBlock->enclosingLayer() == other) {
+ // This layer does not scroll with respect to the other layer if the other one does not scroll and this one is a child.
+ return false;
+ }
containingBlocks.add(containingBlock);
containingBlock = containingBlock->containingBlock();
}
@@ -437,9 +443,14 @@ bool RenderLayer::scrollsWithRespectTo(const RenderLayer* other) const
// Do the same for the 2nd layer, but if we find a common containing block,
// it means both layers are contained within a single non-scrolling subtree.
// Hence, they will not scroll with respect to each other.
+ bool thisLayerScrollsOverflow = scrollsOverflow();
while (otherContainingBlock) {
if (containingBlocks.contains(otherContainingBlock))
return false;
+ // The other layer scrolls with respect to this one if this one scrolls and it's a child.
+ if (!thisLayerScrollsOverflow && otherContainingBlock->enclosingLayer() == this)
+ return false;
+ // The other layer does not scroll with respect to this one if this one does not scroll and it's a child.
if (otherContainingBlock->enclosingLayer()->scrollsOverflow())
break;
otherContainingBlock = otherContainingBlock->containingBlock();
« no previous file with comments | « LayoutTests/compositing/overflow/scrolls-with-respect-to-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698