| 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 if (selector.relationIsAffectedByPseudoContent()) { |
| 138 // Disable fastRejectSelector. |
| 139 *identifierHashes = 0; |
| 140 return; |
| 141 } |
| 138 | 142 |
| 139 // Skip the topmost selector. It is handled quickly by the rule hashes. | 143 // Skip the topmost selector. It is handled quickly by the rule hashes. |
| 140 bool skipOverSubselectors = true; | 144 bool skipOverSubselectors = true; |
| 141 for (const CSSSelector* current = selector.tagHistory(); current; current =
current->tagHistory()) { | 145 for (const CSSSelector* current = selector.tagHistory(); current; current =
current->tagHistory()) { |
| 142 // Only collect identifiers that match ancestors. | 146 // Only collect identifiers that match ancestors. |
| 143 switch (relation) { | 147 switch (relation) { |
| 144 case CSSSelector::SubSelector: | 148 case CSSSelector::SubSelector: |
| 145 if (!skipOverSubselectors) | 149 if (!skipOverSubselectors) |
| 146 collectDescendantSelectorIdentifierHashes(*current, hash); | 150 collectDescendantSelectorIdentifierHashes(*current, hash); |
| 147 break; | 151 break; |
| 148 case CSSSelector::DirectAdjacent: | 152 case CSSSelector::DirectAdjacent: |
| 149 case CSSSelector::IndirectAdjacent: | 153 case CSSSelector::IndirectAdjacent: |
| 150 skipOverSubselectors = true; | 154 skipOverSubselectors = true; |
| 151 break; | 155 break; |
| 156 case CSSSelector::ShadowSlot: |
| 157 // Disable fastRejectSelector. |
| 158 *identifierHashes = 0; |
| 159 return; |
| 152 case CSSSelector::Descendant: | 160 case CSSSelector::Descendant: |
| 153 case CSSSelector::Child: | 161 case CSSSelector::Child: |
| 154 if (relationIsAffectedByPseudoContent) { | |
| 155 // Disable fastRejectSelector. | |
| 156 *identifierHashes = 0; | |
| 157 return; | |
| 158 } | |
| 159 // Fall through. | 162 // Fall through. |
| 160 case CSSSelector::ShadowPseudo: | 163 case CSSSelector::ShadowPseudo: |
| 161 case CSSSelector::ShadowDeep: | 164 case CSSSelector::ShadowDeep: |
| 162 skipOverSubselectors = false; | 165 skipOverSubselectors = false; |
| 163 collectDescendantSelectorIdentifierHashes(*current, hash); | 166 collectDescendantSelectorIdentifierHashes(*current, hash); |
| 164 break; | 167 break; |
| 165 case CSSSelector::ShadowSlot: | |
| 166 // TODO(kochi): Add this in later CL. | |
| 167 break; | |
| 168 } | 168 } |
| 169 if (hash == end) | 169 if (hash == end) |
| 170 return; | 170 return; |
| 171 relation = current->relation(); | 171 relation = current->relation(); |
| 172 relationIsAffectedByPseudoContent = current->relationIsAffectedByPseudoC
ontent(); | 172 if (current->relationIsAffectedByPseudoContent()) { |
| 173 // Disable fastRejectSelector. |
| 174 *identifierHashes = 0; |
| 175 return; |
| 176 } |
| 173 } | 177 } |
| 174 *hash = 0; | 178 *hash = 0; |
| 175 } | 179 } |
| 176 | 180 |
| 177 DEFINE_TRACE(SelectorFilter::ParentStackFrame) | 181 DEFINE_TRACE(SelectorFilter::ParentStackFrame) |
| 178 { | 182 { |
| 179 visitor->trace(element); | 183 visitor->trace(element); |
| 180 } | 184 } |
| 181 | 185 |
| 182 DEFINE_TRACE(SelectorFilter) | 186 DEFINE_TRACE(SelectorFilter) |
| 183 { | 187 { |
| 184 #if ENABLE(OILPAN) | 188 #if ENABLE(OILPAN) |
| 185 visitor->trace(m_parentStack); | 189 visitor->trace(m_parentStack); |
| 186 #endif | 190 #endif |
| 187 } | 191 } |
| 188 | 192 |
| 189 } | 193 } |
| OLD | NEW |