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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 { | 131 { |
132 // first selector has to match | 132 // first selector has to match |
133 unsigned specificity = 0; | 133 unsigned specificity = 0; |
134 if (!checkOne(context, siblingTraversalStrategy, &specificity)) | 134 if (!checkOne(context, siblingTraversalStrategy, &specificity)) |
135 return SelectorFailsLocally; | 135 return SelectorFailsLocally; |
136 | 136 |
137 if (context.selector->m_match == CSSSelector::PseudoElement) { | 137 if (context.selector->m_match == CSSSelector::PseudoElement) { |
138 if (context.selector->isCustomPseudoElement()) { | 138 if (context.selector->isCustomPseudoElement()) { |
139 if (!matchesCustomPseudoElement(context.element, *context.selector)) | 139 if (!matchesCustomPseudoElement(context.element, *context.selector)) |
140 return SelectorFailsLocally; | 140 return SelectorFailsLocally; |
141 } else if (context.selector->isContentPseudoElement()) { | |
142 if (!context.element->isInShadowTree() || !context.element->isInsert
ionPoint()) | |
143 return SelectorFailsLocally; | |
144 } else { | 141 } else { |
145 if ((!context.elementStyle && m_mode == ResolvingStyle) || m_mode ==
QueryingRules) | 142 if ((!context.elementStyle && m_mode == ResolvingStyle) || m_mode ==
QueryingRules) |
146 return SelectorFailsLocally; | 143 return SelectorFailsLocally; |
147 | 144 |
148 PseudoId pseudoId = CSSSelector::pseudoId(context.selector->pseudoTy
pe()); | 145 PseudoId pseudoId = CSSSelector::pseudoId(context.selector->pseudoTy
pe()); |
149 if (pseudoId == FIRST_LETTER) | 146 if (pseudoId == FIRST_LETTER) |
150 context.element->document().styleEngine()->setUsesFirstLetterRul
es(true); | 147 context.element->document().styleEngine()->setUsesFirstLetterRul
es(true); |
151 if (pseudoId != NOPSEUDO && m_mode != SharingRules && result) | 148 if (pseudoId != NOPSEUDO && m_mode != SharingRules && result) |
152 result->dynamicPseudo = pseudoId; | 149 result->dynamicPseudo = pseudoId; |
153 } | 150 } |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 return matchForShadowDistributed(context.element, siblingTravers
alStrategy, nextContext, result); | 253 return matchForShadowDistributed(context.element, siblingTravers
alStrategy, nextContext, result); |
257 | 254 |
258 nextContext.element = parentElement(context); | 255 nextContext.element = parentElement(context); |
259 if (!nextContext.element) | 256 if (!nextContext.element) |
260 return SelectorFailsCompletely; | 257 return SelectorFailsCompletely; |
261 | 258 |
262 nextContext.isSubSelector = false; | 259 nextContext.isSubSelector = false; |
263 nextContext.elementStyle = 0; | 260 nextContext.elementStyle = 0; |
264 return match(nextContext, siblingTraversalStrategy, result); | 261 return match(nextContext, siblingTraversalStrategy, result); |
265 } | 262 } |
| 263 |
| 264 case CSSSelector::ShadowContent: |
| 265 return matchForShadowDistributed(context.element, siblingTraversalStrate
gy, nextContext, result); |
| 266 |
266 case CSSSelector::DirectAdjacent: | 267 case CSSSelector::DirectAdjacent: |
267 if (m_mode == ResolvingStyle) { | 268 if (m_mode == ResolvingStyle) { |
268 if (Node* parent = context.element->parentElementOrShadowRoot()) | 269 if (Node* parent = context.element->parentElementOrShadowRoot()) |
269 SiblingRuleHelper(parent).setChildrenAffectedByDirectAdjacentRul
es(); | 270 SiblingRuleHelper(parent).setChildrenAffectedByDirectAdjacentRul
es(); |
270 } | 271 } |
271 nextContext.element = ElementTraversal::previousSibling(*context.element
); | 272 nextContext.element = ElementTraversal::previousSibling(*context.element
); |
272 if (!nextContext.element) | 273 if (!nextContext.element) |
273 return SelectorFailsAllSiblings; | 274 return SelectorFailsAllSiblings; |
274 nextContext.isSubSelector = false; | 275 nextContext.isSubSelector = false; |
275 nextContext.elementStyle = 0; | 276 nextContext.elementStyle = 0; |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 return element.focused() && isFrameFocused(element); | 1084 return element.focused() && isFrameFocused(element); |
1084 } | 1085 } |
1085 | 1086 |
1086 template | 1087 template |
1087 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst DOMSiblingTraversalStrategy&, MatchResult*) const; | 1088 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst DOMSiblingTraversalStrategy&, MatchResult*) const; |
1088 | 1089 |
1089 template | 1090 template |
1090 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst ShadowDOMSiblingTraversalStrategy&, MatchResult*) const; | 1091 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst ShadowDOMSiblingTraversalStrategy&, MatchResult*) const; |
1091 | 1092 |
1092 } | 1093 } |
OLD | NEW |