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

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: Avoid extra change event Created 6 years, 9 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 if (element().focused())
tkent 2014/03/18 08:26:20 Why is the focus check needed? It looks unnecessar
216 element().dispatchFormControlChangeEvent();
215 event->setDefaultHandled(); 217 event->setDefaultHandled();
216 } 218 }
217 219
218 void TextFieldInputType::forwardEvent(Event* event) 220 void TextFieldInputType::forwardEvent(Event* event)
219 { 221 {
220 if (SpinButtonElement* spinButton = spinButtonElement()) { 222 if (SpinButtonElement* spinButton = spinButtonElement()) {
221 spinButton->forwardEvent(event); 223 spinButton->forwardEvent(event);
222 if (event->defaultHandled()) 224 if (event->defaultHandled())
223 return; 225 return;
224 } 226 }
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 bool TextFieldInputType::shouldSpinButtonRespondToMouseEvents() 553 bool TextFieldInputType::shouldSpinButtonRespondToMouseEvents()
552 { 554 {
553 return !element().isDisabledOrReadOnly(); 555 return !element().isDisabledOrReadOnly();
554 } 556 }
555 557
556 bool TextFieldInputType::shouldSpinButtonRespondToWheelEvents() 558 bool TextFieldInputType::shouldSpinButtonRespondToWheelEvents()
557 { 559 {
558 return shouldSpinButtonRespondToMouseEvents() && element().focused(); 560 return shouldSpinButtonRespondToMouseEvents() && element().focused();
559 } 561 }
560 562
563 void TextFieldInputType::spinButtonDidReleaseMouseCapture()
564 {
565 // Sending dispatch change event only when in focus,
566 // as when out of focus change event is triggered from setValue::DispatchCha ngeEvent.
567 if (element().focused())
tkent 2014/03/18 08:26:20 Ditto.
568 element().dispatchFormControlChangeEvent();
569 }
570
561 } // namespace WebCore 571 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698