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

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

Issue 1188763002: Click event should be fired before change events for checkbox and radio button. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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/forms/CheckboxInputType.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) 2005, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Google Inc. All rights reserved. 3 * Copyright (C) 2010 Google Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 if (event->defaultPrevented() || event->defaultHandled()) { 189 if (event->defaultPrevented() || event->defaultHandled()) {
190 // Restore the original selected radio button if possible. 190 // Restore the original selected radio button if possible.
191 // Make sure it is still a radio button and only do the restoration if i t still belongs to our group. 191 // Make sure it is still a radio button and only do the restoration if i t still belongs to our group.
192 HTMLInputElement* checkedRadioButton = state.checkedRadioButton.get(); 192 HTMLInputElement* checkedRadioButton = state.checkedRadioButton.get();
193 if (!checkedRadioButton) 193 if (!checkedRadioButton)
194 element().setChecked(false); 194 element().setChecked(false);
195 else if (checkedRadioButton->type() == InputTypeNames::radio 195 else if (checkedRadioButton->type() == InputTypeNames::radio
196 && checkedRadioButton->form() == element().form() 196 && checkedRadioButton->form() == element().form()
197 && checkedRadioButton->name() == element().name()) 197 && checkedRadioButton->name() == element().name())
198 checkedRadioButton->setChecked(true); 198 checkedRadioButton->setChecked(true);
199 } else {
200 element().dispatchChangeEventIfNeeded();
199 } 201 }
200 202
201 // The work we did in willDispatchClick was default handling. 203 // The work we did in willDispatchClick was default handling.
202 event->setDefaultHandled(); 204 event->setDefaultHandled();
203 } 205 }
204 206
205 bool RadioInputType::shouldAppearIndeterminate() const 207 bool RadioInputType::shouldAppearIndeterminate() const
206 { 208 {
207 return !element().checkedRadioButtonForGroup(); 209 return !element().checkedRadioButtonForGroup();
208 } 210 }
209 211
210 } // namespace blink 212 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/forms/CheckboxInputType.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698