Chromium Code Reviews| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 End, // css3: E[foo$="bar"] | 121 End, // css3: E[foo$="bar"] |
| 122 PagePseudoClass // ?? | 122 PagePseudoClass // ?? |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 enum Relation { | 125 enum Relation { |
| 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 / shadow pseudo element |
|
dglazkov
2014/03/25 17:10:53
This needs to be renamed to CustomPseudoElement or
tasak
2014/03/26 11:01:46
The actual shadow pseudo uses this relation, becau
| |
| 132 // FIXME: implement named combinator (i.e. named relation) and | 132 ShadowDeep // /shadow-deep/ combinator |
| 133 // replace the following /shadow/ and /shadow-deep/ with the impleme ntation. | |
| 134 Shadow, // /shadow/ combinator | |
| 135 ShadowDeep, // /shadow-deep/ combinator | |
| 136 }; | 133 }; |
| 137 | 134 |
| 138 enum PseudoType { | 135 enum PseudoType { |
| 139 PseudoNotParsed = 0, | 136 PseudoNotParsed = 0, |
| 140 PseudoUnknown, | 137 PseudoUnknown, |
| 141 PseudoEmpty, | 138 PseudoEmpty, |
| 142 PseudoFirstChild, | 139 PseudoFirstChild, |
| 143 PseudoFirstOfType, | 140 PseudoFirstOfType, |
| 144 PseudoLastChild, | 141 PseudoLastChild, |
| 145 PseudoLastOfType, | 142 PseudoLastOfType, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 PseudoOutOfRange, | 208 PseudoOutOfRange, |
| 212 PseudoUserAgentCustomElement, | 209 PseudoUserAgentCustomElement, |
| 213 PseudoWebKitCustomElement, | 210 PseudoWebKitCustomElement, |
| 214 PseudoCue, | 211 PseudoCue, |
| 215 PseudoFutureCue, | 212 PseudoFutureCue, |
| 216 PseudoPastCue, | 213 PseudoPastCue, |
| 217 PseudoDistributed, | 214 PseudoDistributed, |
| 218 PseudoUnresolved, | 215 PseudoUnresolved, |
| 219 PseudoContent, | 216 PseudoContent, |
| 220 PseudoHost, | 217 PseudoHost, |
| 221 PseudoAncestor | 218 PseudoAncestor, |
| 219 PseudoShadow | |
| 222 }; | 220 }; |
| 223 | 221 |
| 224 enum OptionalPseudoTypeRequirements { | 222 enum OptionalPseudoTypeRequirements { |
| 225 // 0 is used to mean "no requirements". | 223 // 0 is used to mean "no requirements". |
| 226 RequiresShadowDOM = 1 | 224 RequiresShadowDOM = 1 |
| 227 }; | 225 }; |
| 228 | 226 |
| 229 enum MarginBoxType { | 227 enum MarginBoxType { |
| 230 TopLeftCornerMarginBox, | 228 TopLeftCornerMarginBox, |
| 231 TopLeftMarginBox, | 229 TopLeftMarginBox, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 bool matchNth(int count) const; | 285 bool matchNth(int count) const; |
| 288 | 286 |
| 289 bool matchesPseudoElement() const; | 287 bool matchesPseudoElement() const; |
| 290 bool isUnknownPseudoElement() const; | 288 bool isUnknownPseudoElement() const; |
| 291 bool isCustomPseudoElement() const; | 289 bool isCustomPseudoElement() const; |
| 292 bool isDirectAdjacentSelector() const { return m_relation == DirectAdjac ent; } | 290 bool isDirectAdjacentSelector() const { return m_relation == DirectAdjac ent; } |
| 293 bool isSiblingSelector() const; | 291 bool isSiblingSelector() const; |
| 294 bool isAttributeSelector() const; | 292 bool isAttributeSelector() const; |
| 295 bool isDistributedPseudoElement() const; | 293 bool isDistributedPseudoElement() const; |
| 296 bool isContentPseudoElement() const; | 294 bool isContentPseudoElement() const; |
| 295 bool isShadowPseudoElement() const; | |
| 297 bool isHostPseudoClass() const; | 296 bool isHostPseudoClass() const; |
| 298 | 297 |
| 299 // FIXME: selectors with no tagHistory() get a relation() of Descendant. It should instead be | 298 // FIXME: selectors with no tagHistory() get a relation() of Descendant. It should instead be |
| 300 // None. | 299 // None. |
| 301 Relation relation() const { return static_cast<Relation>(m_relation); } | 300 Relation relation() const { return static_cast<Relation>(m_relation); } |
| 302 | 301 |
| 303 bool isLastInSelectorList() const { return m_isLastInSelectorList; } | 302 bool isLastInSelectorList() const { return m_isLastInSelectorList; } |
| 304 void setLastInSelectorList() { m_isLastInSelectorList = true; } | 303 void setLastInSelectorList() { m_isLastInSelectorList = true; } |
| 305 bool isLastInTagHistory() const { return m_isLastInTagHistory; } | 304 bool isLastInTagHistory() const { return m_isLastInTagHistory; } |
| 306 void setNotLastInTagHistory() { m_isLastInTagHistory = false; } | 305 void setNotLastInTagHistory() { m_isLastInTagHistory = false; } |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 422 inline bool CSSSelector::isDistributedPseudoElement() const | 421 inline bool CSSSelector::isDistributedPseudoElement() const |
| 423 { | 422 { |
| 424 return m_match == PseudoElement && pseudoType() == PseudoDistributed; | 423 return m_match == PseudoElement && pseudoType() == PseudoDistributed; |
| 425 } | 424 } |
| 426 | 425 |
| 427 inline bool CSSSelector::isContentPseudoElement() const | 426 inline bool CSSSelector::isContentPseudoElement() const |
| 428 { | 427 { |
| 429 return m_match == PseudoElement && pseudoType() == PseudoContent; | 428 return m_match == PseudoElement && pseudoType() == PseudoContent; |
| 430 } | 429 } |
| 431 | 430 |
| 431 inline bool CSSSelector::isShadowPseudoElement() const | |
| 432 { | |
| 433 return m_match == PseudoElement && pseudoType() == PseudoShadow; | |
| 434 } | |
| 435 | |
| 432 inline void CSSSelector::setValue(const AtomicString& value) | 436 inline void CSSSelector::setValue(const AtomicString& value) |
| 433 { | 437 { |
| 434 ASSERT(m_match != Tag); | 438 ASSERT(m_match != Tag); |
| 435 ASSERT(m_pseudoType == PseudoNotParsed); | 439 ASSERT(m_pseudoType == PseudoNotParsed); |
| 436 // Need to do ref counting manually for the union. | 440 // Need to do ref counting manually for the union. |
| 437 if (m_hasRareData) { | 441 if (m_hasRareData) { |
| 438 m_data.m_rareData->m_value = value; | 442 m_data.m_rareData->m_value = value; |
| 439 return; | 443 return; |
| 440 } | 444 } |
| 441 if (m_data.m_value) | 445 if (m_data.m_value) |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 520 if (m_hasRareData) | 524 if (m_hasRareData) |
| 521 return m_data.m_rareData->m_value; | 525 return m_data.m_rareData->m_value; |
| 522 // AtomicString is really just a StringImpl* so the cast below is safe. | 526 // AtomicString is really just a StringImpl* so the cast below is safe. |
| 523 // FIXME: Perhaps call sites could be changed to accept StringImpl? | 527 // FIXME: Perhaps call sites could be changed to accept StringImpl? |
| 524 return *reinterpret_cast<const AtomicString*>(&m_data.m_value); | 528 return *reinterpret_cast<const AtomicString*>(&m_data.m_value); |
| 525 } | 529 } |
| 526 | 530 |
| 527 } // namespace WebCore | 531 } // namespace WebCore |
| 528 | 532 |
| 529 #endif // CSSSelector_h | 533 #endif // CSSSelector_h |
| OLD | NEW |