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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 , m_needsTransformUpdate(true) | 72 , m_needsTransformUpdate(true) |
73 , m_needsTextMetricsUpdate(false) | 73 , m_needsTextMetricsUpdate(false) |
74 { | 74 { |
75 } | 75 } |
76 | 76 |
77 LayoutSVGText::~LayoutSVGText() | 77 LayoutSVGText::~LayoutSVGText() |
78 { | 78 { |
79 ASSERT(m_layoutAttributes.isEmpty()); | 79 ASSERT(m_layoutAttributes.isEmpty()); |
80 } | 80 } |
81 | 81 |
82 void LayoutSVGText::willBeDestroyed() | |
83 { | |
84 m_layoutAttributes.clear(); | |
85 m_layoutAttributesBuilder.clearTextPositioningElements(); | |
86 | |
87 LayoutSVGBlock::willBeDestroyed(); | |
88 } | |
89 | |
82 bool LayoutSVGText::isChildAllowed(LayoutObject* child, const ComputedStyle&) co nst | 90 bool LayoutSVGText::isChildAllowed(LayoutObject* child, const ComputedStyle&) co nst |
83 { | 91 { |
84 return child->isSVGInline() || (child->isText() && SVGLayoutSupport::isLayou tableTextNode(child)); | 92 return child->isSVGInline() || (child->isText() && SVGLayoutSupport::isLayou tableTextNode(child)); |
85 } | 93 } |
86 | 94 |
87 LayoutSVGText* LayoutSVGText::locateLayoutSVGTextAncestor(LayoutObject* start) | 95 LayoutSVGText* LayoutSVGText::locateLayoutSVGTextAncestor(LayoutObject* start) |
88 { | 96 { |
89 return const_cast<LayoutSVGText*>(findTextRoot(start)); | 97 return const_cast<LayoutSVGText*>(findTextRoot(start)); |
90 } | 98 } |
91 | 99 |
(...skipping 23 matching lines...) Expand all Loading... | |
115 if (beingDestroyed() || !everHadLayout()) { | 123 if (beingDestroyed() || !everHadLayout()) { |
116 ASSERT(m_layoutAttributes.isEmpty()); | 124 ASSERT(m_layoutAttributes.isEmpty()); |
117 ASSERT(!m_layoutAttributesBuilder.numberOfTextPositioningElements()); | 125 ASSERT(!m_layoutAttributesBuilder.numberOfTextPositioningElements()); |
118 return; | 126 return; |
119 } | 127 } |
120 if (documentBeingDestroyed()) | 128 if (documentBeingDestroyed()) |
121 return; | 129 return; |
122 | 130 |
123 // The positioning elements cache depends on the size of each text layoutObj ect in the | 131 // The positioning elements cache depends on the size of each text layoutObj ect in the |
124 // subtree. If this changes, clear the cache. It will be rebuilt on the next layout. | 132 // subtree. If this changes, clear the cache. It will be rebuilt on the next layout. |
125 invalidatePositioningValues(LayoutInvalidationReason::ChildChanged); | 133 invalidatePositioningValues(LayoutInvalidationReason::ChildChanged); |
pdr.
2016/04/06 23:31:40
setNeedsTextMetricsUpdate() requires that we mark
fs
2016/04/07 09:00:00
I didn't want to fold this call into invalidatePos
| |
126 } | 134 setNeedsTextMetricsUpdate(); |
pdr.
2016/04/06 23:31:40
No tests seem fail without the change, but I don't
fs
2016/04/07 09:00:00
I think we do need it in subtreeChildWillBeRemoved
| |
127 | |
128 void LayoutSVGText::willBeDestroyed() | |
129 { | |
130 m_layoutAttributes.clear(); | |
131 m_layoutAttributesBuilder.clearTextPositioningElements(); | |
132 | |
133 LayoutSVGBlock::willBeDestroyed(); | |
134 } | 135 } |
135 | 136 |
136 void LayoutSVGText::subtreeChildWillBeRemoved() | 137 void LayoutSVGText::subtreeChildWillBeRemoved() |
137 { | 138 { |
138 if (beingDestroyed() || !everHadLayout()) { | 139 if (beingDestroyed() || !everHadLayout()) { |
139 ASSERT(m_layoutAttributes.isEmpty()); | 140 ASSERT(m_layoutAttributes.isEmpty()); |
140 ASSERT(!m_layoutAttributesBuilder.numberOfTextPositioningElements()); | 141 ASSERT(!m_layoutAttributesBuilder.numberOfTextPositioningElements()); |
141 return; | 142 return; |
142 } | 143 } |
143 | 144 |
144 // The positioning elements cache depends on the size of each text layoutObj ect in the | 145 // The positioning elements cache depends on the size of each text layoutObj ect in the |
145 // subtree. If this changes, clear the cache. It will be rebuilt on the next layout. | 146 // subtree. If this changes, clear the cache. It will be rebuilt on the next layout. |
146 invalidatePositioningValues(LayoutInvalidationReason::ChildChanged); | 147 invalidatePositioningValues(LayoutInvalidationReason::ChildChanged); |
147 } | 148 } |
148 | 149 |
149 void LayoutSVGText::subtreeTextDidChange() | 150 void LayoutSVGText::subtreeTextDidChange() |
150 { | 151 { |
151 ASSERT(!beingDestroyed()); | 152 ASSERT(!beingDestroyed()); |
152 if (!everHadLayout()) { | 153 if (!everHadLayout()) { |
153 ASSERT(m_layoutAttributes.isEmpty()); | 154 ASSERT(m_layoutAttributes.isEmpty()); |
154 ASSERT(!m_layoutAttributesBuilder.numberOfTextPositioningElements()); | 155 ASSERT(!m_layoutAttributesBuilder.numberOfTextPositioningElements()); |
155 return; | 156 return; |
156 } | 157 } |
157 | 158 |
158 // The positioning elements cache depends on the size of each text object in | 159 // The positioning elements cache depends on the size of each text object in |
159 // the subtree. If this changes, clear the cache and mark it for rebuilding | 160 // the subtree. If this changes, clear the cache and mark it for rebuilding |
160 // in the next layout. | 161 // in the next layout. |
161 invalidatePositioningValues(LayoutInvalidationReason::TextChanged); | 162 invalidatePositioningValues(LayoutInvalidationReason::TextChanged); |
163 setNeedsTextMetricsUpdate(); | |
162 } | 164 } |
163 | 165 |
164 static inline void updateFontInAllDescendants(LayoutSVGText& textRoot, SVGTextLa youtAttributesBuilder* builder = nullptr) | 166 static inline void updateFontInAllDescendants(LayoutSVGText& textRoot, SVGTextLa youtAttributesBuilder* builder = nullptr) |
165 { | 167 { |
166 for (LayoutObject* descendant = &textRoot; descendant; descendant = descenda nt->nextInPreOrder(&textRoot)) { | 168 for (LayoutObject* descendant = &textRoot; descendant; descendant = descenda nt->nextInPreOrder(&textRoot)) { |
167 if (!descendant->isSVGInlineText()) | 169 if (!descendant->isSVGInlineText()) |
168 continue; | 170 continue; |
169 LayoutSVGInlineText* text = toLayoutSVGInlineText(descendant); | 171 LayoutSVGInlineText* text = toLayoutSVGInlineText(descendant); |
170 text->updateScaledFont(); | 172 text->updateScaledFont(); |
171 if (builder) | 173 if (builder) |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
405 paintInvalidationState.pushDelayedPaintInvalidationTarget(*this); | 407 paintInvalidationState.pushDelayedPaintInvalidationTarget(*this); |
406 | 408 |
407 if (reason == PaintInvalidationSVGResourceChange) | 409 if (reason == PaintInvalidationSVGResourceChange) |
408 newPaintInvalidationState.setForceSubtreeInvalidationWithinContainer(); | 410 newPaintInvalidationState.setForceSubtreeInvalidationWithinContainer(); |
409 | 411 |
410 newPaintInvalidationState.updateForChildren(); | 412 newPaintInvalidationState.updateForChildren(); |
411 invalidatePaintOfSubtreesIfNeeded(newPaintInvalidationState); | 413 invalidatePaintOfSubtreesIfNeeded(newPaintInvalidationState); |
412 } | 414 } |
413 | 415 |
414 } // namespace blink | 416 } // namespace blink |
OLD | NEW |