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

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

Issue 2797253005: Revert of [instrumentation] Turn inspector override "probes" return values into output parameters. (Closed)
Patch Set: Created 3 years, 8 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. 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
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;
731 730
732 if (context.hasScrollbarPseudo) { 731 if (context.hasScrollbarPseudo) {
733 // CSS scrollbars match a specific subset of pseudo classes, and they have 732 // CSS scrollbars match a specific subset of pseudo classes, and they have
734 // specialized rules for each 733 // specialized rules for each
735 // (since there are no elements involved). 734 // (since there are no elements involved).
736 return checkScrollbarPseudoClass(context, result); 735 return checkScrollbarPseudoClass(context, result);
737 } 736 }
738 737
739 switch (selector.getPseudoType()) { 738 switch (selector.getPseudoType()) {
740 case CSSSelector::PseudoNot: 739 case CSSSelector::PseudoNot:
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 if (m_mode == ResolvingStyle) { 914 if (m_mode == ResolvingStyle) {
916 if (context.inRightmostCompound) { 915 if (context.inRightmostCompound) {
917 m_elementStyle->setAffectedByHover(); 916 m_elementStyle->setAffectedByHover();
918 } else { 917 } else {
919 m_elementStyle->setUnique(); 918 m_elementStyle->setUnique();
920 element.setChildrenOrSiblingsAffectedByHover(); 919 element.setChildrenOrSiblingsAffectedByHover();
921 } 920 }
922 } 921 }
923 if (!shouldMatchHoverOrActive(context)) 922 if (!shouldMatchHoverOrActive(context))
924 return false; 923 return false;
925 probe::forcePseudoState(&element, CSSSelector::PseudoHover, 924 if (probe::forcePseudoState(&element, CSSSelector::PseudoHover))
926 &forcePseudoState);
927 if (forcePseudoState)
928 return true; 925 return true;
929 return element.isHovered(); 926 return element.isHovered();
930 case CSSSelector::PseudoActive: 927 case CSSSelector::PseudoActive:
931 if (m_mode == SharingRules) 928 if (m_mode == SharingRules)
932 return true; 929 return true;
933 if (m_mode == ResolvingStyle) { 930 if (m_mode == ResolvingStyle) {
934 if (context.inRightmostCompound) { 931 if (context.inRightmostCompound) {
935 m_elementStyle->setAffectedByActive(); 932 m_elementStyle->setAffectedByActive();
936 } else { 933 } else {
937 m_elementStyle->setUnique(); 934 m_elementStyle->setUnique();
938 element.setChildrenOrSiblingsAffectedByActive(); 935 element.setChildrenOrSiblingsAffectedByActive();
939 } 936 }
940 } 937 }
941 if (!shouldMatchHoverOrActive(context)) 938 if (!shouldMatchHoverOrActive(context))
942 return false; 939 return false;
943 probe::forcePseudoState(&element, CSSSelector::PseudoActive, 940 if (probe::forcePseudoState(&element, CSSSelector::PseudoActive))
944 &forcePseudoState);
945 if (forcePseudoState)
946 return true; 941 return true;
947 return element.isActive(); 942 return element.isActive();
948 case CSSSelector::PseudoEnabled: 943 case CSSSelector::PseudoEnabled:
949 return element.matchesEnabledPseudoClass(); 944 return element.matchesEnabledPseudoClass();
950 case CSSSelector::PseudoFullPageMedia: 945 case CSSSelector::PseudoFullPageMedia:
951 return element.document().isMediaDocument(); 946 return element.document().isMediaDocument();
952 case CSSSelector::PseudoDefault: 947 case CSSSelector::PseudoDefault:
953 return element.matchesDefaultPseudoClass(); 948 return element.matchesDefaultPseudoClass();
954 case CSSSelector::PseudoDisabled: 949 case CSSSelector::PseudoDisabled:
955 return element.isDisabledFormControl(); 950 return element.isDisabledFormControl();
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 } 1312 }
1318 case CSSSelector::PseudoCornerPresent: 1313 case CSSSelector::PseudoCornerPresent:
1319 return m_scrollbar->getScrollableArea() && 1314 return m_scrollbar->getScrollableArea() &&
1320 m_scrollbar->getScrollableArea()->isScrollCornerVisible(); 1315 m_scrollbar->getScrollableArea()->isScrollCornerVisible();
1321 default: 1316 default:
1322 return false; 1317 return false;
1323 } 1318 }
1324 } 1319 }
1325 1320
1326 bool SelectorChecker::matchesFocusPseudoClass(const Element& element) { 1321 bool SelectorChecker::matchesFocusPseudoClass(const Element& element) {
1327 bool forcePseudoState = false; 1322 if (probe::forcePseudoState(const_cast<Element*>(&element),
1328 probe::forcePseudoState(const_cast<Element*>(&element), 1323 CSSSelector::PseudoFocus))
1329 CSSSelector::PseudoFocus, &forcePseudoState);
1330 if (forcePseudoState)
1331 return true; 1324 return true;
1332 return element.isFocused() && isFrameFocused(element); 1325 return element.isFocused() && isFrameFocused(element);
1333 } 1326 }
1334 1327
1335 } // namespace blink 1328 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698