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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutInline.cpp

Issue 2727093002: Account for perspective and preserve-3d in mapToVisualRectInAncestorSpace (Closed)
Patch Set: none Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 } 1186 }
1187 if (!rects.isEmpty()) { 1187 if (!rects.isEmpty()) {
1188 LayoutRect outlineRect = unionRectEvenIfEmpty(rects); 1188 LayoutRect outlineRect = unionRectEvenIfEmpty(rects);
1189 outlineRect.inflate(outlineOutset); 1189 outlineRect.inflate(outlineOutset);
1190 overflowRect.unite(outlineRect); 1190 overflowRect.unite(outlineRect);
1191 } 1191 }
1192 } 1192 }
1193 return overflowRect; 1193 return overflowRect;
1194 } 1194 }
1195 1195
1196 bool LayoutInline::mapToVisualRectInAncestorSpace( 1196 bool LayoutInline::mapToVisualRectInAncestorSpaceInternal(
1197 const LayoutBoxModelObject* ancestor, 1197 const LayoutBoxModelObject* ancestor,
1198 LayoutRect& rect, 1198 TransformState& transformState,
1199 VisualRectFlags visualRectFlags) const { 1199 VisualRectFlags visualRectFlags) const {
1200 if (ancestor == this) 1200 if (ancestor == this)
1201 return true; 1201 return true;
1202 1202
1203 LayoutObject* container = this->container(); 1203 LayoutObject* container = this->container();
1204 ASSERT(container == parent()); 1204 ASSERT(container == parent());
1205 if (!container) 1205 if (!container)
1206 return true; 1206 return true;
1207 1207
1208 bool preserve3D = container->style()->preserves3D() || style()->preserves3D();
1209
1210 TransformState::TransformAccumulation accumulation =
1211 preserve3D ? TransformState::AccumulateTransform
1212 : TransformState::FlattenTransform;
1213
1208 if (style()->hasInFlowPosition() && layer()) { 1214 if (style()->hasInFlowPosition() && layer()) {
1209 // Apply the in-flow position offset when invalidating a rectangle. The 1215 // Apply the in-flow position offset when invalidating a rectangle. The
1210 // layer is translated, but the layout box isn't, so we need to do this to 1216 // layer is translated, but the layout box isn't, so we need to do this to
1211 // get the right dirty rect. Since this is called from LayoutObject:: 1217 // get the right dirty rect. Since this is called from LayoutObject::
1212 // setStyle, the relative position flag on the LayoutObject has been 1218 // setStyle, the relative position flag on the LayoutObject has been
1213 // cleared, so use the one on the style(). 1219 // cleared, so use the one on the style().
1214 rect.move(layer()->offsetForInFlowPosition()); 1220 transformState.move(layer()->offsetForInFlowPosition(), accumulation);
1215 } 1221 }
1216 1222
1217 LayoutBox* containerBox = 1223 LayoutBox* containerBox =
1218 container->isBox() ? toLayoutBox(container) : nullptr; 1224 container->isBox() ? toLayoutBox(container) : nullptr;
1219 if (containerBox && container != ancestor && 1225 if (containerBox && container != ancestor &&
1220 !containerBox->mapScrollingContentsRectToBoxSpace(rect, visualRectFlags)) 1226 !containerBox->mapScrollingContentsRectToBoxSpace(
1227 transformState, accumulation, visualRectFlags))
1221 return false; 1228 return false;
1222 1229
1223 // TODO(wkorman): Generalize Ruby specialization and/or document more clearly. 1230 // TODO(wkorman): Generalize Ruby specialization and/or document more clearly.
1224 if (containerBox && !isRuby()) 1231 if (containerBox && !isRuby()) {
1232 transformState.flatten();
1233 LayoutRect rect(transformState.lastPlanarQuad().boundingBox());
1225 containerBox->flipForWritingMode(rect); 1234 containerBox->flipForWritingMode(rect);
1226 return container->mapToVisualRectInAncestorSpace(ancestor, rect, 1235 transformState.setQuad(FloatQuad(FloatRect(rect)));
1227 visualRectFlags); 1236 }
1237 return container->mapToVisualRectInAncestorSpaceInternal(
1238 ancestor, transformState, visualRectFlags);
1228 } 1239 }
1229 1240
1230 LayoutSize LayoutInline::offsetFromContainer( 1241 LayoutSize LayoutInline::offsetFromContainer(
1231 const LayoutObject* container) const { 1242 const LayoutObject* container) const {
1232 ASSERT(container == this->container()); 1243 ASSERT(container == this->container());
1233 1244
1234 LayoutSize offset; 1245 LayoutSize offset;
1235 if (isInFlowPositioned()) 1246 if (isInFlowPositioned())
1236 offset += offsetForInFlowPosition(); 1247 offset += offsetForInFlowPosition();
1237 1248
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1517 paintInvalidator.invalidateDisplayItemClient(*box, invalidationReason); 1528 paintInvalidator.invalidateDisplayItemClient(*box, invalidationReason);
1518 } 1529 }
1519 1530
1520 // TODO(lunalu): Not to just dump 0, 0 as the x and y here 1531 // TODO(lunalu): Not to just dump 0, 0 as the x and y here
1521 LayoutRect LayoutInline::debugRect() const { 1532 LayoutRect LayoutInline::debugRect() const {
1522 IntRect linesBox = enclosingIntRect(linesBoundingBox()); 1533 IntRect linesBox = enclosingIntRect(linesBoundingBox());
1523 return LayoutRect(IntRect(0, 0, linesBox.width(), linesBox.height())); 1534 return LayoutRect(IntRect(0, 0, linesBox.width(), linesBox.height()));
1524 } 1535 }
1525 1536
1526 } // namespace blink 1537 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutInline.h ('k') | third_party/WebKit/Source/core/layout/LayoutObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698