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

Side by Side Diff: Source/core/html/HTMLInputElement.cpp

Issue 1189533002: Revert of 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/HTMLInputElement.h ('k') | Source/core/html/forms/CheckboxInputType.cpp » ('j') | 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) 7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
8 * Copyright (C) 2010 Google Inc. All rights reserved. 8 * Copyright (C) 2010 Google Inc. All rights reserved.
9 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 9 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
10 * Copyright (C) 2012 Samsung Electronics. All rights reserved. 10 * Copyright (C) 2012 Samsung Electronics. All rights reserved.
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 890
891 setChecked(hasAttribute(checkedAttr)); 891 setChecked(hasAttribute(checkedAttr));
892 m_reflectsCheckedAttribute = true; 892 m_reflectsCheckedAttribute = true;
893 } 893 }
894 894
895 bool HTMLInputElement::isTextField() const 895 bool HTMLInputElement::isTextField() const
896 { 896 {
897 return m_inputType->isTextField(); 897 return m_inputType->isTextField();
898 } 898 }
899 899
900 void HTMLInputElement::dispatchChangeEventIfNeeded()
901 {
902 setTextAsOfLastFormControlChangeEvent(String());
903 if (inDocument() && m_inputType->shouldSendChangeEventAfterCheckedChanged())
904 dispatchFormControlChangeEvent();
905 }
906
907 void HTMLInputElement::setChecked(bool nowChecked, TextFieldEventBehavior eventB ehavior) 900 void HTMLInputElement::setChecked(bool nowChecked, TextFieldEventBehavior eventB ehavior)
908 { 901 {
909 if (checked() == nowChecked) 902 if (checked() == nowChecked)
910 return; 903 return;
911 904
912 RefPtrWillBeRawPtr<HTMLInputElement> protector(this); 905 RefPtrWillBeRawPtr<HTMLInputElement> protector(this);
913 m_reflectsCheckedAttribute = false; 906 m_reflectsCheckedAttribute = false;
914 m_isChecked = nowChecked; 907 m_isChecked = nowChecked;
915 908
916 if (RadioButtonGroupScope* scope = radioButtonGroupScope()) 909 if (RadioButtonGroupScope* scope = radioButtonGroupScope())
(...skipping 13 matching lines...) Expand all
930 923
931 // Only send a change event for items in the document (avoid firing during 924 // Only send a change event for items in the document (avoid firing during
932 // parsing) and don't send a change event for a radio button that's getting 925 // parsing) and don't send a change event for a radio button that's getting
933 // unchecked to match other browsers. DOM is not a useful standard for this 926 // unchecked to match other browsers. DOM is not a useful standard for this
934 // because it says only to fire change events at "lose focus" time, which is 927 // because it says only to fire change events at "lose focus" time, which is
935 // definitely wrong in practice for these types of elements. 928 // definitely wrong in practice for these types of elements.
936 if (eventBehavior != DispatchNoEvent && inDocument() && m_inputType->shouldS endChangeEventAfterCheckedChanged()) { 929 if (eventBehavior != DispatchNoEvent && inDocument() && m_inputType->shouldS endChangeEventAfterCheckedChanged()) {
937 setTextAsOfLastFormControlChangeEvent(String()); 930 setTextAsOfLastFormControlChangeEvent(String());
938 if (eventBehavior == DispatchInputAndChangeEvent) 931 if (eventBehavior == DispatchInputAndChangeEvent)
939 dispatchFormControlInputEvent(); 932 dispatchFormControlInputEvent();
933 dispatchFormControlChangeEvent();
940 } 934 }
941 935
942 pseudoStateChanged(CSSSelector::PseudoChecked); 936 pseudoStateChanged(CSSSelector::PseudoChecked);
943 } 937 }
944 938
945 void HTMLInputElement::setIndeterminate(bool newValue) 939 void HTMLInputElement::setIndeterminate(bool newValue)
946 { 940 {
947 if (indeterminate() == newValue) 941 if (indeterminate() == newValue)
948 return; 942 return;
949 943
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
1915 void HTMLInputElement::ensurePrimaryContent() 1909 void HTMLInputElement::ensurePrimaryContent()
1916 { 1910 {
1917 m_inputTypeView->ensurePrimaryContent(); 1911 m_inputTypeView->ensurePrimaryContent();
1918 } 1912 }
1919 1913
1920 bool HTMLInputElement::hasFallbackContent() const 1914 bool HTMLInputElement::hasFallbackContent() const
1921 { 1915 {
1922 return m_inputTypeView->hasFallbackContent(); 1916 return m_inputTypeView->hasFallbackContent();
1923 } 1917 }
1924 } // namespace 1918 } // namespace
OLDNEW
« no previous file with comments | « Source/core/html/HTMLInputElement.h ('k') | Source/core/html/forms/CheckboxInputType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698