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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutObject.cpp

Issue 1516003003: Merge LayoutInline::mapLocalToAncestor() into LayoutObject. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review constness + bonus constness Created 4 years, 10 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 | « third_party/WebKit/Source/core/layout/LayoutInline.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/LayoutObject.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
index afc3f54de36afed8d746c40465cd7305f1cf7a91..01dc7314e7dd76963c06e49a4bdc2dba6b250773 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
@@ -2204,22 +2204,46 @@ void LayoutObject::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Tran
if (ancestor == this)
return;
- LayoutObject* o = parent();
+ if (paintInvalidationState && paintInvalidationState->canMapToContainer(ancestor)) {
+ LayoutSize offset = paintInvalidationState->paintOffset();
+ if (const PaintLayer* layer = style()->hasInFlowPosition() && hasLayer() ? toLayoutBoxModelObject(this)->layer() : nullptr)
+ offset += layer->offsetForInFlowPosition();
+ transformState.move(offset);
+ return;
+ }
+
+ bool containerSkipped;
+ const LayoutObject* o = container(ancestor, &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());
+ // Text objects just copy their parent's computed style, so we need to ignore them.
+ bool preserve3D = mode & UseTransforms && ((o->style()->preserves3D() && !o->isText()) || (style()->preserves3D() && !isText()));
+ 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 |ancestor| and |o|, because transforms create
+ // containers, so it should be safe to just subtract the delta between the ancestor and |o|.
+ LayoutSize containerOffset = ancestor->offsetFromAncestorContainer(o);
+ transformState.move(-containerOffset.width(), -containerOffset.height(), preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform);
+ return;
+ }
o->mapLocalToAncestor(ancestor, transformState, mode, wasFixed, paintInvalidationState);
}
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutInline.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698