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

Side by Side Diff: Source/core/css/SelectorChecker.cpp

Issue 616443002: Implement :valid and :invalid pseudoclass for <form> (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add layout tests, apply feedback from Keishi, add support for removing/inserting elements into the … Created 6 years, 2 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) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 case CSSSelector::PseudoReadOnly: 800 case CSSSelector::PseudoReadOnly:
801 return element.matchesReadOnlyPseudoClass(); 801 return element.matchesReadOnlyPseudoClass();
802 case CSSSelector::PseudoReadWrite: 802 case CSSSelector::PseudoReadWrite:
803 return element.matchesReadWritePseudoClass(); 803 return element.matchesReadWritePseudoClass();
804 case CSSSelector::PseudoOptional: 804 case CSSSelector::PseudoOptional:
805 return element.isOptionalFormControl(); 805 return element.isOptionalFormControl();
806 case CSSSelector::PseudoRequired: 806 case CSSSelector::PseudoRequired:
807 return element.isRequiredFormControl(); 807 return element.isRequiredFormControl();
808 case CSSSelector::PseudoValid: 808 case CSSSelector::PseudoValid:
809 element.document().setContainsValidityStyleRules(); 809 element.document().setContainsValidityStyleRules();
810 return element.willValidate() && element.isValidFormControlElement() ; 810 return element.willValidate() && element.isValidElement();
811 case CSSSelector::PseudoInvalid: 811 case CSSSelector::PseudoInvalid:
812 element.document().setContainsValidityStyleRules(); 812 element.document().setContainsValidityStyleRules();
813 return element.willValidate() && !element.isValidFormControlElement( ); 813 return element.willValidate() && !element.isValidElement();
814 case CSSSelector::PseudoChecked: 814 case CSSSelector::PseudoChecked:
815 { 815 {
816 if (isHTMLInputElement(element)) { 816 if (isHTMLInputElement(element)) {
817 HTMLInputElement& inputElement = toHTMLInputElement(element) ; 817 HTMLInputElement& inputElement = toHTMLInputElement(element) ;
818 // Even though WinIE allows checked and indeterminate to 818 // Even though WinIE allows checked and indeterminate to
819 // co-exist, the CSS selector spec says that you can't be 819 // co-exist, the CSS selector spec says that you can't be
820 // both checked and indeterminate. We will behave like WinIE 820 // both checked and indeterminate. We will behave like WinIE
821 // behind the scenes and just obey the CSS spec here in the 821 // behind the scenes and just obey the CSS spec here in the
822 // test for matching the pseudo. 822 // test for matching the pseudo.
823 if (inputElement.shouldAppearChecked() && !inputElement.shou ldAppearIndeterminate()) 823 if (inputElement.shouldAppearChecked() && !inputElement.shou ldAppearIndeterminate())
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 return isHTMLSelectElement(element) && !toHTMLSelectElement(element).usesMen uList(); 1130 return isHTMLSelectElement(element) && !toHTMLSelectElement(element).usesMen uList();
1131 } 1131 }
1132 1132
1133 template 1133 template
1134 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co nst DOMSiblingTraversalStrategy&, MatchResult*) const; 1134 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co nst DOMSiblingTraversalStrategy&, MatchResult*) const;
1135 1135
1136 template 1136 template
1137 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co nst ShadowDOMSiblingTraversalStrategy&, MatchResult*) const; 1137 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co nst ShadowDOMSiblingTraversalStrategy&, MatchResult*) const;
1138 1138
1139 } 1139 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698