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

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

Issue 196933006: Do not dispatch 'change' events during pressing spin buttons for input[type=number]. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Test code updated 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
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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 { 205 {
206 if (element().isDisabledOrReadOnly()) 206 if (element().isDisabledOrReadOnly())
207 return; 207 return;
208 const String& key = event->keyIdentifier(); 208 const String& key = event->keyIdentifier();
209 if (key == "Up") 209 if (key == "Up")
210 spinButtonStepUp(); 210 spinButtonStepUp();
211 else if (key == "Down") 211 else if (key == "Down")
212 spinButtonStepDown(); 212 spinButtonStepDown();
213 else 213 else
214 return; 214 return;
215 element().dispatchFormControlChangeEvent();
215 event->setDefaultHandled(); 216 event->setDefaultHandled();
216 } 217 }
217 218
218 void TextFieldInputType::forwardEvent(Event* event) 219 void TextFieldInputType::forwardEvent(Event* event)
219 { 220 {
220 if (SpinButtonElement* spinButton = spinButtonElement()) { 221 if (SpinButtonElement* spinButton = spinButtonElement()) {
221 spinButton->forwardEvent(event); 222 spinButton->forwardEvent(event);
222 if (event->defaultHandled()) 223 if (event->defaultHandled())
223 return; 224 return;
224 } 225 }
(...skipping 22 matching lines...) Expand all
247 void TextFieldInputType::handleFocusEvent(Element* oldFocusedNode, FocusType foc usType) 248 void TextFieldInputType::handleFocusEvent(Element* oldFocusedNode, FocusType foc usType)
248 { 249 {
249 InputType::handleFocusEvent(oldFocusedNode, focusType); 250 InputType::handleFocusEvent(oldFocusedNode, focusType);
250 element().beginEditing(); 251 element().beginEditing();
251 } 252 }
252 253
253 void TextFieldInputType::handleBlurEvent() 254 void TextFieldInputType::handleBlurEvent()
254 { 255 {
255 InputType::handleBlurEvent(); 256 InputType::handleBlurEvent();
256 element().endEditing(); 257 element().endEditing();
258 if (SpinButtonElement *spinButton = spinButtonElement())
259 spinButton->releaseCapture();
257 } 260 }
258 261
259 bool TextFieldInputType::shouldSubmitImplicitly(Event* event) 262 bool TextFieldInputType::shouldSubmitImplicitly(Event* event)
260 { 263 {
261 return (event->type() == EventTypeNames::textInput && event->hasInterface(Ev entNames::TextEvent) && toTextEvent(event)->data() == "\n") || InputType::should SubmitImplicitly(event); 264 return (event->type() == EventTypeNames::textInput && event->hasInterface(Ev entNames::TextEvent) && toTextEvent(event)->data() == "\n") || InputType::should SubmitImplicitly(event);
262 } 265 }
263 266
264 RenderObject* TextFieldInputType::createRenderer(RenderStyle*) const 267 RenderObject* TextFieldInputType::createRenderer(RenderStyle*) const
265 { 268 {
266 return new RenderTextControlSingleLine(&element()); 269 return new RenderTextControlSingleLine(&element());
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 bool TextFieldInputType::shouldSpinButtonRespondToMouseEvents() 554 bool TextFieldInputType::shouldSpinButtonRespondToMouseEvents()
552 { 555 {
553 return !element().isDisabledOrReadOnly(); 556 return !element().isDisabledOrReadOnly();
554 } 557 }
555 558
556 bool TextFieldInputType::shouldSpinButtonRespondToWheelEvents() 559 bool TextFieldInputType::shouldSpinButtonRespondToWheelEvents()
557 { 560 {
558 return shouldSpinButtonRespondToMouseEvents() && element().focused(); 561 return shouldSpinButtonRespondToMouseEvents() && element().focused();
559 } 562 }
560 563
564 void TextFieldInputType::spinButtonDidReleaseMouseCapture()
565 {
566 element().dispatchFormControlChangeEvent();
567 }
568
561 } // namespace WebCore 569 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/forms/TextFieldInputType.h ('k') | Source/core/html/shadow/SpinButtonElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698