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

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

Issue 128133002: Update of change event for input type number (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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
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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 if (input->focused()) 171 if (input->focused())
172 input->setSelectionRange(max, max); 172 input->setSelectionRange(max, max);
173 else 173 else
174 input->cacheSelectionInResponseToSetValue(max); 174 input->cacheSelectionInResponseToSetValue(max);
175 175
176 if (!valueChanged) 176 if (!valueChanged)
177 return; 177 return;
178 178
179 switch (eventBehavior) { 179 switch (eventBehavior) {
180 case DispatchChangeEvent: 180 case DispatchChangeEvent:
181 case DispatchInputAndChangeEvent:
tkent 2014/01/14 01:06:46 This is not acceptable as I already wrote.
181 // If the user is still editing this field, dispatch an input event rath er than a change event. 182 // If the user is still editing this field, dispatch an input event rath er than a change event.
182 // The change event will be dispatched when editing finishes. 183 // The change event will be dispatched when editing finishes.
183 if (input->focused()) 184 if (input->focused())
184 input->dispatchFormControlInputEvent(); 185 input->dispatchFormControlInputEvent();
185 else 186 else
186 input->dispatchFormControlChangeEvent(); 187 input->dispatchFormControlChangeEvent();
187 break; 188 break;
188
189 case DispatchInputAndChangeEvent: {
190 input->dispatchFormControlInputEvent();
191 input->dispatchFormControlChangeEvent();
192 break;
193 }
194
195 case DispatchNoEvent: 189 case DispatchNoEvent:
196 break; 190 break;
197 } 191 }
198 192
199 if (!input->focused()) 193 if (!input->focused())
200 input->setTextAsOfLastFormControlChangeEvent(sanitizedValue); 194 input->setTextAsOfLastFormControlChangeEvent(sanitizedValue);
201 } 195 }
202 196
203 void TextFieldInputType::handleKeydownEvent(KeyboardEvent* event) 197 void TextFieldInputType::handleKeydownEvent(KeyboardEvent* event)
204 { 198 {
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 { 563 {
570 return !element().isDisabledOrReadOnly(); 564 return !element().isDisabledOrReadOnly();
571 } 565 }
572 566
573 bool TextFieldInputType::shouldSpinButtonRespondToWheelEvents() 567 bool TextFieldInputType::shouldSpinButtonRespondToWheelEvents()
574 { 568 {
575 return shouldSpinButtonRespondToMouseEvents() && element().focused(); 569 return shouldSpinButtonRespondToMouseEvents() && element().focused();
576 } 570 }
577 571
578 } // namespace WebCore 572 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/forms/number/number-type-update-by-change-event.html ('k') | Source/core/html/shadow/SpinButtonElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698