OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights
reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights
reserved. |
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 default: | 127 default: |
128 break; | 128 break; |
129 } | 129 } |
130 } | 130 } |
131 | 131 |
132 void SelectorFilter::collectIdentifierHashes(const CSSSelector& selector, unsign
ed* identifierHashes, unsigned maximumIdentifierCount) | 132 void SelectorFilter::collectIdentifierHashes(const CSSSelector& selector, unsign
ed* identifierHashes, unsigned maximumIdentifierCount) |
133 { | 133 { |
134 unsigned* hash = identifierHashes; | 134 unsigned* hash = identifierHashes; |
135 unsigned* end = identifierHashes + maximumIdentifierCount; | 135 unsigned* end = identifierHashes + maximumIdentifierCount; |
136 CSSSelector::Relation relation = selector.relation(); | 136 CSSSelector::Relation relation = selector.relation(); |
137 bool relationIsAffectedByPseudoContent = selector.relationIsAffectedByPseudo
Content(); | 137 bool relationIsAffectedByPseudoContentOrSlotted = selector.relationIsAffecte
dByPseudoContent() || selector.relationIsAffectedByPseudoSlotted(); |
138 | 138 |
139 // Skip the topmost selector. It is handled quickly by the rule hashes. | 139 // Skip the topmost selector. It is handled quickly by the rule hashes. |
140 bool skipOverSubselectors = true; | 140 bool skipOverSubselectors = true; |
141 for (const CSSSelector* current = selector.tagHistory(); current; current =
current->tagHistory()) { | 141 for (const CSSSelector* current = selector.tagHistory(); current; current =
current->tagHistory()) { |
142 // Only collect identifiers that match ancestors. | 142 // Only collect identifiers that match ancestors. |
143 switch (relation) { | 143 switch (relation) { |
144 case CSSSelector::SubSelector: | 144 case CSSSelector::SubSelector: |
145 if (!skipOverSubselectors) | 145 if (!skipOverSubselectors) |
146 collectDescendantSelectorIdentifierHashes(*current, hash); | 146 collectDescendantSelectorIdentifierHashes(*current, hash); |
147 break; | 147 break; |
148 case CSSSelector::DirectAdjacent: | 148 case CSSSelector::DirectAdjacent: |
149 case CSSSelector::IndirectAdjacent: | 149 case CSSSelector::IndirectAdjacent: |
150 skipOverSubselectors = true; | 150 skipOverSubselectors = true; |
151 break; | 151 break; |
152 case CSSSelector::Descendant: | 152 case CSSSelector::Descendant: |
153 case CSSSelector::Child: | 153 case CSSSelector::Child: |
154 if (relationIsAffectedByPseudoContent) { | 154 case CSSSelector::ShadowSlot: |
| 155 if (relationIsAffectedByPseudoContentOrSlotted) { |
155 // Disable fastRejectSelector. | 156 // Disable fastRejectSelector. |
156 *identifierHashes = 0; | 157 *identifierHashes = 0; |
157 return; | 158 return; |
158 } | 159 } |
159 // Fall through. | 160 // Fall through. |
160 case CSSSelector::ShadowPseudo: | 161 case CSSSelector::ShadowPseudo: |
161 case CSSSelector::ShadowDeep: | 162 case CSSSelector::ShadowDeep: |
162 skipOverSubselectors = false; | 163 skipOverSubselectors = false; |
163 collectDescendantSelectorIdentifierHashes(*current, hash); | 164 collectDescendantSelectorIdentifierHashes(*current, hash); |
164 break; | 165 break; |
165 } | 166 } |
166 if (hash == end) | 167 if (hash == end) |
167 return; | 168 return; |
168 relation = current->relation(); | 169 relation = current->relation(); |
169 relationIsAffectedByPseudoContent = current->relationIsAffectedByPseudoC
ontent(); | 170 relationIsAffectedByPseudoContentOrSlotted = current->relationIsAffected
ByPseudoContent() || current->relationIsAffectedByPseudoSlotted(); |
170 } | 171 } |
171 *hash = 0; | 172 *hash = 0; |
172 } | 173 } |
173 | 174 |
174 DEFINE_TRACE(SelectorFilter::ParentStackFrame) | 175 DEFINE_TRACE(SelectorFilter::ParentStackFrame) |
175 { | 176 { |
176 visitor->trace(element); | 177 visitor->trace(element); |
177 } | 178 } |
178 | 179 |
179 DEFINE_TRACE(SelectorFilter) | 180 DEFINE_TRACE(SelectorFilter) |
180 { | 181 { |
181 #if ENABLE(OILPAN) | 182 #if ENABLE(OILPAN) |
182 visitor->trace(m_parentStack); | 183 visitor->trace(m_parentStack); |
183 #endif | 184 #endif |
184 } | 185 } |
185 | 186 |
186 } | 187 } |
OLD | NEW |