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
reserved. | 4 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights
reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 Descendant = 0, // "Space" combinator | 126 Descendant = 0, // "Space" combinator |
127 Child, // > combinator | 127 Child, // > combinator |
128 DirectAdjacent, // + combinator | 128 DirectAdjacent, // + combinator |
129 IndirectAdjacent, // ~ combinator | 129 IndirectAdjacent, // ~ combinator |
130 SubSelector, // "No space" combinator | 130 SubSelector, // "No space" combinator |
131 ShadowPseudo, // Special case of shadow DOM pseudo elements | 131 ShadowPseudo, // Special case of shadow DOM pseudo elements |
132 // FIXME: implement named combinator (i.e. named relation) and | 132 // FIXME: implement named combinator (i.e. named relation) and |
133 // replace the following /shadow/ and /shadow-deep/ with the impleme
ntation. | 133 // replace the following /shadow/ and /shadow-deep/ with the impleme
ntation. |
134 Shadow, // /shadow/ combinator | 134 Shadow, // /shadow/ combinator |
135 ShadowDeep, // /shadow-deep/ combinator | 135 ShadowDeep, // /shadow-deep/ combinator |
136 ShadowContent // /content/ for shadow styling | |
137 }; | 136 }; |
138 | 137 |
139 enum PseudoType { | 138 enum PseudoType { |
140 PseudoNotParsed = 0, | 139 PseudoNotParsed = 0, |
141 PseudoUnknown, | 140 PseudoUnknown, |
142 PseudoEmpty, | 141 PseudoEmpty, |
143 PseudoFirstChild, | 142 PseudoFirstChild, |
144 PseudoFirstOfType, | 143 PseudoFirstOfType, |
145 PseudoLastChild, | 144 PseudoLastChild, |
146 PseudoLastOfType, | 145 PseudoLastOfType, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 PseudoFullScreenAncestor, | 209 PseudoFullScreenAncestor, |
211 PseudoInRange, | 210 PseudoInRange, |
212 PseudoOutOfRange, | 211 PseudoOutOfRange, |
213 PseudoUserAgentCustomElement, | 212 PseudoUserAgentCustomElement, |
214 PseudoWebKitCustomElement, | 213 PseudoWebKitCustomElement, |
215 PseudoCue, | 214 PseudoCue, |
216 PseudoFutureCue, | 215 PseudoFutureCue, |
217 PseudoPastCue, | 216 PseudoPastCue, |
218 PseudoDistributed, | 217 PseudoDistributed, |
219 PseudoUnresolved, | 218 PseudoUnresolved, |
| 219 PseudoContent, |
220 PseudoHost, | 220 PseudoHost, |
221 PseudoAncestor | 221 PseudoAncestor |
222 }; | 222 }; |
223 | 223 |
224 enum OptionalPseudoTypeRequirements { | 224 enum OptionalPseudoTypeRequirements { |
225 // 0 is used to mean "no requirements". | 225 // 0 is used to mean "no requirements". |
226 RequiresShadowDOM = 1 | 226 RequiresShadowDOM = 1 |
227 }; | 227 }; |
228 | 228 |
229 enum MarginBoxType { | 229 enum MarginBoxType { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 bool parseNth() const; | 286 bool parseNth() const; |
287 bool matchNth(int count) const; | 287 bool matchNth(int count) const; |
288 | 288 |
289 bool matchesPseudoElement() const; | 289 bool matchesPseudoElement() const; |
290 bool isUnknownPseudoElement() const; | 290 bool isUnknownPseudoElement() const; |
291 bool isCustomPseudoElement() const; | 291 bool isCustomPseudoElement() const; |
292 bool isDirectAdjacentSelector() const { return m_relation == DirectAdjac
ent; } | 292 bool isDirectAdjacentSelector() const { return m_relation == DirectAdjac
ent; } |
293 bool isSiblingSelector() const; | 293 bool isSiblingSelector() const; |
294 bool isAttributeSelector() const; | 294 bool isAttributeSelector() const; |
295 bool isDistributedPseudoElement() const; | 295 bool isDistributedPseudoElement() const; |
| 296 bool isContentPseudoElement() const; |
296 bool isHostPseudoClass() const; | 297 bool isHostPseudoClass() const; |
297 | 298 |
298 // FIXME: selectors with no tagHistory() get a relation() of Descendant.
It should instead be | 299 // FIXME: selectors with no tagHistory() get a relation() of Descendant.
It should instead be |
299 // None. | 300 // None. |
300 Relation relation() const { return static_cast<Relation>(m_relation); } | 301 Relation relation() const { return static_cast<Relation>(m_relation); } |
301 | 302 |
302 bool isLastInSelectorList() const { return m_isLastInSelectorList; } | 303 bool isLastInSelectorList() const { return m_isLastInSelectorList; } |
303 void setLastInSelectorList() { m_isLastInSelectorList = true; } | 304 void setLastInSelectorList() { m_isLastInSelectorList = true; } |
304 bool isLastInTagHistory() const { return m_isLastInTagHistory; } | 305 bool isLastInTagHistory() const { return m_isLastInTagHistory; } |
305 void setNotLastInTagHistory() { m_isLastInTagHistory = false; } | 306 void setNotLastInTagHistory() { m_isLastInTagHistory = false; } |
306 | 307 |
307 // http://dev.w3.org/csswg/selectors4/#compound | 308 // http://dev.w3.org/csswg/selectors4/#compound |
308 bool isCompound() const; | 309 bool isCompound() const; |
309 | 310 |
310 bool isForPage() const { return m_isForPage; } | 311 bool isForPage() const { return m_isForPage; } |
311 void setForPage() { m_isForPage = true; } | 312 void setForPage() { m_isForPage = true; } |
312 | 313 |
313 bool relationIsAffectedByPseudoContent() const { return m_relationIsAffe
ctedByPseudoContent; } | 314 bool relationIsAffectedByPseudoContent() const { return m_relationIsAffe
ctedByPseudoContent; } |
314 void setRelationIsAffectedByPseudoContent() { m_relationIsAffectedByPseu
doContent = true; } | 315 void setRelationIsAffectedByPseudoContent() { m_relationIsAffectedByPseu
doContent = true; } |
315 | 316 |
316 unsigned m_relation : 4; // enum Relation | 317 unsigned m_relation : 3; // enum Relation |
317 mutable unsigned m_match : 4; // enum Match | 318 mutable unsigned m_match : 4; // enum Match |
318 mutable unsigned m_pseudoType : 8; // PseudoType | 319 mutable unsigned m_pseudoType : 8; // PseudoType |
319 | 320 |
320 private: | 321 private: |
321 mutable unsigned m_parsedNth : 1; // Used for :nth-* | 322 mutable unsigned m_parsedNth : 1; // Used for :nth-* |
322 unsigned m_isLastInSelectorList : 1; | 323 unsigned m_isLastInSelectorList : 1; |
323 unsigned m_isLastInTagHistory : 1; | 324 unsigned m_isLastInTagHistory : 1; |
324 unsigned m_hasRareData : 1; | 325 unsigned m_hasRareData : 1; |
325 unsigned m_isForPage : 1; | 326 unsigned m_isForPage : 1; |
326 unsigned m_tagIsForNamespaceRule : 1; | 327 unsigned m_tagIsForNamespaceRule : 1; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 || m_match == CSSSelector::Contain | 417 || m_match == CSSSelector::Contain |
417 || m_match == CSSSelector::Begin | 418 || m_match == CSSSelector::Begin |
418 || m_match == CSSSelector::End; | 419 || m_match == CSSSelector::End; |
419 } | 420 } |
420 | 421 |
421 inline bool CSSSelector::isDistributedPseudoElement() const | 422 inline bool CSSSelector::isDistributedPseudoElement() const |
422 { | 423 { |
423 return m_match == PseudoElement && pseudoType() == PseudoDistributed; | 424 return m_match == PseudoElement && pseudoType() == PseudoDistributed; |
424 } | 425 } |
425 | 426 |
| 427 inline bool CSSSelector::isContentPseudoElement() const |
| 428 { |
| 429 return m_match == PseudoElement && pseudoType() == PseudoContent; |
| 430 } |
| 431 |
426 inline void CSSSelector::setValue(const AtomicString& value) | 432 inline void CSSSelector::setValue(const AtomicString& value) |
427 { | 433 { |
428 ASSERT(m_match != Tag); | 434 ASSERT(m_match != Tag); |
429 ASSERT(m_pseudoType == PseudoNotParsed); | 435 ASSERT(m_pseudoType == PseudoNotParsed); |
430 // Need to do ref counting manually for the union. | 436 // Need to do ref counting manually for the union. |
431 if (m_hasRareData) { | 437 if (m_hasRareData) { |
432 m_data.m_rareData->m_value = value; | 438 m_data.m_rareData->m_value = value; |
433 return; | 439 return; |
434 } | 440 } |
435 if (m_data.m_value) | 441 if (m_data.m_value) |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 if (m_hasRareData) | 520 if (m_hasRareData) |
515 return m_data.m_rareData->m_value; | 521 return m_data.m_rareData->m_value; |
516 // AtomicString is really just a StringImpl* so the cast below is safe. | 522 // AtomicString is really just a StringImpl* so the cast below is safe. |
517 // FIXME: Perhaps call sites could be changed to accept StringImpl? | 523 // FIXME: Perhaps call sites could be changed to accept StringImpl? |
518 return *reinterpret_cast<const AtomicString*>(&m_data.m_value); | 524 return *reinterpret_cast<const AtomicString*>(&m_data.m_value); |
519 } | 525 } |
520 | 526 |
521 } // namespace WebCore | 527 } // namespace WebCore |
522 | 528 |
523 #endif // CSSSelector_h | 529 #endif // CSSSelector_h |
OLD | NEW |