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

Unified Diff: third_party/WebKit/Source/core/html/TextControlElement.cpp

Issue 2882953002: Merge "INPUT/TEXTAREA elements: Fix incorrect selectionStart/selectionEnd values after blur." to M59 (Closed)
Patch Set: Created 3 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/forms/text/text-selection-after-type-change.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/TextControlElement.cpp
diff --git a/third_party/WebKit/Source/core/html/TextControlElement.cpp b/third_party/WebKit/Source/core/html/TextControlElement.cpp
index bfc92d1c5a04c91fa2bfdd656e5935b3db460cda..41ecf18a4ac2016577e7d2402108fe64f8efc31e 100644
--- a/third_party/WebKit/Source/core/html/TextControlElement.cpp
+++ b/third_party/WebKit/Source/core/html/TextControlElement.cpp
@@ -99,6 +99,18 @@ void TextControlElement::DefaultEventHandler(Event* event) {
if (event->type() == EventTypeNames::webkitEditableContentChanged &&
GetLayoutObject() && GetLayoutObject()->IsTextControl()) {
last_change_was_user_edit_ = !GetDocument().IsRunningExecCommand();
+
+ if (IsFocused()) {
+ // Updating the cache in SelectionChanged() isn't enough because
+ // SelectionChanged() is not called if:
+ // - Text nodes in the inner-editor is split to multiple, and
+ // - The caret is on the beginning of a Text node, and its previous node
+ // is updated, or
+ // - The caret is on the end of a text node, and its next node is updated.
+ CacheSelection(ComputeSelectionStart(), ComputeSelectionEnd(),
+ ComputeSelectionDirection());
+ }
+
SubtreeHasChanged();
return;
}
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/forms/text/text-selection-after-type-change.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698