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

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

Issue 1844723003: Move metrics list storage to LayoutSVGInlineText (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
Index: third_party/WebKit/Source/core/layout/svg/SVGTextMetricsBuilder.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGTextMetricsBuilder.cpp b/third_party/WebKit/Source/core/layout/svg/SVGTextMetricsBuilder.cpp
index 79f1bd3fe6d76be63f781241025adecc7fe44c2e..759a7d5e3e3e28283ec62dc705f95955678f89bb 100644
--- a/third_party/WebKit/Source/core/layout/svg/SVGTextMetricsBuilder.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/SVGTextMetricsBuilder.cpp
@@ -226,21 +226,25 @@ struct TreeWalkTextState {
// TreeWalkTextState should be used to maintain the value list position which
// indexes into the SVGCharacterDataMap of all characters.
struct UpdateAttributes {
- UpdateAttributes(SVGTextLayoutAttributes& textAttributes, const SVGCharacterDataMap* allCharacters)
- : attributes(textAttributes)
+ UpdateAttributes(
+ SVGTextLayoutAttributes& textAttributes,
+ Vector<SVGTextMetrics>& metricsList,
+ const SVGCharacterDataMap* allCharacters)
+ : metricsList(metricsList)
+ , attributes(textAttributes)
, allCharactersMap(allCharacters) { }
void clearExistingAttributes()
{
+ metricsList.clear();
+
if (allCharactersMap)
attributes.clear();
- else
- attributes.textMetricsValues().clear();
}
void addMetrics(SVGTextMetrics metrics)
{
- attributes.textMetricsValues().append(metrics);
+ metricsList.append(metrics);
}
void updateCharacterDataMap(unsigned valueListPosition, unsigned currentTextPosition)
@@ -252,6 +256,7 @@ struct UpdateAttributes {
attributes.characterDataMap().set(currentTextPosition, it->value);
}
+ Vector<SVGTextMetrics>& metricsList;
SVGTextLayoutAttributes& attributes;
const SVGCharacterDataMap* allCharactersMap;
};
@@ -303,7 +308,7 @@ void walkTree(LayoutSVGText* start, LayoutSVGInlineText* stopAtText, SVGCharacte
LayoutSVGInlineText* text = toLayoutSVGInlineText(child);
OwnPtr<UpdateAttributes> attributesToUpdate = nullptr;
if (!stopAtText || stopAtText == text)
- attributesToUpdate = adoptPtr(new UpdateAttributes(*text->layoutAttributes(), allCharactersMap));
+ attributesToUpdate = adoptPtr(new UpdateAttributes(*text->layoutAttributes(), text->metricsList(), allCharactersMap));
walkInlineText(text, textState, attributesToUpdate.get());
if (stopAtText == text)
return;

Powered by Google App Engine
This is Rietveld 408576698