Commit e5a88a78 authored by antti@apple.com's avatar antti@apple.com

Split stylesheet related code out from Document

https://bugs.webkit.org/show_bug.cgi?id=97353

Reviewed by Andreas Kling.

Document is big and unwieldy. The code related to tracking active stylesheets can be factored out.
        
The patch moves stylesheet upkeep, collection and invalidation code from Document to a separate
DocumentStyleSheetCollection class. There are no functional changes.
        
The usesLinkRules stylesheet feature bit and the related code is removed as no one was using it.

* WebCore.xcodeproj/project.pbxproj:
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOneSelector):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::StyleResolver):
(WebCore::StyleResolver::Features::Features):
(WebCore::StyleResolver::Features::add):
(WebCore::StyleResolver::Features::clear):
(WebCore::StyleResolver::collectMatchingRulesForList):
* css/StyleResolver.h:
(WebCore::StyleResolver::usesBeforeAfterRules):
(Features):
* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::~Document):
(WebCore::Document::setCompatibilityMode):
(WebCore::Document::recalcStyle):
(WebCore):
(WebCore::Document::createStyleResolver):
(WebCore::Document::seamlessParentUpdatedStylesheets):
(WebCore::Document::didRemoveAllPendingStylesheet):
(WebCore::Document::processHttpEquiv):
(WebCore::Document::styleSheets):
(WebCore::Document::preferredStylesheetSet):
(WebCore::Document::selectedStylesheetSet):
(WebCore::Document::setSelectedStylesheetSet):
(WebCore::Document::styleResolverChanged):
(WebCore::Document::reportMemoryUsage):
(WebCore::Document::haveStylesheetsLoaded):
* dom/Document.h:
(WebCore):
(Document):
(WebCore::Document::styleSheetCollection):
(WebCore::Document::hasNodesWithPlaceholderStyle):
(WebCore::Document::setNeedsNotifyRemoveAllPendingStylesheet):
(WebCore::Document::inStyleRecalc):
* dom/DocumentStyleSheetCollection.cpp: Added.
(WebCore):
(WebCore::DocumentStyleSheetCollection::DocumentStyleSheetCollection):
(WebCore::DocumentStyleSheetCollection::~DocumentStyleSheetCollection):
(WebCore::DocumentStyleSheetCollection::pageUserSheet):
(WebCore::DocumentStyleSheetCollection::clearPageUserSheet):
(WebCore::DocumentStyleSheetCollection::updatePageUserSheet):
(WebCore::DocumentStyleSheetCollection::pageGroupUserSheets):
(WebCore::DocumentStyleSheetCollection::clearPageGroupUserSheets):
(WebCore::DocumentStyleSheetCollection::updatePageGroupUserSheets):
(WebCore::DocumentStyleSheetCollection::addUserSheet):
(WebCore::DocumentStyleSheetCollection::removePendingSheet):
(WebCore::DocumentStyleSheetCollection::addStyleSheetCandidateNode):
(WebCore::DocumentStyleSheetCollection::removeStyleSheetCandidateNode):
(WebCore::DocumentStyleSheetCollection::collectActiveStyleSheets):
(WebCore::DocumentStyleSheetCollection::testAddedStyleSheetRequiresStyleRecalc):
(WebCore::DocumentStyleSheetCollection::analyzeStyleSheetChange):
(WebCore::styleSheetsUseRemUnits):
(WebCore::DocumentStyleSheetCollection::updateActiveStyleSheets):
(WebCore::DocumentStyleSheetCollection::combineCSSFeatureFlags):
(WebCore::DocumentStyleSheetCollection::resetCSSFeatureFlags):
(WebCore::DocumentStyleSheetCollection::reportMemoryUsage):
* dom/DocumentStyleSheetCollection.h: Added.
(WebCore):
(DocumentStyleSheetCollection):
(WebCore::DocumentStyleSheetCollection::authorStyleSheets):
(WebCore::DocumentStyleSheetCollection::documentUserSheets):
(WebCore::DocumentStyleSheetCollection::needsUpdateActiveStylesheetsOnStyleRecalc):
(WebCore::DocumentStyleSheetCollection::preferredStylesheetSetName):
(WebCore::DocumentStyleSheetCollection::selectedStylesheetSetName):
(WebCore::DocumentStyleSheetCollection::setPreferredStylesheetSetName):
(WebCore::DocumentStyleSheetCollection::setSelectedStylesheetSetName):
(WebCore::DocumentStyleSheetCollection::addPendingSheet):
(WebCore::DocumentStyleSheetCollection::hasPendingSheets):
(WebCore::DocumentStyleSheetCollection::usesSiblingRules):
(WebCore::DocumentStyleSheetCollection::setUsesSiblingRulesOverride):
(WebCore::DocumentStyleSheetCollection::usesFirstLineRules):
(WebCore::DocumentStyleSheetCollection::usesFirstLetterRules):
(WebCore::DocumentStyleSheetCollection::setUsesFirstLetterRules):
(WebCore::DocumentStyleSheetCollection::usesBeforeAfterRules):
(WebCore::DocumentStyleSheetCollection::setUsesBeforeAfterRulesOverride):
(WebCore::DocumentStyleSheetCollection::usesRemUnits):
(WebCore::DocumentStyleSheetCollection::setUsesRemUnit):
* dom/Element.cpp:
(WebCore::Element::recalcStyle):
* dom/ProcessingInstruction.cpp:
(WebCore::ProcessingInstruction::~ProcessingInstruction):
(WebCore::ProcessingInstruction::checkStyleSheet):
(WebCore::ProcessingInstruction::sheetLoaded):
(WebCore::ProcessingInstruction::insertedInto):
(WebCore::ProcessingInstruction::removedFrom):
* dom/StyleElement.cpp:
(WebCore::StyleElement::insertedIntoDocument):
(WebCore::StyleElement::removedFromDocument):
(WebCore::StyleElement::clearDocumentData):
(WebCore::StyleElement::createSheet):
(WebCore::StyleElement::sheetLoaded):
(WebCore::StyleElement::startLoadingDynamicSheet):
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::~HTMLLinkElement):
(WebCore::HTMLLinkElement::insertedInto):
(WebCore::HTMLLinkElement::removedFrom):
(WebCore::HTMLLinkElement::addPendingSheet):
(WebCore::HTMLLinkElement::removePendingSheet):
* html/HTMLQuoteElement.cpp:
(WebCore::HTMLQuoteElement::insertedInto):
* html/HTMLViewSourceDocument.cpp:
(WebCore::HTMLViewSourceDocument::HTMLViewSourceDocument):
* mathml/MathMLMathElement.cpp:
(WebCore::MathMLMathElement::insertedInto):
* page/Page.cpp:
(WebCore::Page::userStyleSheetLocationChanged):
* page/PageGroup.cpp:
(WebCore::PageGroup::resetUserStyleCacheInAllFrames):
* rendering/RenderBR.cpp:
(WebCore::RenderBR::lineHeight):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::styleDidChange):
(WebCore::RenderBlock::splitBlocks):
(WebCore::RenderBlock::addChildIgnoringAnonymousColumnBlocks):
(WebCore::RenderBlock::lineHeight):
(WebCore::RenderBlock::updateFirstLetter):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::styleDidChange):
(WebCore::RenderInline::updateAlwaysCreateLineBoxes):
(WebCore::RenderInline::addChildIgnoringContinuation):
(WebCore::RenderInline::splitInlines):
(WebCore::RenderInline::lineHeight):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::uncachedFirstLineStyle):
(WebCore::RenderObject::firstLineStyleSlowCase):
* rendering/RenderObject.h:
(WebCore::RenderObject::firstLineStyle):
* rendering/RenderObjectChildList.cpp:
(WebCore::RenderObjectChildList::updateBeforeAfterContent):
* rendering/RenderTableRow.cpp:
(WebCore::RenderTableRow::updateBeforeAndAfterContent):
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::verticalPositionForBox):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129423 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 76f40e59
......@@ -1125,6 +1125,7 @@ SET(WebCore_SOURCES
dom/DocumentFragment.cpp
dom/DocumentParser.cpp
dom/DocumentOrderedMap.cpp
dom/DocumentStyleSheetCollection.cpp
dom/DocumentType.cpp
dom/DynamicNodeList.cpp
dom/EditingText.cpp
......
2012-09-24 Antti Koivisto <antti@apple.com>
Split stylesheet related code out from Document
https://bugs.webkit.org/show_bug.cgi?id=97353
Reviewed by Andreas Kling.
Document is big and unwieldy. The code related to tracking active stylesheets can be factored out.
The patch moves stylesheet upkeep, collection and invalidation code from Document to a separate
DocumentStyleSheetCollection class. There are no functional changes.
The usesLinkRules stylesheet feature bit and the related code is removed as no one was using it.
* WebCore.xcodeproj/project.pbxproj:
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOneSelector):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::StyleResolver):
(WebCore::StyleResolver::Features::Features):
(WebCore::StyleResolver::Features::add):
(WebCore::StyleResolver::Features::clear):
(WebCore::StyleResolver::collectMatchingRulesForList):
* css/StyleResolver.h:
(WebCore::StyleResolver::usesBeforeAfterRules):
(Features):
* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::~Document):
(WebCore::Document::setCompatibilityMode):
(WebCore::Document::recalcStyle):
(WebCore):
(WebCore::Document::createStyleResolver):
(WebCore::Document::seamlessParentUpdatedStylesheets):
(WebCore::Document::didRemoveAllPendingStylesheet):
(WebCore::Document::processHttpEquiv):
(WebCore::Document::styleSheets):
(WebCore::Document::preferredStylesheetSet):
(WebCore::Document::selectedStylesheetSet):
(WebCore::Document::setSelectedStylesheetSet):
(WebCore::Document::styleResolverChanged):
(WebCore::Document::reportMemoryUsage):
(WebCore::Document::haveStylesheetsLoaded):
* dom/Document.h:
(WebCore):
(Document):
(WebCore::Document::styleSheetCollection):
(WebCore::Document::hasNodesWithPlaceholderStyle):
(WebCore::Document::setNeedsNotifyRemoveAllPendingStylesheet):
(WebCore::Document::inStyleRecalc):
* dom/DocumentStyleSheetCollection.cpp: Added.
(WebCore):
(WebCore::DocumentStyleSheetCollection::DocumentStyleSheetCollection):
(WebCore::DocumentStyleSheetCollection::~DocumentStyleSheetCollection):
(WebCore::DocumentStyleSheetCollection::pageUserSheet):
(WebCore::DocumentStyleSheetCollection::clearPageUserSheet):
(WebCore::DocumentStyleSheetCollection::updatePageUserSheet):
(WebCore::DocumentStyleSheetCollection::pageGroupUserSheets):
(WebCore::DocumentStyleSheetCollection::clearPageGroupUserSheets):
(WebCore::DocumentStyleSheetCollection::updatePageGroupUserSheets):
(WebCore::DocumentStyleSheetCollection::addUserSheet):
(WebCore::DocumentStyleSheetCollection::removePendingSheet):
(WebCore::DocumentStyleSheetCollection::addStyleSheetCandidateNode):
(WebCore::DocumentStyleSheetCollection::removeStyleSheetCandidateNode):
(WebCore::DocumentStyleSheetCollection::collectActiveStyleSheets):
(WebCore::DocumentStyleSheetCollection::testAddedStyleSheetRequiresStyleRecalc):
(WebCore::DocumentStyleSheetCollection::analyzeStyleSheetChange):
(WebCore::styleSheetsUseRemUnits):
(WebCore::DocumentStyleSheetCollection::updateActiveStyleSheets):
(WebCore::DocumentStyleSheetCollection::combineCSSFeatureFlags):
(WebCore::DocumentStyleSheetCollection::resetCSSFeatureFlags):
(WebCore::DocumentStyleSheetCollection::reportMemoryUsage):
* dom/DocumentStyleSheetCollection.h: Added.
(WebCore):
(DocumentStyleSheetCollection):
(WebCore::DocumentStyleSheetCollection::authorStyleSheets):
(WebCore::DocumentStyleSheetCollection::documentUserSheets):
(WebCore::DocumentStyleSheetCollection::needsUpdateActiveStylesheetsOnStyleRecalc):
(WebCore::DocumentStyleSheetCollection::preferredStylesheetSetName):
(WebCore::DocumentStyleSheetCollection::selectedStylesheetSetName):
(WebCore::DocumentStyleSheetCollection::setPreferredStylesheetSetName):
(WebCore::DocumentStyleSheetCollection::setSelectedStylesheetSetName):
(WebCore::DocumentStyleSheetCollection::addPendingSheet):
(WebCore::DocumentStyleSheetCollection::hasPendingSheets):
(WebCore::DocumentStyleSheetCollection::usesSiblingRules):
(WebCore::DocumentStyleSheetCollection::setUsesSiblingRulesOverride):
(WebCore::DocumentStyleSheetCollection::usesFirstLineRules):
(WebCore::DocumentStyleSheetCollection::usesFirstLetterRules):
(WebCore::DocumentStyleSheetCollection::setUsesFirstLetterRules):
(WebCore::DocumentStyleSheetCollection::usesBeforeAfterRules):
(WebCore::DocumentStyleSheetCollection::setUsesBeforeAfterRulesOverride):
(WebCore::DocumentStyleSheetCollection::usesRemUnits):
(WebCore::DocumentStyleSheetCollection::setUsesRemUnit):
* dom/Element.cpp:
(WebCore::Element::recalcStyle):
* dom/ProcessingInstruction.cpp:
(WebCore::ProcessingInstruction::~ProcessingInstruction):
(WebCore::ProcessingInstruction::checkStyleSheet):
(WebCore::ProcessingInstruction::sheetLoaded):
(WebCore::ProcessingInstruction::insertedInto):
(WebCore::ProcessingInstruction::removedFrom):
* dom/StyleElement.cpp:
(WebCore::StyleElement::insertedIntoDocument):
(WebCore::StyleElement::removedFromDocument):
(WebCore::StyleElement::clearDocumentData):
(WebCore::StyleElement::createSheet):
(WebCore::StyleElement::sheetLoaded):
(WebCore::StyleElement::startLoadingDynamicSheet):
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::~HTMLLinkElement):
(WebCore::HTMLLinkElement::insertedInto):
(WebCore::HTMLLinkElement::removedFrom):
(WebCore::HTMLLinkElement::addPendingSheet):
(WebCore::HTMLLinkElement::removePendingSheet):
* html/HTMLQuoteElement.cpp:
(WebCore::HTMLQuoteElement::insertedInto):
* html/HTMLViewSourceDocument.cpp:
(WebCore::HTMLViewSourceDocument::HTMLViewSourceDocument):
* mathml/MathMLMathElement.cpp:
(WebCore::MathMLMathElement::insertedInto):
* page/Page.cpp:
(WebCore::Page::userStyleSheetLocationChanged):
* page/PageGroup.cpp:
(WebCore::PageGroup::resetUserStyleCacheInAllFrames):
* rendering/RenderBR.cpp:
(WebCore::RenderBR::lineHeight):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::styleDidChange):
(WebCore::RenderBlock::splitBlocks):
(WebCore::RenderBlock::addChildIgnoringAnonymousColumnBlocks):
(WebCore::RenderBlock::lineHeight):
(WebCore::RenderBlock::updateFirstLetter):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::styleDidChange):
(WebCore::RenderInline::updateAlwaysCreateLineBoxes):
(WebCore::RenderInline::addChildIgnoringContinuation):
(WebCore::RenderInline::splitInlines):
(WebCore::RenderInline::lineHeight):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::uncachedFirstLineStyle):
(WebCore::RenderObject::firstLineStyleSlowCase):
* rendering/RenderObject.h:
(WebCore::RenderObject::firstLineStyle):
* rendering/RenderObjectChildList.cpp:
(WebCore::RenderObjectChildList::updateBeforeAfterContent):
* rendering/RenderTableRow.cpp:
(WebCore::RenderTableRow::updateBeforeAndAfterContent):
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::verticalPositionForBox):
2012-09-24 Otto Derek Cheung <otcheung@rim.com>
[BlackBerry] Reverting implementation for 407 error pages
......@@ -2734,6 +2734,8 @@ webcore_sources += \
Source/WebCore/dom/DocumentOrderedMap.h \
Source/WebCore/dom/DocumentParser.cpp \
Source/WebCore/dom/DocumentParser.h \
Source/WebCore/dom/DocumentStyleSheetCollection.cpp \
Source/WebCore/dom/DocumentStyleSheetCollection.h \
Source/WebCore/dom/DocumentTiming.h \
Source/WebCore/dom/DocumentType.cpp \
Source/WebCore/dom/DocumentType.h \
......
......@@ -371,6 +371,7 @@ SOURCES += \
dom/DocumentMarker.cpp \
dom/DocumentOrderedMap.cpp \
dom/DocumentParser.cpp \
dom/DocumentStyleSheetCollection.cpp \
dom/DocumentType.cpp \
dom/DOMCoreException.cpp \
dom/DOMError.cpp \
......@@ -1528,6 +1529,7 @@ HEADERS += \
dom/DocumentMarker.h \
dom/DocumentMarkerController.h \
dom/DocumentOrderedMap.h \
dom/DocumentStyleSheetCollection.h \
dom/DocumentType.h \
dom/DOMError.h \
dom/DOMImplementation.h \
......
......@@ -657,6 +657,7 @@
'dom/DocumentMarkerController.h',
'dom/DocumentOrderedMap.h',
'dom/DocumentParser.h',
'dom/DocumentStyleSheetCollection.h',
'dom/DocumentTiming.h',
'dom/DocumentType.h',
'dom/Element.h',
......@@ -3816,6 +3817,7 @@
'dom/DocumentMarker.cpp',
'dom/DocumentOrderedMap.cpp',
'dom/DocumentParser.cpp',
'dom/DocumentStyleSheetCollection.cpp',
'dom/DocumentType.cpp',
'dom/DynamicNodeList.cpp',
'dom/DynamicNodeList.h',
......
......@@ -50406,6 +50406,14 @@
RelativePath="..\dom\DocumentParser.h"
>
</File>
<File
RelativePath="..\dom\DocumentStyleSheetCollection.cpp"
>
</File>
<File
RelativePath="..\dom\DocumentStyleSheetCollection.h"
>
</File>
<File
RelativePath="..\dom\DocumentTiming.h"
>
......@@ -6141,6 +6141,8 @@
E4778B80115A581A00B5D372 /* JSCustomEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = E4778B7E115A581A00B5D372 /* JSCustomEvent.h */; };
E47B4BE80E71241600038854 /* CachedResourceHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = E47B4BE60E71241600038854 /* CachedResourceHandle.h */; settings = {ATTRIBUTES = (Private, ); }; };
E47B4BE90E71241600038854 /* CachedResourceHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E47B4BE70E71241600038854 /* CachedResourceHandle.cpp */; };
E47E276516036ED200EE2AFB /* DocumentStyleSheetCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = E47E276416036ED200EE2AFB /* DocumentStyleSheetCollection.h */; settings = {ATTRIBUTES = (Private, ); }; };
E47E276816036EDC00EE2AFB /* DocumentStyleSheetCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E47E276716036EDC00EE2AFB /* DocumentStyleSheetCollection.cpp */; };
E4946EAE156E64DD00D3297F /* StyleRuleImport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4946EAC156E64DD00D3297F /* StyleRuleImport.cpp */; };
E4946EAF156E64DD00D3297F /* StyleRuleImport.h in Headers */ = {isa = PBXBuildFile; fileRef = E4946EAD156E64DD00D3297F /* StyleRuleImport.h */; };
E49BD9FA131FD2ED003C56F0 /* CSSValuePool.h in Headers */ = {isa = PBXBuildFile; fileRef = E49BD9F9131FD2ED003C56F0 /* CSSValuePool.h */; };
......@@ -13520,6 +13522,8 @@
E4778B7E115A581A00B5D372 /* JSCustomEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCustomEvent.h; sourceTree = "<group>"; };
E47B4BE60E71241600038854 /* CachedResourceHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedResourceHandle.h; sourceTree = "<group>"; };
E47B4BE70E71241600038854 /* CachedResourceHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedResourceHandle.cpp; sourceTree = "<group>"; };
E47E276416036ED200EE2AFB /* DocumentStyleSheetCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentStyleSheetCollection.h; sourceTree = "<group>"; };
E47E276716036EDC00EE2AFB /* DocumentStyleSheetCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentStyleSheetCollection.cpp; sourceTree = "<group>"; };
E4946EAC156E64DD00D3297F /* StyleRuleImport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleRuleImport.cpp; sourceTree = "<group>"; };
E4946EAD156E64DD00D3297F /* StyleRuleImport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleRuleImport.h; sourceTree = "<group>"; };
E49BD9F9131FD2ED003C56F0 /* CSSValuePool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSValuePool.h; sourceTree = "<group>"; };
......@@ -21671,6 +21675,8 @@
14947FFC12F80CD200A0F631 /* DocumentOrderedMap.h */,
A8C2280D11D4A59700D5A7D3 /* DocumentParser.cpp */,
BCCFBAE70B5152ED0001F1D7 /* DocumentParser.h */,
E47E276716036EDC00EE2AFB /* DocumentStyleSheetCollection.cpp */,
E47E276416036ED200EE2AFB /* DocumentStyleSheetCollection.h */,
86D982F6125C154000AD9E3D /* DocumentTiming.h */,
A8185F3209765765005826D9 /* DocumentType.cpp */,
A8185F3109765765005826D9 /* DocumentType.h */,
......@@ -22275,6 +22281,7 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
E47E276516036ED200EE2AFB /* DocumentStyleSheetCollection.h in Headers */,
97BC69DB1505F076001B74AC /* AbstractDatabase.h in Headers */,
41E1B1D10FF5986900576B3B /* AbstractWorker.h in Headers */,
29A8122E0FBB9C1D00510293 /* AccessibilityARIAGridCell.h in Headers */,
......@@ -28668,6 +28675,7 @@
E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */,
977E2E0E12F0FC9C00C13379 /* XSSAuditor.cpp in Sources */,
FD537352137B651800008DCE /* ZeroPole.cpp in Sources */,
E47E276816036EDC00EE2AFB /* DocumentStyleSheetCollection.cpp in Sources */,
4F1D11BF15FF37200026E908 /* PlatformMemoryInstrumentation.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
......@@ -31,6 +31,7 @@
#include "CSSSelector.h"
#include "CSSSelectorList.h"
#include "Document.h"
#include "DocumentStyleSheetCollection.h"
#include "FocusController.h"
#include "Frame.h"
#include "FrameSelection.h"
......@@ -783,7 +784,7 @@ bool SelectorChecker::checkOneSelector(const SelectorCheckingContext& context, P
if (m_mode == ResolvingStyle) {
if (context.elementStyle)
context.elementStyle->setEmptyState(result);
else if (element->renderStyle() && (element->document()->usesSiblingRules() || element->renderStyle()->unique()))
else if (element->renderStyle() && (element->document()->styleSheetCollection()->usesSiblingRules() || element->renderStyle()->unique()))
element->renderStyle()->setEmptyState(result);
}
return result;
......@@ -1183,7 +1184,7 @@ bool SelectorChecker::checkOneSelector(const SelectorCheckingContext& context, P
PseudoId pseudoId = CSSSelector::pseudoId(selector->pseudoType());
if (pseudoId == FIRST_LETTER) {
if (Document* document = element->document())
document->setUsesFirstLetterRules(true);
document->styleSheetCollection()->setUsesFirstLetterRules(true);
}
if (pseudoId != NOPSEUDO)
dynamicPseudo = pseudoId;
......
......@@ -60,6 +60,7 @@
#include "Counter.h"
#include "CounterContent.h"
#include "CursorList.h"
#include "DocumentStyleSheetCollection.h"
#include "FontFeatureValue.h"
#include "FontValue.h"
#include "Frame.h"
......@@ -428,12 +429,13 @@ StyleResolver::StyleResolver(Document* document, bool matchAuthorAndUserStyles)
// Note that there usually is only 1 sheet for scoped rules, so auto-shrink-to-fit is fine.
m_authorStyle->disableAutoShrinkToFit();
DocumentStyleSheetCollection* styleSheetCollection = document->styleSheetCollection();
// FIXME: This sucks! The user sheet is reparsed every time!
OwnPtr<RuleSet> tempUserStyle = RuleSet::create();
if (CSSStyleSheet* pageUserSheet = document->pageUserSheet())
if (CSSStyleSheet* pageUserSheet = styleSheetCollection->pageUserSheet())
tempUserStyle->addRulesFromSheet(pageUserSheet->contents(), *m_medium, this);
addAuthorRulesAndCollectUserRulesFromSheets(document->pageGroupUserSheets(), *tempUserStyle);
addAuthorRulesAndCollectUserRulesFromSheets(document->documentUserSheets(), *tempUserStyle);
addAuthorRulesAndCollectUserRulesFromSheets(styleSheetCollection->pageGroupUserSheets(), *tempUserStyle);
addAuthorRulesAndCollectUserRulesFromSheets(styleSheetCollection->documentUserSheets(), *tempUserStyle);
if (tempUserStyle->m_ruleCount > 0 || tempUserStyle->m_pageRules.size() > 0)
m_userStyle = tempUserStyle.release();
......@@ -447,7 +449,7 @@ StyleResolver::StyleResolver(Document* document, bool matchAuthorAndUserStyles)
#endif
addStylesheetsFromSeamlessParents();
appendAuthorStylesheets(0, document->styleSheets()->vector());
appendAuthorStylesheets(0, styleSheetCollection->authorStyleSheets()->vector());
}
void StyleResolver::addStylesheetsFromSeamlessParents()
......@@ -708,7 +710,6 @@ void StyleResolver::sweepMatchedPropertiesCache()
StyleResolver::Features::Features()
: usesFirstLineRules(false)
, usesBeforeAfterRules(false)
, usesLinkRules(false)
{
}
......@@ -728,7 +729,6 @@ void StyleResolver::Features::add(const StyleResolver::Features& other)
uncommonAttributeRules.append(other.uncommonAttributeRules);
usesFirstLineRules = usesFirstLineRules || other.usesFirstLineRules;
usesBeforeAfterRules = usesBeforeAfterRules || other.usesBeforeAfterRules;
usesLinkRules = usesLinkRules || other.usesLinkRules;
}
void StyleResolver::Features::clear()
......@@ -739,7 +739,6 @@ void StyleResolver::Features::clear()
uncommonAttributeRules.clear();
usesFirstLineRules = false;
usesBeforeAfterRules = false;
usesLinkRules = false;
}
void StyleResolver::Features::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
......@@ -2605,10 +2604,6 @@ static inline void collectFeaturesFromSelector(StyleResolver::Features& features
case CSSSelector::PseudoAfter:
features.usesBeforeAfterRules = true;
break;
case CSSSelector::PseudoLink:
case CSSSelector::PseudoVisited:
features.usesLinkRules = true;
break;
default:
break;
}
......@@ -3181,25 +3176,25 @@ static void collectCSSOMWrappers(HashMap<StyleRule*, RefPtr<CSSStyleRule> >& wra
collectCSSOMWrappers(wrapperMap, styleSheetWrapper.get());
}
static void collectCSSOMWrappers(HashMap<StyleRule*, RefPtr<CSSStyleRule> >& wrapperMap, Document* document)
static void collectCSSOMWrappers(HashMap<StyleRule*, RefPtr<CSSStyleRule> >& wrapperMap, DocumentStyleSheetCollection* styleSheetCollection)
{
const Vector<RefPtr<StyleSheet> >& styleSheets = document->styleSheets()->vector();
const Vector<RefPtr<StyleSheet> >& styleSheets = styleSheetCollection->authorStyleSheets()->vector();
for (unsigned i = 0; i < styleSheets.size(); ++i) {
StyleSheet* styleSheet = styleSheets[i].get();
if (!styleSheet->isCSSStyleSheet())
continue;
collectCSSOMWrappers(wrapperMap, static_cast<CSSStyleSheet*>(styleSheet));
}
collectCSSOMWrappers(wrapperMap, document->pageUserSheet());
collectCSSOMWrappers(wrapperMap, styleSheetCollection->pageUserSheet());
{
const Vector<RefPtr<CSSStyleSheet> >* pageGroupUserSheets = document->pageGroupUserSheets();
const Vector<RefPtr<CSSStyleSheet> >* pageGroupUserSheets = styleSheetCollection->pageGroupUserSheets();
if (pageGroupUserSheets) {
for (size_t i = 0, size = pageGroupUserSheets->size(); i < size; ++i)
collectCSSOMWrappers(wrapperMap, pageGroupUserSheets->at(i).get());
}
}
{
const Vector<RefPtr<CSSStyleSheet> >* documentUserSheets = document->documentUserSheets();
const Vector<RefPtr<CSSStyleSheet> >* documentUserSheets = styleSheetCollection->documentUserSheets();
if (documentUserSheets) {
for (size_t i = 0, size = documentUserSheets->size(); i < size; ++i)
collectCSSOMWrappers(wrapperMap, documentUserSheets->at(i).get());
......@@ -3218,7 +3213,7 @@ CSSStyleRule* StyleResolver::ensureFullCSSOMWrapperForInspector(StyleRule* rule)
collectCSSOMWrappers(m_styleRuleToCSSOMWrapperMap, m_styleSheetCSSOMWrapperSet, mediaControlsStyleSheet);
collectCSSOMWrappers(m_styleRuleToCSSOMWrapperMap, m_styleSheetCSSOMWrapperSet, fullscreenStyleSheet);
collectCSSOMWrappers(m_styleRuleToCSSOMWrapperMap, document());
collectCSSOMWrappers(m_styleRuleToCSSOMWrapperMap, document()->styleSheetCollection());
}
return m_styleRuleToCSSOMWrapperMap.get(rule).get();
}
......
......@@ -244,7 +244,6 @@ public:
bool usesSiblingRules() const { return !m_features.siblingRules.isEmpty(); }
bool usesFirstLineRules() const { return m_features.usesFirstLineRules; }
bool usesBeforeAfterRules() const { return m_features.usesBeforeAfterRules; }
bool usesLinkRules() const { return m_features.usesLinkRules; }
static bool createTransformOperations(CSSValue* inValue, RenderStyle* inStyle, RenderStyle* rootStyle, TransformOperations& outOperations);
......@@ -297,7 +296,6 @@ public:
Vector<RuleFeature> uncommonAttributeRules;
bool usesFirstLineRules;
bool usesBeforeAfterRules;
bool usesLinkRules;
};
private:
......
This diff is collapsed.
......@@ -78,6 +78,7 @@ class DocumentFragment;
class DocumentLoader;
class DocumentMarkerController;
class DocumentParser;
class DocumentStyleSheetCollection;
class DocumentType;
class DocumentWeakReference;
class DynamicNodeListCacheBase;
......@@ -485,34 +486,14 @@ public:
return m_styleResolver.get();
}
/**
* Updates the pending sheet count and then calls updateActiveStylesheets.
*/
enum RemovePendingSheetNotificationType {
RemovePendingSheetNotifyImmediately,
RemovePendingSheetNotifyLater
};
void removePendingSheet(RemovePendingSheetNotificationType = RemovePendingSheetNotifyImmediately);
void notifyRemovePendingSheetIfNeeded();
/**
* This method returns true if all top-level stylesheets have loaded (including
* any @imports that they may be loading).
*/
bool haveStylesheetsLoaded() const
{
return m_pendingStylesheets <= 0 || m_ignorePendingStylesheets;
}
bool haveStylesheetsLoaded() const;
/**
* Increments the number of pending sheets. The <link> elements
* invoke this to add themselves to the loading list.
*/
void addPendingSheet() { m_pendingStylesheets++; }
// This is a DOM function.
StyleSheetList* styleSheets();
void addStyleSheetCandidateNode(Node*, bool createdByParser);
void removeStyleSheetCandidateNode(Node*);
DocumentStyleSheetCollection* styleSheetCollection() { return m_styleSheetCollection.get(); }
bool gotoAnchorNeededAfterStylesheetsLoad() { return m_gotoAnchorNeededAfterStylesheetsLoad; }
void setGotoAnchorNeededAfterStylesheetsLoad(bool b) { m_gotoAnchorNeededAfterStylesheetsLoad = b; }
......@@ -530,17 +511,6 @@ public:
void evaluateMediaQueryList();
bool usesSiblingRules() const { return m_usesSiblingRules || m_usesSiblingRulesOverride; }
void setUsesSiblingRules(bool b) { m_usesSiblingRulesOverride = b; }
bool usesFirstLineRules() const { return m_usesFirstLineRules; }
bool usesFirstLetterRules() const { return m_usesFirstLetterRules; }
void setUsesFirstLetterRules(bool b) { m_usesFirstLetterRules = b; }
bool usesBeforeAfterRules() const { return m_usesBeforeAfterRules || m_usesBeforeAfterRulesOverride; }
void setUsesBeforeAfterRules(bool b) { m_usesBeforeAfterRulesOverride = b; }
bool usesRemUnits() const { return m_usesRemUnits; }
bool usesLinkRules() const { return linkColor() != visitedLinkColor() || m_usesLinkRules; }
void setUsesLinkRules(bool b) { m_usesLinkRules = b; }
// Never returns 0.
FormController* formController();
Vector<String> formElementsState() const;
......@@ -556,7 +526,7 @@ public:
PassRefPtr<NodeIterator> createNodeIterator(Node* root, unsigned whatToShow,
PassRefPtr<NodeFilter>, bool expandEntityReferences, ExceptionCode&);
PassRefPtr<TreeWalker> createTreeWalker(Node* root, unsigned whatToShow,
PassRefPtr<TreeWalker> createTreeWalker(Node* root, unsigned whatToShow,
PassRefPtr<NodeFilter>, bool expandEntityReferences, ExceptionCode&);
// Special support for editing
......@@ -649,17 +619,6 @@ public:
bool canNavigate(Frame* targetFrame);
Frame* findUnsafeParentScrollPropagationBoundary();
CSSStyleSheet* pageUserSheet();
void clearPageUserSheet();
void updatePageUserSheet();
const Vector<RefPtr<CSSStyleSheet> >* pageGroupUserSheets() const;
void clearPageGroupUserSheets();
void updatePageGroupUserSheets();
const Vector<RefPtr<CSSStyleSheet> >* documentUserSheets() const { return m_userSheets.get(); }
void addUserSheet(PassRefPtr<StyleSheetContents> userSheet);
CSSStyleSheet* elementSheet();
virtual PassRefPtr<DocumentParser> createParser();
......@@ -716,8 +675,6 @@ public:
MouseEventWithHitTestResults prepareMouseEvent(const HitTestRequest&, const LayoutPoint&, const PlatformMouseEvent&);
StyleSheetList* styleSheets();
/* Newly proposed CSS3 mechanism for selecting alternate
stylesheets using the DOM. May be subject to change as
spec matures. - dwh
......@@ -974,7 +931,8 @@ public:
enum PendingSheetLayout { NoLayoutWithPendingSheets, DidLayoutWithPendingSheets, IgnoreLayoutWithPendingSheets };
bool didLayoutWithPendingStylesheets() const { return m_pendingSheetLayout == DidLayoutWithPendingSheets; }
bool hasNodesWithPlaceholderStyle() const { return m_hasNodesWithPlaceholderStyle; }
void setHasNodesWithPlaceholderStyle() { m_hasNodesWithPlaceholderStyle = true; }
const Vector<IconURL>& iconURLs();
......@@ -1194,6 +1152,13 @@ public:
PassRefPtr<ElementAttributeData> cachedImmutableAttributeData(const Element*, const Vector<Attribute>&);
void didRemoveAllPendingStylesheet();
void setNeedsNotifyRemoveAllPendingStylesheet() { m_needsNotifyRemoveAllPendingStylesheet = true; }
void clearStyleResolver();
void notifySeamlessChildDocumentsOfStylesheetUpdate() const;
bool inStyleRecalc() { return m_inStyleRecalc; }
Localizer& getLocalizer(const AtomicString& locale);
protected:
......@@ -1241,19 +1206,8 @@ private:
void buildAccessKeyMap(TreeScope* root);
void createStyleResolver();
void clearStyleResolver();
void combineCSSFeatureFlags();
void resetCSSFeatureFlags();
bool updateActiveStylesheets(StyleResolverUpdateFlag);
void collectActiveStylesheets(Vector<RefPtr<StyleSheet> >&);
bool testAddedStylesheetRequiresStyleRecalc(StyleSheetContents*);
void analyzeStylesheetChange(StyleResolverUpdateFlag, const Vector<RefPtr<StyleSheet> >& newStylesheets, bool& requiresStyleResolverReset, bool& requiresFullStyleRecalc);
void didRemoveAllPendingStylesheet();
void setNeedsNotifyRemoveAllPendingStylesheet() { m_needsNotifyRemoveAllPendingStylesheet = true; }
void seamlessParentUpdatedStylesheets();
void notifySeamlessChildDocumentsOfStylesheetUpdate() const;
void deleteCustomFonts();
......@@ -1290,6 +1244,17 @@ private:
OwnPtr<StyleResolver> m_styleResolver;
bool m_didCalculateStyleResolver;
bool m_hasDirtyStyleResolver;
bool m_hasNodesWithPlaceholderStyle;
bool m_needsNotifyRemoveAllPendingStylesheet;
// But sometimes you need to ignore pending stylesheet count to
// force an immediate layout when requested by JS.
bool m_ignorePendingStylesheets;
// If we do ignore the pending stylesheet count, then we need to add a boolean
// to track that this happened so that we can do a full repaint when the stylesheets
// do eventually load.
PendingSheetLayout m_pendingSheetLayout;
Vector<OwnPtr<FontData> > m_customFonts;
Frame* m_frame;
......@@ -1323,29 +1288,7 @@ private:
RefPtr<DocumentType> m_docType;
OwnPtr<DOMImplementation> m_implementation;
// Track the number of currently loading top-level stylesheets needed for rendering.
// Sheets loaded using the @import directive are not included in this count.
// We use this count of pending sheets to detect when we can begin attaching
// elements and when it is safe to execute scripts.
int m_pendingStylesheets;
// But sometimes you need to ignore pending stylesheet count to
// force an immediate layout when requested by JS.
bool m_ignorePendingStylesheets : 1;
bool m_needsNotifyRemoveAllPendingStylesheet : 1;
// If we do ignore the pending stylesheet count, then we need to add a boolean
// to track that this happened so that we can do a full repaint when the stylesheets
// do eventually load.
PendingSheetLayout m_pendingSheetLayout;
bool m_hasNodesWithPlaceholderStyle;
RefPtr<CSSStyleSheet> m_elemSheet;
RefPtr<CSSStyleSheet> m_pageUserSheet;
mutable OwnPtr<Vector<RefPtr<CSSStyleSheet> > > m_pageGroupUserSheets;
OwnPtr<Vector<RefPtr<CSSStyleSheet> > > m_userSheets;
mutable bool m_pageGroupUserSheetCacheValid;
bool m_printing;
bool m_paginatedForScreen;
......@@ -1374,11 +1317,8 @@ private:
MutationObserverOptions m_mutationObserverTypes;
#endif
RefPtr<StyleSheetList> m_styleSheets; // All of the stylesheets that are currently in effect for our media type and stylesheet set.
bool m_hadActiveLoadingStylesheet;
typedef ListHashSet<Node*, 32> StyleSheetCandidateListHashSet;
StyleSheetCandidateListHashSet m_styleSheetCandidateNodes; // All of the nodes that could potentially provide stylesheets to the document (<link>, <style>, <?xml-stylesheet>)
OwnPtr<DocumentStyleSheetCollection> m_styleSheetCollection;
OwnPtr<FormController> m_formController;
......@@ -1386,9 +1326,6 @@ private:
Color m_visitedLinkColor;
Color m_activeLinkColor;
String m_preferredStylesheetSet;
String m_selectedStylesheetSet;
bool m_loadingSheet;
bool m_visuallyOrdered;
ReadyState m_readyState;
......@@ -1399,14 +1336,6 @@ private:
bool m_inStyleRecalc;
bool m_closeAfterStyleRecalc;
bool m_usesSiblingRules;
bool m_usesSiblingRulesOverride;
bool m_usesFirstLineRules;
bool m_usesFirstLetterRules;
bool m_usesBeforeAfterRules;
bool m_usesBeforeAfterRulesOverride;
bool m_usesRemUnits;
bool m_usesLinkRules;
bool m_gotoAnchorNeededAfterStylesheetsLoad;
bool m_isDNSPrefetchEnabled;
bool m_haveExplicitlyDisabledDNSPrefetch;
......
This diff is collapsed.
/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2001 Dirk Mueller (mueller@kde.org)
* (C) 2006 Alexey Proskuryakov (ap@webkit.org)
* Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved.
* Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
* Copyright (C) 2011 Google Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef DocumentStyleSheetCollection_h
#define DocumentStyleSheetCollection_h
#include <wtf/FastAllocBase.h>
#include <wtf/ListHashSet.h>
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>