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

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

Issue 540533004: Use style invalidation for more pseudo classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased Created 6 years, 3 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
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 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 } 832 }
833 833
834 void HTMLInputElement::setChecked(bool nowChecked, TextFieldEventBehavior eventB ehavior) 834 void HTMLInputElement::setChecked(bool nowChecked, TextFieldEventBehavior eventB ehavior)
835 { 835 {
836 if (checked() == nowChecked) 836 if (checked() == nowChecked)
837 return; 837 return;
838 838
839 RefPtrWillBeRawPtr<HTMLInputElement> protector(this); 839 RefPtrWillBeRawPtr<HTMLInputElement> protector(this);
840 m_reflectsCheckedAttribute = false; 840 m_reflectsCheckedAttribute = false;
841 m_isChecked = nowChecked; 841 m_isChecked = nowChecked;
842 setNeedsStyleRecalc(SubtreeStyleChange);
843 842
844 if (RadioButtonGroupScope* scope = radioButtonGroupScope()) 843 if (RadioButtonGroupScope* scope = radioButtonGroupScope())
845 scope->updateCheckedState(this); 844 scope->updateCheckedState(this);
846 if (renderer() && renderer()->style()->hasAppearance()) 845 if (renderer() && renderer()->style()->hasAppearance())
847 RenderTheme::theme().stateChanged(renderer(), CheckedControlState); 846 RenderTheme::theme().stateChanged(renderer(), CheckedControlState);
848 847
849 setNeedsValidityCheck(); 848 setNeedsValidityCheck();
850 849
851 // Ideally we'd do this from the render tree (matching 850 // Ideally we'd do this from the render tree (matching
852 // RenderTextView), but it's not possible to do it at the moment 851 // RenderTextView), but it's not possible to do it at the moment
853 // because of the way the code is structured. 852 // because of the way the code is structured.
854 if (renderer()) { 853 if (renderer()) {
855 if (AXObjectCache* cache = renderer()->document().existingAXObjectCache( )) 854 if (AXObjectCache* cache = renderer()->document().existingAXObjectCache( ))
856 cache->checkedStateChanged(this); 855 cache->checkedStateChanged(this);
857 } 856 }
858 857
859 // Only send a change event for items in the document (avoid firing during 858 // Only send a change event for items in the document (avoid firing during
860 // parsing) and don't send a change event for a radio button that's getting 859 // parsing) and don't send a change event for a radio button that's getting
861 // unchecked to match other browsers. DOM is not a useful standard for this 860 // unchecked to match other browsers. DOM is not a useful standard for this
862 // because it says only to fire change events at "lose focus" time, which is 861 // because it says only to fire change events at "lose focus" time, which is
863 // definitely wrong in practice for these types of elements. 862 // definitely wrong in practice for these types of elements.
864 if (eventBehavior != DispatchNoEvent && inDocument() && m_inputType->shouldS endChangeEventAfterCheckedChanged()) { 863 if (eventBehavior != DispatchNoEvent && inDocument() && m_inputType->shouldS endChangeEventAfterCheckedChanged()) {
865 setTextAsOfLastFormControlChangeEvent(String()); 864 setTextAsOfLastFormControlChangeEvent(String());
866 if (eventBehavior == DispatchInputAndChangeEvent) 865 if (eventBehavior == DispatchInputAndChangeEvent)
867 dispatchFormControlInputEvent(); 866 dispatchFormControlInputEvent();
868 dispatchFormControlChangeEvent(); 867 dispatchFormControlChangeEvent();
869 } 868 }
870 869
871 didAffectSelector(AffectedSelectorChecked); 870 pseudoStateChanged(CSSSelector::PseudoChecked);
872 } 871 }
873 872
874 void HTMLInputElement::setIndeterminate(bool newValue) 873 void HTMLInputElement::setIndeterminate(bool newValue)
875 { 874 {
876 if (indeterminate() == newValue) 875 if (indeterminate() == newValue)
877 return; 876 return;
878 877
879 m_isIndeterminate = newValue; 878 m_isIndeterminate = newValue;
880 879
881 didAffectSelector(AffectedSelectorIndeterminate); 880 pseudoStateChanged(CSSSelector::PseudoIndeterminate);
882 881
883 if (renderer() && renderer()->style()->hasAppearance()) 882 if (renderer() && renderer()->style()->hasAppearance())
884 RenderTheme::theme().stateChanged(renderer(), CheckedControlState); 883 RenderTheme::theme().stateChanged(renderer(), CheckedControlState);
885 } 884 }
886 885
887 int HTMLInputElement::size() const 886 int HTMLInputElement::size() const
888 { 887 {
889 return m_size; 888 return m_size;
890 } 889 }
891 890
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
1794 { 1793 {
1795 listAttributeTargetChanged(); 1794 listAttributeTargetChanged();
1796 } 1795 }
1797 1796
1798 AXObject* HTMLInputElement::popupRootAXObject() 1797 AXObject* HTMLInputElement::popupRootAXObject()
1799 { 1798 {
1800 return m_inputTypeView->popupRootAXObject(); 1799 return m_inputTypeView->popupRootAXObject();
1801 } 1800 }
1802 1801
1803 } // namespace 1802 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698