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

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

Issue 1349543004: CSS: Avoid invalidating style when only descendants need updating (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: invalidatesSelf Created 5 years, 3 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 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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 311
312 if (!contentValue->isValueList()) 312 if (!contentValue->isValueList())
313 return; 313 return;
314 314
315 for (auto& item : toCSSValueList(*contentValue)) { 315 for (auto& item : toCSSValueList(*contentValue)) {
316 if (!item->isFunctionValue()) 316 if (!item->isFunctionValue())
317 continue; 317 continue;
318 CSSFunctionValue* functionValue = toCSSFunctionValue(item.get()); 318 CSSFunctionValue* functionValue = toCSSFunctionValue(item.get());
319 if (functionValue->functionType() != CSSValueAttr) 319 if (functionValue->functionType() != CSSValueAttr)
320 continue; 320 continue;
321 ensureAttributeInvalidationSet(AtomicString(toCSSPrimitiveValue(function Value->item(0))->getStringValue())); 321 ensureAttributeInvalidationSet(AtomicString(toCSSPrimitiveValue(function Value->item(0))->getStringValue())).setInvalidatesSelf();
322 } 322 }
323 } 323 }
324 324
325 std::pair<const CSSSelector*, RuleFeatureSet::UseFeaturesType> 325 std::pair<const CSSSelector*, RuleFeatureSet::UseFeaturesType>
326 RuleFeatureSet::extractInvalidationSetFeatures(const CSSSelector& selector, Inva lidationSetFeatures& features, bool negated) 326 RuleFeatureSet::extractInvalidationSetFeatures(const CSSSelector& selector, Inva lidationSetFeatures& features, bool negated)
327 { 327 {
328 bool foundFeatures = false; 328 bool foundFeatures = false;
329 for (const CSSSelector* current = &selector; current; current = current->tag History()) { 329 for (const CSSSelector* current = &selector; current; current = current->tag History()) {
330 if (!negated) 330 if (!negated)
331 foundFeatures |= extractInvalidationSetFeature(*current, features); 331 foundFeatures |= extractInvalidationSetFeature(*current, features);
332 // Initialize the entry in the invalidation set map, if supported. 332 // Initialize the entry in the invalidation set map, if supported.
333 if (!invalidationSetForSelector(*current)) { 333 if (InvalidationSet* invalidationSet = invalidationSetForSelector(*curre nt)) {
334 invalidationSet->setInvalidatesSelf();
335 } else {
334 if (requiresSubtreeInvalidation(*current)) { 336 if (requiresSubtreeInvalidation(*current)) {
335 // Fall back to use subtree invalidations, even for features in the 337 // Fall back to use subtree invalidations, even for features in the
336 // rightmost compound selector. Returning the start &selector he re 338 // rightmost compound selector. Returning the start &selector he re
337 // will make addFeaturesToInvalidationSets start marking invalid ation 339 // will make addFeaturesToInvalidationSets start marking invalid ation
338 // sets for subtree recalc for features in the rightmost compoun d 340 // sets for subtree recalc for features in the rightmost compoun d
339 // selector. 341 // selector.
340 return std::make_pair(&selector, ForceSubtree); 342 return std::make_pair(&selector, ForceSubtree);
341 } 343 }
342 if (const CSSSelectorList* selectorList = current->selectorList()) { 344 if (const CSSSelectorList* selectorList = current->selectorList()) {
343 ASSERT(supportsInvalidationWithSelectorList(current->pseudoType( ))); 345 ASSERT(supportsInvalidationWithSelectorList(current->pseudoType( )));
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 visitor->trace(siblingRules); 587 visitor->trace(siblingRules);
586 visitor->trace(uncommonAttributeRules); 588 visitor->trace(uncommonAttributeRules);
587 visitor->trace(m_classInvalidationSets); 589 visitor->trace(m_classInvalidationSets);
588 visitor->trace(m_attributeInvalidationSets); 590 visitor->trace(m_attributeInvalidationSets);
589 visitor->trace(m_idInvalidationSets); 591 visitor->trace(m_idInvalidationSets);
590 visitor->trace(m_pseudoInvalidationSets); 592 visitor->trace(m_pseudoInvalidationSets);
591 #endif 593 #endif
592 } 594 }
593 595
594 } // namespace blink 596 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/media/track/cue-style-invalidation-expected.txt ('k') | Source/core/css/invalidation/InvalidationSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698