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. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. |
6 * All rights reserved. | 6 * All rights reserved. |
7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
10 * (http://www.torchmobile.com/) | 10 * (http://www.torchmobile.com/) |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 | 492 |
493 SelectorChecker::MatchStatus SelectorChecker::MatchForPseudoContent( | 493 SelectorChecker::MatchStatus SelectorChecker::MatchForPseudoContent( |
494 const SelectorCheckingContext& context, | 494 const SelectorCheckingContext& context, |
495 const Element& element, | 495 const Element& element, |
496 MatchResult& result) const { | 496 MatchResult& result) const { |
497 HeapVector<Member<InsertionPoint>, 8> insertion_points; | 497 HeapVector<Member<InsertionPoint>, 8> insertion_points; |
498 CollectDestinationInsertionPoints(element, insertion_points); | 498 CollectDestinationInsertionPoints(element, insertion_points); |
499 SelectorCheckingContext next_context(context); | 499 SelectorCheckingContext next_context(context); |
500 for (const auto& insertion_point : insertion_points) { | 500 for (const auto& insertion_point : insertion_points) { |
501 next_context.element = insertion_point; | 501 next_context.element = insertion_point; |
502 // TODO(esprehn): Why does SharingRules have a special case? | 502 // TODO(esprehn): Why does kSharingRules have a special case? |
503 if (mode_ == kSharingRules) | 503 if (mode_ == kSharingRules) |
504 next_context.scope = insertion_point->ContainingShadowRoot(); | 504 next_context.scope = insertion_point->ContainingShadowRoot(); |
505 if (Match(next_context, result)) | 505 if (Match(next_context, result)) |
506 return kSelectorMatches; | 506 return kSelectorMatches; |
507 } | 507 } |
508 return kSelectorFailsLocally; | 508 return kSelectorFailsLocally; |
509 } | 509 } |
510 | 510 |
511 static bool AttributeValueMatches(const Attribute& attribute_item, | 511 static bool AttributeValueMatches(const Attribute& attribute_item, |
512 CSSSelector::MatchType match, | 512 CSSSelector::MatchType match, |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 // restriction in CSS3, but it is, so let's honor it. | 700 // restriction in CSS3, but it is, so let's honor it. |
701 // the parser enforces that this never occurs | 701 // the parser enforces that this never occurs |
702 DCHECK_NE(sub_context.selector->GetPseudoType(), CSSSelector::kPseudoNot); | 702 DCHECK_NE(sub_context.selector->GetPseudoType(), CSSSelector::kPseudoNot); |
703 // We select between :visited and :link when applying. We don't know which | 703 // We select between :visited and :link when applying. We don't know which |
704 // one applied (or not) yet. | 704 // one applied (or not) yet. |
705 if (sub_context.selector->GetPseudoType() == CSSSelector::kPseudoVisited || | 705 if (sub_context.selector->GetPseudoType() == CSSSelector::kPseudoVisited || |
706 (sub_context.selector->GetPseudoType() == CSSSelector::kPseudoLink && | 706 (sub_context.selector->GetPseudoType() == CSSSelector::kPseudoLink && |
707 sub_context.visited_match_type == kVisitedMatchEnabled)) | 707 sub_context.visited_match_type == kVisitedMatchEnabled)) |
708 return true; | 708 return true; |
709 if (mode_ == kSharingRules) { | 709 if (mode_ == kSharingRules) { |
710 // context.scope is not available if m_mode == SharingRules. | 710 // context.scope is not available if mode_ == kSharingRules. |
711 // We cannot determine whether :host or :scope matches a given element or | 711 // We cannot determine whether :host or :scope matches a given element or |
712 // not. | 712 // not. |
713 if (sub_context.selector->IsHostPseudoClass() || | 713 if (sub_context.selector->IsHostPseudoClass() || |
714 sub_context.selector->GetPseudoType() == CSSSelector::kPseudoScope) | 714 sub_context.selector->GetPseudoType() == CSSSelector::kPseudoScope) |
715 return true; | 715 return true; |
716 // :hover, :active, :focus, :-webkit-drag relies on setting flags on | 716 // :hover, :active, :focus, :-webkit-drag relies on setting flags on |
717 // ComputedStyle even if the whole selector may not match. That | 717 // ComputedStyle even if the whole selector may not match. That |
718 // means we cannot share style between elements which may fail | 718 // means we cannot share style between elements which may fail |
719 // matching the same selector for different reasons. An example is | 719 // matching the same selector for different reasons. An example is |
720 // [attr]:hover which both fail for :hover, but an element without | 720 // [attr]:hover which both fail for :hover, but an element without |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1335 bool SelectorChecker::MatchesFocusPseudoClass(const Element& element) { | 1335 bool SelectorChecker::MatchesFocusPseudoClass(const Element& element) { |
1336 bool force_pseudo_state = false; | 1336 bool force_pseudo_state = false; |
1337 probe::forcePseudoState(const_cast<Element*>(&element), | 1337 probe::forcePseudoState(const_cast<Element*>(&element), |
1338 CSSSelector::kPseudoFocus, &force_pseudo_state); | 1338 CSSSelector::kPseudoFocus, &force_pseudo_state); |
1339 if (force_pseudo_state) | 1339 if (force_pseudo_state) |
1340 return true; | 1340 return true; |
1341 return element.IsFocused() && IsFrameFocused(element); | 1341 return element.IsFocused() && IsFrameFocused(element); |
1342 } | 1342 } |
1343 | 1343 |
1344 } // namespace blink | 1344 } // namespace blink |
OLD | NEW |