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

Unified Diff: Source/core/layout/LayoutText.cpp

Issue 361683002: Make LayoutText::absoluteQuadsForRange to consider leading/trailing whitespaces (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-18T16:38:30 Created 5 years, 4 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: Source/core/layout/LayoutText.cpp
diff --git a/Source/core/layout/LayoutText.cpp b/Source/core/layout/LayoutText.cpp
index ac36dc083ba35685a1bf8b5d22a0079e180c6ea5..834a9e33c28c4dd9dd38514da69ff856394d5eab 100644
--- a/Source/core/layout/LayoutText.cpp
+++ b/Source/core/layout/LayoutText.cpp
@@ -441,6 +441,12 @@ void LayoutText::absoluteQuadsForRange(Vector<FloatQuad>& quads, unsigned start,
start = std::min(start, static_cast<unsigned>(INT_MAX));
end = std::min(end, static_cast<unsigned>(INT_MAX));
+ const unsigned caretMinOffset = static_cast<unsigned>(this->caretMinOffset());
+ const unsigned caretMaxOffset = static_cast<unsigned>(this->caretMaxOffset());
+ // Skip leading and trailing unrendered whitespaces
eae 2015/08/18 16:14:45 The comment doesn't explain how this accounts for
yosin_UTC9 2015/08/19 06:08:55 Done.
+ start = std::min(std::max(caretMinOffset, start), caretMaxOffset);
+ end = std::min(std::max(caretMinOffset, end), caretMaxOffset);
+
for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
// Note: box->end() returns the index of the last character, not the index past it
if (start <= box->start() && box->end() < end) {

Powered by Google App Engine
This is Rietveld 408576698