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

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

Issue 2878613002: INPUT/TEXTAREA elements: Fix incorrect selectionStart/selectionEnd values after blur. (Closed)
Patch Set: Improve a test 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 6eb7ed0df1f12ff32856e8de60e1df06cd67081e..e7e5ad0aac7f7b1094dec12d9ecc3770171f7abf 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