Index: Source/core/paint/DeprecatedPaintLayer.cpp |
diff --git a/Source/core/paint/DeprecatedPaintLayer.cpp b/Source/core/paint/DeprecatedPaintLayer.cpp |
index 4cc659ddced37bb39eb93558e23121fe4a33aed4..8f81438d191b53a8bd1b75dbbeec10a6ec70eaf8 100644 |
--- a/Source/core/paint/DeprecatedPaintLayer.cpp |
+++ b/Source/core/paint/DeprecatedPaintLayer.cpp |
@@ -1250,58 +1250,14 @@ static inline const DeprecatedPaintLayer* accumulateOffsetTowardsAncestor(const |
return ancestorLayer; |
} |
- if (position == FixedPosition) { |
- // For a fixed layers, we need to walk up to the root to see if there's a fixed position container |
- // (e.g. a transformed layer). It's an error to call convertToLayerCoords() across a layer with a transform, |
- // so we should always find the ancestor at or before we find the fixed position container, if |
- // the container is transformed. |
- DeprecatedPaintLayer* fixedPositionContainerLayer = 0; |
- bool foundAncestor = false; |
- for (DeprecatedPaintLayer* currLayer = layer->parent(); currLayer; currLayer = currLayer->parent()) { |
- if (currLayer == ancestorLayer) |
- foundAncestor = true; |
- |
- if (isFixedPositionedContainer(currLayer)) { |
- fixedPositionContainerLayer = currLayer; |
- // A layer that has a transform-related property but not a |
- // transform still acts as a fixed-position container. |
- // Accumulating offsets across such layers is allowed. |
- if (currLayer->transform()) |
- ASSERT_UNUSED(foundAncestor, foundAncestor); |
- break; |
- } |
- } |
- |
- ASSERT(fixedPositionContainerLayer); // We should have hit the LayoutView's layer at least. |
- |
- if (fixedPositionContainerLayer != ancestorLayer) { |
- LayoutPoint fixedContainerCoords; |
- layer->convertToLayerCoords(fixedPositionContainerLayer, fixedContainerCoords); |
- location += fixedContainerCoords; |
- |
- if (foundAncestor) { |
- LayoutPoint ancestorCoords; |
- ancestorLayer->convertToLayerCoords(fixedPositionContainerLayer, ancestorCoords); |
- location += -ancestorCoords; |
- } |
- } else { |
- // LayoutView has been handled in the first top-level 'if' block above. |
- ASSERT(ancestorLayer != layoutObject->view()->layer()); |
- ASSERT(ancestorLayer->hasTransformRelatedProperty()); |
- |
- location += layer->location(); |
- } |
- return foundAncestor ? ancestorLayer : fixedPositionContainerLayer; |
- } |
- |
DeprecatedPaintLayer* parentLayer; |
- if (position == AbsolutePosition) { |
+ if (position == AbsolutePosition || position == FixedPosition) { |
bool foundAncestorFirst; |
parentLayer = layer->enclosingPositionedAncestor(ancestorLayer, &foundAncestorFirst); |
if (foundAncestorFirst) { |
- // Found ancestorLayer before the abs. positioned container, so compute offset of both relative |
- // to the positioned ancestor and subtract. |
+ // Found ancestorLayer before the container of the out-of-flow object, so compute offset |
+ // of both relative to the container and subtract. |
LayoutPoint thisCoords; |
layer->convertToLayerCoords(parentLayer, thisCoords); |
@@ -1322,7 +1278,7 @@ static inline const DeprecatedPaintLayer* accumulateOffsetTowardsAncestor(const |
} |
if (!parentLayer) |
- return 0; |
+ return nullptr; |
location += layer->location(); |
return parentLayer; |