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

Unified Diff: third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp

Issue 2832123002: Do not count extra trailing space for the last word in a range (Closed)
Patch Set: getElementById Created 3 years, 8 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/editing/iterators/TextIterator.cpp
diff --git a/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp b/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
index b569a1f12776a9a837a7e280f150bec825747e2c..2e995686b61755d113276724d972d25c8f021115 100644
--- a/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
+++ b/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
@@ -784,6 +784,16 @@ void TextIteratorAlgorithm<Strategy>::HandleTextBox() {
text_box_end)
return;
+ if (behavior_.DoesNotEmitSpaceBeyondRangeEnd()) {
+ // If the subrun went to the text box end and this end is also the end
+ // of the range, do not advance to the next text box and do not
+ // generate a space, just stop.
+ if (text_box_end == end) {
+ text_box_ = nullptr;
+ return;
+ }
+ }
+
// Advance and return
unsigned next_run_start =
next_text_box ? next_text_box->Start() : str.length();

Powered by Google App Engine
This is Rietveld 408576698