| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Apple Computer, Inc. | 2 * Copyright (C) 2006 Apple Computer, Inc. |
| 3 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> | 3 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> |
| 4 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> | 4 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> |
| 5 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 5 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
| 6 * Copyright (C) 2008 Rob Buis <buis@kde.org> | 6 * Copyright (C) 2008 Rob Buis <buis@kde.org> |
| 7 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 7 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
| 8 * Copyright (C) Research In Motion Limited 2010-2012. All rights reserved. | 8 * Copyright (C) Research In Motion Limited 2010-2012. All rights reserved. |
| 9 * Copyright (C) 2012 Google Inc. | 9 * Copyright (C) 2012 Google Inc. |
| 10 * | 10 * |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 } | 110 } |
| 111 | 111 |
| 112 void LayoutSVGText::subtreeChildWasAdded() { | 112 void LayoutSVGText::subtreeChildWasAdded() { |
| 113 if (beingDestroyed() || !everHadLayout()) { | 113 if (beingDestroyed() || !everHadLayout()) { |
| 114 ASSERT(m_descendantTextNodes.isEmpty()); | 114 ASSERT(m_descendantTextNodes.isEmpty()); |
| 115 return; | 115 return; |
| 116 } | 116 } |
| 117 if (documentBeingDestroyed()) | 117 if (documentBeingDestroyed()) |
| 118 return; | 118 return; |
| 119 | 119 |
| 120 // The positioning elements cache depends on the size of each text layoutObjec
t in the | 120 // The positioning elements cache depends on the size of each text |
| 121 // subtree. If this changes, clear the cache. It will be rebuilt on the next l
ayout. | 121 // layoutObject in the subtree. If this changes, clear the cache. It will be |
| 122 // rebuilt on the next layout. |
| 122 invalidatePositioningValues(LayoutInvalidationReason::ChildChanged); | 123 invalidatePositioningValues(LayoutInvalidationReason::ChildChanged); |
| 123 setNeedsTextMetricsUpdate(); | 124 setNeedsTextMetricsUpdate(); |
| 124 } | 125 } |
| 125 | 126 |
| 126 void LayoutSVGText::subtreeChildWillBeRemoved() { | 127 void LayoutSVGText::subtreeChildWillBeRemoved() { |
| 127 if (beingDestroyed() || !everHadLayout()) { | 128 if (beingDestroyed() || !everHadLayout()) { |
| 128 ASSERT(m_descendantTextNodes.isEmpty()); | 129 ASSERT(m_descendantTextNodes.isEmpty()); |
| 129 return; | 130 return; |
| 130 } | 131 } |
| 131 | 132 |
| 132 // The positioning elements cache depends on the size of each text layoutObjec
t in the | 133 // The positioning elements cache depends on the size of each text |
| 133 // subtree. If this changes, clear the cache. It will be rebuilt on the next l
ayout. | 134 // layoutObject in the subtree. If this changes, clear the cache. It will be |
| 135 // rebuilt on the next layout. |
| 134 invalidatePositioningValues(LayoutInvalidationReason::ChildChanged); | 136 invalidatePositioningValues(LayoutInvalidationReason::ChildChanged); |
| 135 setNeedsTextMetricsUpdate(); | 137 setNeedsTextMetricsUpdate(); |
| 136 } | 138 } |
| 137 | 139 |
| 138 void LayoutSVGText::subtreeTextDidChange() { | 140 void LayoutSVGText::subtreeTextDidChange() { |
| 139 ASSERT(!beingDestroyed()); | 141 ASSERT(!beingDestroyed()); |
| 140 if (!everHadLayout()) { | 142 if (!everHadLayout()) { |
| 141 ASSERT(m_descendantTextNodes.isEmpty()); | 143 ASSERT(m_descendantTextNodes.isEmpty()); |
| 142 return; | 144 return; |
| 143 } | 145 } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 213 |
| 212 SVGTextLayoutAttributesBuilder(*this).buildLayoutAttributes(); | 214 SVGTextLayoutAttributesBuilder(*this).buildLayoutAttributes(); |
| 213 | 215 |
| 214 m_needsPositioningValuesUpdate = false; | 216 m_needsPositioningValuesUpdate = false; |
| 215 m_needsReordering = true; | 217 m_needsReordering = true; |
| 216 updateParentBoundaries = true; | 218 updateParentBoundaries = true; |
| 217 } | 219 } |
| 218 | 220 |
| 219 checkDescendantTextNodeConsistency(*this, m_descendantTextNodes); | 221 checkDescendantTextNodeConsistency(*this, m_descendantTextNodes); |
| 220 | 222 |
| 221 // Reduced version of LayoutBlock::layoutBlock(), which only takes care of SVG
text. | 223 // Reduced version of LayoutBlock::layoutBlock(), which only takes care of SVG |
| 222 // All if branches that could cause early exit in LayoutBlocks layoutBlock() m
ethod are turned into assertions. | 224 // text. All if branches that could cause early exit in LayoutBlocks |
| 225 // layoutBlock() method are turned into assertions. |
| 223 ASSERT(!isInline()); | 226 ASSERT(!isInline()); |
| 224 ASSERT(!simplifiedLayout()); | 227 ASSERT(!simplifiedLayout()); |
| 225 ASSERT(!scrollsOverflow()); | 228 ASSERT(!scrollsOverflow()); |
| 226 ASSERT(!hasControlClip()); | 229 ASSERT(!hasControlClip()); |
| 227 ASSERT(!positionedObjects()); | 230 ASSERT(!positionedObjects()); |
| 228 ASSERT(!isAnonymousBlock()); | 231 ASSERT(!isAnonymousBlock()); |
| 229 | 232 |
| 230 if (!firstChild()) | 233 if (!firstChild()) |
| 231 setChildrenInline(true); | 234 setChildrenInline(true); |
| 232 | 235 |
| 233 // FIXME: We need to find a way to only layout the child boxes, if needed. | 236 // FIXME: We need to find a way to only layout the child boxes, if needed. |
| 234 FloatRect oldBoundaries = objectBoundingBox(); | 237 FloatRect oldBoundaries = objectBoundingBox(); |
| 235 ASSERT(childrenInline()); | 238 ASSERT(childrenInline()); |
| 236 | 239 |
| 237 rebuildFloatsFromIntruding(); | 240 rebuildFloatsFromIntruding(); |
| 238 | 241 |
| 239 LayoutUnit beforeEdge = borderBefore() + paddingBefore(); | 242 LayoutUnit beforeEdge = borderBefore() + paddingBefore(); |
| 240 LayoutUnit afterEdge = | 243 LayoutUnit afterEdge = |
| 241 borderAfter() + paddingAfter() + scrollbarLogicalHeight(); | 244 borderAfter() + paddingAfter() + scrollbarLogicalHeight(); |
| 242 setLogicalHeight(beforeEdge); | 245 setLogicalHeight(beforeEdge); |
| 243 | 246 |
| 244 LayoutState state(*this, locationOffset()); | 247 LayoutState state(*this, locationOffset()); |
| 245 layoutInlineChildren(true, afterEdge); | 248 layoutInlineChildren(true, afterEdge); |
| 246 | 249 |
| 247 m_needsReordering = false; | 250 m_needsReordering = false; |
| 248 | 251 |
| 249 // If we don't have any line boxes, then make sure the frame rect is still cle
ared. | 252 // If we don't have any line boxes, then make sure the frame rect is still |
| 253 // cleared. |
| 250 if (!firstLineBox()) | 254 if (!firstLineBox()) |
| 251 setFrameRect(LayoutRect()); | 255 setFrameRect(LayoutRect()); |
| 252 | 256 |
| 253 m_overflow.reset(); | 257 m_overflow.reset(); |
| 254 addVisualEffectOverflow(); | 258 addVisualEffectOverflow(); |
| 255 | 259 |
| 256 if (!updateParentBoundaries) | 260 if (!updateParentBoundaries) |
| 257 updateParentBoundaries = oldBoundaries != objectBoundingBox(); | 261 updateParentBoundaries = oldBoundaries != objectBoundingBox(); |
| 258 | 262 |
| 259 // Invalidate all resources of this client if our layout changed. | 263 // Invalidate all resources of this client if our layout changed. |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 | 393 |
| 390 void LayoutSVGText::removeChild(LayoutObject* child) { | 394 void LayoutSVGText::removeChild(LayoutObject* child) { |
| 391 SVGResourcesCache::clientWillBeRemovedFromTree(child); | 395 SVGResourcesCache::clientWillBeRemovedFromTree(child); |
| 392 subtreeChildWillBeRemoved(); | 396 subtreeChildWillBeRemoved(); |
| 393 | 397 |
| 394 LayoutSVGBlock::removeChild(child); | 398 LayoutSVGBlock::removeChild(child); |
| 395 } | 399 } |
| 396 | 400 |
| 397 void LayoutSVGText::invalidateTreeIfNeeded( | 401 void LayoutSVGText::invalidateTreeIfNeeded( |
| 398 const PaintInvalidationState& paintInvalidationState) { | 402 const PaintInvalidationState& paintInvalidationState) { |
| 399 // TODO(wangxianzhu): Verify if the inherited LayoutBoxModelObject::invalidate
TreeIfNeeded() | 403 // TODO(wangxianzhu): Verify if the inherited |
| 404 // LayoutBoxModelObject::invalidateTreeIfNeeded() |
| 400 // is applicable here. If yes, remove this overriding method. | 405 // is applicable here. If yes, remove this overriding method. |
| 401 LayoutObject::invalidateTreeIfNeeded(paintInvalidationState); | 406 LayoutObject::invalidateTreeIfNeeded(paintInvalidationState); |
| 402 } | 407 } |
| 403 | 408 |
| 404 } // namespace blink | 409 } // namespace blink |
| OLD | NEW |