Index: Source/core/layout/LayoutObject.cpp |
diff --git a/Source/core/layout/LayoutObject.cpp b/Source/core/layout/LayoutObject.cpp |
index e96113c8527123bac9e23bd9410e148474f9f1a9..29e2b7689cc366ddfa2031a13ea849363118fea1 100644 |
--- a/Source/core/layout/LayoutObject.cpp |
+++ b/Source/core/layout/LayoutObject.cpp |
@@ -2040,22 +2040,45 @@ void LayoutObject::mapLocalToContainer(const LayoutBoxModelObject* paintInvalida |
if (paintInvalidationContainer == this) |
return; |
- LayoutObject* o = parent(); |
+ if (paintInvalidationState && paintInvalidationState->canMapToContainer(paintInvalidationContainer)) { |
+ LayoutSize offset = paintInvalidationState->paintOffset(); |
+ if (!isText() && style()->hasInFlowPosition() && hasLayer()) |
ojan
2015/06/19 02:21:09
Nit: I believe a LayoutText can't have a layer, so
mstensho (USE GERRIT)
2015/06/19 09:52:42
Indeed. I can remove it. I put it there, so that w
|
+ offset += toLayoutBoxModelObject(this)->layer()->offsetForInFlowPosition(); |
+ transformState.move(offset); |
+ return; |
+ } |
+ |
+ bool containerSkipped; |
+ LayoutObject* o = container(paintInvalidationContainer, &containerSkipped); |
if (!o) |
return; |
- // FIXME: this should call offsetFromContainer to share code, but I'm not sure it's ever called. |
- LayoutPoint centerPoint = roundedLayoutPoint(transformState.mappedPoint()); |
if (mode & ApplyContainerFlip && o->isBox()) { |
- if (o->style()->isFlippedBlocksWritingMode()) |
- transformState.move(toLayoutBox(o)->flipForWritingMode(roundedLayoutPoint(transformState.mappedPoint())) - centerPoint); |
+ if (o->style()->isFlippedBlocksWritingMode()) { |
+ IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint()); |
+ transformState.move(toLayoutBox(o)->flipForWritingMode(LayoutPoint(centerPoint)) - centerPoint); |
+ } |
mode &= ~ApplyContainerFlip; |
} |
- transformState.move(o->columnOffset(roundedLayoutPoint(transformState.mappedPoint()))); |
+ LayoutSize containerOffset = offsetFromContainer(o, roundedLayoutPoint(transformState.mappedPoint())); |
- if (o->hasOverflowClip()) |
- transformState.move(-toLayoutBox(o)->scrolledContentOffset()); |
+ bool preserve3D = mode & UseTransforms && (o->style()->preserves3D() || (!isText() && style()->preserves3D())); |
ojan
2015/06/19 02:21:09
I don't think this is right. Even if your parent p
mstensho (USE GERRIT)
2015/06/19 09:52:42
First of all: this was an unintended change from m
|
+ if (mode & UseTransforms && shouldUseTransformFromContainer(o)) { |
+ TransformationMatrix t; |
+ getTransformFromContainer(o, containerOffset, t); |
+ transformState.applyTransform(t, preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform); |
+ } else { |
+ transformState.move(containerOffset.width(), containerOffset.height(), preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform); |
+ } |
+ |
+ if (containerSkipped) { |
+ // There can't be a transform between paintInvalidationContainer and o, because transforms create containers, so it should be safe |
+ // to just subtract the delta between the paintInvalidationContainer and o. |
+ LayoutSize containerOffset = paintInvalidationContainer->offsetFromAncestorContainer(o); |
+ transformState.move(-containerOffset.width(), -containerOffset.height(), preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform); |
+ return; |
+ } |
o->mapLocalToContainer(paintInvalidationContainer, transformState, mode, wasFixed, paintInvalidationState); |
} |