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

Side by Side Diff: Source/core/html/forms/TextFieldInputType.cpp

Issue 258953002: Caret position after updating value IDL attribute of unfocused INPUT element is incompatible (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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * Copyright (C) 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2011 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 // We don't ask InputType::setValue to dispatch events because 153 // We don't ask InputType::setValue to dispatch events because
154 // TextFieldInputType dispatches events different way from InputType. 154 // TextFieldInputType dispatches events different way from InputType.
155 InputType::setValue(sanitizedValue, valueChanged, DispatchNoEvent); 155 InputType::setValue(sanitizedValue, valueChanged, DispatchNoEvent);
156 156
157 if (valueChanged) 157 if (valueChanged)
158 input->updateView(); 158 input->updateView();
159 159
160 unsigned max = visibleValue().length(); 160 unsigned max = visibleValue().length();
161 if (input->focused()) 161 if (input->focused())
162 input->setSelectionRange(max, max); 162 input->setSelectionRange(max, max);
163 else
164 input->cacheSelectionInResponseToSetValue(max);
tkent 2014/04/28 00:33:40 What happens if selectionStart=selectionEnd=3 befo
harpreet.sk 2014/04/28 16:07:55 In the above case the caret is place at end of tex
165 163
166 if (!valueChanged) 164 if (!valueChanged)
167 return; 165 return;
168 166
169 switch (eventBehavior) { 167 switch (eventBehavior) {
170 case DispatchChangeEvent: 168 case DispatchChangeEvent:
171 // If the user is still editing this field, dispatch an input event rath er than a change event. 169 // If the user is still editing this field, dispatch an input event rath er than a change event.
172 // The change event will be dispatched when editing finishes. 170 // The change event will be dispatched when editing finishes.
173 if (input->focused()) 171 if (input->focused())
174 input->dispatchFormControlInputEvent(); 172 input->dispatchFormControlInputEvent();
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 return shouldSpinButtonRespondToMouseEvents() && element().focused(); 563 return shouldSpinButtonRespondToMouseEvents() && element().focused();
566 } 564 }
567 565
568 void TextFieldInputType::spinButtonDidReleaseMouseCapture(SpinButtonElement::Eve ntDispatch eventDispatch) 566 void TextFieldInputType::spinButtonDidReleaseMouseCapture(SpinButtonElement::Eve ntDispatch eventDispatch)
569 { 567 {
570 if (eventDispatch == SpinButtonElement::EventDispatchAllowed) 568 if (eventDispatch == SpinButtonElement::EventDispatchAllowed)
571 element().dispatchFormControlChangeEvent(); 569 element().dispatchFormControlChangeEvent();
572 } 570 }
573 571
574 } // namespace WebCore 572 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698