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

Unified Diff: Source/core/paint/DeprecatedPaintLayer.cpp

Issue 1268493002: Unify code paths for fixed and absolutely positioned objects in accumulateOffsetTowardsAncestor(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix comment Created 5 years, 5 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/fast/multicol/transform-with-fixedpos-expected.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « LayoutTests/fast/multicol/transform-with-fixedpos-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698