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

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

Issue 1988063002: Use SVGInlineTextMetricsIterator in updateLayoutAttributes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/api/LineLayoutSVGInlineText.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/SVGTextLayoutAttributesBuilder.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutAttributesBuilder.cpp b/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutAttributesBuilder.cpp
index f2c8cd5fe00a874ac796e3f0da51ff2c78b886fb..1d7780c9c50e4e004b04509679ab7869dcd46b83 100644
--- a/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutAttributesBuilder.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutAttributesBuilder.cpp
@@ -19,6 +19,7 @@
#include "core/layout/svg/SVGTextLayoutAttributesBuilder.h"
+#include "core/layout/api/LineLayoutSVGInlineText.h"
#include "core/layout/svg/LayoutSVGInline.h"
#include "core/layout/svg/LayoutSVGInlineText.h"
#include "core/layout/svg/LayoutSVGText.h"
@@ -33,16 +34,14 @@ void updateLayoutAttributes(LayoutSVGInlineText& text, unsigned& valueListPositi
SVGCharacterDataMap& characterDataMap = text.characterDataMap();
characterDataMap.clear();
- const Vector<SVGTextMetrics>& metricsList = text.metricsList();
- auto metricsEnd = metricsList.end();
- unsigned currentPosition = 0;
- for (auto metrics = metricsList.begin(); metrics != metricsEnd; currentPosition += metrics->length(), ++metrics) {
- if (metrics->isEmpty())
+ LineLayoutSVGInlineText textLineLayout(&text);
+ for (SVGInlineTextMetricsIterator iterator(textLineLayout); !iterator.isAtEnd(); iterator.next()) {
+ if (iterator.metrics().isEmpty())
continue;
auto it = allCharactersMap.find(valueListPosition + 1);
if (it != allCharactersMap.end())
- characterDataMap.set(currentPosition + 1, it->value);
+ characterDataMap.set(iterator.characterOffset() + 1, it->value);
// Increase the position in the value/attribute list with one for each
// "character unit" (that will be displayed.)
« no previous file with comments | « third_party/WebKit/Source/core/layout/api/LineLayoutSVGInlineText.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698