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" |
28 #include "core/dom/QualifiedName.h" | 29 #include "core/dom/QualifiedName.h" |
29 #include "core/style/ComputedStyleConstants.h" | 30 #include "core/style/ComputedStyleConstants.h" |
30 #include "platform/wtf/RefCounted.h" | 31 #include "platform/wtf/RefCounted.h" |
31 | 32 |
32 namespace blink { | 33 namespace blink { |
33 class CSSSelectorList; | 34 class CSSSelectorList; |
34 | 35 |
35 // This class represents a selector for a StyleRule. | 36 // This class represents a selector for a StyleRule. |
36 | 37 |
37 // CSS selector representation is somewhat complicated and subtle. A | 38 // CSS selector representation is somewhat complicated and subtle. A |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 126 |
126 enum RelationType { | 127 enum RelationType { |
127 kSubSelector, // No combinator | 128 kSubSelector, // No combinator |
128 kDescendant, // "Space" combinator | 129 kDescendant, // "Space" combinator |
129 kChild, // > combinator | 130 kChild, // > combinator |
130 kDirectAdjacent, // + combinator | 131 kDirectAdjacent, // + combinator |
131 kIndirectAdjacent, // ~ combinator | 132 kIndirectAdjacent, // ~ combinator |
132 // Special cases for shadow DOM related selectors. | 133 // Special cases for shadow DOM related selectors. |
133 kShadowPiercingDescendant, // >>> combinator | 134 kShadowPiercingDescendant, // >>> combinator |
134 kShadowDeep, // /deep/ combinator | 135 kShadowDeep, // /deep/ combinator |
| 136 kShadowDeepAsDescendant, // /deep/ as an alias for descendant |
135 kShadowPseudo, // ::shadow pseudo element | 137 kShadowPseudo, // ::shadow pseudo element |
136 kShadowSlot // ::slotted() pseudo element | 138 kShadowSlot // ::slotted() pseudo element |
137 }; | 139 }; |
138 | 140 |
139 enum PseudoType { | 141 enum PseudoType { |
140 kPseudoUnknown, | 142 kPseudoUnknown, |
141 kPseudoEmpty, | 143 kPseudoEmpty, |
142 kPseudoFirstChild, | 144 kPseudoFirstChild, |
143 kPseudoFirstOfType, | 145 kPseudoFirstOfType, |
144 kPseudoLastChild, | 146 kPseudoLastChild, |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 }; | 233 }; |
232 | 234 |
233 enum AttributeMatchType { | 235 enum AttributeMatchType { |
234 kCaseSensitive, | 236 kCaseSensitive, |
235 kCaseInsensitive, | 237 kCaseInsensitive, |
236 }; | 238 }; |
237 | 239 |
238 PseudoType GetPseudoType() const { | 240 PseudoType GetPseudoType() const { |
239 return static_cast<PseudoType>(pseudo_type_); | 241 return static_cast<PseudoType>(pseudo_type_); |
240 } | 242 } |
241 void UpdatePseudoType(const AtomicString&, bool has_arguments); | 243 void UpdatePseudoType(const AtomicString&, |
| 244 const CSSParserContext&, |
| 245 bool has_arguments); |
242 | 246 |
243 static PseudoType ParsePseudoType(const AtomicString&, bool has_arguments); | 247 static PseudoType ParsePseudoType(const AtomicString&, bool has_arguments); |
244 static PseudoId ParsePseudoId(const String&); | 248 static PseudoId ParsePseudoId(const String&); |
245 static PseudoId GetPseudoId(PseudoType); | 249 static PseudoId GetPseudoId(PseudoType); |
246 | 250 |
247 // Selectors are kept in an array by CSSSelectorList. The next component of | 251 // Selectors are kept in an array by CSSSelectorList. The next component of |
248 // the selector is the next item in the array. | 252 // the selector is the next item in the array. |
249 const CSSSelector* TagHistory() const { | 253 const CSSSelector* TagHistory() const { |
250 return is_last_in_tag_history_ ? 0 : const_cast<CSSSelector*>(this + 1); | 254 return is_last_in_tag_history_ ? 0 : const_cast<CSSSelector*>(this + 1); |
251 } | 255 } |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 } | 541 } |
538 | 542 |
539 inline bool CSSSelector::IsIdClassOrAttributeSelector() const { | 543 inline bool CSSSelector::IsIdClassOrAttributeSelector() const { |
540 return IsAttributeSelector() || Match() == CSSSelector::kId || | 544 return IsAttributeSelector() || Match() == CSSSelector::kId || |
541 Match() == CSSSelector::kClass; | 545 Match() == CSSSelector::kClass; |
542 } | 546 } |
543 | 547 |
544 } // namespace blink | 548 } // namespace blink |
545 | 549 |
546 #endif // CSSSelector_h | 550 #endif // CSSSelector_h |
OLD | NEW |