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, 2012, 2013 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 { | 144 { |
145 // first selector has to match | 145 // first selector has to match |
146 unsigned specificity = 0; | 146 unsigned specificity = 0; |
147 if (!checkOne(context, siblingTraversalStrategy, &specificity)) | 147 if (!checkOne(context, siblingTraversalStrategy, &specificity)) |
148 return SelectorFailsLocally; | 148 return SelectorFailsLocally; |
149 | 149 |
150 if (context.selector->m_match == CSSSelector::PseudoElement) { | 150 if (context.selector->m_match == CSSSelector::PseudoElement) { |
151 if (context.selector->isCustomPseudoElement()) { | 151 if (context.selector->isCustomPseudoElement()) { |
152 if (!matchesCustomPseudoElement(context.element, *context.selector)) | 152 if (!matchesCustomPseudoElement(context.element, *context.selector)) |
153 return SelectorFailsLocally; | 153 return SelectorFailsLocally; |
| 154 } else if (context.selector->isContentPseudoElement()) { |
| 155 if (!context.element->isInShadowTree() || !context.element->isInsert
ionPoint()) |
| 156 return SelectorFailsLocally; |
154 } else { | 157 } else { |
155 if ((!context.elementStyle && m_mode == ResolvingStyle) || m_mode ==
QueryingRules) | 158 if ((!context.elementStyle && m_mode == ResolvingStyle) || m_mode ==
QueryingRules) |
156 return SelectorFailsLocally; | 159 return SelectorFailsLocally; |
157 | 160 |
158 PseudoId pseudoId = CSSSelector::pseudoId(context.selector->pseudoTy
pe()); | 161 PseudoId pseudoId = CSSSelector::pseudoId(context.selector->pseudoTy
pe()); |
159 if (pseudoId == FIRST_LETTER) | 162 if (pseudoId == FIRST_LETTER) |
160 context.element->document().styleEngine()->setUsesFirstLetterRul
es(true); | 163 context.element->document().styleEngine()->setUsesFirstLetterRul
es(true); |
161 if (pseudoId != NOPSEUDO && m_mode != SharingRules && result) | 164 if (pseudoId != NOPSEUDO && m_mode != SharingRules && result) |
162 result->dynamicPseudo = pseudoId; | 165 result->dynamicPseudo = pseudoId; |
163 } | 166 } |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 return matchForShadowDistributed(context.element, siblingTravers
alStrategy, nextContext, result); | 269 return matchForShadowDistributed(context.element, siblingTravers
alStrategy, nextContext, result); |
267 | 270 |
268 nextContext.element = parentElement(context); | 271 nextContext.element = parentElement(context); |
269 if (!nextContext.element) | 272 if (!nextContext.element) |
270 return SelectorFailsCompletely; | 273 return SelectorFailsCompletely; |
271 | 274 |
272 nextContext.isSubSelector = false; | 275 nextContext.isSubSelector = false; |
273 nextContext.elementStyle = 0; | 276 nextContext.elementStyle = 0; |
274 return match(nextContext, siblingTraversalStrategy, result); | 277 return match(nextContext, siblingTraversalStrategy, result); |
275 } | 278 } |
276 | |
277 case CSSSelector::ShadowContent: | |
278 return matchForShadowDistributed(context.element, siblingTraversalStrate
gy, nextContext, result); | |
279 | |
280 case CSSSelector::DirectAdjacent: | 279 case CSSSelector::DirectAdjacent: |
281 if (m_mode == ResolvingStyle) { | 280 if (m_mode == ResolvingStyle) { |
282 if (ContainerNode* parent = context.element->parentElementOrShadowRo
ot()) | 281 if (ContainerNode* parent = context.element->parentElementOrShadowRo
ot()) |
283 parent->setChildrenAffectedByDirectAdjacentRules(); | 282 parent->setChildrenAffectedByDirectAdjacentRules(); |
284 } | 283 } |
285 nextContext.element = ElementTraversal::previousSibling(*context.element
); | 284 nextContext.element = ElementTraversal::previousSibling(*context.element
); |
286 if (!nextContext.element) | 285 if (!nextContext.element) |
287 return SelectorFailsAllSiblings; | 286 return SelectorFailsAllSiblings; |
288 nextContext.isSubSelector = false; | 287 nextContext.isSubSelector = false; |
289 nextContext.elementStyle = 0; | 288 nextContext.elementStyle = 0; |
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 return element.focused() && isFrameFocused(element); | 1097 return element.focused() && isFrameFocused(element); |
1099 } | 1098 } |
1100 | 1099 |
1101 template | 1100 template |
1102 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst DOMSiblingTraversalStrategy&, MatchResult*) const; | 1101 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst DOMSiblingTraversalStrategy&, MatchResult*) const; |
1103 | 1102 |
1104 template | 1103 template |
1105 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst ShadowDOMSiblingTraversalStrategy&, MatchResult*) const; | 1104 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst ShadowDOMSiblingTraversalStrategy&, MatchResult*) const; |
1106 | 1105 |
1107 } | 1106 } |
OLD | NEW |