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

Side by Side Diff: Source/core/html/forms/TextFieldInputType.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: Addressing changes asked in previous patch Created 6 years, 5 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 | « Source/core/html/HTMLTextFormControlElement.cpp ('k') | 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // TextFieldInputType dispatches events different way from InputType. 156 // TextFieldInputType dispatches events different way from InputType.
157 InputType::setValue(sanitizedValue, valueChanged, DispatchNoEvent); 157 InputType::setValue(sanitizedValue, valueChanged, DispatchNoEvent);
158 158
159 if (valueChanged) 159 if (valueChanged)
160 input->updateView(); 160 input->updateView();
161 161
162 unsigned max = visibleValue().length(); 162 unsigned max = visibleValue().length();
163 if (input->focused()) 163 if (input->focused())
164 input->setSelectionRange(max, max); 164 input->setSelectionRange(max, max);
165 else 165 else
166 input->cacheSelectionInResponseToSetValue(max); 166 input->setSelectionRange(input->selectionStart(), input->selectionEnd()) ;
167 167
168 if (!valueChanged) 168 if (!valueChanged)
169 return; 169 return;
170 170
171 switch (eventBehavior) { 171 switch (eventBehavior) {
172 case DispatchChangeEvent: 172 case DispatchChangeEvent:
173 // If the user is still editing this field, dispatch an input event rath er than a change event. 173 // If the user is still editing this field, dispatch an input event rath er than a change event.
174 // The change event will be dispatched when editing finishes. 174 // The change event will be dispatched when editing finishes.
175 if (input->focused()) 175 if (input->focused())
176 input->dispatchFormControlInputEvent(); 176 input->dispatchFormControlInputEvent();
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 return shouldSpinButtonRespondToMouseEvents() && element().focused(); 554 return shouldSpinButtonRespondToMouseEvents() && element().focused();
555 } 555 }
556 556
557 void TextFieldInputType::spinButtonDidReleaseMouseCapture(SpinButtonElement::Eve ntDispatch eventDispatch) 557 void TextFieldInputType::spinButtonDidReleaseMouseCapture(SpinButtonElement::Eve ntDispatch eventDispatch)
558 { 558 {
559 if (eventDispatch == SpinButtonElement::EventDispatchAllowed) 559 if (eventDispatch == SpinButtonElement::EventDispatchAllowed)
560 element().dispatchFormControlChangeEvent(); 560 element().dispatchFormControlChangeEvent();
561 } 561 }
562 562
563 } // namespace WebCore 563 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/HTMLTextFormControlElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698