| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org> | 2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org> |
| 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
| 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
| 5 * Copyright (C) 2009 Google, Inc. All rights reserved. | 5 * Copyright (C) 2009 Google, Inc. All rights reserved. |
| 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
| 7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 const LayoutSVGRoot* SVGLayoutSupport::findTreeRootObject(const LayoutObject* st
art) | 240 const LayoutSVGRoot* SVGLayoutSupport::findTreeRootObject(const LayoutObject* st
art) |
| 241 { | 241 { |
| 242 while (start && !start->isSVGRoot()) | 242 while (start && !start->isSVGRoot()) |
| 243 start = start->parent(); | 243 start = start->parent(); |
| 244 | 244 |
| 245 ASSERT(start); | 245 ASSERT(start); |
| 246 ASSERT(start->isSVGRoot()); | 246 ASSERT(start->isSVGRoot()); |
| 247 return toLayoutSVGRoot(start); | 247 return toLayoutSVGRoot(start); |
| 248 } | 248 } |
| 249 | 249 |
| 250 inline bool SVGLayoutSupport::layoutSizeOfNearestViewportChanged(const LayoutObj
ect* start) | 250 bool SVGLayoutSupport::layoutSizeOfNearestViewportChanged(const LayoutObject* st
art) |
| 251 { | 251 { |
| 252 while (start && !start->isSVGRoot() && !start->isSVGViewportContainer()) | 252 for (; start; start = start->parent()) { |
| 253 start = start->parent(); | 253 if (start->isSVGRoot()) |
| 254 | 254 return toLayoutSVGRoot(start)->isLayoutSizeChanged(); |
| 255 ASSERT(start); | 255 if (start->isSVGViewportContainer()) |
| 256 ASSERT(start->isSVGRoot() || start->isSVGViewportContainer()); | 256 return toLayoutSVGViewportContainer(start)->isLayoutSizeChanged(); |
| 257 if (start->isSVGViewportContainer()) | 257 } |
| 258 return toLayoutSVGViewportContainer(start)->isLayoutSizeChanged(); | 258 ASSERT_NOT_REACHED(); |
| 259 | 259 return false; |
| 260 return toLayoutSVGRoot(start)->isLayoutSizeChanged(); | |
| 261 } | 260 } |
| 262 | 261 |
| 263 bool SVGLayoutSupport::transformToRootChanged(const LayoutObject* ancestor) | 262 bool SVGLayoutSupport::transformToRootChanged(const LayoutObject* ancestor) |
| 264 { | 263 { |
| 265 while (ancestor && !ancestor->isSVGRoot()) { | 264 while (ancestor && !ancestor->isSVGRoot()) { |
| 266 if (ancestor->isSVGTransformableContainer()) | 265 if (ancestor->isSVGTransformableContainer()) |
| 267 return toLayoutSVGTransformableContainer(ancestor)->didTransformToRo
otUpdate(); | 266 return toLayoutSVGTransformableContainer(ancestor)->didTransformToRo
otUpdate(); |
| 268 if (ancestor->isSVGViewportContainer()) | 267 if (ancestor->isSVGViewportContainer()) |
| 269 return toLayoutSVGViewportContainer(ancestor)->didTransformToRootUpd
ate(); | 268 return toLayoutSVGViewportContainer(ancestor)->didTransformToRootUpd
ate(); |
| 270 ancestor = ancestor->parent(); | 269 ancestor = ancestor->parent(); |
| 271 } | 270 } |
| 272 return false; | 271 return false; |
| 273 } | 272 } |
| 274 | 273 |
| 275 void SVGLayoutSupport::layoutChildren(LayoutObject* start, bool forceLayout, boo
l transformChanged) | 274 void SVGLayoutSupport::layoutChildren(LayoutObject* start, bool forceLayout, boo
l transformChanged, bool layoutSizeChanged) |
| 276 { | 275 { |
| 277 // When hasRelativeLengths() is false, no descendants have relative lengths | |
| 278 // (hence no one is interested in viewport size changes). | |
| 279 bool layoutSizeChanged = toSVGElement(start->node())->hasRelativeLengths() | |
| 280 && layoutSizeOfNearestViewportChanged(start); | |
| 281 | |
| 282 for (LayoutObject* child = start->slowFirstChild(); child; child = child->ne
xtSibling()) { | 276 for (LayoutObject* child = start->slowFirstChild(); child; child = child->ne
xtSibling()) { |
| 283 bool forceChildLayout = forceLayout; | 277 bool forceChildLayout = forceLayout; |
| 284 | 278 |
| 285 if (transformChanged) { | 279 if (transformChanged) { |
| 286 // If the transform changed we need to update the text metrics (note
: this also happens for layoutSizeChanged=true). | 280 // If the transform changed we need to update the text metrics (note
: this also happens for layoutSizeChanged=true). |
| 287 if (child->isSVGText()) | 281 if (child->isSVGText()) |
| 288 toLayoutSVGText(child)->setNeedsTextMetricsUpdate(); | 282 toLayoutSVGText(child)->setNeedsTextMetricsUpdate(); |
| 289 forceChildLayout = true; | 283 forceChildLayout = true; |
| 290 } | 284 } |
| 291 | 285 |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 | 573 |
| 580 return closestText; | 574 return closestText; |
| 581 } | 575 } |
| 582 | 576 |
| 583 LayoutObject* SVGLayoutSupport::findClosestLayoutSVGText(LayoutObject* layoutObj
ect, const FloatPoint& point) | 577 LayoutObject* SVGLayoutSupport::findClosestLayoutSVGText(LayoutObject* layoutObj
ect, const FloatPoint& point) |
| 584 { | 578 { |
| 585 return searchTreeForFindClosestLayoutSVGText(layoutObject, point).candidateL
ayoutObject; | 579 return searchTreeForFindClosestLayoutSVGText(layoutObject, point).candidateL
ayoutObject; |
| 586 } | 580 } |
| 587 | 581 |
| 588 } // namespace blink | 582 } // namespace blink |
| OLD | NEW |