| 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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 template<typename SiblingTraversalStrategy> | 484 template<typename SiblingTraversalStrategy> |
| 485 bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
lingTraversalStrategy& siblingTraversalStrategy, unsigned* specificity) const | 485 bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
lingTraversalStrategy& siblingTraversalStrategy, unsigned* specificity) const |
| 486 { | 486 { |
| 487 ASSERT(context.element); | 487 ASSERT(context.element); |
| 488 Element& element = *context.element; | 488 Element& element = *context.element; |
| 489 ASSERT(context.selector); | 489 ASSERT(context.selector); |
| 490 const CSSSelector& selector = *context.selector; | 490 const CSSSelector& selector = *context.selector; |
| 491 | 491 |
| 492 bool elementIsHostInItsShadowTree = isHostInItsShadowTree(element, context.b
ehaviorAtBoundary, context.scope); | 492 bool elementIsHostInItsShadowTree = isHostInItsShadowTree(element, context.b
ehaviorAtBoundary, context.scope); |
| 493 | 493 |
| 494 // Only :host and :ancestor should match the host: http://drafts.csswg.org/c
ss-scoping/#host-element |
| 495 if (elementIsHostInItsShadowTree && !selector.isHostPseudoClass()) |
| 496 return false; |
| 497 |
| 494 if (selector.m_match == CSSSelector::Tag) | 498 if (selector.m_match == CSSSelector::Tag) |
| 495 return SelectorChecker::tagMatches(element, selector.tagQName()) && !ele
mentIsHostInItsShadowTree; | 499 return SelectorChecker::tagMatches(element, selector.tagQName()); |
| 496 | 500 |
| 497 if (selector.m_match == CSSSelector::Class) | 501 if (selector.m_match == CSSSelector::Class) |
| 498 return element.hasClass() && element.classNames().contains(selector.valu
e()) && !elementIsHostInItsShadowTree; | 502 return element.hasClass() && element.classNames().contains(selector.valu
e()); |
| 499 | 503 |
| 500 if (selector.m_match == CSSSelector::Id) | 504 if (selector.m_match == CSSSelector::Id) |
| 501 return element.hasID() && element.idForStyleResolution() == selector.val
ue() && !elementIsHostInItsShadowTree; | 505 return element.hasID() && element.idForStyleResolution() == selector.val
ue(); |
| 502 | 506 |
| 503 if (selector.isAttributeSelector()) { | 507 if (selector.isAttributeSelector()) { |
| 504 if (elementIsHostInItsShadowTree) | |
| 505 return false; | |
| 506 if (!anyAttributeMatches(element, static_cast<CSSSelector::Match>(select
or.m_match), selector)) | 508 if (!anyAttributeMatches(element, static_cast<CSSSelector::Match>(select
or.m_match), selector)) |
| 507 return false; | 509 return false; |
| 508 } | 510 } |
| 509 | 511 |
| 510 if (selector.m_match == CSSSelector::PseudoClass) { | 512 if (selector.m_match == CSSSelector::PseudoClass) { |
| 511 // Handle :not up front. | 513 // Handle :not up front. |
| 512 if (selector.pseudoType() == CSSSelector::PseudoNot) { | 514 if (selector.pseudoType() == CSSSelector::PseudoNot) { |
| 513 SelectorCheckingContext subContext(context); | 515 SelectorCheckingContext subContext(context); |
| 514 subContext.isSubSelector = true; | 516 subContext.isSubSelector = true; |
| 515 ASSERT(selector.selectorList()); | 517 ASSERT(selector.selectorList()); |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1101 return element.focused() && isFrameFocused(element); | 1103 return element.focused() && isFrameFocused(element); |
| 1102 } | 1104 } |
| 1103 | 1105 |
| 1104 template | 1106 template |
| 1105 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst DOMSiblingTraversalStrategy&, MatchResult*) const; | 1107 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst DOMSiblingTraversalStrategy&, MatchResult*) const; |
| 1106 | 1108 |
| 1107 template | 1109 template |
| 1108 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst ShadowDOMSiblingTraversalStrategy&, MatchResult*) const; | 1110 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst ShadowDOMSiblingTraversalStrategy&, MatchResult*) const; |
| 1109 | 1111 |
| 1110 } | 1112 } |
| OLD | NEW |