OLD | NEW |
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 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 bool HTMLInputElement::isTextType() const | 850 bool HTMLInputElement::isTextType() const |
851 { | 851 { |
852 return m_inputType->isTextType(); | 852 return m_inputType->isTextType(); |
853 } | 853 } |
854 | 854 |
855 void HTMLInputElement::setChecked(bool nowChecked, TextFieldEventBehavior eventB
ehavior) | 855 void HTMLInputElement::setChecked(bool nowChecked, TextFieldEventBehavior eventB
ehavior) |
856 { | 856 { |
857 if (checked() == nowChecked) | 857 if (checked() == nowChecked) |
858 return; | 858 return; |
859 | 859 |
| 860 RefPtr<HTMLInputElement> protector(this); |
860 m_reflectsCheckedAttribute = false; | 861 m_reflectsCheckedAttribute = false; |
861 m_isChecked = nowChecked; | 862 m_isChecked = nowChecked; |
862 setNeedsStyleRecalc(SubtreeStyleChange); | 863 setNeedsStyleRecalc(SubtreeStyleChange); |
863 | 864 |
864 if (RadioButtonGroupScope* scope = radioButtonGroupScope()) | 865 if (RadioButtonGroupScope* scope = radioButtonGroupScope()) |
865 scope->updateCheckedState(this); | 866 scope->updateCheckedState(this); |
866 if (renderer() && renderer()->style()->hasAppearance()) | 867 if (renderer() && renderer()->style()->hasAppearance()) |
867 RenderTheme::theme().stateChanged(renderer(), CheckedState); | 868 RenderTheme::theme().stateChanged(renderer(), CheckedState); |
868 | 869 |
869 setNeedsValidityCheck(); | 870 setNeedsValidityCheck(); |
870 | 871 |
871 // Ideally we'd do this from the render tree (matching | 872 // Ideally we'd do this from the render tree (matching |
872 // RenderTextView), but it's not possible to do it at the moment | 873 // RenderTextView), but it's not possible to do it at the moment |
873 // because of the way the code is structured. | 874 // because of the way the code is structured. |
874 if (renderer()) { | 875 if (renderer()) { |
875 if (AXObjectCache* cache = renderer()->document().existingAXObjectCache(
)) | 876 if (AXObjectCache* cache = renderer()->document().existingAXObjectCache(
)) |
876 cache->checkedStateChanged(this); | 877 cache->checkedStateChanged(this); |
877 } | 878 } |
878 | 879 |
879 // Only send a change event for items in the document (avoid firing during | 880 // Only send a change event for items in the document (avoid firing during |
880 // parsing) and don't send a change event for a radio button that's getting | 881 // parsing) and don't send a change event for a radio button that's getting |
881 // unchecked to match other browsers. DOM is not a useful standard for this | 882 // unchecked to match other browsers. DOM is not a useful standard for this |
882 // because it says only to fire change events at "lose focus" time, which is | 883 // because it says only to fire change events at "lose focus" time, which is |
883 // definitely wrong in practice for these types of elements. | 884 // definitely wrong in practice for these types of elements. |
884 if (eventBehavior != DispatchNoEvent && inDocument() && m_inputType->shouldS
endChangeEventAfterCheckedChanged()) { | 885 if (eventBehavior != DispatchNoEvent && inDocument() && m_inputType->shouldS
endChangeEventAfterCheckedChanged()) { |
885 setTextAsOfLastFormControlChangeEvent(String()); | 886 setTextAsOfLastFormControlChangeEvent(String()); |
| 887 if (eventBehavior == DispatchInputAndChangeEvent) |
| 888 dispatchFormControlInputEvent(); |
886 dispatchFormControlChangeEvent(); | 889 dispatchFormControlChangeEvent(); |
887 } | 890 } |
888 | 891 |
889 didAffectSelector(AffectedSelectorChecked); | 892 didAffectSelector(AffectedSelectorChecked); |
890 } | 893 } |
891 | 894 |
892 void HTMLInputElement::setIndeterminate(bool newValue) | 895 void HTMLInputElement::setIndeterminate(bool newValue) |
893 { | 896 { |
894 if (indeterminate() == newValue) | 897 if (indeterminate() == newValue) |
895 return; | 898 return; |
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1878 } | 1881 } |
1879 | 1882 |
1880 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) | 1883 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) |
1881 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer() | 1884 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer() |
1882 { | 1885 { |
1883 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer()); | 1886 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer()); |
1884 } | 1887 } |
1885 #endif | 1888 #endif |
1886 | 1889 |
1887 } // namespace | 1890 } // namespace |
OLD | NEW |