OLD | NEW |
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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 if (m_mode == ResolvingStyle) { | 723 if (m_mode == ResolvingStyle) { |
724 if (context.elementStyle) | 724 if (context.elementStyle) |
725 context.elementStyle->setAffectedByFocus(); | 725 context.elementStyle->setAffectedByFocus(); |
726 else | 726 else |
727 element.setChildrenAffectedByFocus(); | 727 element.setChildrenAffectedByFocus(); |
728 } | 728 } |
729 return matchesFocusPseudoClass(element); | 729 return matchesFocusPseudoClass(element); |
730 case CSSSelector::PseudoHover: | 730 case CSSSelector::PseudoHover: |
731 // If we're in quirks mode, then hover should never match anchors wi
th no | 731 // If we're in quirks mode, then hover should never match anchors wi
th no |
732 // href and *:hover should not match anything. This is important for
sites like wsj.com. | 732 // href and *:hover should not match anything. This is important for
sites like wsj.com. |
733 if (m_strictParsing || context.isSubSelector || (selector.m_match ==
CSSSelector::Tag && selector.tagQName() != anyQName() && !element.hasTagName(aT
ag)) || element.isLink()) { | 733 if (m_strictParsing || context.isSubSelector || (selector.m_match ==
CSSSelector::Tag && selector.tagQName() != anyQName() && !isHTMLAnchorElement(e
lement)) || element.isLink()) { |
734 if (m_mode == ResolvingStyle) { | 734 if (m_mode == ResolvingStyle) { |
735 if (context.elementStyle) | 735 if (context.elementStyle) |
736 context.elementStyle->setAffectedByHover(); | 736 context.elementStyle->setAffectedByHover(); |
737 else | 737 else |
738 element.setChildrenAffectedByHover(); | 738 element.setChildrenAffectedByHover(); |
739 } | 739 } |
740 if (element.hovered() || InspectorInstrumentation::forcePseudoSt
ate(&element, CSSSelector::PseudoHover)) | 740 if (element.hovered() || InspectorInstrumentation::forcePseudoSt
ate(&element, CSSSelector::PseudoHover)) |
741 return true; | 741 return true; |
742 } | 742 } |
743 break; | 743 break; |
744 case CSSSelector::PseudoActive: | 744 case CSSSelector::PseudoActive: |
745 // If we're in quirks mode, then :active should never match anchors
with no | 745 // If we're in quirks mode, then :active should never match anchors
with no |
746 // href and *:active should not match anything. | 746 // href and *:active should not match anything. |
747 if (m_strictParsing || context.isSubSelector || (selector.m_match ==
CSSSelector::Tag && selector.tagQName() != anyQName() && !element.hasTagName(aT
ag)) || element.isLink()) { | 747 if (m_strictParsing || context.isSubSelector || (selector.m_match ==
CSSSelector::Tag && selector.tagQName() != anyQName() && !isHTMLAnchorElement(e
lement)) || element.isLink()) { |
748 if (m_mode == ResolvingStyle) { | 748 if (m_mode == ResolvingStyle) { |
749 if (context.elementStyle) | 749 if (context.elementStyle) |
750 context.elementStyle->setAffectedByActive(); | 750 context.elementStyle->setAffectedByActive(); |
751 else | 751 else |
752 element.setChildrenAffectedByActive(); | 752 element.setChildrenAffectedByActive(); |
753 } | 753 } |
754 if (element.active() || InspectorInstrumentation::forcePseudoSta
te(&element, CSSSelector::PseudoActive)) | 754 if (element.active() || InspectorInstrumentation::forcePseudoSta
te(&element, CSSSelector::PseudoActive)) |
755 return true; | 755 return true; |
756 } | 756 } |
757 break; | 757 break; |
758 case CSSSelector::PseudoEnabled: | 758 case CSSSelector::PseudoEnabled: |
759 if (element.isFormControlElement() || element.hasTagName(optionTag)
|| element.hasTagName(optgroupTag)) | 759 if (element.isFormControlElement() || isHTMLOptionElement(element) |
| isHTMLOptGroupElement(element)) |
760 return !element.isDisabledFormControl(); | 760 return !element.isDisabledFormControl(); |
761 break; | 761 break; |
762 case CSSSelector::PseudoFullPageMedia: | 762 case CSSSelector::PseudoFullPageMedia: |
763 return element.document().isMediaDocument(); | 763 return element.document().isMediaDocument(); |
764 break; | 764 break; |
765 case CSSSelector::PseudoDefault: | 765 case CSSSelector::PseudoDefault: |
766 return element.isDefaultButtonForForm(); | 766 return element.isDefaultButtonForForm(); |
767 case CSSSelector::PseudoDisabled: | 767 case CSSSelector::PseudoDisabled: |
768 if (element.isFormControlElement() || element.hasTagName(optionTag)
|| element.hasTagName(optgroupTag)) | 768 if (element.isFormControlElement() || isHTMLOptionElement(element) |
| isHTMLOptGroupElement(element)) |
769 return element.isDisabledFormControl(); | 769 return element.isDisabledFormControl(); |
770 break; | 770 break; |
771 case CSSSelector::PseudoReadOnly: | 771 case CSSSelector::PseudoReadOnly: |
772 return element.matchesReadOnlyPseudoClass(); | 772 return element.matchesReadOnlyPseudoClass(); |
773 case CSSSelector::PseudoReadWrite: | 773 case CSSSelector::PseudoReadWrite: |
774 return element.matchesReadWritePseudoClass(); | 774 return element.matchesReadWritePseudoClass(); |
775 case CSSSelector::PseudoOptional: | 775 case CSSSelector::PseudoOptional: |
776 return element.isOptionalFormControl(); | 776 return element.isOptionalFormControl(); |
777 case CSSSelector::PseudoRequired: | 777 case CSSSelector::PseudoRequired: |
778 return element.isRequiredFormControl(); | 778 return element.isRequiredFormControl(); |
779 case CSSSelector::PseudoValid: | 779 case CSSSelector::PseudoValid: |
780 element.document().setContainsValidityStyleRules(); | 780 element.document().setContainsValidityStyleRules(); |
781 return element.willValidate() && element.isValidFormControlElement()
; | 781 return element.willValidate() && element.isValidFormControlElement()
; |
782 case CSSSelector::PseudoInvalid: | 782 case CSSSelector::PseudoInvalid: |
783 element.document().setContainsValidityStyleRules(); | 783 element.document().setContainsValidityStyleRules(); |
784 return element.willValidate() && !element.isValidFormControlElement(
); | 784 return element.willValidate() && !element.isValidFormControlElement(
); |
785 case CSSSelector::PseudoChecked: | 785 case CSSSelector::PseudoChecked: |
786 { | 786 { |
787 if (element.hasTagName(inputTag)) { | 787 if (isHTMLInputElement(element)) { |
788 HTMLInputElement& inputElement = toHTMLInputElement(element)
; | 788 HTMLInputElement& inputElement = toHTMLInputElement(element)
; |
789 // Even though WinIE allows checked and indeterminate to | 789 // Even though WinIE allows checked and indeterminate to |
790 // co-exist, the CSS selector spec says that you can't be | 790 // co-exist, the CSS selector spec says that you can't be |
791 // both checked and indeterminate. We will behave like WinIE | 791 // both checked and indeterminate. We will behave like WinIE |
792 // behind the scenes and just obey the CSS spec here in the | 792 // behind the scenes and just obey the CSS spec here in the |
793 // test for matching the pseudo. | 793 // test for matching the pseudo. |
794 if (inputElement.shouldAppearChecked() && !inputElement.shou
ldAppearIndeterminate()) | 794 if (inputElement.shouldAppearChecked() && !inputElement.shou
ldAppearIndeterminate()) |
795 return true; | 795 return true; |
796 } else if (element.hasTagName(optionTag) && toHTMLOptionElement(
element).selected()) | 796 } else if (isHTMLOptionElement(element) && toHTMLOptionElement(e
lement).selected()) |
797 return true; | 797 return true; |
798 break; | 798 break; |
799 } | 799 } |
800 case CSSSelector::PseudoIndeterminate: | 800 case CSSSelector::PseudoIndeterminate: |
801 return element.shouldAppearIndeterminate(); | 801 return element.shouldAppearIndeterminate(); |
802 case CSSSelector::PseudoRoot: | 802 case CSSSelector::PseudoRoot: |
803 if (element == element.document().documentElement()) | 803 if (element == element.document().documentElement()) |
804 return true; | 804 return true; |
805 break; | 805 break; |
806 case CSSSelector::PseudoLang: | 806 case CSSSelector::PseudoLang: |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 return element.focused() && isFrameFocused(element); | 1083 return element.focused() && isFrameFocused(element); |
1084 } | 1084 } |
1085 | 1085 |
1086 template | 1086 template |
1087 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst DOMSiblingTraversalStrategy&, MatchResult*) const; | 1087 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst DOMSiblingTraversalStrategy&, MatchResult*) const; |
1088 | 1088 |
1089 template | 1089 template |
1090 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst ShadowDOMSiblingTraversalStrategy&, MatchResult*) const; | 1090 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst ShadowDOMSiblingTraversalStrategy&, MatchResult*) const; |
1091 | 1091 |
1092 } | 1092 } |
OLD | NEW |