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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #include "core/svg/SVGTransformList.h" | 47 #include "core/svg/SVGTransformList.h" |
48 #include "core/svg/SVGURIReference.h" | 48 #include "core/svg/SVGURIReference.h" |
49 #include "platform/FloatConversion.h" | 49 #include "platform/FloatConversion.h" |
50 #include "platform/fonts/FontCache.h" | 50 #include "platform/fonts/FontCache.h" |
51 #include "platform/fonts/SimpleFontData.h" | 51 #include "platform/fonts/SimpleFontData.h" |
52 #include "platform/geometry/FloatQuad.h" | 52 #include "platform/geometry/FloatQuad.h" |
53 #include "platform/geometry/TransformState.h" | 53 #include "platform/geometry/TransformState.h" |
54 | 54 |
55 namespace blink { | 55 namespace blink { |
56 | 56 |
| 57 namespace { |
| 58 |
| 59 const LayoutSVGText* findTextRoot(const LayoutObject* start) |
| 60 { |
| 61 ASSERT(start); |
| 62 for (; start; start = start->parent()) { |
| 63 if (start->isSVGText()) |
| 64 return toLayoutSVGText(start); |
| 65 } |
| 66 return nullptr; |
| 67 } |
| 68 |
| 69 } |
| 70 |
57 LayoutSVGText::LayoutSVGText(SVGTextElement* node) | 71 LayoutSVGText::LayoutSVGText(SVGTextElement* node) |
58 : LayoutSVGBlock(node) | 72 : LayoutSVGBlock(node) |
59 , m_needsReordering(false) | 73 , m_needsReordering(false) |
60 , m_needsPositioningValuesUpdate(false) | 74 , m_needsPositioningValuesUpdate(false) |
61 , m_needsTransformUpdate(true) | 75 , m_needsTransformUpdate(true) |
62 , m_needsTextMetricsUpdate(false) | 76 , m_needsTextMetricsUpdate(false) |
63 { | 77 { |
64 } | 78 } |
65 | 79 |
66 LayoutSVGText::~LayoutSVGText() | 80 LayoutSVGText::~LayoutSVGText() |
67 { | 81 { |
68 ASSERT(m_layoutAttributes.isEmpty()); | 82 ASSERT(m_layoutAttributes.isEmpty()); |
69 } | 83 } |
70 | 84 |
71 bool LayoutSVGText::isChildAllowed(LayoutObject* child, const ComputedStyle&) co
nst | 85 bool LayoutSVGText::isChildAllowed(LayoutObject* child, const ComputedStyle&) co
nst |
72 { | 86 { |
73 return child->isSVGInline() || (child->isText() && SVGLayoutSupport::isLayou
tableTextNode(child)); | 87 return child->isSVGInline() || (child->isText() && SVGLayoutSupport::isLayou
tableTextNode(child)); |
74 } | 88 } |
75 | 89 |
76 LayoutSVGText* LayoutSVGText::locateLayoutSVGTextAncestor(LayoutObject* start) | 90 LayoutSVGText* LayoutSVGText::locateLayoutSVGTextAncestor(LayoutObject* start) |
77 { | 91 { |
78 ASSERT(start); | 92 return const_cast<LayoutSVGText*>(findTextRoot(start)); |
79 while (start && !start->isSVGText()) | |
80 start = start->parent(); | |
81 if (!start || !start->isSVGText()) | |
82 return nullptr; | |
83 return toLayoutSVGText(start); | |
84 } | 93 } |
85 | 94 |
86 const LayoutSVGText* LayoutSVGText::locateLayoutSVGTextAncestor(const LayoutObje
ct* start) | 95 const LayoutSVGText* LayoutSVGText::locateLayoutSVGTextAncestor(const LayoutObje
ct* start) |
87 { | 96 { |
88 ASSERT(start); | 97 return findTextRoot(start); |
89 while (start && !start->isSVGText()) | |
90 start = start->parent(); | |
91 if (!start || !start->isSVGText()) | |
92 return nullptr; | |
93 return toLayoutSVGText(start); | |
94 } | 98 } |
95 | 99 |
96 static inline void collectLayoutAttributes(LayoutObject* text, Vector<SVGTextLay
outAttributes*>& attributes) | 100 static inline void collectLayoutAttributes(LayoutObject* text, Vector<SVGTextLay
outAttributes*>& attributes) |
97 { | 101 { |
98 for (LayoutObject* descendant = text; descendant; descendant = descendant->n
extInPreOrder(text)) { | 102 for (LayoutObject* descendant = text; descendant; descendant = descendant->n
extInPreOrder(text)) { |
99 if (descendant->isSVGInlineText()) | 103 if (descendant->isSVGInlineText()) |
100 attributes.append(toLayoutSVGInlineText(descendant)->layoutAttribute
s()); | 104 attributes.append(toLayoutSVGInlineText(descendant)->layoutAttribute
s()); |
101 } | 105 } |
102 } | 106 } |
103 | 107 |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 SVGResourcesCache::clientWillBeRemovedFromTree(child); | 510 SVGResourcesCache::clientWillBeRemovedFromTree(child); |
507 | 511 |
508 Vector<SVGTextLayoutAttributes*, 2> affectedAttributes; | 512 Vector<SVGTextLayoutAttributes*, 2> affectedAttributes; |
509 FontCachePurgePreventer fontCachePurgePreventer; | 513 FontCachePurgePreventer fontCachePurgePreventer; |
510 subtreeChildWillBeRemoved(child, affectedAttributes); | 514 subtreeChildWillBeRemoved(child, affectedAttributes); |
511 LayoutSVGBlock::removeChild(child); | 515 LayoutSVGBlock::removeChild(child); |
512 subtreeChildWasRemoved(affectedAttributes); | 516 subtreeChildWasRemoved(affectedAttributes); |
513 } | 517 } |
514 | 518 |
515 } | 519 } |
OLD | NEW |