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

Unified Diff: Source/core/html/HTMLSelectElement.cpp

Issue 120373005: OnChange event should fire if the multiple selection changes in listbox using mouse (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Minor modification and incorporated review comments 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/html/HTMLSelectElement.cpp
diff --git a/Source/core/html/HTMLSelectElement.cpp b/Source/core/html/HTMLSelectElement.cpp
old mode 100644
new mode 100755
index 2d581071d37568b86dd674a14514976a284ad179..c1682651de2c92da005c15a80b3b681f9f339c49
--- a/Source/core/html/HTMLSelectElement.cpp
+++ b/Source/core/html/HTMLSelectElement.cpp
@@ -1277,7 +1277,7 @@ void HTMLSelectElement::updateSelectedState(int listIndex, bool multi, bool shif
void HTMLSelectElement::listBoxDefaultEventHandler(Event* event)
{
const Vector<HTMLElement*>& listItems = this->listItems();
-
+ bool dragSelection = false;
Inactive 2014/04/20 00:43:41 I don't understand how the changes to this file co
if (event->type() == EventTypeNames::mousedown && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton) {
focus();
// Calling focus() may cause us to lose our renderer, in which case do not want to handle the event.
@@ -1323,7 +1323,7 @@ void HTMLSelectElement::listBoxDefaultEventHandler(Event* event)
updateListBoxSelection(true);
}
}
- event->setDefaultHandled();
+ dragSelection = true;
Inactive 2014/04/20 00:43:41 The clang static analyzer (rightfully) complains a
}
} else if (event->type() == EventTypeNames::mouseup && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton && renderer() && !toRenderBox(renderer())->autoscrollInProgress()) {
// We didn't start this click/drag on any options.
@@ -1332,7 +1332,9 @@ void HTMLSelectElement::listBoxDefaultEventHandler(Event* event)
// This makes sure we fire dispatchFormControlChangeEvent for a single
// click. For drag selection, onChange will fire when the autoscroll
// timer stops.
- listBoxOnChange();
+ if (!dragSelection) {
Inactive 2014/04/20 00:43:41 dragSelection will always be false here since it i
+ listBoxOnChange();
+ }
} else if (event->type() == EventTypeNames::keydown) {
if (!event->isKeyboardEvent())
return;

Powered by Google App Engine
This is Rietveld 408576698