Split each RuleSet and feature out from StyleResolver into its own class.
authorhayato@chromium.org <hayato@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Feb 2013 04:28:57 +0000 (04:28 +0000)
committerhayato@chromium.org <hayato@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Feb 2013 04:28:57 +0000 (04:28 +0000)
commit61f2991baa3b95aa9befab63964ee42233de7b19
tree0e9b29efa009474fdf952136a78341c217dbf3f5
parent85bc0cd584e14c5ed4792d76d18a46853ad104d9
Split each RuleSet and feature out from StyleResolver into its own class.
https://bugs.webkit.org/show_bug.cgi?id=107777

Reviewed by Dimitri Glazkov.

Splitting each RuleSet and feature out from StyleResover into its onw class, DocumentRuleSets,
to manage them separately.

This is one of the attempts to try to resolve meta bug (bug 89879)
to lose StyleResolver's weight.  We need further action to factor
StyleResolver to separate it into some classes cleanly.
See also https://bugs.webkit.org/show_bug.cgi?id=108890. A following patch will address that.

No tests. No change in behavior.

* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.gypi:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSAllInOne.cpp:
* css/DocumentRuleSets.cpp: Added.
(WebCore):
(WebCore::DocumentRuleSets::DocumentRuleSets):
(WebCore::DocumentRuleSets::~DocumentRuleSets):
(WebCore::DocumentRuleSets::initUserStyle): New helper to initialize each RuleSets.
(WebCore::DocumentRuleSets::collectRulesFromUserStyleSheets): Factored out from StyleResolver.
(WebCore::makeRuleSet): Ditto.
(WebCore::DocumentRuleSets::resetAuthorStyle): Ditto.
(WebCore::DocumentRuleSets::appendAuthorStyleSheets): Ditto.
(WebCore::DocumentRuleSets::collectFeatures): Ditto.
(WebCore::DocumentRuleSets::reportMemoryUsage): New methods to report memory usage. Factored out from StyleResolver.
* css/DocumentRuleSets.h: Added.
(WebCore):
(DocumentRuleSets):
(WebCore::DocumentRuleSets::authorStyle): Moved from StyleResolver.
(WebCore::DocumentRuleSets::userStyle): Ditto.
(WebCore::DocumentRuleSets::features): Ditto.
(WebCore::DocumentRuleSets::sibling): Ditto.
(WebCore::DocumentRuleSets::uncommonAttribute): Ditto.
* css/StyleResolver.cpp:
(WebCore::StyleResolver::StyleResolver):
(WebCore::StyleResolver::appendAuthorStyleSheets): Now calls DocumentRuleSets::appendAuthorStyleSheets.
(WebCore::StyleResolver::matchAuthorRules): Use m_ruleSets.
(WebCore::StyleResolver::matchUserRules): Ditto.
(WebCore::StyleResolver::classNamesAffectedByRules): Ditto.
(WebCore::StyleResolver::locateCousinList): Ditto.
(WebCore::StyleResolver::canShareStyleWithElement): Ditto.
(WebCore::StyleResolver::locateSharedStyle): Ditto.
(WebCore::StyleResolver::styleForPage): Ditto.
(WebCore::StyleResolver::checkRegionStyle): Ditto.
(WebCore::StyleResolver::applyProperty): Ditto.
(WebCore::StyleResolver::reportMemoryUsage): Now calls DocumentRuleSets::reportMemoryUsage.
* css/StyleResolver.h:
(WebCore::StyleResolver::scopeResolver):
(StyleResolver):
(WebCore::StyleResolver::ruleSets): accessor r to DocumentRuleSets.
(WebCore::StyleResolver::usesSiblingRules): Use m_ruleSets.
(WebCore::StyleResolver::usesFirstLineRules): Ditto.
(WebCore::StyleResolver::usesBeforeAfterRules): Ditto.
(WebCore::StyleResolver::hasSelectorForAttribute): Ditto.
(WebCore::StyleResolver::hasSelectorForClass): Ditto.
(WebCore::StyleResolver::hasSelectorForId): Ditto.
* dom/DocumentStyleSheetCollection.cpp:
(WebCore::DocumentStyleSheetCollection::updateActiveStyleSheets):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@141964 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/css/CSSAllInOne.cpp
Source/WebCore/css/DocumentRuleSets.cpp [new file with mode: 0644]
Source/WebCore/css/DocumentRuleSets.h [new file with mode: 0644]
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/css/StyleResolver.h
Source/WebCore/dom/DocumentStyleSheetCollection.cpp