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

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

Issue 343623003: Fix RenderLayer::scrollsWithRespectTo(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: efficiency Created 6 years, 6 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 be92d92417e0a84c5a96345eb64f1c16ec420a37..bfa66d765b5a193f8450b3b14c4c0427caef3bdc 100644
--- a/Source/core/rendering/RenderLayer.cpp
+++ b/Source/core/rendering/RenderLayer.cpp
@@ -368,35 +368,31 @@ bool RenderLayer::scrollsWithRespectTo(const RenderLayer* other) const
if (isRootFixedPos || otherIsRootFixedPos)
return true;
- if (containingBlock == otherContainingBlock)
+ if (containingBlock->enclosingLayer() == otherContainingBlock->enclosingLayer())
return false;
// Maintain a set of containing blocks between the first layer and its
// closest scrollable ancestor.
- HashSet<const RenderObject*> containingBlocks;
+ HashSet<const RenderLayer*> containingBlocks;
while (containingBlock) {
- if (containingBlock->enclosingLayer()->scrollsOverflow()) {
+ containingBlocks.add(containingBlock->enclosingLayer());
+ 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();
}
// 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))
+ if (containingBlocks.contains(otherContainingBlock->enclosingLayer()))
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