| 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. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. |
| 6 * All rights reserved. | 6 * All rights reserved. |
| 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
| 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 10 * (http://www.torchmobile.com/) | 10 * (http://www.torchmobile.com/) |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 if (!checkOne(subContext, result)) | 720 if (!checkOne(subContext, result)) |
| 721 return true; | 721 return true; |
| 722 } | 722 } |
| 723 return false; | 723 return false; |
| 724 } | 724 } |
| 725 | 725 |
| 726 bool SelectorChecker::checkPseudoClass(const SelectorCheckingContext& context, | 726 bool SelectorChecker::checkPseudoClass(const SelectorCheckingContext& context, |
| 727 MatchResult& result) const { | 727 MatchResult& result) const { |
| 728 Element& element = *context.element; | 728 Element& element = *context.element; |
| 729 const CSSSelector& selector = *context.selector; | 729 const CSSSelector& selector = *context.selector; |
| 730 bool forcePseudoState = false; |
| 730 | 731 |
| 731 if (context.hasScrollbarPseudo) { | 732 if (context.hasScrollbarPseudo) { |
| 732 // CSS scrollbars match a specific subset of pseudo classes, and they have | 733 // CSS scrollbars match a specific subset of pseudo classes, and they have |
| 733 // specialized rules for each | 734 // specialized rules for each |
| 734 // (since there are no elements involved). | 735 // (since there are no elements involved). |
| 735 return checkScrollbarPseudoClass(context, result); | 736 return checkScrollbarPseudoClass(context, result); |
| 736 } | 737 } |
| 737 | 738 |
| 738 switch (selector.getPseudoType()) { | 739 switch (selector.getPseudoType()) { |
| 739 case CSSSelector::PseudoNot: | 740 case CSSSelector::PseudoNot: |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 if (m_mode == ResolvingStyle) { | 915 if (m_mode == ResolvingStyle) { |
| 915 if (context.inRightmostCompound) { | 916 if (context.inRightmostCompound) { |
| 916 m_elementStyle->setAffectedByHover(); | 917 m_elementStyle->setAffectedByHover(); |
| 917 } else { | 918 } else { |
| 918 m_elementStyle->setUnique(); | 919 m_elementStyle->setUnique(); |
| 919 element.setChildrenOrSiblingsAffectedByHover(); | 920 element.setChildrenOrSiblingsAffectedByHover(); |
| 920 } | 921 } |
| 921 } | 922 } |
| 922 if (!shouldMatchHoverOrActive(context)) | 923 if (!shouldMatchHoverOrActive(context)) |
| 923 return false; | 924 return false; |
| 924 if (probe::forcePseudoState(&element, CSSSelector::PseudoHover)) | 925 probe::forcePseudoState(&element, CSSSelector::PseudoHover, |
| 926 &forcePseudoState); |
| 927 if (forcePseudoState) |
| 925 return true; | 928 return true; |
| 926 return element.isHovered(); | 929 return element.isHovered(); |
| 927 case CSSSelector::PseudoActive: | 930 case CSSSelector::PseudoActive: |
| 928 if (m_mode == SharingRules) | 931 if (m_mode == SharingRules) |
| 929 return true; | 932 return true; |
| 930 if (m_mode == ResolvingStyle) { | 933 if (m_mode == ResolvingStyle) { |
| 931 if (context.inRightmostCompound) { | 934 if (context.inRightmostCompound) { |
| 932 m_elementStyle->setAffectedByActive(); | 935 m_elementStyle->setAffectedByActive(); |
| 933 } else { | 936 } else { |
| 934 m_elementStyle->setUnique(); | 937 m_elementStyle->setUnique(); |
| 935 element.setChildrenOrSiblingsAffectedByActive(); | 938 element.setChildrenOrSiblingsAffectedByActive(); |
| 936 } | 939 } |
| 937 } | 940 } |
| 938 if (!shouldMatchHoverOrActive(context)) | 941 if (!shouldMatchHoverOrActive(context)) |
| 939 return false; | 942 return false; |
| 940 if (probe::forcePseudoState(&element, CSSSelector::PseudoActive)) | 943 probe::forcePseudoState(&element, CSSSelector::PseudoActive, |
| 944 &forcePseudoState); |
| 945 if (forcePseudoState) |
| 941 return true; | 946 return true; |
| 942 return element.isActive(); | 947 return element.isActive(); |
| 943 case CSSSelector::PseudoEnabled: | 948 case CSSSelector::PseudoEnabled: |
| 944 return element.matchesEnabledPseudoClass(); | 949 return element.matchesEnabledPseudoClass(); |
| 945 case CSSSelector::PseudoFullPageMedia: | 950 case CSSSelector::PseudoFullPageMedia: |
| 946 return element.document().isMediaDocument(); | 951 return element.document().isMediaDocument(); |
| 947 case CSSSelector::PseudoDefault: | 952 case CSSSelector::PseudoDefault: |
| 948 return element.matchesDefaultPseudoClass(); | 953 return element.matchesDefaultPseudoClass(); |
| 949 case CSSSelector::PseudoDisabled: | 954 case CSSSelector::PseudoDisabled: |
| 950 return element.isDisabledFormControl(); | 955 return element.isDisabledFormControl(); |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1312 } | 1317 } |
| 1313 case CSSSelector::PseudoCornerPresent: | 1318 case CSSSelector::PseudoCornerPresent: |
| 1314 return m_scrollbar->getScrollableArea() && | 1319 return m_scrollbar->getScrollableArea() && |
| 1315 m_scrollbar->getScrollableArea()->isScrollCornerVisible(); | 1320 m_scrollbar->getScrollableArea()->isScrollCornerVisible(); |
| 1316 default: | 1321 default: |
| 1317 return false; | 1322 return false; |
| 1318 } | 1323 } |
| 1319 } | 1324 } |
| 1320 | 1325 |
| 1321 bool SelectorChecker::matchesFocusPseudoClass(const Element& element) { | 1326 bool SelectorChecker::matchesFocusPseudoClass(const Element& element) { |
| 1322 if (probe::forcePseudoState(const_cast<Element*>(&element), | 1327 bool forcePseudoState = false; |
| 1323 CSSSelector::PseudoFocus)) | 1328 probe::forcePseudoState(const_cast<Element*>(&element), |
| 1329 CSSSelector::PseudoFocus, &forcePseudoState); |
| 1330 if (forcePseudoState) |
| 1324 return true; | 1331 return true; |
| 1325 return element.isFocused() && isFrameFocused(element); | 1332 return element.isFocused() && isFrameFocused(element); |
| 1326 } | 1333 } |
| 1327 | 1334 |
| 1328 } // namespace blink | 1335 } // namespace blink |
| OLD | NEW |