OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) |
3 * 1999 Waldo Bastian (bastian@kde.org) | 3 * 1999 Waldo Bastian (bastian@kde.org) |
4 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights | 4 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights |
5 * reserved. | 5 * reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
11 * | 11 * |
12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
16 * | 16 * |
17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
21 */ | 21 */ |
22 | 22 |
23 #ifndef CSSSelector_h | 23 #ifndef CSSSelector_h |
24 #define CSSSelector_h | 24 #define CSSSelector_h |
25 | 25 |
26 #include <memory> | 26 #include <memory> |
27 #include "core/CoreExport.h" | 27 #include "core/CoreExport.h" |
28 #include "core/css/parser/CSSParserContext.h" | |
29 #include "core/dom/QualifiedName.h" | 28 #include "core/dom/QualifiedName.h" |
30 #include "core/style/ComputedStyleConstants.h" | 29 #include "core/style/ComputedStyleConstants.h" |
31 #include "platform/wtf/RefCounted.h" | 30 #include "platform/wtf/RefCounted.h" |
32 | 31 |
33 namespace blink { | 32 namespace blink { |
34 class CSSSelectorList; | 33 class CSSSelectorList; |
35 | 34 |
36 // This class represents a selector for a StyleRule. | 35 // This class represents a selector for a StyleRule. |
37 | 36 |
38 // CSS selector representation is somewhat complicated and subtle. A | 37 // CSS selector representation is somewhat complicated and subtle. A |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 125 |
127 enum RelationType { | 126 enum RelationType { |
128 kSubSelector, // No combinator | 127 kSubSelector, // No combinator |
129 kDescendant, // "Space" combinator | 128 kDescendant, // "Space" combinator |
130 kChild, // > combinator | 129 kChild, // > combinator |
131 kDirectAdjacent, // + combinator | 130 kDirectAdjacent, // + combinator |
132 kIndirectAdjacent, // ~ combinator | 131 kIndirectAdjacent, // ~ combinator |
133 // Special cases for shadow DOM related selectors. | 132 // Special cases for shadow DOM related selectors. |
134 kShadowPiercingDescendant, // >>> combinator | 133 kShadowPiercingDescendant, // >>> combinator |
135 kShadowDeep, // /deep/ combinator | 134 kShadowDeep, // /deep/ combinator |
136 kShadowDeepAsDescendant, // /deep/ as an alias for descendant | |
137 kShadowPseudo, // ::shadow pseudo element | 135 kShadowPseudo, // ::shadow pseudo element |
138 kShadowSlot // ::slotted() pseudo element | 136 kShadowSlot // ::slotted() pseudo element |
139 }; | 137 }; |
140 | 138 |
141 enum PseudoType { | 139 enum PseudoType { |
142 kPseudoUnknown, | 140 kPseudoUnknown, |
143 kPseudoEmpty, | 141 kPseudoEmpty, |
144 kPseudoFirstChild, | 142 kPseudoFirstChild, |
145 kPseudoFirstOfType, | 143 kPseudoFirstOfType, |
146 kPseudoLastChild, | 144 kPseudoLastChild, |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 }; | 231 }; |
234 | 232 |
235 enum AttributeMatchType { | 233 enum AttributeMatchType { |
236 kCaseSensitive, | 234 kCaseSensitive, |
237 kCaseInsensitive, | 235 kCaseInsensitive, |
238 }; | 236 }; |
239 | 237 |
240 PseudoType GetPseudoType() const { | 238 PseudoType GetPseudoType() const { |
241 return static_cast<PseudoType>(pseudo_type_); | 239 return static_cast<PseudoType>(pseudo_type_); |
242 } | 240 } |
243 void UpdatePseudoType(const AtomicString&, | 241 void UpdatePseudoType(const AtomicString&, bool has_arguments); |
244 const CSSParserContext&, | |
245 bool has_arguments); | |
246 | 242 |
247 static PseudoType ParsePseudoType(const AtomicString&, bool has_arguments); | 243 static PseudoType ParsePseudoType(const AtomicString&, bool has_arguments); |
248 static PseudoId ParsePseudoId(const String&); | 244 static PseudoId ParsePseudoId(const String&); |
249 static PseudoId GetPseudoId(PseudoType); | 245 static PseudoId GetPseudoId(PseudoType); |
250 | 246 |
251 // Selectors are kept in an array by CSSSelectorList. The next component of | 247 // Selectors are kept in an array by CSSSelectorList. The next component of |
252 // the selector is the next item in the array. | 248 // the selector is the next item in the array. |
253 const CSSSelector* TagHistory() const { | 249 const CSSSelector* TagHistory() const { |
254 return is_last_in_tag_history_ ? 0 : const_cast<CSSSelector*>(this + 1); | 250 return is_last_in_tag_history_ ? 0 : const_cast<CSSSelector*>(this + 1); |
255 } | 251 } |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 } | 537 } |
542 | 538 |
543 inline bool CSSSelector::IsIdClassOrAttributeSelector() const { | 539 inline bool CSSSelector::IsIdClassOrAttributeSelector() const { |
544 return IsAttributeSelector() || Match() == CSSSelector::kId || | 540 return IsAttributeSelector() || Match() == CSSSelector::kId || |
545 Match() == CSSSelector::kClass; | 541 Match() == CSSSelector::kClass; |
546 } | 542 } |
547 | 543 |
548 } // namespace blink | 544 } // namespace blink |
549 | 545 |
550 #endif // CSSSelector_h | 546 #endif // CSSSelector_h |
OLD | NEW |