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

Unified Diff: third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp

Issue 2025503002: Revert of Expand WTF::StringView's API to be more like StringPiece. (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
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();
}

Powered by Google App Engine
This is Rietveld 408576698