OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // Example: | 73 // Example: |
74 // @namespace "http://www.w3.org/2000/svg"; | 74 // @namespace "http://www.w3.org/2000/svg"; |
75 // svg:not(:root) { ... | 75 // svg:not(:root) { ... |
76 if (m_selector->tagQName().localName() == starAtom) | 76 if (m_selector->tagQName().localName() == starAtom) |
77 return m_tagHistory->isSimple(); | 77 return m_tagHistory->isSimple(); |
78 } | 78 } |
79 | 79 |
80 return false; | 80 return false; |
81 } | 81 } |
82 | 82 |
83 void CSSParserSelector::insertTagHistory(CSSSelector::Relation before, PassOwnPt
r<CSSParserSelector> selector, CSSSelector::Relation after) | |
84 { | |
85 if (m_tagHistory) | |
86 selector->setTagHistory(m_tagHistory.release()); | |
87 setRelation(before); | |
88 selector->setRelation(after); | |
89 m_tagHistory = selector; | |
90 } | |
91 | |
92 void CSSParserSelector::appendTagHistory(CSSSelector::Relation relation, PassOwn
Ptr<CSSParserSelector> selector) | 83 void CSSParserSelector::appendTagHistory(CSSSelector::Relation relation, PassOwn
Ptr<CSSParserSelector> selector) |
93 { | 84 { |
94 CSSParserSelector* end = this; | 85 CSSParserSelector* end = this; |
95 while (end->tagHistory()) | 86 while (end->tagHistory()) |
96 end = end->tagHistory(); | 87 end = end->tagHistory(); |
97 end->setRelation(relation); | 88 end->setRelation(relation); |
98 end->setTagHistory(selector); | 89 end->setTagHistory(selector); |
99 } | 90 } |
100 | 91 |
| 92 PassOwnPtr<CSSParserSelector> CSSParserSelector::releaseTagHistory() |
| 93 { |
| 94 setRelation(CSSSelector::SubSelector); |
| 95 return m_tagHistory.release(); |
| 96 } |
| 97 |
101 void CSSParserSelector::prependTagSelector(const QualifiedName& tagQName, bool i
sImplicit) | 98 void CSSParserSelector::prependTagSelector(const QualifiedName& tagQName, bool i
sImplicit) |
102 { | 99 { |
103 OwnPtr<CSSParserSelector> second = CSSParserSelector::create(); | 100 OwnPtr<CSSParserSelector> second = CSSParserSelector::create(); |
104 second->m_selector = m_selector.release(); | 101 second->m_selector = m_selector.release(); |
105 second->m_tagHistory = m_tagHistory.release(); | 102 second->m_tagHistory = m_tagHistory.release(); |
106 m_tagHistory = second.release(); | 103 m_tagHistory = second.release(); |
107 m_selector = adoptPtr(new CSSSelector(tagQName, isImplicit)); | 104 m_selector = adoptPtr(new CSSSelector(tagQName, isImplicit)); |
108 } | 105 } |
109 | 106 |
110 bool CSSParserSelector::hasHostPseudoSelector() const | 107 bool CSSParserSelector::isHostPseudoSelector() const |
111 { | 108 { |
112 for (CSSParserSelector* selector = const_cast<CSSParserSelector*>(this); sel
ector; selector = selector->tagHistory()) { | 109 return pseudoType() == CSSSelector::PseudoHost || pseudoType() == CSSSelecto
r::PseudoHostContext; |
113 if (selector->pseudoType() == CSSSelector::PseudoHost || selector->pseud
oType() == CSSSelector::PseudoHostContext) | |
114 return true; | |
115 } | |
116 return false; | |
117 } | 110 } |
118 | 111 |
119 } // namespace blink | 112 } // namespace blink |
OLD | NEW |