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

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

Issue 1988543002: Better counting of /deep/ usage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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. 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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 368
369 case CSSSelector::ShadowDeep: 369 case CSSSelector::ShadowDeep:
370 { 370 {
371 if (!m_isUARule && !m_isQuerySelector) 371 if (!m_isUARule && !m_isQuerySelector)
372 Deprecation::countDeprecation(context.element->document(), UseCo unter::CSSDeepCombinator); 372 Deprecation::countDeprecation(context.element->document(), UseCo unter::CSSDeepCombinator);
373 if (ShadowRoot* root = context.element->containingShadowRoot()) { 373 if (ShadowRoot* root = context.element->containingShadowRoot()) {
374 if (root->type() == ShadowRootType::UserAgent) 374 if (root->type() == ShadowRootType::UserAgent)
375 return SelectorFailsCompletely; 375 return SelectorFailsCompletely;
376 } 376 }
377 377
378
378 if (context.selector->relationIsAffectedByPseudoContent()) { 379 if (context.selector->relationIsAffectedByPseudoContent()) {
379 // TODO(kochi): closed mode tree should be handled as well for : :content. 380 // TODO(kochi): closed mode tree should be handled as well for : :content.
380 for (Element* element = context.element; element; element = elem ent->parentOrShadowHostElement()) { 381 for (Element* element = context.element; element; element = elem ent->parentOrShadowHostElement()) {
381 if (matchForPseudoContent(nextContext, *element, result) == SelectorMatches) 382 if (matchForPseudoContent(nextContext, *element, result) == SelectorMatches) {
383 if (context.element->isInShadowTree())
384 UseCounter::count(context.element->document(), UseCo unter::CSSDeepCombinatorAndShadow);
382 return SelectorMatches; 385 return SelectorMatches;
386 }
383 } 387 }
384 return SelectorFailsCompletely; 388 return SelectorFailsCompletely;
385 } 389 }
386 390
387 for (nextContext.element = parentOrV0ShadowHostElement(*context.elem ent); nextContext.element; nextContext.element = parentOrV0ShadowHostElement(*ne xtContext.element)) { 391 for (nextContext.element = parentOrV0ShadowHostElement(*context.elem ent); nextContext.element; nextContext.element = parentOrV0ShadowHostElement(*ne xtContext.element)) {
388 Match match = matchSelector(nextContext, result); 392 Match match = matchSelector(nextContext, result);
393 if (match == SelectorMatches && context.element->isInShadowTree( ))
394 UseCounter::count(context.element->document(), UseCounter::C SSDeepCombinatorAndShadow);
389 if (match == SelectorMatches || match == SelectorFailsCompletely ) 395 if (match == SelectorMatches || match == SelectorFailsCompletely )
390 return match; 396 return match;
391 if (nextSelectorExceedsScope(nextContext)) 397 if (nextSelectorExceedsScope(nextContext))
392 return SelectorFailsCompletely; 398 return SelectorFailsCompletely;
393 } 399 }
394 return SelectorFailsCompletely; 400 return SelectorFailsCompletely;
395 } 401 }
396 402
397 case CSSSelector::ShadowSlot: 403 case CSSSelector::ShadowSlot:
398 { 404 {
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 } 1157 }
1152 1158
1153 bool SelectorChecker::matchesFocusPseudoClass(const Element& element) 1159 bool SelectorChecker::matchesFocusPseudoClass(const Element& element)
1154 { 1160 {
1155 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element ), CSSSelector::PseudoFocus)) 1161 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element ), CSSSelector::PseudoFocus))
1156 return true; 1162 return true;
1157 return element.focused() && isFrameFocused(element); 1163 return element.focused() && isFrameFocused(element);
1158 } 1164 }
1159 1165
1160 } // namespace blink 1166 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698