Index: third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp |
diff --git a/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp b/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp |
index 29011935e3c15f29c3494d3bb226f6ce93e2ac34..545ff16437845baf0a629e9156cddc3959dee88e 100644 |
--- a/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp |
+++ b/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp |
@@ -553,10 +553,14 @@ |
{ |
ASSERT(getLineLayoutItem().text()); |
- String string = getLineLayoutItem().text(); |
+ StringView string = getLineLayoutItem().text().createView(); |
unsigned startPos = start(); |
unsigned length = len(); |
- return constructTextRun(style, font, StringView(string, startPos, length), getLineLayoutItem().textLength() - startPos, charactersWithHyphen); |
+ |
+ if (string.length() != length || startPos) |
+ string.narrow(startPos, length); |
+ |
+ return constructTextRun(style, font, string, getLineLayoutItem().textLength() - startPos, charactersWithHyphen); |
} |
TextRun InlineTextBox::constructTextRun(const ComputedStyle& style, const Font& font, StringView string, int maximumLength, StringBuilder* charactersWithHyphen) const |
@@ -566,7 +570,7 @@ |
charactersWithHyphen->reserveCapacity(string.length() + hyphenString.length()); |
charactersWithHyphen->append(string); |
charactersWithHyphen->append(hyphenString); |
- string = charactersWithHyphen->toString(); |
+ string = charactersWithHyphen->toString().createView(); |
maximumLength = string.length(); |
} |