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

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

Issue 1496533003: Implement a simple version of SelectorQuery. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert change to SelectorFilter.h Created 5 years 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 struct MatchResult { 92 struct MatchResult {
93 STACK_ALLOCATED(); 93 STACK_ALLOCATED();
94 MatchResult() 94 MatchResult()
95 : dynamicPseudo(NOPSEUDO) 95 : dynamicPseudo(NOPSEUDO)
96 , specificity(0) { } 96 , specificity(0) { }
97 97
98 PseudoId dynamicPseudo; 98 PseudoId dynamicPseudo;
99 unsigned specificity; 99 unsigned specificity;
100 }; 100 };
101 101
102 bool match(const SelectorCheckingContext&, MatchResult&) const; 102 bool match(const SelectorCheckingContext& context, MatchResult& result) cons t
103 bool match(const SelectorCheckingContext&) const; 103 {
104 ASSERT(context.selector);
105 return matchSelector(context, result) == SelectorMatches;
106 }
107
108 bool match(const SelectorCheckingContext& context) const
109 {
110 MatchResult ignoreResult;
111 return match(context, ignoreResult);
112 }
104 113
105 static bool matchesFocusPseudoClass(const Element&); 114 static bool matchesFocusPseudoClass(const Element&);
106 115
107 private: 116 private:
108 bool checkOne(const SelectorCheckingContext&, MatchResult&) const; 117 bool checkOne(const SelectorCheckingContext&, MatchResult&) const;
109 118
110 enum Match { SelectorMatches, SelectorFailsLocally, SelectorFailsAllSiblings , SelectorFailsCompletely }; 119 enum Match { SelectorMatches, SelectorFailsLocally, SelectorFailsAllSiblings , SelectorFailsCompletely };
111 120
112 Match matchSelector(const SelectorCheckingContext&, MatchResult&) const; 121 Match matchSelector(const SelectorCheckingContext&, MatchResult&) const;
113 Match matchForSubSelector(const SelectorCheckingContext&, MatchResult&) cons t; 122 Match matchForSubSelector(const SelectorCheckingContext&, MatchResult&) cons t;
114 Match matchForRelation(const SelectorCheckingContext&, MatchResult&) const; 123 Match matchForRelation(const SelectorCheckingContext&, MatchResult&) const;
115 Match matchForShadowDistributed(const SelectorCheckingContext&, const Elemen t&, MatchResult&) const; 124 Match matchForShadowDistributed(const SelectorCheckingContext&, const Elemen t&, MatchResult&) const;
116 Match matchForPseudoShadow(const SelectorCheckingContext&, const ContainerNo de*, MatchResult&) const; 125 Match matchForPseudoShadow(const SelectorCheckingContext&, const ContainerNo de*, MatchResult&) const;
117 bool checkPseudoClass(const SelectorCheckingContext&, MatchResult&) const; 126 bool checkPseudoClass(const SelectorCheckingContext&, MatchResult&) const;
118 bool checkPseudoElement(const SelectorCheckingContext&, MatchResult&) const; 127 bool checkPseudoElement(const SelectorCheckingContext&, MatchResult&) const;
119 bool checkScrollbarPseudoClass(const SelectorCheckingContext&, MatchResult&) const; 128 bool checkScrollbarPseudoClass(const SelectorCheckingContext&, MatchResult&) const;
120 bool checkPseudoHost(const SelectorCheckingContext&, MatchResult&) const; 129 bool checkPseudoHost(const SelectorCheckingContext&, MatchResult&) const;
121 bool checkPseudoNot(const SelectorCheckingContext&, MatchResult&) const; 130 bool checkPseudoNot(const SelectorCheckingContext&, MatchResult&) const;
122 131
123 Mode m_mode; 132 Mode m_mode;
124 }; 133 };
125 134
126 } 135 }
127 136
128 #endif 137 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/core.gypi ('k') | third_party/WebKit/Source/core/css/SelectorChecker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698