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

Side by Side Diff: Source/core/css/resolver/StyleResolver.cpp

Issue 143653010: Refactor RuleFeatureSet to simplify iteration over CSS Selectors when collecting data. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Merged. Created 6 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 | Annotate | Revision Log
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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 326
327 m_styleTree.collectFeaturesTo(m_features); 327 m_styleTree.collectFeaturesTo(m_features);
328 328
329 m_siblingRuleSet = makeRuleSet(m_features.siblingRules); 329 m_siblingRuleSet = makeRuleSet(m_features.siblingRules);
330 m_uncommonAttributeRuleSet = makeRuleSet(m_features.uncommonAttributeRules); 330 m_uncommonAttributeRuleSet = makeRuleSet(m_features.uncommonAttributeRules);
331 m_needCollectFeatures = false; 331 m_needCollectFeatures = false;
332 } 332 }
333 333
334 bool StyleResolver::hasRulesForId(const AtomicString& id) const 334 bool StyleResolver::hasRulesForId(const AtomicString& id) const
335 { 335 {
336 return m_features.idsInRules.contains(id); 336 return m_features.hasSelectorForId(id);
337 } 337 }
338 338
339 void StyleResolver::addToStyleSharingList(Element& element) 339 void StyleResolver::addToStyleSharingList(Element& element)
340 { 340 {
341 // Never add elements to the style sharing list if we're not in a recalcStyl e, 341 // Never add elements to the style sharing list if we're not in a recalcStyl e,
342 // otherwise we could leave stale pointers in there. 342 // otherwise we could leave stale pointers in there.
343 if (!document().inStyleRecalc()) 343 if (!document().inStyleRecalc())
344 return; 344 return;
345 INCREMENT_STYLE_STATS_COUNTER(*this, sharedStyleCandidates); 345 INCREMENT_STYLE_STATS_COUNTER(*this, sharedStyleCandidates);
346 if (m_styleSharingList.size() >= styleSharingListSize) 346 if (m_styleSharingList.size() >= styleSharingListSize)
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 621
622 static inline void resetDirectionAndWritingModeOnDocument(Document& document) 622 static inline void resetDirectionAndWritingModeOnDocument(Document& document)
623 { 623 {
624 document.setDirectionSetOnDocumentElement(false); 624 document.setDirectionSetOnDocumentElement(false);
625 document.setWritingModeSetOnDocumentElement(false); 625 document.setWritingModeSetOnDocumentElement(false);
626 } 626 }
627 627
628 static void addContentAttrValuesToFeatures(const Vector<AtomicString>& contentAt trValues, RuleFeatureSet& features) 628 static void addContentAttrValuesToFeatures(const Vector<AtomicString>& contentAt trValues, RuleFeatureSet& features)
629 { 629 {
630 for (size_t i = 0; i < contentAttrValues.size(); ++i) 630 for (size_t i = 0; i < contentAttrValues.size(); ++i)
631 features.attrsInRules.add(contentAttrValues[i]); 631 features.addAttributeInASelector(contentAttrValues[i]);
632 } 632 }
633 633
634 PassRefPtr<RenderStyle> StyleResolver::styleForElement(Element* element, RenderS tyle* defaultParent, StyleSharingBehavior sharingBehavior, 634 PassRefPtr<RenderStyle> StyleResolver::styleForElement(Element* element, RenderS tyle* defaultParent, StyleSharingBehavior sharingBehavior,
635 RuleMatchingBehavior matchingBehavior, RenderRegion* regionForStyling) 635 RuleMatchingBehavior matchingBehavior, RenderRegion* regionForStyling)
636 { 636 {
637 ASSERT(document().frame()); 637 ASSERT(document().frame());
638 ASSERT(documentSettings()); 638 ASSERT(documentSettings());
639 ASSERT(!hasPendingAuthorStyleSheets()); 639 ASSERT(!hasPendingAuthorStyleSheets());
640 ASSERT(!m_needCollectFeatures); 640 ASSERT(!m_needCollectFeatures);
641 641
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 bool StyleResolver::mediaQueryAffectedByViewportChange() const 1514 bool StyleResolver::mediaQueryAffectedByViewportChange() const
1515 { 1515 {
1516 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) { 1516 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) {
1517 if (m_medium->eval(&m_viewportDependentMediaQueryResults[i]->m_expressio n) != m_viewportDependentMediaQueryResults[i]->m_result) 1517 if (m_medium->eval(&m_viewportDependentMediaQueryResults[i]->m_expressio n) != m_viewportDependentMediaQueryResults[i]->m_result)
1518 return true; 1518 return true;
1519 } 1519 }
1520 return false; 1520 return false;
1521 } 1521 }
1522 1522
1523 } // namespace WebCore 1523 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/resolver/SharedStyleFinder.cpp ('k') | Source/core/dom/shadow/SelectRuleFeatureSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698