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 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. |
7 * All rights reserved. | 7 * All rights reserved. |
8 * Copyright (C) 2009 Google Inc. All rights reserved. | 8 * Copyright (C) 2009 Google Inc. All rights reserved. |
9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. | 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. |
10 * (http://www.torchmobile.com/) | 10 * (http://www.torchmobile.com/) |
(...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1266 | 1266 |
1267 LayoutRect LayoutObject::localVisualRect() const { | 1267 LayoutRect LayoutObject::localVisualRect() const { |
1268 NOTREACHED(); | 1268 NOTREACHED(); |
1269 return LayoutRect(); | 1269 return LayoutRect(); |
1270 } | 1270 } |
1271 | 1271 |
1272 bool LayoutObject::mapToVisualRectInAncestorSpace( | 1272 bool LayoutObject::mapToVisualRectInAncestorSpace( |
1273 const LayoutBoxModelObject* ancestor, | 1273 const LayoutBoxModelObject* ancestor, |
1274 LayoutRect& rect, | 1274 LayoutRect& rect, |
1275 VisualRectFlags visualRectFlags) const { | 1275 VisualRectFlags visualRectFlags) const { |
| 1276 TransformState transformState(TransformState::ApplyTransformDirection, |
| 1277 FloatQuad(FloatRect(rect))); |
| 1278 bool retval = mapToVisualRectInAncestorSpaceInternal(ancestor, transformState, |
| 1279 visualRectFlags); |
| 1280 transformState.flatten(); |
| 1281 rect = LayoutRect(transformState.lastPlanarQuad().boundingBox()); |
| 1282 return retval; |
| 1283 } |
| 1284 |
| 1285 bool LayoutObject::mapToVisualRectInAncestorSpaceInternal( |
| 1286 const LayoutBoxModelObject* ancestor, |
| 1287 TransformState& transformState, |
| 1288 VisualRectFlags visualRectFlags) const { |
1276 // For any layout object that doesn't override this method (the main example | 1289 // For any layout object that doesn't override this method (the main example |
1277 // is LayoutText), the rect is assumed to be in the parent's coordinate space, | 1290 // is LayoutText), the rect is assumed to be in the parent's coordinate space, |
1278 // except for container flip. | 1291 // except for container flip. |
1279 | 1292 |
1280 if (ancestor == this) | 1293 if (ancestor == this) |
1281 return true; | 1294 return true; |
1282 | 1295 |
1283 if (LayoutObject* parent = this->parent()) { | 1296 if (LayoutObject* parent = this->parent()) { |
1284 if (parent->isBox()) { | 1297 if (parent->isBox()) { |
1285 LayoutBox* parentBox = toLayoutBox(parent); | 1298 LayoutBox* parentBox = toLayoutBox(parent); |
1286 | 1299 |
1287 // Never flip for SVG as it handles writing modes itself. | 1300 // Never flip for SVG as it handles writing modes itself. |
1288 if (!isSVG()) | 1301 if (!isSVG()) { |
| 1302 transformState.flatten(); |
| 1303 LayoutRect rect(transformState.lastPlanarQuad().boundingBox()); |
1289 parentBox->flipForWritingMode(rect); | 1304 parentBox->flipForWritingMode(rect); |
| 1305 transformState.setQuad(FloatQuad(FloatRect(rect))); |
| 1306 } |
| 1307 |
| 1308 bool preserve3D = (parent->style()->preserves3D() && !parent->isText()) || |
| 1309 (style()->preserves3D() && !isText()); |
| 1310 |
| 1311 TransformState::TransformAccumulation accumulation = |
| 1312 preserve3D ? TransformState::AccumulateTransform |
| 1313 : TransformState::FlattenTransform; |
1290 | 1314 |
1291 if (parent != ancestor && | 1315 if (parent != ancestor && |
1292 !parentBox->mapScrollingContentsRectToBoxSpace(rect, visualRectFlags)) | 1316 !parentBox->mapScrollingContentsRectToBoxSpace( |
| 1317 transformState, accumulation, visualRectFlags)) |
1293 return false; | 1318 return false; |
1294 } | 1319 } |
1295 return parent->mapToVisualRectInAncestorSpace(ancestor, rect, | 1320 return parent->mapToVisualRectInAncestorSpaceInternal( |
1296 visualRectFlags); | 1321 ancestor, transformState, visualRectFlags); |
1297 } | 1322 } |
1298 return true; | 1323 return true; |
1299 } | 1324 } |
1300 | 1325 |
1301 void LayoutObject::dirtyLinesFromChangedChild(LayoutObject*, MarkingBehavior) {} | 1326 void LayoutObject::dirtyLinesFromChangedChild(LayoutObject*, MarkingBehavior) {} |
1302 | 1327 |
1303 #ifndef NDEBUG | 1328 #ifndef NDEBUG |
1304 | 1329 |
1305 void LayoutObject::showTreeForThis() const { | 1330 void LayoutObject::showTreeForThis() const { |
1306 if (node()) | 1331 if (node()) |
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2258 } | 2283 } |
2259 | 2284 |
2260 FloatQuad LayoutObject::localToAncestorQuadInternal( | 2285 FloatQuad LayoutObject::localToAncestorQuadInternal( |
2261 const FloatQuad& localQuad, | 2286 const FloatQuad& localQuad, |
2262 const LayoutBoxModelObject* ancestor, | 2287 const LayoutBoxModelObject* ancestor, |
2263 MapCoordinatesFlags mode) const { | 2288 MapCoordinatesFlags mode) const { |
2264 // Track the point at the center of the quad's bounding box. As | 2289 // Track the point at the center of the quad's bounding box. As |
2265 // mapLocalToAncestor() calls offsetFromContainer(), it will use that point | 2290 // mapLocalToAncestor() calls offsetFromContainer(), it will use that point |
2266 // as the reference point to decide which column's transform to apply in | 2291 // as the reference point to decide which column's transform to apply in |
2267 // multiple-column blocks. | 2292 // multiple-column blocks. |
| 2293 // TODO(chrishtr): the second argument to this constructor is unnecessary, |
| 2294 // since we never call lastPlanarPoint(). |
2268 TransformState transformState(TransformState::ApplyTransformDirection, | 2295 TransformState transformState(TransformState::ApplyTransformDirection, |
2269 localQuad.boundingBox().center(), localQuad); | 2296 localQuad.boundingBox().center(), localQuad); |
2270 mapLocalToAncestor(ancestor, transformState, mode | ApplyContainerFlip); | 2297 mapLocalToAncestor(ancestor, transformState, mode | ApplyContainerFlip); |
2271 transformState.flatten(); | 2298 transformState.flatten(); |
2272 | 2299 |
2273 return transformState.lastPlanarQuad(); | 2300 return transformState.lastPlanarQuad(); |
2274 } | 2301 } |
2275 | 2302 |
2276 FloatPoint LayoutObject::localToAncestorPoint( | 2303 FloatPoint LayoutObject::localToAncestorPoint( |
2277 const FloatPoint& localPoint, | 2304 const FloatPoint& localPoint, |
(...skipping 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3525 const blink::LayoutObject* root = object1; | 3552 const blink::LayoutObject* root = object1; |
3526 while (root->parent()) | 3553 while (root->parent()) |
3527 root = root->parent(); | 3554 root = root->parent(); |
3528 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3555 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3529 } else { | 3556 } else { |
3530 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); | 3557 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); |
3531 } | 3558 } |
3532 } | 3559 } |
3533 | 3560 |
3534 #endif | 3561 #endif |
OLD | NEW |