Split author style code out from DocumentStyleSheetCollection
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Sep 2015 15:04:16 +0000 (15:04 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Sep 2015 15:04:16 +0000 (15:04 +0000)
commit8ad5b89e718e70a5e530f18e15c1d4b0ccfbcb4b
tree9ba782e7dd33ce2c68ae9124b2b813e2b83045a0
parent47cc68285a0c620fd8a01486f9dfdc1543635720
Split author style code out from DocumentStyleSheetCollection
https://bugs.webkit.org/show_bug.cgi?id=149446

Reviewed by Andreas Kling.

Shadow trees may have their own author style. Factor the related code out so we can use
it outside the document context.

DocumentStyleSheetCollection is replaced by two classes:

AuthorStyleSheets - author stylesheets and mutation optimization code
ExtensionStyleSheets - user stylesheets, injected author stylesheets, content extension stylesheets

* WebCore.xcodeproj/project.pbxproj:
* contentextensions/ContentExtensionsBackend.cpp:
(WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForLoad):
* css/CSSStyleSheet.cpp:
(WebCore::CSSStyleSheet::didMutateRules):
* css/DocumentRuleSets.cpp:
(WebCore::DocumentRuleSets::~DocumentRuleSets):
(WebCore::DocumentRuleSets::initUserStyle):
* css/DocumentRuleSets.h:
(WebCore::DocumentRuleSets::sibling):
(WebCore::DocumentRuleSets::uncommonAttribute):
* css/InspectorCSSOMWrappers.cpp:
(WebCore::InspectorCSSOMWrappers::collectFromStyleSheets):
(WebCore::InspectorCSSOMWrappers::getWrapperForRuleInSheets):
(WebCore::InspectorCSSOMWrappers::collectFromDocumentStyleSheetCollection): Deleted.
* css/InspectorCSSOMWrappers.h:
* css/StyleResolver.cpp:
(WebCore::StyleResolver::StyleResolver):
(WebCore::StyleResolver::appendAuthorStyleSheets):
* css/StyleSheetList.cpp:
(WebCore::StyleSheetList::styleSheets):
(WebCore::StyleSheetList::detachFromDocument):
(WebCore::StyleSheetList::length):
* dom/AuthorStyleSheets.cpp: Added.
(WebCore::AuthorStyleSheets::AuthorStyleSheets):
(WebCore::AuthorStyleSheets::combineCSSFeatureFlags):
(WebCore::AuthorStyleSheets::resetCSSFeatureFlags):
(WebCore::AuthorStyleSheets::addAuthorSheet):
(WebCore::AuthorStyleSheets::removePendingSheet):
(WebCore::AuthorStyleSheets::addStyleSheetCandidateNode):
(WebCore::AuthorStyleSheets::removeStyleSheetCandidateNode):
(WebCore::AuthorStyleSheets::collectActiveStyleSheets):
(WebCore::AuthorStyleSheets::analyzeStyleSheetChange):
(WebCore::filterEnabledNonemptyCSSStyleSheets):
(WebCore::AuthorStyleSheets::updateActiveStyleSheets):
(WebCore::AuthorStyleSheets::activeStyleSheetsForInspector):
(WebCore::AuthorStyleSheets::activeStyleSheetsContains):
(WebCore::AuthorStyleSheets::detachFromDocument):
* dom/AuthorStyleSheets.h: Added.
(WebCore::AuthorStyleSheets::activeStyleSheets):
(WebCore::AuthorStyleSheets::styleSheets):
(WebCore::AuthorStyleSheets::styleSheetsForStyleSheetList):
(WebCore::AuthorStyleSheets::pendingUpdateType):
(WebCore::AuthorStyleSheets::setPendingUpdateType):
(WebCore::AuthorStyleSheets::flushPendingUpdates):
(WebCore::AuthorStyleSheets::preferredStylesheetSetName):
(WebCore::AuthorStyleSheets::selectedStylesheetSetName):
(WebCore::AuthorStyleSheets::setPreferredStylesheetSetName):
(WebCore::AuthorStyleSheets::setSelectedStylesheetSetName):
(WebCore::AuthorStyleSheets::addPendingSheet):
(WebCore::AuthorStyleSheets::hasPendingSheets):
(WebCore::AuthorStyleSheets::usesFirstLineRules):
(WebCore::AuthorStyleSheets::usesFirstLetterRules):
(WebCore::AuthorStyleSheets::usesRemUnits):
(WebCore::AuthorStyleSheets::setUsesRemUnit):
(WebCore::AuthorStyleSheets::usesStyleBasedEditability):
(WebCore::AuthorStyleSheets::setUsesStyleBasedEditability):
* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::~Document):
(WebCore::Document::setCompatibilityMode):
(WebCore::Document::recalcStyle):
(WebCore::Document::createStyleResolver):
(WebCore::Document::fontsNeedUpdate):
(WebCore::Document::usesStyleBasedEditability):
(WebCore::Document::processHttpEquiv):
(WebCore::Document::preferredStylesheetSet):
(WebCore::Document::selectedStylesheetSet):
(WebCore::Document::setSelectedStylesheetSet):
(WebCore::Document::scheduleOptimizedStyleSheetUpdate):
(WebCore::Document::styleResolverChanged):
(WebCore::Document::haveStylesheetsLoaded):
(WebCore::Document::getCachedLocale):
* dom/Document.h:
(WebCore::Document::authorStyleSheets):
(WebCore::Document::extensionStyleSheets):
(WebCore::Document::gotoAnchorNeededAfterStylesheetsLoad):
(WebCore::Document::setGotoAnchorNeededAfterStylesheetsLoad):
(WebCore::Document::styleSheetCollection): Deleted.
* dom/DocumentStyleSheetCollection.cpp: Removed.
* dom/DocumentStyleSheetCollection.h: Removed.
* dom/ExtensionStyleSheets.cpp: Copied from Source/WebCore/dom/DocumentStyleSheetCollection.cpp.
(WebCore::ExtensionStyleSheets::ExtensionStyleSheets):
(WebCore::ExtensionStyleSheets::pageUserSheet):
(WebCore::ExtensionStyleSheets::clearPageUserSheet):
(WebCore::ExtensionStyleSheets::updatePageUserSheet):
(WebCore::ExtensionStyleSheets::injectedUserStyleSheets):
(WebCore::ExtensionStyleSheets::injectedAuthorStyleSheets):
(WebCore::ExtensionStyleSheets::updateInjectedStyleSheetCache):
(WebCore::ExtensionStyleSheets::invalidateInjectedStyleSheetCache):
(WebCore::ExtensionStyleSheets::addUserSheet):
(WebCore::ExtensionStyleSheets::addDisplayNoneSelector):
(WebCore::ExtensionStyleSheets::maybeAddContentExtensionSheet):
(WebCore::ExtensionStyleSheets::styleResolverChangedTimerFired):
(WebCore::ExtensionStyleSheets::detachFromDocument):
(WebCore::DocumentStyleSheetCollection::DocumentStyleSheetCollection): Deleted.
(WebCore::DocumentStyleSheetCollection::combineCSSFeatureFlags): Deleted.
(WebCore::DocumentStyleSheetCollection::resetCSSFeatureFlags): Deleted.
(WebCore::DocumentStyleSheetCollection::pageUserSheet): Deleted.
(WebCore::DocumentStyleSheetCollection::clearPageUserSheet): Deleted.
(WebCore::DocumentStyleSheetCollection::updatePageUserSheet): Deleted.
(WebCore::DocumentStyleSheetCollection::injectedUserStyleSheets): Deleted.
(WebCore::DocumentStyleSheetCollection::injectedAuthorStyleSheets): Deleted.
(WebCore::DocumentStyleSheetCollection::updateInjectedStyleSheetCache): Deleted.
(WebCore::DocumentStyleSheetCollection::invalidateInjectedStyleSheetCache): Deleted.
(WebCore::DocumentStyleSheetCollection::addAuthorSheet): Deleted.
(WebCore::DocumentStyleSheetCollection::addUserSheet): Deleted.
(WebCore::DocumentStyleSheetCollection::addDisplayNoneSelector): Deleted.
(WebCore::DocumentStyleSheetCollection::maybeAddContentExtensionSheet): Deleted.
(WebCore::DocumentStyleSheetCollection::styleResolverChangedTimerFired): Deleted.
(WebCore::DocumentStyleSheetCollection::removePendingSheet): Deleted.
(WebCore::DocumentStyleSheetCollection::addStyleSheetCandidateNode): Deleted.
(WebCore::DocumentStyleSheetCollection::removeStyleSheetCandidateNode): Deleted.
(WebCore::DocumentStyleSheetCollection::collectActiveStyleSheets): Deleted.
(WebCore::DocumentStyleSheetCollection::analyzeStyleSheetChange): Deleted.
(WebCore::filterEnabledNonemptyCSSStyleSheets): Deleted.
(WebCore::DocumentStyleSheetCollection::updateActiveStyleSheets): Deleted.
(WebCore::DocumentStyleSheetCollection::activeStyleSheetsForInspector): Deleted.
(WebCore::DocumentStyleSheetCollection::activeStyleSheetsContains): Deleted.
(WebCore::DocumentStyleSheetCollection::detachFromDocument): Deleted.
* dom/ExtensionStyleSheets.h: Copied from Source/WebCore/dom/DocumentStyleSheetCollection.h.
(WebCore::ExtensionStyleSheets::documentUserStyleSheets):
(WebCore::DocumentStyleSheetCollection::styleSheetsForStyleSheetList): Deleted.
(WebCore::DocumentStyleSheetCollection::activeAuthorStyleSheets): Deleted.
(WebCore::DocumentStyleSheetCollection::documentUserStyleSheets): Deleted.
(WebCore::DocumentStyleSheetCollection::documentAuthorStyleSheets): Deleted.
(WebCore::DocumentStyleSheetCollection::pendingUpdateType): Deleted.
(WebCore::DocumentStyleSheetCollection::setPendingUpdateType): Deleted.
(WebCore::DocumentStyleSheetCollection::flushPendingUpdates): Deleted.
(WebCore::DocumentStyleSheetCollection::preferredStylesheetSetName): Deleted.
(WebCore::DocumentStyleSheetCollection::selectedStylesheetSetName): Deleted.
(WebCore::DocumentStyleSheetCollection::setPreferredStylesheetSetName): Deleted.
(WebCore::DocumentStyleSheetCollection::setSelectedStylesheetSetName): Deleted.
(WebCore::DocumentStyleSheetCollection::addPendingSheet): Deleted.
(WebCore::DocumentStyleSheetCollection::hasPendingSheets): Deleted.
(WebCore::DocumentStyleSheetCollection::usesFirstLineRules): Deleted.
(WebCore::DocumentStyleSheetCollection::usesFirstLetterRules): Deleted.
(WebCore::DocumentStyleSheetCollection::usesRemUnits): Deleted.
(WebCore::DocumentStyleSheetCollection::setUsesRemUnit): Deleted.
(WebCore::DocumentStyleSheetCollection::usesStyleBasedEditability): Deleted.
(WebCore::DocumentStyleSheetCollection::setUsesStyleBasedEditability): Deleted.
* dom/InlineStyleSheetOwner.cpp:
(WebCore::InlineStyleSheetOwner::insertedIntoDocument):
(WebCore::InlineStyleSheetOwner::removedFromDocument):
(WebCore::InlineStyleSheetOwner::clearDocumentData):
(WebCore::InlineStyleSheetOwner::childrenChanged):
(WebCore::InlineStyleSheetOwner::createSheet):
(WebCore::InlineStyleSheetOwner::sheetLoaded):
(WebCore::InlineStyleSheetOwner::startLoadingDynamicSheet):
* dom/ProcessingInstruction.cpp:
(WebCore::ProcessingInstruction::~ProcessingInstruction):
(WebCore::ProcessingInstruction::nodeName):
(WebCore::ProcessingInstruction::checkStyleSheet):
(WebCore::ProcessingInstruction::sheetLoaded):
(WebCore::ProcessingInstruction::insertedInto):
(WebCore::ProcessingInstruction::removedFrom):
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::~HTMLLinkElement):
(WebCore::HTMLLinkElement::insertedInto):
(WebCore::HTMLLinkElement::removedFrom):
(WebCore::HTMLLinkElement::addPendingSheet):
(WebCore::HTMLLinkElement::removePendingSheet):
* html/HTMLQuoteElement.cpp:
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::collectAllDocumentStyleSheets):
(WebCore::InspectorCSSAgent::buildObjectForRule):
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::commitData):
* page/Page.cpp:
(WebCore::Page::userStyleSheetLocationChanged):
(WebCore::Page::setUserContentController):
* page/PageGroup.cpp:
* page/UserContentController.cpp:
(WebCore::UserContentController::invalidateInjectedStyleSheetCacheInAllFrames):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::lineHeight):
(WebCore::RenderBlock::getFirstLetter):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::uncachedFirstLineStyle):
(WebCore::RenderElement::cachedFirstLineStyle):
* rendering/RenderElement.h:
(WebCore::RenderElement::firstLineStyle):
(WebCore::RenderElement::setAncestorLineBoxDirty):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::updateAlwaysCreateLineBoxes):
(WebCore::RenderInline::lineHeight):
* rendering/RenderLineBreak.cpp:
(WebCore::RenderLineBreak::lineHeight):
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::verticalPositionForBox):
* style/StyleResolveTree.cpp:
(WebCore::Style::resolveLocal):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@190169 268f45cc-cd09-0410-ab3c-d52691b4dbfc
37 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/contentextensions/ContentExtensionsBackend.cpp
Source/WebCore/css/CSSStyleSheet.cpp
Source/WebCore/css/DocumentRuleSets.cpp
Source/WebCore/css/DocumentRuleSets.h
Source/WebCore/css/InspectorCSSOMWrappers.cpp
Source/WebCore/css/InspectorCSSOMWrappers.h
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/css/StyleSheetList.cpp
Source/WebCore/dom/AuthorStyleSheets.cpp [moved from Source/WebCore/dom/DocumentStyleSheetCollection.cpp with 58% similarity]
Source/WebCore/dom/AuthorStyleSheets.h [moved from Source/WebCore/dom/DocumentStyleSheetCollection.h with 59% similarity]
Source/WebCore/dom/DOMAllInOne.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/ExtensionStyleSheets.cpp [new file with mode: 0644]
Source/WebCore/dom/ExtensionStyleSheets.h [new file with mode: 0644]
Source/WebCore/dom/InlineStyleSheetOwner.cpp
Source/WebCore/dom/ProcessingInstruction.cpp
Source/WebCore/html/HTMLLinkElement.cpp
Source/WebCore/html/HTMLQuoteElement.cpp
Source/WebCore/inspector/InspectorCSSAgent.cpp
Source/WebCore/loader/DocumentLoader.cpp
Source/WebCore/page/Page.cpp
Source/WebCore/page/PageGroup.cpp
Source/WebCore/page/UserContentController.cpp
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderElement.cpp
Source/WebCore/rendering/RenderElement.h
Source/WebCore/rendering/RenderInline.cpp
Source/WebCore/rendering/RenderLineBreak.cpp
Source/WebCore/rendering/RenderView.h
Source/WebCore/rendering/RootInlineBox.cpp
Source/WebCore/style/StyleResolveTree.cpp
Source/WebCore/testing/Internals.cpp