Chromium Code Reviews| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 105 inline bool LayoutSVGText::shouldHandleSubtreeMutations() const | 105 inline bool LayoutSVGText::shouldHandleSubtreeMutations() const |
| 106 { | 106 { |
| 107 if (beingDestroyed() || !everHadLayout()) { | 107 if (beingDestroyed() || !everHadLayout()) { |
| 108 ASSERT(m_layoutAttributes.isEmpty()); | 108 ASSERT(m_layoutAttributes.isEmpty()); |
| 109 ASSERT(!m_layoutAttributesBuilder.numberOfTextPositioningElements()); | 109 ASSERT(!m_layoutAttributesBuilder.numberOfTextPositioningElements()); |
| 110 return false; | 110 return false; |
| 111 } | 111 } |
| 112 return true; | 112 return true; |
| 113 } | 113 } |
| 114 | 114 |
| 115 void LayoutSVGText::invalidatePositioningValues(LayoutInvalidationReasonForTraci ng reason) | |
| 116 { | |
| 117 m_layoutAttributes.clear(); | |
| 118 m_layoutAttributesBuilder.clearTextPositioningElements(); | |
| 119 setNeedsPositioningValuesUpdate(); | |
| 120 setNeedsLayoutAndFullPaintInvalidation(reason); | |
| 121 } | |
| 122 | |
| 115 void LayoutSVGText::subtreeChildWasAdded(LayoutObject*) | 123 void LayoutSVGText::subtreeChildWasAdded(LayoutObject*) |
| 116 { | 124 { |
| 117 if (!shouldHandleSubtreeMutations() || documentBeingDestroyed()) | 125 if (!shouldHandleSubtreeMutations() || documentBeingDestroyed()) |
|
pdr.
2016/04/05 18:12:36
(Minor cleanup for some other patch) shouldHandleS
fs
2016/04/05 19:12:17
I folded shouldHandleSubtreeMutations() into its t
| |
| 118 return; | 126 return; |
| 119 | 127 |
| 120 // The positioning elements cache doesn't include the new 'child' yet. Clear the | 128 // The positioning elements cache depends on the size of each text layoutObj ect in the |
| 121 // cache, as the next buildLayoutAttributesForText() call rebuilds it. | 129 // subtree. If this changes, clear the cache. It will be rebuilt on the next layout. |
| 122 m_layoutAttributesBuilder.clearTextPositioningElements(); | 130 invalidatePositioningValues(LayoutInvalidationReason::ChildChanged); |
| 123 setNeedsPositioningValuesUpdate(); | |
| 124 setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidationReason::ChildChange d); | |
| 125 } | 131 } |
| 126 | 132 |
| 127 void LayoutSVGText::willBeDestroyed() | 133 void LayoutSVGText::willBeDestroyed() |
| 128 { | 134 { |
| 129 m_layoutAttributes.clear(); | 135 m_layoutAttributes.clear(); |
| 130 m_layoutAttributesBuilder.clearTextPositioningElements(); | 136 m_layoutAttributesBuilder.clearTextPositioningElements(); |
| 131 | 137 |
| 132 LayoutSVGBlock::willBeDestroyed(); | 138 LayoutSVGBlock::willBeDestroyed(); |
| 133 } | 139 } |
| 134 | 140 |
| 135 void LayoutSVGText::subtreeChildWillBeRemoved(LayoutObject* child) | 141 void LayoutSVGText::subtreeChildWillBeRemoved(LayoutObject*) |
|
pdr.
2016/04/05 18:12:36
Similar here, can you remove the argument entirely
| |
| 136 { | 142 { |
| 137 ASSERT(child); | |
| 138 if (!shouldHandleSubtreeMutations()) | 143 if (!shouldHandleSubtreeMutations()) |
| 139 return; | 144 return; |
| 140 | 145 |
| 141 // The positioning elements cache depends on the size of each text layoutObj ect in the | 146 // The positioning elements cache depends on the size of each text layoutObj ect in the |
| 142 // subtree. If this changes, clear the cache. It will be rebuilt below on th e next layout. | 147 // subtree. If this changes, clear the cache. It will be rebuilt on the next layout. |
| 143 m_layoutAttributesBuilder.clearTextPositioningElements(); | 148 invalidatePositioningValues(LayoutInvalidationReason::ChildChanged); |
| 144 setNeedsPositioningValuesUpdate(); | |
| 145 setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidationReason::ChildChange d); | |
| 146 | |
| 147 if (m_layoutAttributes.isEmpty() || !child->isSVGInlineText()) | |
| 148 return; | |
| 149 | |
| 150 // Make sure that a text node (layout attribute) reference is not left | |
| 151 // dangling in |m_layoutAttributes|. | |
| 152 size_t position = m_layoutAttributes.find(toLayoutSVGInlineText(child)->layo utAttributes()); | |
| 153 ASSERT(position != kNotFound); | |
| 154 m_layoutAttributes.remove(position); | |
| 155 } | 149 } |
| 156 | 150 |
| 157 void LayoutSVGText::subtreeTextDidChange(LayoutSVGInlineText* text) | 151 void LayoutSVGText::subtreeTextDidChange(LayoutSVGInlineText*) |
|
pdr.
2016/04/05 18:12:36
LayoutSVGInlineText::setTextInternal is the only c
fs
2016/04/05 19:12:17
Removed dead argument in all (three) cases.
| |
| 158 { | 152 { |
| 159 ASSERT(text); | |
| 160 ASSERT(!beingDestroyed()); | 153 ASSERT(!beingDestroyed()); |
| 161 if (!everHadLayout()) { | 154 if (!everHadLayout()) { |
| 162 ASSERT(m_layoutAttributes.isEmpty()); | 155 ASSERT(m_layoutAttributes.isEmpty()); |
| 163 ASSERT(!m_layoutAttributesBuilder.numberOfTextPositioningElements()); | 156 ASSERT(!m_layoutAttributesBuilder.numberOfTextPositioningElements()); |
| 164 return; | 157 return; |
| 165 } | 158 } |
| 166 | 159 |
| 167 // The positioning elements cache depends on the size of each text object in | 160 // The positioning elements cache depends on the size of each text object in |
| 168 // the subtree. If this changes, clear the cache and mark it for rebuilding | 161 // the subtree. If this changes, clear the cache and mark it for rebuilding |
| 169 // in the next layout. | 162 // in the next layout. |
| 170 m_layoutAttributesBuilder.clearTextPositioningElements(); | 163 invalidatePositioningValues(LayoutInvalidationReason::TextChanged); |
| 171 setNeedsPositioningValuesUpdate(); | |
| 172 setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidationReason::TextChanged ); | |
| 173 } | 164 } |
| 174 | 165 |
| 175 static inline void updateFontInAllDescendants(LayoutSVGText& textRoot, SVGTextLa youtAttributesBuilder* builder = nullptr) | 166 static inline void updateFontInAllDescendants(LayoutSVGText& textRoot, SVGTextLa youtAttributesBuilder* builder = nullptr) |
| 176 { | 167 { |
| 177 for (LayoutObject* descendant = &textRoot; descendant; descendant = descenda nt->nextInPreOrder(&textRoot)) { | 168 for (LayoutObject* descendant = &textRoot; descendant; descendant = descenda nt->nextInPreOrder(&textRoot)) { |
| 178 if (!descendant->isSVGInlineText()) | 169 if (!descendant->isSVGInlineText()) |
| 179 continue; | 170 continue; |
| 180 LayoutSVGInlineText* text = toLayoutSVGInlineText(descendant); | 171 LayoutSVGInlineText* text = toLayoutSVGInlineText(descendant); |
| 181 text->updateScaledFont(); | 172 text->updateScaledFont(); |
| 182 if (builder) | 173 if (builder) |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 416 paintInvalidationState.pushDelayedPaintInvalidationTarget(*this); | 407 paintInvalidationState.pushDelayedPaintInvalidationTarget(*this); |
| 417 | 408 |
| 418 if (reason == PaintInvalidationSVGResourceChange) | 409 if (reason == PaintInvalidationSVGResourceChange) |
| 419 newPaintInvalidationState.setForceSubtreeInvalidationWithinContainer(); | 410 newPaintInvalidationState.setForceSubtreeInvalidationWithinContainer(); |
| 420 | 411 |
| 421 newPaintInvalidationState.updateForChildren(); | 412 newPaintInvalidationState.updateForChildren(); |
| 422 invalidatePaintOfSubtreesIfNeeded(newPaintInvalidationState); | 413 invalidatePaintOfSubtreesIfNeeded(newPaintInvalidationState); |
| 423 } | 414 } |
| 424 | 415 |
| 425 } // namespace blink | 416 } // namespace blink |
| OLD | NEW |