Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: third_party/WebKit/Source/core/css/SelectorChecker.cpp

Issue 2778983006: Make /deep/ as no-op and remove ::shadow in dynamic profile (Closed)
Patch Set: rebased Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
340 case CSSSelector::kDescendant: 344 case CSSSelector::kDescendant:
341 if (context.selector->RelationIsAffectedByPseudoContent()) { 345 if (context.selector->RelationIsAffectedByPseudoContent()) {
342 for (Element* element = context.element; element; 346 for (Element* element = context.element; element;
343 element = element->parentElement()) { 347 element = element->parentElement()) {
344 if (MatchForPseudoContent(next_context, *element, result) == 348 if (MatchForPseudoContent(next_context, *element, result) ==
345 kSelectorMatches) 349 kSelectorMatches)
346 return kSelectorMatches; 350 return kSelectorMatches;
347 } 351 }
348 return kSelectorFailsCompletely; 352 return kSelectorFailsCompletely;
349 } 353 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 next_context.element = 411 next_context.element =
408 ElementTraversal::PreviousSibling(*next_context.element)) { 412 ElementTraversal::PreviousSibling(*next_context.element)) {
409 MatchStatus match = MatchSelector(next_context, result); 413 MatchStatus match = MatchSelector(next_context, result);
410 if (match == kSelectorMatches || match == kSelectorFailsAllSiblings || 414 if (match == kSelectorMatches || match == kSelectorFailsAllSiblings ||
411 match == kSelectorFailsCompletely) 415 match == kSelectorFailsCompletely)
412 return match; 416 return match;
413 } 417 }
414 return kSelectorFailsAllSiblings; 418 return kSelectorFailsAllSiblings;
415 419
416 case CSSSelector::kShadowPseudo: { 420 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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSSelector.cpp ('k') | third_party/WebKit/Source/core/css/SelectorFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698