Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Unified Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGText.cpp

Issue 1856393002: Simplify layout attribute invalidation in LayoutSVGText (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/layout/svg/LayoutSVGText.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/svg/LayoutSVGText.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGText.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGText.cpp
index a5d12e49b7143fbf0b984da98180a79237c4bea8..f67174ed988d4b659356aca5a842dd8da4e52c51 100644
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGText.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGText.cpp
@@ -112,16 +112,22 @@ inline bool LayoutSVGText::shouldHandleSubtreeMutations() const
return true;
}
+void LayoutSVGText::invalidatePositioningValues(LayoutInvalidationReasonForTracing reason)
+{
+ m_layoutAttributes.clear();
+ m_layoutAttributesBuilder.clearTextPositioningElements();
+ setNeedsPositioningValuesUpdate();
+ setNeedsLayoutAndFullPaintInvalidation(reason);
+}
+
void LayoutSVGText::subtreeChildWasAdded(LayoutObject*)
{
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
return;
- // The positioning elements cache doesn't include the new 'child' yet. Clear the
- // cache, as the next buildLayoutAttributesForText() call rebuilds it.
- m_layoutAttributesBuilder.clearTextPositioningElements();
- setNeedsPositioningValuesUpdate();
- setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidationReason::ChildChanged);
+ // The positioning elements cache depends on the size of each text layoutObject in the
+ // subtree. If this changes, clear the cache. It will be rebuilt on the next layout.
+ invalidatePositioningValues(LayoutInvalidationReason::ChildChanged);
}
void LayoutSVGText::willBeDestroyed()
@@ -132,31 +138,18 @@ void LayoutSVGText::willBeDestroyed()
LayoutSVGBlock::willBeDestroyed();
}
-void LayoutSVGText::subtreeChildWillBeRemoved(LayoutObject* child)
+void LayoutSVGText::subtreeChildWillBeRemoved(LayoutObject*)
pdr. 2016/04/05 18:12:36 Similar here, can you remove the argument entirely
{
- ASSERT(child);
if (!shouldHandleSubtreeMutations())
return;
// The positioning elements cache depends on the size of each text layoutObject in the
- // subtree. If this changes, clear the cache. It will be rebuilt below on the next layout.
- m_layoutAttributesBuilder.clearTextPositioningElements();
- setNeedsPositioningValuesUpdate();
- setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidationReason::ChildChanged);
-
- if (m_layoutAttributes.isEmpty() || !child->isSVGInlineText())
- return;
-
- // Make sure that a text node (layout attribute) reference is not left
- // dangling in |m_layoutAttributes|.
- size_t position = m_layoutAttributes.find(toLayoutSVGInlineText(child)->layoutAttributes());
- ASSERT(position != kNotFound);
- m_layoutAttributes.remove(position);
+ // subtree. If this changes, clear the cache. It will be rebuilt on the next layout.
+ invalidatePositioningValues(LayoutInvalidationReason::ChildChanged);
}
-void LayoutSVGText::subtreeTextDidChange(LayoutSVGInlineText* text)
+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.
{
- ASSERT(text);
ASSERT(!beingDestroyed());
if (!everHadLayout()) {
ASSERT(m_layoutAttributes.isEmpty());
@@ -167,9 +160,7 @@ void LayoutSVGText::subtreeTextDidChange(LayoutSVGInlineText* text)
// The positioning elements cache depends on the size of each text object in
// the subtree. If this changes, clear the cache and mark it for rebuilding
// in the next layout.
- m_layoutAttributesBuilder.clearTextPositioningElements();
- setNeedsPositioningValuesUpdate();
- setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidationReason::TextChanged);
+ invalidatePositioningValues(LayoutInvalidationReason::TextChanged);
}
static inline void updateFontInAllDescendants(LayoutSVGText& textRoot, SVGTextLayoutAttributesBuilder* builder = nullptr)
« no previous file with comments | « third_party/WebKit/Source/core/layout/svg/LayoutSVGText.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698