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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 // rule is the same as the element we are matching rules for. | 330 // rule is the same as the element we are matching rules for. |
331 if (mode_ == kSharingRules && next_context.selector->IsHostPseudoClass()) | 331 if (mode_ == kSharingRules && next_context.selector->IsHostPseudoClass()) |
332 next_context.scope = next_context.element->ContainingShadowRoot(); | 332 next_context.scope = next_context.element->ContainingShadowRoot(); |
333 | 333 |
334 next_context.in_rightmost_compound = false; | 334 next_context.in_rightmost_compound = false; |
335 next_context.is_sub_selector = false; | 335 next_context.is_sub_selector = false; |
336 next_context.previous_element = context.element; | 336 next_context.previous_element = context.element; |
337 next_context.pseudo_id = kPseudoIdNone; | 337 next_context.pseudo_id = kPseudoIdNone; |
338 | 338 |
339 switch (relation) { | 339 switch (relation) { |
340 case CSSSelector::kShadowDeepAsDescendant: | |
341 Deprecation::CountDeprecation(context.element->GetDocument(), | |
342 UseCounter::kCSSDeepCombinator); | |
343 // fall through | |
344 case CSSSelector::kDescendant: | 340 case CSSSelector::kDescendant: |
345 if (context.selector->RelationIsAffectedByPseudoContent()) { | 341 if (context.selector->RelationIsAffectedByPseudoContent()) { |
346 for (Element* element = context.element; element; | 342 for (Element* element = context.element; element; |
347 element = element->parentElement()) { | 343 element = element->parentElement()) { |
348 if (MatchForPseudoContent(next_context, *element, result) == | 344 if (MatchForPseudoContent(next_context, *element, result) == |
349 kSelectorMatches) | 345 kSelectorMatches) |
350 return kSelectorMatches; | 346 return kSelectorMatches; |
351 } | 347 } |
352 return kSelectorFailsCompletely; | 348 return kSelectorFailsCompletely; |
353 } | 349 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 next_context.element = | 407 next_context.element = |
412 ElementTraversal::PreviousSibling(*next_context.element)) { | 408 ElementTraversal::PreviousSibling(*next_context.element)) { |
413 MatchStatus match = MatchSelector(next_context, result); | 409 MatchStatus match = MatchSelector(next_context, result); |
414 if (match == kSelectorMatches || match == kSelectorFailsAllSiblings || | 410 if (match == kSelectorMatches || match == kSelectorFailsAllSiblings || |
415 match == kSelectorFailsCompletely) | 411 match == kSelectorFailsCompletely) |
416 return match; | 412 return match; |
417 } | 413 } |
418 return kSelectorFailsAllSiblings; | 414 return kSelectorFailsAllSiblings; |
419 | 415 |
420 case CSSSelector::kShadowPseudo: { | 416 case CSSSelector::kShadowPseudo: { |
| 417 if (!is_ua_rule_ && mode_ != kQueryingRules && |
| 418 context.selector->GetPseudoType() == CSSSelector::kPseudoShadow) |
| 419 Deprecation::CountDeprecation(context.element->GetDocument(), |
| 420 UseCounter::kCSSSelectorPseudoShadow); |
421 // If we're in the same tree-scope as the scoping element, then following | 421 // If we're in the same tree-scope as the scoping element, then following |
422 // a shadow descendant combinator would escape that and thus the scope. | 422 // a shadow descendant combinator would escape that and thus the scope. |
423 if (context.scope && context.scope->OwnerShadowHost() && | 423 if (context.scope && context.scope->OwnerShadowHost() && |
424 context.scope->OwnerShadowHost()->GetTreeScope() == | 424 context.scope->OwnerShadowHost()->GetTreeScope() == |
425 context.element->GetTreeScope()) | 425 context.element->GetTreeScope()) |
426 return kSelectorFailsCompletely; | 426 return kSelectorFailsCompletely; |
427 | 427 |
428 Element* shadow_host = context.element->OwnerShadowHost(); | 428 Element* shadow_host = context.element->OwnerShadowHost(); |
429 if (!shadow_host) | 429 if (!shadow_host) |
430 return kSelectorFailsCompletely; | 430 return kSelectorFailsCompletely; |
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1372 bool SelectorChecker::MatchesFocusPseudoClass(const Element& element) { | 1372 bool SelectorChecker::MatchesFocusPseudoClass(const Element& element) { |
1373 bool force_pseudo_state = false; | 1373 bool force_pseudo_state = false; |
1374 probe::forcePseudoState(const_cast<Element*>(&element), | 1374 probe::forcePseudoState(const_cast<Element*>(&element), |
1375 CSSSelector::kPseudoFocus, &force_pseudo_state); | 1375 CSSSelector::kPseudoFocus, &force_pseudo_state); |
1376 if (force_pseudo_state) | 1376 if (force_pseudo_state) |
1377 return true; | 1377 return true; |
1378 return element.IsFocused() && IsFrameFocused(element); | 1378 return element.IsFocused() && IsFrameFocused(element); |
1379 } | 1379 } |
1380 | 1380 |
1381 } // namespace blink | 1381 } // namespace blink |
OLD | NEW |