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 18 matching lines...) Expand all Loading... |
29 #include "core/layout/svg/LayoutSVGText.h" | 29 #include "core/layout/svg/LayoutSVGText.h" |
30 | 30 |
31 #include "core/editing/PositionWithAffinity.h" | 31 #include "core/editing/PositionWithAffinity.h" |
32 #include "core/layout/HitTestRequest.h" | 32 #include "core/layout/HitTestRequest.h" |
33 #include "core/layout/HitTestResult.h" | 33 #include "core/layout/HitTestResult.h" |
34 #include "core/layout/PaintInfo.h" | 34 #include "core/layout/PaintInfo.h" |
35 #include "core/layout/PointerEventsHitRules.h" | 35 #include "core/layout/PointerEventsHitRules.h" |
36 #include "core/layout/style/ShadowList.h" | 36 #include "core/layout/style/ShadowList.h" |
37 #include "core/layout/svg/LayoutSVGInline.h" | 37 #include "core/layout/svg/LayoutSVGInline.h" |
38 #include "core/layout/svg/LayoutSVGInlineText.h" | 38 #include "core/layout/svg/LayoutSVGInlineText.h" |
| 39 #include "core/layout/svg/LayoutSVGRoot.h" |
39 #include "core/layout/svg/SVGLayoutSupport.h" | 40 #include "core/layout/svg/SVGLayoutSupport.h" |
40 #include "core/layout/svg/SVGResourcesCache.h" | 41 #include "core/layout/svg/SVGResourcesCache.h" |
41 #include "core/layout/svg/line/SVGRootInlineBox.h" | 42 #include "core/layout/svg/line/SVGRootInlineBox.h" |
42 #include "core/paint/SVGTextPainter.h" | 43 #include "core/paint/SVGTextPainter.h" |
43 #include "core/rendering/svg/RenderSVGRoot.h" | |
44 #include "core/svg/SVGLengthList.h" | 44 #include "core/svg/SVGLengthList.h" |
45 #include "core/svg/SVGTextElement.h" | 45 #include "core/svg/SVGTextElement.h" |
46 #include "core/svg/SVGTransformList.h" | 46 #include "core/svg/SVGTransformList.h" |
47 #include "core/svg/SVGURIReference.h" | 47 #include "core/svg/SVGURIReference.h" |
48 #include "platform/FloatConversion.h" | 48 #include "platform/FloatConversion.h" |
49 #include "platform/fonts/FontCache.h" | 49 #include "platform/fonts/FontCache.h" |
50 #include "platform/fonts/SimpleFontData.h" | 50 #include "platform/fonts/SimpleFontData.h" |
51 #include "platform/geometry/FloatQuad.h" | 51 #include "platform/geometry/FloatQuad.h" |
52 #include "platform/geometry/TransformState.h" | 52 #include "platform/geometry/TransformState.h" |
53 | 53 |
54 namespace blink { | 54 namespace blink { |
55 | 55 |
56 LayoutSVGText::LayoutSVGText(SVGTextElement* node) | 56 LayoutSVGText::LayoutSVGText(SVGTextElement* node) |
57 : RenderSVGBlock(node) | 57 : LayoutSVGBlock(node) |
58 , m_needsReordering(false) | 58 , m_needsReordering(false) |
59 , m_needsPositioningValuesUpdate(false) | 59 , m_needsPositioningValuesUpdate(false) |
60 , m_needsTransformUpdate(true) | 60 , m_needsTransformUpdate(true) |
61 , m_needsTextMetricsUpdate(false) | 61 , m_needsTextMetricsUpdate(false) |
62 { | 62 { |
63 } | 63 } |
64 | 64 |
65 LayoutSVGText::~LayoutSVGText() | 65 LayoutSVGText::~LayoutSVGText() |
66 { | 66 { |
67 ASSERT(m_layoutAttributes.isEmpty()); | 67 ASSERT(m_layoutAttributes.isEmpty()); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 collectLayoutAttributes(text, newLayoutAttributes); | 203 collectLayoutAttributes(text, newLayoutAttributes); |
204 ASSERT(newLayoutAttributes == expectedLayoutAttributes); | 204 ASSERT(newLayoutAttributes == expectedLayoutAttributes); |
205 #endif | 205 #endif |
206 } | 206 } |
207 | 207 |
208 void LayoutSVGText::willBeDestroyed() | 208 void LayoutSVGText::willBeDestroyed() |
209 { | 209 { |
210 m_layoutAttributes.clear(); | 210 m_layoutAttributes.clear(); |
211 m_layoutAttributesBuilder.clearTextPositioningElements(); | 211 m_layoutAttributesBuilder.clearTextPositioningElements(); |
212 | 212 |
213 RenderSVGBlock::willBeDestroyed(); | 213 LayoutSVGBlock::willBeDestroyed(); |
214 } | 214 } |
215 | 215 |
216 void LayoutSVGText::subtreeChildWillBeRemoved(LayoutObject* child, Vector<SVGTex
tLayoutAttributes*, 2>& affectedAttributes) | 216 void LayoutSVGText::subtreeChildWillBeRemoved(LayoutObject* child, Vector<SVGTex
tLayoutAttributes*, 2>& affectedAttributes) |
217 { | 217 { |
218 ASSERT(child); | 218 ASSERT(child); |
219 if (!shouldHandleSubtreeMutations()) | 219 if (!shouldHandleSubtreeMutations()) |
220 return; | 220 return; |
221 | 221 |
222 checkLayoutAttributesConsistency(this, m_layoutAttributes); | 222 checkLayoutAttributesConsistency(this, m_layoutAttributes); |
223 | 223 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 | 393 |
394 if (!updateCachedBoundariesInParents) | 394 if (!updateCachedBoundariesInParents) |
395 updateCachedBoundariesInParents = oldBoundaries != objectBoundingBox(); | 395 updateCachedBoundariesInParents = oldBoundaries != objectBoundingBox(); |
396 | 396 |
397 // Invalidate all resources of this client if our layout changed. | 397 // Invalidate all resources of this client if our layout changed. |
398 if (everHadLayout() && selfNeedsLayout()) | 398 if (everHadLayout() && selfNeedsLayout()) |
399 SVGResourcesCache::clientLayoutChanged(this); | 399 SVGResourcesCache::clientLayoutChanged(this); |
400 | 400 |
401 // If our bounds changed, notify the parents. | 401 // If our bounds changed, notify the parents. |
402 if (updateCachedBoundariesInParents) | 402 if (updateCachedBoundariesInParents) |
403 RenderSVGBlock::setNeedsBoundariesUpdate(); | 403 LayoutSVGBlock::setNeedsBoundariesUpdate(); |
404 | 404 |
405 clearNeedsLayout(); | 405 clearNeedsLayout(); |
406 } | 406 } |
407 | 407 |
408 RootInlineBox* LayoutSVGText::createRootInlineBox() | 408 RootInlineBox* LayoutSVGText::createRootInlineBox() |
409 { | 409 { |
410 RootInlineBox* box = new SVGRootInlineBox(*this); | 410 RootInlineBox* box = new SVGRootInlineBox(*this); |
411 box->setHasVirtualLogicalHeight(); | 411 box->setHasVirtualLogicalHeight(); |
412 return box; | 412 return box; |
413 } | 413 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 SVGLayoutSupport::intersectPaintInvalidationRectWithResources(this, paintInv
alidationRect); | 481 SVGLayoutSupport::intersectPaintInvalidationRectWithResources(this, paintInv
alidationRect); |
482 | 482 |
483 if (const ShadowList* textShadow = style()->textShadow()) | 483 if (const ShadowList* textShadow = style()->textShadow()) |
484 textShadow->adjustRectForShadow(paintInvalidationRect); | 484 textShadow->adjustRectForShadow(paintInvalidationRect); |
485 | 485 |
486 return paintInvalidationRect; | 486 return paintInvalidationRect; |
487 } | 487 } |
488 | 488 |
489 void LayoutSVGText::addChild(LayoutObject* child, LayoutObject* beforeChild) | 489 void LayoutSVGText::addChild(LayoutObject* child, LayoutObject* beforeChild) |
490 { | 490 { |
491 RenderSVGBlock::addChild(child, beforeChild); | 491 LayoutSVGBlock::addChild(child, beforeChild); |
492 | 492 |
493 SVGResourcesCache::clientWasAddedToTree(child, child->styleRef()); | 493 SVGResourcesCache::clientWasAddedToTree(child, child->styleRef()); |
494 subtreeChildWasAdded(child); | 494 subtreeChildWasAdded(child); |
495 } | 495 } |
496 | 496 |
497 void LayoutSVGText::removeChild(LayoutObject* child) | 497 void LayoutSVGText::removeChild(LayoutObject* child) |
498 { | 498 { |
499 SVGResourcesCache::clientWillBeRemovedFromTree(child); | 499 SVGResourcesCache::clientWillBeRemovedFromTree(child); |
500 | 500 |
501 Vector<SVGTextLayoutAttributes*, 2> affectedAttributes; | 501 Vector<SVGTextLayoutAttributes*, 2> affectedAttributes; |
502 FontCachePurgePreventer fontCachePurgePreventer; | 502 FontCachePurgePreventer fontCachePurgePreventer; |
503 subtreeChildWillBeRemoved(child, affectedAttributes); | 503 subtreeChildWillBeRemoved(child, affectedAttributes); |
504 RenderSVGBlock::removeChild(child); | 504 LayoutSVGBlock::removeChild(child); |
505 subtreeChildWasRemoved(affectedAttributes); | 505 subtreeChildWasRemoved(affectedAttributes); |
506 } | 506 } |
507 | 507 |
508 } | 508 } |
OLD | NEW |