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

Unified Diff: Source/core/rendering/RenderText.cpp

Issue 361683002: Make LayoutText::absoluteQuadsForRange to consider leading/trailing whitespaces (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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/rendering/RenderText.cpp
diff --git a/Source/core/rendering/RenderText.cpp b/Source/core/rendering/RenderText.cpp
index 156a2944343ff133c32f58ba96fbf263de87c2ab..d2f81c38893ab783e57f94064166a074bd5e658d 100644
--- a/Source/core/rendering/RenderText.cpp
+++ b/Source/core/rendering/RenderText.cpp
@@ -444,6 +444,13 @@ void RenderText::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
+ 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