Chromium Code Reviews| 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 6e66dcecbf1827f0aa76ed281430a9a10e05164a..47a400c81ea6395e53ec59712ed24a91574f433f 100644 |
| --- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp |
| +++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp |
| @@ -1277,6 +1277,19 @@ bool LayoutObject::mapToVisualRectInAncestorSpace( |
| const LayoutBoxModelObject* ancestor, |
| LayoutRect& rect, |
| VisualRectFlags visualRectFlags) const { |
| + TransformState transformState(TransformState::ApplyTransformDirection, |
| + FloatQuad(FloatRect(rect))); |
| + bool retval = mapToVisualRectInAncestorSpaceInternal(ancestor, transformState, |
| + visualRectFlags); |
| + transformState.flatten(); |
| + rect = LayoutRect(transformState.lastPlanarQuad().boundingBox()); |
| + return retval; |
| +} |
| + |
| +bool LayoutObject::mapToVisualRectInAncestorSpaceInternal( |
| + const LayoutBoxModelObject* ancestor, |
| + TransformState& transformState, |
| + VisualRectFlags visualRectFlags) const { |
| // For any layout object that doesn't override this method (the main example |
| // is LayoutText), the rect is assumed to be in the parent's coordinate space, |
| // except for container flip. |
| @@ -1289,15 +1302,27 @@ bool LayoutObject::mapToVisualRectInAncestorSpace( |
| LayoutBox* parentBox = toLayoutBox(parent); |
| // Never flip for SVG as it handles writing modes itself. |
| - if (!isSVG()) |
| + if (!isSVG()) { |
| + transformState.flatten(); |
| + LayoutRect rect(transformState.lastPlanarQuad().boundingBox()); |
| parentBox->flipForWritingMode(rect); |
| + transformState.setQuad(FloatQuad(FloatRect(rect))); |
| + } |
| + |
| + bool preserve3D = (parent->style()->preserves3D() && !parent->isText()) || |
|
Xianzhu
2017/03/03 01:24:42
Ditto about !parent->isText().
chrishtr
2017/03/03 02:45:11
I copied this conditional from:
https://cs.chromi
|
| + (style()->preserves3D() && !isText()); |
| + |
| + TransformState::TransformAccumulation accumulation = |
| + preserve3D ? TransformState::AccumulateTransform |
| + : TransformState::FlattenTransform; |
| if (parent != ancestor && |
| - !parentBox->mapScrollingContentsRectToBoxSpace(rect, visualRectFlags)) |
| + !parentBox->mapScrollingContentsRectToBoxSpace( |
| + transformState, accumulation, visualRectFlags)) |
| return false; |
| } |
| - return parent->mapToVisualRectInAncestorSpace(ancestor, rect, |
| - visualRectFlags); |
| + return parent->mapToVisualRectInAncestorSpaceInternal( |
| + ancestor, transformState, visualRectFlags); |
| } |
| return true; |
| } |
| @@ -2269,6 +2294,8 @@ FloatQuad LayoutObject::localToAncestorQuadInternal( |
| // mapLocalToAncestor() calls offsetFromContainer(), it will use that point |
| // as the reference point to decide which column's transform to apply in |
| // multiple-column blocks. |
| + // TODO(chrishtr): the second argument to this constructor is unnecessary, |
| + // since we never call lastPlanarPoint(). |
| TransformState transformState(TransformState::ApplyTransformDirection, |
| localQuad.boundingBox().center(), localQuad); |
| mapLocalToAncestor(ancestor, transformState, mode | ApplyContainerFlip); |