Index: Source/core/paint/DeprecatedPaintLayer.cpp |
diff --git a/Source/core/paint/DeprecatedPaintLayer.cpp b/Source/core/paint/DeprecatedPaintLayer.cpp |
index a67baee4c4ad558a506e9b5888e7664980a51127..67c6735717339f910182f06766eafae4f4d29803 100644 |
--- a/Source/core/paint/DeprecatedPaintLayer.cpp |
+++ b/Source/core/paint/DeprecatedPaintLayer.cpp |
@@ -711,6 +711,18 @@ bool DeprecatedPaintLayer::update3DTransformedDescendantStatus() |
return has3DTransform(); |
} |
+LayoutPoint DeprecatedPaintLayer::locationExcludingOverflowScroll() const |
+{ |
+ ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
+ |
+ // Our m_location already has scroll offset baked-in. We have to revert it here. |
+ IntSize scrollOffset; |
+ DeprecatedPaintLayer* scrollParent = layoutObject()->isOutOfFlowPositioned() ? enclosingPositionedAncestor() : parent(); |
+ if (scrollParent && scrollParent->layoutObject()->hasOverflowClip()) |
+ scrollOffset = scrollParent->layoutBox()->scrolledContentOffset(); |
+ return m_location + LayoutSize(scrollOffset); |
+} |
+ |
bool DeprecatedPaintLayer::updateLayerPosition() |
{ |
LayoutPoint localPoint; |
@@ -1244,7 +1256,7 @@ void DeprecatedPaintLayer::insertOnlyThisLayer() |
} |
// Returns the layer reached on the walk up towards the ancestor. |
-static inline const DeprecatedPaintLayer* accumulateOffsetTowardsAncestor(const DeprecatedPaintLayer* layer, const DeprecatedPaintLayer* ancestorLayer, LayoutPoint& location) |
+static inline const DeprecatedPaintLayer* accumulateOffsetTowardsAncestor(const DeprecatedPaintLayer* layer, const DeprecatedPaintLayer* ancestorLayer, LayoutPoint& location, DeprecatedPaintLayer::LocationQueryBehavior behavior) |
{ |
ASSERT(ancestorLayer != layer); |
@@ -1269,10 +1281,10 @@ static inline const DeprecatedPaintLayer* accumulateOffsetTowardsAncestor(const |
// of both relative to the container and subtract. |
LayoutPoint thisCoords; |
- layer->convertToLayerCoords(parentLayer, thisCoords); |
+ layer->convertToLayerCoords(parentLayer, thisCoords, behavior); |
LayoutPoint ancestorCoords; |
- ancestorLayer->convertToLayerCoords(parentLayer, ancestorCoords); |
+ ancestorLayer->convertToLayerCoords(parentLayer, ancestorCoords, behavior); |
location += (thisCoords - ancestorCoords); |
return ancestorLayer; |
@@ -1289,18 +1301,18 @@ static inline const DeprecatedPaintLayer* accumulateOffsetTowardsAncestor(const |
if (!parentLayer) |
return nullptr; |
- location += layer->location(); |
+ location += layer->location(behavior); |
chrishtr
2015/09/17 18:07:53
I think this introduces n^2 performance, because o
|
return parentLayer; |
} |
-void DeprecatedPaintLayer::convertToLayerCoords(const DeprecatedPaintLayer* ancestorLayer, LayoutPoint& location) const |
+void DeprecatedPaintLayer::convertToLayerCoords(const DeprecatedPaintLayer* ancestorLayer, LayoutPoint& location, LocationQueryBehavior behavior) const |
{ |
if (ancestorLayer == this) |
return; |
const DeprecatedPaintLayer* currLayer = this; |
while (currLayer && currLayer != ancestorLayer) |
- currLayer = accumulateOffsetTowardsAncestor(currLayer, ancestorLayer, location); |
+ currLayer = accumulateOffsetTowardsAncestor(currLayer, ancestorLayer, location, behavior); |
} |
void DeprecatedPaintLayer::convertToLayerCoords(const DeprecatedPaintLayer* ancestorLayer, LayoutRect& rect) const |