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

Unified Diff: Source/core/html/HTMLTextFormControlElement.cpp

Issue 258063005: Blink does not respect input.selectionStart and input.selectionEnd for some cases (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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: Source/core/html/HTMLTextFormControlElement.cpp
diff --git a/Source/core/html/HTMLTextFormControlElement.cpp b/Source/core/html/HTMLTextFormControlElement.cpp
index c3f751a63f54d4eb643bdb97275b0ecbe1ae555c..e0b02e66f21eaf05ae4c8f6f73a8f6fe767a728c 100644
--- a/Source/core/html/HTMLTextFormControlElement.cpp
+++ b/Source/core/html/HTMLTextFormControlElement.cpp
@@ -279,11 +279,10 @@ void HTMLTextFormControlElement::setSelectionRange(int start, int end, TextField
end = max(end, 0);
start = min(max(start, 0), end);
+ cacheSelection(start, end, direction);
tkent 2014/04/29 23:55:44 What happens if |start| or |end| is larger than va
harpreet.sk 2014/04/30 14:36:27 The browser will displays the caret at end of the
- if (!hasVisibleTextArea(renderer(), innerTextElement())) {
- cacheSelection(start, end, direction);
+ if (!hasVisibleTextArea(renderer(), innerTextElement()))
return;
- }
VisiblePosition startPosition = visiblePositionForIndex(start);
VisiblePosition endPosition;
if (start == end)
@@ -472,9 +471,6 @@ void HTMLTextFormControlElement::selectionChanged(bool userTriggered)
if (!renderer() || !isTextFormControl())
return;
- // selectionStart() or selectionEnd() will return cached selection when this node doesn't have focus
- cacheSelection(computeSelectionStart(), computeSelectionEnd(), computeSelectionDirection());
-
if (LocalFrame* frame = document().frame()) {
if (frame->selection().isRange() && userTriggered)
dispatchEvent(Event::createBubble(EventTypeNames::select));

Powered by Google App Engine
This is Rietveld 408576698