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.pseudoType() == CSSSelector::PseudoSlotted; |
rune
2016/01/20 12:53:32
I think this code is a bit more advanced than it n
kochi
2016/01/21 05:09:37
Done.
| |
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. |
rune
2016/01/20 12:53:32
I don't think there's a need to wait for the next
kochi
2016/01/21 05:09:37
Done.
| |
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 case CSSSelector::ShadowSlot: | |
166 // TODO(kochi): Add this in later CL. | |
167 break; | |
168 } | 166 } |
169 if (hash == end) | 167 if (hash == end) |
170 return; | 168 return; |
171 relation = current->relation(); | 169 relation = current->relation(); |
172 relationIsAffectedByPseudoContent = current->relationIsAffectedByPseudoC ontent(); | 170 relationIsAffectedByPseudoContentOrSlotted = current->relationIsAffected ByPseudoContent() || current->pseudoType() == CSSSelector::PseudoSlotted; |
rune
2016/01/20 12:53:32
This can be replaced with:
if (current->relationI
kochi
2016/01/21 05:09:37
Done.
| |
173 } | 171 } |
174 *hash = 0; | 172 *hash = 0; |
175 } | 173 } |
176 | 174 |
177 DEFINE_TRACE(SelectorFilter::ParentStackFrame) | 175 DEFINE_TRACE(SelectorFilter::ParentStackFrame) |
178 { | 176 { |
179 visitor->trace(element); | 177 visitor->trace(element); |
180 } | 178 } |
181 | 179 |
182 DEFINE_TRACE(SelectorFilter) | 180 DEFINE_TRACE(SelectorFilter) |
183 { | 181 { |
184 #if ENABLE(OILPAN) | 182 #if ENABLE(OILPAN) |
185 visitor->trace(m_parentStack); | 183 visitor->trace(m_parentStack); |
186 #endif | 184 #endif |
187 } | 185 } |
188 | 186 |
189 } | 187 } |
OLD | NEW |