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

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

Issue 1848463002: Include the surrogate character count when updating text state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@svg-metrics-cleanup-5
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 | « third_party/WebKit/LayoutTests/svg/text/surrogate-pair-attribute-positions-expected.html ('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/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 355c8eb90c0356a5efdc739edce709a3c0a964b0..8be2a13b5aa724e2dddbc679dab2c801b563340e 100644
--- a/third_party/WebKit/Source/core/layout/svg/SVGTextMetricsBuilder.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/SVGTextMetricsBuilder.cpp
@@ -283,7 +283,8 @@ void walkInlineText(LayoutSVGInlineText* text, TreeWalkTextState& textState, Upd
}
if (attributesToUpdate) {
- attributesToUpdate->updateCharacterDataMap(textState.valueListPosition - skippedWhitespace - surrogatePairCharacters + calculator.currentPosition() + 1, calculator.currentPosition() + 1);
+ unsigned currentTextValueListPosition = calculator.currentPosition() - skippedWhitespace - surrogatePairCharacters;
+ attributesToUpdate->updateCharacterDataMap(textState.valueListPosition + currentTextValueListPosition + 1, calculator.currentPosition() + 1);
attributesToUpdate->addMetrics(calculator.currentCharacterMetrics());
}
@@ -292,7 +293,8 @@ void walkInlineText(LayoutSVGInlineText* text, TreeWalkTextState& textState, Upd
textState.lastCharacterWasWhiteSpace = currentCharacterIsWhiteSpace;
} while (calculator.advancePosition());
- textState.valueListPosition += calculator.currentPosition() - skippedWhitespace;
+ unsigned currentTextValueListPosition = calculator.currentPosition() - skippedWhitespace - surrogatePairCharacters;
+ textState.valueListPosition += currentTextValueListPosition;
}
void walkTree(LayoutSVGText* start, LayoutSVGInlineText* stopAtText, SVGCharacterDataMap* allCharactersMap = nullptr)
« no previous file with comments | « third_party/WebKit/LayoutTests/svg/text/surrogate-pair-attribute-positions-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698