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 24 matching lines...) Expand all Loading... |
35 // CSS selector representation is somewhat complicated and subtle. A represe
ntative list of selectors is | 35 // CSS selector representation is somewhat complicated and subtle. A represe
ntative list of selectors is |
36 // in CSSSelectorTest; run it in a debug build to see useful debugging outpu
t. | 36 // in CSSSelectorTest; run it in a debug build to see useful debugging outpu
t. |
37 // | 37 // |
38 // ** tagHistory() and relation(): | 38 // ** tagHistory() and relation(): |
39 // | 39 // |
40 // Selectors are represented as a linked list of simple selectors (defined m
ore or less according to | 40 // Selectors are represented as a linked list of simple selectors (defined m
ore or less according to |
41 // http://www.w3.org/TR/css3-selectors/#simple-selectors-dfn). The tagHistor
y() method returns the next | 41 // http://www.w3.org/TR/css3-selectors/#simple-selectors-dfn). The tagHistor
y() method returns the next |
42 // simple selector in the list. The relation() method returns the relationsh
ip of the current simple selector to | 42 // simple selector in the list. The relation() method returns the relationsh
ip of the current simple selector to |
43 // the one in tagHistory(). For example, the CSS selector .a.b #c is represe
nted as: | 43 // the one in tagHistory(). For example, the CSS selector .a.b #c is represe
nted as: |
44 // | 44 // |
45 // selectorText(): .a.b .c | 45 // selectorText(): .a.b #c |
46 // --> (relation == Descendant) | 46 // --> (relation == Descendant) |
47 // selectorText(): .a.b | 47 // selectorText(): .a.b |
48 // --> (relation == SubSelector) | 48 // --> (relation == SubSelector) |
49 // selectorText(): .b | 49 // selectorText(): .b |
50 // | 50 // |
51 // Note that currently a bare selector such as ".a" has a relation() of Desc
endant. This is a bug - instead the relation should be | 51 // Note that currently a bare selector such as ".a" has a relation() of Desc
endant. This is a bug - instead the relation should be |
52 // "None". | 52 // "None". |
53 // | 53 // |
54 // The order of tagHistory() varies depending on the situation. | 54 // The order of tagHistory() varies depending on the situation. |
55 // * Relations using combinators (http://www.w3.org/TR/css3-selectors/#combi
nators), such as descendant, sibling, etc., are parsed | 55 // * Relations using combinators (http://www.w3.org/TR/css3-selectors/#combi
nators), such as descendant, sibling, etc., are parsed |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 FirstAttributeSelectorMatch = Exact, | 123 FirstAttributeSelectorMatch = Exact, |
124 }; | 124 }; |
125 | 125 |
126 enum Relation { | 126 enum Relation { |
127 Descendant = 0, // "Space" combinator | 127 Descendant = 0, // "Space" combinator |
128 Child, // > combinator | 128 Child, // > combinator |
129 DirectAdjacent, // + combinator | 129 DirectAdjacent, // + combinator |
130 IndirectAdjacent, // ~ combinator | 130 IndirectAdjacent, // ~ combinator |
131 SubSelector, // "No space" combinator | 131 SubSelector, // "No space" combinator |
132 ShadowPseudo, // Special case of shadow DOM pseudo elements / shadow
pseudo element | 132 ShadowPseudo, // Special case of shadow DOM pseudo elements / shadow
pseudo element |
133 ShadowDeep // /shadow-deep/ combinator | 133 ShadowDeep // /deep/ combinator |
134 }; | 134 }; |
135 | 135 |
136 enum PseudoType { | 136 enum PseudoType { |
137 PseudoNotParsed = 0, | 137 PseudoNotParsed = 0, |
138 PseudoUnknown, | 138 PseudoUnknown, |
139 PseudoEmpty, | 139 PseudoEmpty, |
140 PseudoFirstChild, | 140 PseudoFirstChild, |
141 PseudoFirstOfType, | 141 PseudoFirstOfType, |
142 PseudoLastChild, | 142 PseudoLastChild, |
143 PseudoLastOfType, | 143 PseudoLastOfType, |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 if (m_hasRareData) | 518 if (m_hasRareData) |
519 return m_data.m_rareData->m_value; | 519 return m_data.m_rareData->m_value; |
520 // AtomicString is really just a StringImpl* so the cast below is safe. | 520 // AtomicString is really just a StringImpl* so the cast below is safe. |
521 // FIXME: Perhaps call sites could be changed to accept StringImpl? | 521 // FIXME: Perhaps call sites could be changed to accept StringImpl? |
522 return *reinterpret_cast<const AtomicString*>(&m_data.m_value); | 522 return *reinterpret_cast<const AtomicString*>(&m_data.m_value); |
523 } | 523 } |
524 | 524 |
525 } // namespace WebCore | 525 } // namespace WebCore |
526 | 526 |
527 #endif // CSSSelector_h | 527 #endif // CSSSelector_h |
OLD | NEW |