| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2012 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Google Inc. All rights reserved. | 3 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 static bool forEachSelector(const Functor& functor, const CSSSelectorList* selec
torList) | 144 static bool forEachSelector(const Functor& functor, const CSSSelectorList* selec
torList) |
| 145 { | 145 { |
| 146 for (const CSSSelector* selector = selectorList->first(); selector; selector
= CSSSelectorList::next(*selector)) { | 146 for (const CSSSelector* selector = selectorList->first(); selector; selector
= CSSSelectorList::next(*selector)) { |
| 147 if (forEachTagSelector(functor, *selector)) | 147 if (forEachTagSelector(functor, *selector)) |
| 148 return true; | 148 return true; |
| 149 } | 149 } |
| 150 | 150 |
| 151 return false; | 151 return false; |
| 152 } | 152 } |
| 153 | 153 |
| 154 bool CSSSelectorList::selectorsNeedNamespaceResolution() | |
| 155 { | |
| 156 return forEachSelector([](const CSSSelector& selector) -> bool { | |
| 157 if (selector.match() != CSSSelector::Tag && !selector.isAttributeSelecto
r()) | |
| 158 return false; | |
| 159 const AtomicString& prefix = selector.isAttributeSelector() ? selector.a
ttribute().prefix() : selector.tagQName().prefix(); | |
| 160 return prefix != nullAtom && prefix != emptyAtom && prefix != starAtom; | |
| 161 }, this); | |
| 162 } | |
| 163 | |
| 164 bool CSSSelectorList::selectorHasContentPseudo(size_t index) const | 154 bool CSSSelectorList::selectorHasContentPseudo(size_t index) const |
| 165 { | 155 { |
| 166 return forEachTagSelector([](const CSSSelector& selector) -> bool { | 156 return forEachTagSelector([](const CSSSelector& selector) -> bool { |
| 167 return selector.relationIsAffectedByPseudoContent(); | 157 return selector.relationIsAffectedByPseudoContent(); |
| 168 }, selectorAt(index)); | 158 }, selectorAt(index)); |
| 169 } | 159 } |
| 170 | 160 |
| 171 bool CSSSelectorList::selectorHasSlottedPseudo(size_t index) const | 161 bool CSSSelectorList::selectorHasSlottedPseudo(size_t index) const |
| 172 { | 162 { |
| 173 return forEachTagSelector([](const CSSSelector& selector) -> bool { | 163 return forEachTagSelector([](const CSSSelector& selector) -> bool { |
| 174 return selector.pseudoType() == CSSSelector::PseudoSlotted; | 164 return selector.pseudoType() == CSSSelector::PseudoSlotted; |
| 175 }, selectorAt(index)); | 165 }, selectorAt(index)); |
| 176 } | 166 } |
| 177 | 167 |
| 178 bool CSSSelectorList::selectorUsesDeepCombinatorOrShadowPseudo(size_t index) con
st | 168 bool CSSSelectorList::selectorUsesDeepCombinatorOrShadowPseudo(size_t index) con
st |
| 179 { | 169 { |
| 180 return forEachTagSelector([](const CSSSelector& selector) -> bool { | 170 return forEachTagSelector([](const CSSSelector& selector) -> bool { |
| 181 return selector.relation() == CSSSelector::ShadowDeep || selector.pseudo
Type() == CSSSelector::PseudoShadow; | 171 return selector.relation() == CSSSelector::ShadowDeep || selector.pseudo
Type() == CSSSelector::PseudoShadow; |
| 182 }, selectorAt(index)); | 172 }, selectorAt(index)); |
| 183 } | 173 } |
| 184 | 174 |
| 185 bool CSSSelectorList::selectorNeedsUpdatedDistribution(size_t index) const | 175 bool CSSSelectorList::selectorNeedsUpdatedDistribution(size_t index) const |
| 186 { | 176 { |
| 187 return forEachTagSelector([](const CSSSelector& selector) -> bool { | 177 return forEachTagSelector([](const CSSSelector& selector) -> bool { |
| 188 return selector.relationIsAffectedByPseudoContent() || selector.pseudoTy
pe() == CSSSelector::PseudoSlotted || selector.pseudoType() == CSSSelector::Pseu
doHostContext; | 178 return selector.relationIsAffectedByPseudoContent() || selector.pseudoTy
pe() == CSSSelector::PseudoSlotted || selector.pseudoType() == CSSSelector::Pseu
doHostContext; |
| 189 }, selectorAt(index)); | 179 }, selectorAt(index)); |
| 190 } | 180 } |
| 191 | 181 |
| 192 } // namespace blink | 182 } // namespace blink |
| OLD | NEW |