Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 = | |
| 1209 (container->style()->preserves3D() && !container->isText()) || | |
| 1210 (style()->preserves3D() && !isText()); | |
|
Xianzhu
2017/03/03 01:24:42
Ditto about !isText().
chrishtr
2017/03/03 02:45:11
Done.
| |
| 1211 | |
| 1212 TransformState::TransformAccumulation accumulation = | |
| 1213 preserve3D ? TransformState::AccumulateTransform | |
| 1214 : TransformState::FlattenTransform; | |
| 1215 | |
| 1208 if (style()->hasInFlowPosition() && layer()) { | 1216 if (style()->hasInFlowPosition() && layer()) { |
| 1209 // Apply the in-flow position offset when invalidating a rectangle. The | 1217 // 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 | 1218 // 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:: | 1219 // get the right dirty rect. Since this is called from LayoutObject:: |
| 1212 // setStyle, the relative position flag on the LayoutObject has been | 1220 // setStyle, the relative position flag on the LayoutObject has been |
| 1213 // cleared, so use the one on the style(). | 1221 // cleared, so use the one on the style(). |
| 1214 rect.move(layer()->offsetForInFlowPosition()); | 1222 transformState.move(layer()->offsetForInFlowPosition(), accumulation); |
| 1215 } | 1223 } |
| 1216 | 1224 |
| 1217 LayoutBox* containerBox = | 1225 LayoutBox* containerBox = |
| 1218 container->isBox() ? toLayoutBox(container) : nullptr; | 1226 container->isBox() ? toLayoutBox(container) : nullptr; |
| 1219 if (containerBox && container != ancestor && | 1227 if (containerBox && container != ancestor && |
| 1220 !containerBox->mapScrollingContentsRectToBoxSpace(rect, visualRectFlags)) | 1228 !containerBox->mapScrollingContentsRectToBoxSpace( |
| 1229 transformState, accumulation, visualRectFlags)) | |
| 1221 return false; | 1230 return false; |
| 1222 | 1231 |
| 1223 // TODO(wkorman): Generalize Ruby specialization and/or document more clearly. | 1232 // TODO(wkorman): Generalize Ruby specialization and/or document more clearly. |
| 1224 if (containerBox && !isRuby()) | 1233 if (containerBox && !isRuby()) { |
| 1234 transformState.flatten(); | |
| 1235 LayoutRect rect(transformState.lastPlanarQuad().boundingBox()); | |
|
Xianzhu
2017/03/03 01:24:42
Do we need enclosingBoundingBox here?
| |
| 1225 containerBox->flipForWritingMode(rect); | 1236 containerBox->flipForWritingMode(rect); |
| 1226 return container->mapToVisualRectInAncestorSpace(ancestor, rect, | 1237 transformState.setQuad(FloatQuad(FloatRect(rect))); |
| 1227 visualRectFlags); | 1238 } |
| 1239 return container->mapToVisualRectInAncestorSpaceInternal( | |
| 1240 ancestor, transformState, visualRectFlags); | |
| 1228 } | 1241 } |
| 1229 | 1242 |
| 1230 LayoutSize LayoutInline::offsetFromContainer( | 1243 LayoutSize LayoutInline::offsetFromContainer( |
| 1231 const LayoutObject* container) const { | 1244 const LayoutObject* container) const { |
| 1232 ASSERT(container == this->container()); | 1245 ASSERT(container == this->container()); |
| 1233 | 1246 |
| 1234 LayoutSize offset; | 1247 LayoutSize offset; |
| 1235 if (isInFlowPositioned()) | 1248 if (isInFlowPositioned()) |
| 1236 offset += offsetForInFlowPosition(); | 1249 offset += offsetForInFlowPosition(); |
| 1237 | 1250 |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1517 paintInvalidator.invalidateDisplayItemClient(*box, invalidationReason); | 1530 paintInvalidator.invalidateDisplayItemClient(*box, invalidationReason); |
| 1518 } | 1531 } |
| 1519 | 1532 |
| 1520 // TODO(lunalu): Not to just dump 0, 0 as the x and y here | 1533 // TODO(lunalu): Not to just dump 0, 0 as the x and y here |
| 1521 LayoutRect LayoutInline::debugRect() const { | 1534 LayoutRect LayoutInline::debugRect() const { |
| 1522 IntRect linesBox = enclosingIntRect(linesBoundingBox()); | 1535 IntRect linesBox = enclosingIntRect(linesBoundingBox()); |
| 1523 return LayoutRect(IntRect(0, 0, linesBox.width(), linesBox.height())); | 1536 return LayoutRect(IntRect(0, 0, linesBox.width(), linesBox.height())); |
| 1524 } | 1537 } |
| 1525 | 1538 |
| 1526 } // namespace blink | 1539 } // namespace blink |
| OLD | NEW |