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

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

Issue 343623003: Fix RenderLayer::scrollsWithRespectTo(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
Index: Source/core/rendering/RenderLayer.cpp
diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp
index be92d92417e0a84c5a96345eb64f1c16ec420a37..a13176a281125c032501a1bb6053cbb485a8cf6e 100644
--- a/Source/core/rendering/RenderLayer.cpp
+++ b/Source/core/rendering/RenderLayer.cpp
@@ -368,35 +368,25 @@ bool RenderLayer::scrollsWithRespectTo(const RenderLayer* other) const
if (isRootFixedPos || otherIsRootFixedPos)
return true;
- if (containingBlock == otherContainingBlock)
+ if (containingBlock->enclosingLayer() == otherContainingBlock->enclosingLayer())
hartmanng 2014/06/18 17:54:01 We need to compare enclosingLayers, not just Rende
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) {
hartmanng 2014/06/18 17:54:01 I don't think these special cases are required any
Ian Vollick 2014/06/18 18:28:30 I think we were also looking to early out for effi
hartmanng 2014/06/18 18:46:12 It's still valid, I just thought it was unnecessar
- // 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.
hartmanng 2014/06/18 18:46:12 I don't think this early-out will gain us much in
Ian Vollick 2014/06/18 20:40:02 I buy it.
- 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();

Powered by Google App Engine
This is Rietveld 408576698