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 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 } | 839 } |
840 | 840 |
841 void HTMLInputElement::setChecked(bool nowChecked, TextFieldEventBehavior eventB
ehavior) | 841 void HTMLInputElement::setChecked(bool nowChecked, TextFieldEventBehavior eventB
ehavior) |
842 { | 842 { |
843 if (checked() == nowChecked) | 843 if (checked() == nowChecked) |
844 return; | 844 return; |
845 | 845 |
846 RefPtrWillBeRawPtr<HTMLInputElement> protector(this); | 846 RefPtrWillBeRawPtr<HTMLInputElement> protector(this); |
847 m_reflectsCheckedAttribute = false; | 847 m_reflectsCheckedAttribute = false; |
848 m_isChecked = nowChecked; | 848 m_isChecked = nowChecked; |
849 setNeedsStyleRecalc(SubtreeStyleChange); | |
850 | 849 |
851 if (RadioButtonGroupScope* scope = radioButtonGroupScope()) | 850 if (RadioButtonGroupScope* scope = radioButtonGroupScope()) |
852 scope->updateCheckedState(this); | 851 scope->updateCheckedState(this); |
853 if (renderer() && renderer()->style()->hasAppearance()) | 852 if (renderer() && renderer()->style()->hasAppearance()) |
854 RenderTheme::theme().stateChanged(renderer(), CheckedControlState); | 853 RenderTheme::theme().stateChanged(renderer(), CheckedControlState); |
855 | 854 |
856 setNeedsValidityCheck(); | 855 setNeedsValidityCheck(); |
857 | 856 |
858 // Ideally we'd do this from the render tree (matching | 857 // Ideally we'd do this from the render tree (matching |
859 // RenderTextView), but it's not possible to do it at the moment | 858 // RenderTextView), but it's not possible to do it at the moment |
860 // because of the way the code is structured. | 859 // because of the way the code is structured. |
861 if (renderer()) { | 860 if (renderer()) { |
862 if (AXObjectCache* cache = renderer()->document().existingAXObjectCache(
)) | 861 if (AXObjectCache* cache = renderer()->document().existingAXObjectCache(
)) |
863 cache->checkedStateChanged(this); | 862 cache->checkedStateChanged(this); |
864 } | 863 } |
865 | 864 |
866 // Only send a change event for items in the document (avoid firing during | 865 // Only send a change event for items in the document (avoid firing during |
867 // parsing) and don't send a change event for a radio button that's getting | 866 // parsing) and don't send a change event for a radio button that's getting |
868 // unchecked to match other browsers. DOM is not a useful standard for this | 867 // unchecked to match other browsers. DOM is not a useful standard for this |
869 // because it says only to fire change events at "lose focus" time, which is | 868 // because it says only to fire change events at "lose focus" time, which is |
870 // definitely wrong in practice for these types of elements. | 869 // definitely wrong in practice for these types of elements. |
871 if (eventBehavior != DispatchNoEvent && inDocument() && m_inputType->shouldS
endChangeEventAfterCheckedChanged()) { | 870 if (eventBehavior != DispatchNoEvent && inDocument() && m_inputType->shouldS
endChangeEventAfterCheckedChanged()) { |
872 setTextAsOfLastFormControlChangeEvent(String()); | 871 setTextAsOfLastFormControlChangeEvent(String()); |
873 if (eventBehavior == DispatchInputAndChangeEvent) | 872 if (eventBehavior == DispatchInputAndChangeEvent) |
874 dispatchFormControlInputEvent(); | 873 dispatchFormControlInputEvent(); |
875 dispatchFormControlChangeEvent(); | 874 dispatchFormControlChangeEvent(); |
876 } | 875 } |
877 | 876 |
878 didAffectSelector(AffectedSelectorChecked); | 877 pseudoStateChanged(CSSSelector::PseudoChecked); |
879 } | 878 } |
880 | 879 |
881 void HTMLInputElement::setIndeterminate(bool newValue) | 880 void HTMLInputElement::setIndeterminate(bool newValue) |
882 { | 881 { |
883 if (indeterminate() == newValue) | 882 if (indeterminate() == newValue) |
884 return; | 883 return; |
885 | 884 |
886 m_isIndeterminate = newValue; | 885 m_isIndeterminate = newValue; |
887 | 886 |
888 didAffectSelector(AffectedSelectorIndeterminate); | 887 pseudoStateChanged(CSSSelector::PseudoIndeterminate); |
889 | 888 |
890 if (renderer() && renderer()->style()->hasAppearance()) | 889 if (renderer() && renderer()->style()->hasAppearance()) |
891 RenderTheme::theme().stateChanged(renderer(), CheckedControlState); | 890 RenderTheme::theme().stateChanged(renderer(), CheckedControlState); |
892 } | 891 } |
893 | 892 |
894 int HTMLInputElement::size() const | 893 int HTMLInputElement::size() const |
895 { | 894 { |
896 return m_size; | 895 return m_size; |
897 } | 896 } |
898 | 897 |
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1805 { | 1804 { |
1806 listAttributeTargetChanged(); | 1805 listAttributeTargetChanged(); |
1807 } | 1806 } |
1808 | 1807 |
1809 AXObject* HTMLInputElement::popupRootAXObject() | 1808 AXObject* HTMLInputElement::popupRootAXObject() |
1810 { | 1809 { |
1811 return m_inputTypeView->popupRootAXObject(); | 1810 return m_inputTypeView->popupRootAXObject(); |
1812 } | 1811 } |
1813 | 1812 |
1814 } // namespace | 1813 } // namespace |
OLD | NEW |