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

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

Issue 1839413002: Simplify the computation of the value list position (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@svg-metrics-cleanup-6
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
« no previous file with comments | « no previous file | 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/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 8be2a13b5aa724e2dddbc679dab2c801b563340e..23b43b43b47ab19f87a653801f0d8bae71ec82da 100644
--- a/third_party/WebKit/Source/core/layout/svg/SVGTextMetricsBuilder.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/SVGTextMetricsBuilder.cpp
@@ -270,31 +270,25 @@ void walkInlineText(LayoutSVGInlineText* text, TreeWalkTextState& textState, Upd
// iterator and move all subrun logic to a single function.
SVGTextMetricsCalculator calculator(textLayoutItem);
bool preserveWhiteSpace = textLayoutItem.styleRef().whiteSpace() == PRE;
- unsigned surrogatePairCharacters = 0;
- unsigned skippedWhitespace = 0;
do {
bool currentCharacterIsWhiteSpace = calculator.currentCharacterIsWhiteSpace();
if (currentCharacterIsWhiteSpace && !preserveWhiteSpace && textState.lastCharacterWasWhiteSpace) {
if (attributesToUpdate)
attributesToUpdate->addMetrics(SVGTextMetrics(SVGTextMetrics::SkippedSpaceMetrics));
ASSERT(calculator.currentCharacterMetrics().length() == 1);
- skippedWhitespace++;
continue;
}
if (attributesToUpdate) {
- unsigned currentTextValueListPosition = calculator.currentPosition() - skippedWhitespace - surrogatePairCharacters;
- attributesToUpdate->updateCharacterDataMap(textState.valueListPosition + currentTextValueListPosition + 1, calculator.currentPosition() + 1);
+ attributesToUpdate->updateCharacterDataMap(textState.valueListPosition + 1, calculator.currentPosition() + 1);
attributesToUpdate->addMetrics(calculator.currentCharacterMetrics());
}
- if (calculator.currentCharacterStartsSurrogatePair())
- surrogatePairCharacters++;
+ // Increase the position in the value/attribute list with one for each
+ // "character unit" (that will be displayed.)
+ textState.valueListPosition++;
textState.lastCharacterWasWhiteSpace = currentCharacterIsWhiteSpace;
} while (calculator.advancePosition());
-
- unsigned currentTextValueListPosition = calculator.currentPosition() - skippedWhitespace - surrogatePairCharacters;
- textState.valueListPosition += currentTextValueListPosition;
}
void walkTree(LayoutSVGText* start, LayoutSVGInlineText* stopAtText, SVGCharacterDataMap* allCharactersMap = nullptr)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698