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

Side by Side Diff: Source/core/css/RuleFeature.cpp

Issue 861553003: Invalidate CustomScrollbars on having window-inactive selector. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: addressed review comments Created 5 years, 11 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 | « Source/core/css/RuleFeature.h ('k') | Source/core/dom/StyleEngine.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 Apple Inc. All r ights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r ights 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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 return *addResult.storedValue->value; 473 return *addResult.storedValue->value;
474 } 474 }
475 475
476 void RuleFeatureSet::collectFeaturesFromSelector(const CSSSelector& selector, Ru leFeatureSet::FeatureMetadata& metadata) 476 void RuleFeatureSet::collectFeaturesFromSelector(const CSSSelector& selector, Ru leFeatureSet::FeatureMetadata& metadata)
477 { 477 {
478 unsigned maxDirectAdjacentSelectors = 0; 478 unsigned maxDirectAdjacentSelectors = 0;
479 479
480 for (const CSSSelector* current = &selector; current; current = current->tag History()) { 480 for (const CSSSelector* current = &selector; current; current = current->tag History()) {
481 if (current->pseudoType() == CSSSelector::PseudoFirstLine) 481 if (current->pseudoType() == CSSSelector::PseudoFirstLine)
482 metadata.usesFirstLineRules = true; 482 metadata.usesFirstLineRules = true;
483 if (current->pseudoType() == CSSSelector::PseudoWindowInactive)
484 metadata.usesWindowInactiveSelector = true;
483 if (current->isDirectAdjacentSelector()) { 485 if (current->isDirectAdjacentSelector()) {
484 maxDirectAdjacentSelectors++; 486 maxDirectAdjacentSelectors++;
485 } else if (maxDirectAdjacentSelectors) { 487 } else if (maxDirectAdjacentSelectors) {
486 if (maxDirectAdjacentSelectors > metadata.maxDirectAdjacentSelectors ) 488 if (maxDirectAdjacentSelectors > metadata.maxDirectAdjacentSelectors )
487 metadata.maxDirectAdjacentSelectors = maxDirectAdjacentSelectors ; 489 metadata.maxDirectAdjacentSelectors = maxDirectAdjacentSelectors ;
488 maxDirectAdjacentSelectors = 0; 490 maxDirectAdjacentSelectors = 0;
489 } 491 }
490 if (current->isSiblingSelector()) 492 if (current->isSiblingSelector())
491 metadata.foundSiblingSelector = true; 493 metadata.foundSiblingSelector = true;
492 494
493 const CSSSelectorList* selectorList = current->selectorList(); 495 const CSSSelectorList* selectorList = current->selectorList();
494 if (!selectorList) 496 if (!selectorList)
495 continue; 497 continue;
496 498
497 for (const CSSSelector* selector = selectorList->first(); selector; sele ctor = CSSSelectorList::next(*selector)) 499 for (const CSSSelector* selector = selectorList->first(); selector; sele ctor = CSSSelectorList::next(*selector))
498 collectFeaturesFromSelector(*selector, metadata); 500 collectFeaturesFromSelector(*selector, metadata);
499 } 501 }
500 502
501 ASSERT(!maxDirectAdjacentSelectors); 503 ASSERT(!maxDirectAdjacentSelectors);
502 } 504 }
503 505
504 void RuleFeatureSet::FeatureMetadata::add(const FeatureMetadata& other) 506 void RuleFeatureSet::FeatureMetadata::add(const FeatureMetadata& other)
505 { 507 {
506 usesFirstLineRules = usesFirstLineRules || other.usesFirstLineRules; 508 usesFirstLineRules = usesFirstLineRules || other.usesFirstLineRules;
509 usesWindowInactiveSelector = usesWindowInactiveSelector || other.usesWindowI nactiveSelector;
507 maxDirectAdjacentSelectors = std::max(maxDirectAdjacentSelectors, other.maxD irectAdjacentSelectors); 510 maxDirectAdjacentSelectors = std::max(maxDirectAdjacentSelectors, other.maxD irectAdjacentSelectors);
508 } 511 }
509 512
510 void RuleFeatureSet::FeatureMetadata::clear() 513 void RuleFeatureSet::FeatureMetadata::clear()
511 { 514 {
512 usesFirstLineRules = false; 515 usesFirstLineRules = false;
516 usesWindowInactiveSelector = false;
513 foundSiblingSelector = false; 517 foundSiblingSelector = false;
514 maxDirectAdjacentSelectors = 0; 518 maxDirectAdjacentSelectors = 0;
515 } 519 }
516 520
517 void RuleFeatureSet::add(const RuleFeatureSet& other) 521 void RuleFeatureSet::add(const RuleFeatureSet& other)
518 { 522 {
519 for (const auto& invalidationSet : other.m_classInvalidationSets) 523 for (const auto& invalidationSet : other.m_classInvalidationSets)
520 ensureClassInvalidationSet(invalidationSet.key).combine(*invalidationSet .value); 524 ensureClassInvalidationSet(invalidationSet.key).combine(*invalidationSet .value);
521 for (const auto& invalidationSet : other.m_attributeInvalidationSets) 525 for (const auto& invalidationSet : other.m_attributeInvalidationSets)
522 ensureAttributeInvalidationSet(invalidationSet.key).combine(*invalidatio nSet.value); 526 ensureAttributeInvalidationSet(invalidationSet.key).combine(*invalidatio nSet.value);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 visitor->trace(uncommonAttributeRules); 644 visitor->trace(uncommonAttributeRules);
641 visitor->trace(m_classInvalidationSets); 645 visitor->trace(m_classInvalidationSets);
642 visitor->trace(m_attributeInvalidationSets); 646 visitor->trace(m_attributeInvalidationSets);
643 visitor->trace(m_idInvalidationSets); 647 visitor->trace(m_idInvalidationSets);
644 visitor->trace(m_pseudoInvalidationSets); 648 visitor->trace(m_pseudoInvalidationSets);
645 visitor->trace(m_styleInvalidator); 649 visitor->trace(m_styleInvalidator);
646 #endif 650 #endif
647 } 651 }
648 652
649 } // namespace blink 653 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/RuleFeature.h ('k') | Source/core/dom/StyleEngine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698