| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 default: | 147 default: |
| 148 break; | 148 break; |
| 149 } | 149 } |
| 150 } | 150 } |
| 151 | 151 |
| 152 void SelectorFilter::collectIdentifierHashes(const CSSSelector& selector, unsign
ed* identifierHashes, unsigned maximumIdentifierCount) | 152 void SelectorFilter::collectIdentifierHashes(const CSSSelector& selector, unsign
ed* identifierHashes, unsigned maximumIdentifierCount) |
| 153 { | 153 { |
| 154 unsigned* hash = identifierHashes; | 154 unsigned* hash = identifierHashes; |
| 155 unsigned* end = identifierHashes + maximumIdentifierCount; | 155 unsigned* end = identifierHashes + maximumIdentifierCount; |
| 156 CSSSelector::Relation relation = selector.relation(); | 156 CSSSelector::Relation relation = selector.relation(); |
| 157 bool relationIsAffectedByPseudoContent = selector.relationIsAffectedByPseudo
Content(); | 157 bool relationIsAffectedByPseudoContentOrSlotted = selector.relationIsAffecte
dByPseudoContent() || selector.relationIsAffectedByPseudoSlotted(); |
| 158 | 158 |
| 159 // Skip the topmost selector. It is handled quickly by the rule hashes. | 159 // Skip the topmost selector. It is handled quickly by the rule hashes. |
| 160 bool skipOverSubselectors = true; | 160 bool skipOverSubselectors = true; |
| 161 for (const CSSSelector* current = selector.tagHistory(); current; current =
current->tagHistory()) { | 161 for (const CSSSelector* current = selector.tagHistory(); current; current =
current->tagHistory()) { |
| 162 // Only collect identifiers that match ancestors. | 162 // Only collect identifiers that match ancestors. |
| 163 switch (relation) { | 163 switch (relation) { |
| 164 case CSSSelector::SubSelector: | 164 case CSSSelector::SubSelector: |
| 165 if (!skipOverSubselectors) | 165 if (!skipOverSubselectors) |
| 166 collectDescendantSelectorIdentifierHashes(*current, hash); | 166 collectDescendantSelectorIdentifierHashes(*current, hash); |
| 167 break; | 167 break; |
| 168 case CSSSelector::DirectAdjacent: | 168 case CSSSelector::DirectAdjacent: |
| 169 case CSSSelector::IndirectAdjacent: | 169 case CSSSelector::IndirectAdjacent: |
| 170 skipOverSubselectors = true; | 170 skipOverSubselectors = true; |
| 171 break; | 171 break; |
| 172 case CSSSelector::Descendant: | 172 case CSSSelector::Descendant: |
| 173 case CSSSelector::Child: | 173 case CSSSelector::Child: |
| 174 if (relationIsAffectedByPseudoContent) { | 174 case CSSSelector::ShadowSlot: |
| 175 if (relationIsAffectedByPseudoContentOrSlotted) { |
| 175 // Disable fastRejectSelector. | 176 // Disable fastRejectSelector. |
| 176 *identifierHashes = 0; | 177 *identifierHashes = 0; |
| 177 return; | 178 return; |
| 178 } | 179 } |
| 179 // Fall through. | 180 // Fall through. |
| 180 case CSSSelector::ShadowPseudo: | 181 case CSSSelector::ShadowPseudo: |
| 181 case CSSSelector::ShadowDeep: | 182 case CSSSelector::ShadowDeep: |
| 182 skipOverSubselectors = false; | 183 skipOverSubselectors = false; |
| 183 collectDescendantSelectorIdentifierHashes(*current, hash); | 184 collectDescendantSelectorIdentifierHashes(*current, hash); |
| 184 break; | 185 break; |
| 185 } | 186 } |
| 186 if (hash == end) | 187 if (hash == end) |
| 187 return; | 188 return; |
| 188 relation = current->relation(); | 189 relation = current->relation(); |
| 189 relationIsAffectedByPseudoContent = current->relationIsAffectedByPseudoC
ontent(); | 190 relationIsAffectedByPseudoContentOrSlotted = current->relationIsAffected
ByPseudoContent() || current->relationIsAffectedByPseudoSlotted(); |
| 190 } | 191 } |
| 191 *hash = 0; | 192 *hash = 0; |
| 192 } | 193 } |
| 193 | 194 |
| 194 DEFINE_TRACE(SelectorFilter::ParentStackFrame) | 195 DEFINE_TRACE(SelectorFilter::ParentStackFrame) |
| 195 { | 196 { |
| 196 visitor->trace(element); | 197 visitor->trace(element); |
| 197 } | 198 } |
| 198 | 199 |
| 199 DEFINE_TRACE(SelectorFilter) | 200 DEFINE_TRACE(SelectorFilter) |
| 200 { | 201 { |
| 201 #if ENABLE(OILPAN) | 202 #if ENABLE(OILPAN) |
| 202 visitor->trace(m_parentStack); | 203 visitor->trace(m_parentStack); |
| 203 #endif | 204 #endif |
| 204 } | 205 } |
| 205 | 206 |
| 206 } | 207 } |
| OLD | NEW |