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

Unified Diff: third_party/WebKit/Source/core/paint/InlineTextBoxPainter.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/paint/InlineTextBoxPainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp b/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp
index 14db122e6bb6fbde188dce5be2080c6e855de1f3..e1d33b2f0d04da0ffe5e1530cd660e95ee791347 100644
--- a/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp
@@ -149,7 +149,10 @@
// 2. Now paint the foreground, including text and decorations like underline/overline (in quirks mode only).
int length = m_inlineTextBox.len();
- StringView string = StringView(m_inlineTextBox.getLineLayoutItem().text(), m_inlineTextBox.start(), length);
+ StringView string = m_inlineTextBox.getLineLayoutItem().text().createView();
+ ASSERT(m_inlineTextBox.start() + length <= string.length());
+ if (static_cast<unsigned>(length) != string.length() || m_inlineTextBox.start())
+ string.narrow(m_inlineTextBox.start(), length);
int maximumLength = m_inlineTextBox.getLineLayoutItem().textLength() - m_inlineTextBox.start();
StringBuilder charactersWithHyphen;
@@ -438,7 +441,10 @@
// If the text is truncated, let the thing being painted in the truncation
// draw its own highlight.
int length = m_inlineTextBox.truncation() != cNoTruncation ? m_inlineTextBox.truncation() : m_inlineTextBox.len();
- StringView string(m_inlineTextBox.getLineLayoutItem().text(), m_inlineTextBox.start(), static_cast<unsigned>(length));
+ StringView string = m_inlineTextBox.getLineLayoutItem().text().createView();
+
+ if (string.length() != static_cast<unsigned>(length) || m_inlineTextBox.start())
+ string.narrow(m_inlineTextBox.start(), length);
StringBuilder charactersWithHyphen;
bool respectHyphen = ePos == length && m_inlineTextBox.hasHyphen();

Powered by Google App Engine
This is Rietveld 408576698