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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 ASSERT(m_layoutAttributes.isEmpty()); | 161 ASSERT(m_layoutAttributes.isEmpty()); |
162 ASSERT(!m_layoutAttributesBuilder.numberOfTextPositioningElements()); | 162 ASSERT(!m_layoutAttributesBuilder.numberOfTextPositioningElements()); |
163 return false; | 163 return false; |
164 } | 164 } |
165 return true; | 165 return true; |
166 } | 166 } |
167 | 167 |
168 void RenderSVGText::subtreeChildWasAdded(RenderObject* child) | 168 void RenderSVGText::subtreeChildWasAdded(RenderObject* child) |
169 { | 169 { |
170 ASSERT(child); | 170 ASSERT(child); |
171 ASSERT(child->isSVGInlineText() || child->isSVGInline()); | |
172 if (!shouldHandleSubtreeMutations() || documentBeingDestroyed()) | 171 if (!shouldHandleSubtreeMutations() || documentBeingDestroyed()) |
173 return; | 172 return; |
174 | 173 |
175 // The positioning elements cache doesn't include the new 'child' yet. Clear
the | 174 // The positioning elements cache doesn't include the new 'child' yet. Clear
the |
176 // cache, as the next buildLayoutAttributesForTextRenderer() call rebuilds i
t. | 175 // cache, as the next buildLayoutAttributesForTextRenderer() call rebuilds i
t. |
177 m_layoutAttributesBuilder.clearTextPositioningElements(); | 176 m_layoutAttributesBuilder.clearTextPositioningElements(); |
178 | 177 |
| 178 if (!child->isSVGInlineText() && !child->isSVGInline()) |
| 179 return; |
| 180 |
179 // Detect changes in layout attributes and only measure those text parts tha
t have changed! | 181 // Detect changes in layout attributes and only measure those text parts tha
t have changed! |
180 Vector<SVGTextLayoutAttributes*> newLayoutAttributes; | 182 Vector<SVGTextLayoutAttributes*> newLayoutAttributes; |
181 collectLayoutAttributes(this, newLayoutAttributes); | 183 collectLayoutAttributes(this, newLayoutAttributes); |
182 if (newLayoutAttributes.isEmpty()) { | 184 if (newLayoutAttributes.isEmpty()) { |
183 ASSERT(m_layoutAttributes.isEmpty()); | 185 ASSERT(m_layoutAttributes.isEmpty()); |
184 return; | 186 return; |
185 } | 187 } |
186 | 188 |
187 // Compare m_layoutAttributes with newLayoutAttributes to figure out which a
ttribute got added. | 189 // Compare m_layoutAttributes with newLayoutAttributes to figure out which a
ttribute got added. |
188 size_t size = newLayoutAttributes.size(); | 190 size_t size = newLayoutAttributes.size(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 { | 233 { |
232 m_layoutAttributes.clear(); | 234 m_layoutAttributes.clear(); |
233 m_layoutAttributesBuilder.clearTextPositioningElements(); | 235 m_layoutAttributesBuilder.clearTextPositioningElements(); |
234 | 236 |
235 RenderSVGBlock::willBeDestroyed(); | 237 RenderSVGBlock::willBeDestroyed(); |
236 } | 238 } |
237 | 239 |
238 void RenderSVGText::subtreeChildWillBeRemoved(RenderObject* child, Vector<SVGTex
tLayoutAttributes*, 2>& affectedAttributes) | 240 void RenderSVGText::subtreeChildWillBeRemoved(RenderObject* child, Vector<SVGTex
tLayoutAttributes*, 2>& affectedAttributes) |
239 { | 241 { |
240 ASSERT(child); | 242 ASSERT(child); |
241 ASSERT(child->isSVGInlineText() || child->isSVGInline()); | |
242 if (!shouldHandleSubtreeMutations()) | 243 if (!shouldHandleSubtreeMutations()) |
243 return; | 244 return; |
244 | 245 |
245 checkLayoutAttributesConsistency(this, m_layoutAttributes); | 246 checkLayoutAttributesConsistency(this, m_layoutAttributes); |
246 | 247 |
247 // The positioning elements cache depends on the size of each text renderer
in the | 248 // The positioning elements cache depends on the size of each text renderer
in the |
248 // subtree. If this changes, clear the cache. It's going to be rebuilt below
. | 249 // subtree. If this changes, clear the cache. It's going to be rebuilt below
. |
249 m_layoutAttributesBuilder.clearTextPositioningElements(); | 250 m_layoutAttributesBuilder.clearTextPositioningElements(); |
250 if (m_layoutAttributes.isEmpty() || child->isSVGInline()) | 251 if (m_layoutAttributes.isEmpty() || !child->isSVGInlineText()) |
251 return; | 252 return; |
252 | 253 |
253 // This logic requires that the 'text' child is still inserted in the tree. | 254 // This logic requires that the 'text' child is still inserted in the tree. |
254 RenderSVGInlineText* text = toRenderSVGInlineText(child); | 255 RenderSVGInlineText* text = toRenderSVGInlineText(child); |
255 bool stopAfterNext = false; | 256 bool stopAfterNext = false; |
256 SVGTextLayoutAttributes* previous = 0; | 257 SVGTextLayoutAttributes* previous = 0; |
257 SVGTextLayoutAttributes* next = 0; | 258 SVGTextLayoutAttributes* next = 0; |
258 if (!documentBeingDestroyed()) | 259 if (!documentBeingDestroyed()) |
259 findPreviousAndNextAttributes(this, text, stopAfterNext, previous, next)
; | 260 findPreviousAndNextAttributes(this, text, stopAfterNext, previous, next)
; |
260 | 261 |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 | 538 |
538 // Fix for <rdar://problem/8048875>. We should not render :first-letter CSS Styl
e | 539 // Fix for <rdar://problem/8048875>. We should not render :first-letter CSS Styl
e |
539 // in a SVG text element context. | 540 // in a SVG text element context. |
540 void RenderSVGText::updateFirstLetter() | 541 void RenderSVGText::updateFirstLetter() |
541 { | 542 { |
542 } | 543 } |
543 | 544 |
544 } | 545 } |
545 | 546 |
546 #endif // ENABLE(SVG) | 547 #endif // ENABLE(SVG) |
OLD | NEW |