Rename AuthorStyleSheets to Style::Scope
https://bugs.webkit.org/show_bug.cgi?id=163108

Reviewed by Andreas Kling.

It represents the style scope in DOM.
Also move the file under style/.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSStyleSheet.cpp:
(WebCore::CSSStyleSheet::styleSheetScope):
* css/CSSStyleSheet.h:
* css/InspectorCSSOMWrappers.cpp:
(WebCore::InspectorCSSOMWrappers::getWrapperForRuleInSheets):
* css/InspectorCSSOMWrappers.h:
* css/StyleSheetList.cpp:
(WebCore::StyleSheetList::styleSheets):
(WebCore::StyleSheetList::detachFromDocument):
* dom/AuthorStyleSheets.cpp: Removed.
* dom/AuthorStyleSheets.h: Removed.
* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::setContentLanguage):
(WebCore::Document::recalcStyle):
(WebCore::Document::needsStyleRecalc):
(WebCore::Document::updateStyleIfNeeded):
(WebCore::Document::updateLayoutIgnorePendingStylesheets):
(WebCore::Document::createStyleResolver):
(WebCore::Document::didRemoveAllPendingStylesheet):
(WebCore::Document::usesStyleBasedEditability):
(WebCore::Document::processHttpEquiv):
(WebCore::Document::preferredStylesheetSet):
(WebCore::Document::selectedStylesheetSet):
(WebCore::Document::setSelectedStylesheetSet):
(WebCore::Document::haveStylesheetsLoaded):
* dom/Document.h:
(WebCore::Document::styleScope):
(WebCore::Document::authorStyleSheets): Deleted.
* dom/ExtensionStyleSheets.cpp:
(WebCore::ExtensionStyleSheets::clearPageUserSheet):
(WebCore::ExtensionStyleSheets::updatePageUserSheet):
(WebCore::ExtensionStyleSheets::invalidateInjectedStyleSheetCache):
(WebCore::ExtensionStyleSheets::addUserStyleSheet):
(WebCore::ExtensionStyleSheets::addAuthorStyleSheetForTesting):
(WebCore::ExtensionStyleSheets::styleResolverChangedTimerFired):
* dom/InlineStyleSheetOwner.cpp:
(WebCore::InlineStyleSheetOwner::insertedIntoDocument):
(WebCore::InlineStyleSheetOwner::removedFromDocument):
(WebCore::InlineStyleSheetOwner::clearDocumentData):
(WebCore::InlineStyleSheetOwner::createSheet):
(WebCore::InlineStyleSheetOwner::sheetLoaded):
(WebCore::InlineStyleSheetOwner::startLoadingDynamicSheet):
* dom/InlineStyleSheetOwner.h:
(WebCore::InlineStyleSheetOwner::styleScope):
(WebCore::InlineStyleSheetOwner::styleSheetScope): Deleted.
* dom/ProcessingInstruction.cpp:
(WebCore::ProcessingInstruction::~ProcessingInstruction):
(WebCore::ProcessingInstruction::checkStyleSheet):
(WebCore::ProcessingInstruction::sheetLoaded):
(WebCore::ProcessingInstruction::insertedInto):
(WebCore::ProcessingInstruction::removedFrom):
* dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::styleResolver):
(WebCore::ShadowRoot::styleScope):
(WebCore::ShadowRoot::updateStyle):
(WebCore::ShadowRoot::authorStyleSheets): Deleted.
* dom/ShadowRoot.h:
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::~HTMLLinkElement):
(WebCore::HTMLLinkElement::setDisabledState):
(WebCore::HTMLLinkElement::parseAttribute):
(WebCore::HTMLLinkElement::process):
(WebCore::HTMLLinkElement::insertedInto):
(WebCore::HTMLLinkElement::removedFrom):
(WebCore::HTMLLinkElement::addPendingSheet):
(WebCore::HTMLLinkElement::removePendingSheet):
* html/HTMLStyleElement.cpp:
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::collectAllDocumentStyleSheets):
(WebCore::InspectorCSSAgent::forcePseudoState):
(WebCore::InspectorCSSAgent::buildObjectForRule):
(WebCore::InspectorCSSAgent::resetPseudoStates):
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::setEmulatedMedia):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::getMatchedCSSRules):
* page/Frame.cpp:
(WebCore::Frame::setPrinting):
* page/FrameView.cpp:
(WebCore::FrameView::layout):
(WebCore::FrameView::setPagination):
(WebCore::FrameView::setViewportSizeForCSSViewportUnits):
* page/Page.cpp:
(WebCore::Page::setViewMode):
(WebCore::Page::setNeedsRecalcStyleInAllFrames):
(WebCore::Page::invalidateInjectedStyleSheetCacheInAllFrames):
* style/StyleScope.cpp: Copied from dom/AuthorStyleSheets.cpp.
(WebCore::Style::Scope::Scope):
(WebCore::Style::Scope::styleResolver):
(WebCore::Style::Scope::styleResolverIfExists):
(WebCore::Style::Scope::forNode):
(WebCore::Style::Scope::removePendingSheet):
(WebCore::Style::Scope::addStyleSheetCandidateNode):
(WebCore::Style::Scope::removeStyleSheetCandidateNode):
(WebCore::Style::Scope::collectActiveStyleSheets):
(WebCore::Style::Scope::analyzeStyleSheetChange):
(WebCore::Style::Scope::updateActiveStyleSheets):
(WebCore::Style::Scope::updateStyleResolver):
(WebCore::Style::Scope::activeStyleSheetsForInspector):
(WebCore::Style::Scope::activeStyleSheetsContains):
(WebCore::Style::Scope::flushPendingUpdate):
(WebCore::Style::Scope::clearPendingUpdate):
(WebCore::Style::Scope::scheduleActiveSetUpdate):
(WebCore::Style::Scope::didChangeCandidatesForActiveSet):
(WebCore::Style::Scope::didChangeContentsOrInterpretation):
(WebCore::Style::Scope::pendingUpdateTimerFired):
(WebCore::AuthorStyleSheets::AuthorStyleSheets): Deleted.
(WebCore::AuthorStyleSheets::styleResolver): Deleted.
(WebCore::AuthorStyleSheets::styleResolverIfExists): Deleted.
(WebCore::AuthorStyleSheets::forNode): Deleted.
(WebCore::AuthorStyleSheets::removePendingSheet): Deleted.
(WebCore::AuthorStyleSheets::addStyleSheetCandidateNode): Deleted.
(WebCore::AuthorStyleSheets::removeStyleSheetCandidateNode): Deleted.
(WebCore::AuthorStyleSheets::collectActiveStyleSheets): Deleted.
(WebCore::AuthorStyleSheets::analyzeStyleSheetChange): Deleted.
(WebCore::AuthorStyleSheets::updateActiveStyleSheets): Deleted.
(WebCore::AuthorStyleSheets::updateStyleResolver): Deleted.
(WebCore::AuthorStyleSheets::activeStyleSheetsForInspector): Deleted.
(WebCore::AuthorStyleSheets::activeStyleSheetsContains): Deleted.
(WebCore::AuthorStyleSheets::flushPendingUpdate): Deleted.
(WebCore::AuthorStyleSheets::clearPendingUpdate): Deleted.
(WebCore::AuthorStyleSheets::scheduleActiveSetUpdate): Deleted.
(WebCore::AuthorStyleSheets::didChangeCandidatesForActiveSet): Deleted.
(WebCore::AuthorStyleSheets::didChangeContentsOrInterpretation): Deleted.
(WebCore::AuthorStyleSheets::pendingUpdateTimerFired): Deleted.
* style/StyleScope.h: Copied from dom/AuthorStyleSheets.h.
* style/StyleTreeResolver.cpp:
* svg/SVGFontFaceElement.cpp:
(WebCore::SVGFontFaceElement::rebuildFontFace):
(WebCore::SVGFontFaceElement::removedFrom):
* xml/XMLTreeViewer.cpp:
(WebCore::XMLTreeViewer::transformDocumentToTreeView):
* xml/parser/XMLDocumentParser.cpp:
(WebCore::XMLDocumentParser::end):
* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::XMLDocumentParser::doEnd):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@206917 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt
index f9f10b1..cc40387 100644
--- a/Source/WebCore/CMakeLists.txt
+++ b/Source/WebCore/CMakeLists.txt
@@ -1384,7 +1384,6 @@
     dom/ActiveDOMObject.cpp
     dom/AnimationEvent.cpp
     dom/Attr.cpp
-    dom/AuthorStyleSheets.cpp
     dom/BeforeTextInsertedEvent.cpp
     dom/BeforeUnloadEvent.cpp
     dom/CDATASection.cpp
@@ -2650,6 +2649,7 @@
     style/StylePendingResources.cpp
     style/StyleRelations.cpp
     style/StyleResolveForDocument.cpp
+    style/StyleScope.cpp
     style/StyleSharingResolver.cpp
     style/StyleTreeResolver.cpp
     style/StyleUpdate.cpp
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 9cad8b7..5fd4627 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,153 @@
+2016-10-07  Antti Koivisto  <antti@apple.com>
+
+        Rename AuthorStyleSheets to Style::Scope
+        https://bugs.webkit.org/show_bug.cgi?id=163108
+
+        Reviewed by Andreas Kling.
+
+        It represents the style scope in DOM.
+        Also move the file under style/.
+
+        * CMakeLists.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * css/CSSStyleSheet.cpp:
+        (WebCore::CSSStyleSheet::styleSheetScope):
+        * css/CSSStyleSheet.h:
+        * css/InspectorCSSOMWrappers.cpp:
+        (WebCore::InspectorCSSOMWrappers::getWrapperForRuleInSheets):
+        * css/InspectorCSSOMWrappers.h:
+        * css/StyleSheetList.cpp:
+        (WebCore::StyleSheetList::styleSheets):
+        (WebCore::StyleSheetList::detachFromDocument):
+        * dom/AuthorStyleSheets.cpp: Removed.
+        * dom/AuthorStyleSheets.h: Removed.
+        * dom/Document.cpp:
+        (WebCore::Document::Document):
+        (WebCore::Document::setContentLanguage):
+        (WebCore::Document::recalcStyle):
+        (WebCore::Document::needsStyleRecalc):
+        (WebCore::Document::updateStyleIfNeeded):
+        (WebCore::Document::updateLayoutIgnorePendingStylesheets):
+        (WebCore::Document::createStyleResolver):
+        (WebCore::Document::didRemoveAllPendingStylesheet):
+        (WebCore::Document::usesStyleBasedEditability):
+        (WebCore::Document::processHttpEquiv):
+        (WebCore::Document::preferredStylesheetSet):
+        (WebCore::Document::selectedStylesheetSet):
+        (WebCore::Document::setSelectedStylesheetSet):
+        (WebCore::Document::haveStylesheetsLoaded):
+        * dom/Document.h:
+        (WebCore::Document::styleScope):
+        (WebCore::Document::authorStyleSheets): Deleted.
+        * dom/ExtensionStyleSheets.cpp:
+        (WebCore::ExtensionStyleSheets::clearPageUserSheet):
+        (WebCore::ExtensionStyleSheets::updatePageUserSheet):
+        (WebCore::ExtensionStyleSheets::invalidateInjectedStyleSheetCache):
+        (WebCore::ExtensionStyleSheets::addUserStyleSheet):
+        (WebCore::ExtensionStyleSheets::addAuthorStyleSheetForTesting):
+        (WebCore::ExtensionStyleSheets::styleResolverChangedTimerFired):
+        * dom/InlineStyleSheetOwner.cpp:
+        (WebCore::InlineStyleSheetOwner::insertedIntoDocument):
+        (WebCore::InlineStyleSheetOwner::removedFromDocument):
+        (WebCore::InlineStyleSheetOwner::clearDocumentData):
+        (WebCore::InlineStyleSheetOwner::createSheet):
+        (WebCore::InlineStyleSheetOwner::sheetLoaded):
+        (WebCore::InlineStyleSheetOwner::startLoadingDynamicSheet):
+        * dom/InlineStyleSheetOwner.h:
+        (WebCore::InlineStyleSheetOwner::styleScope):
+        (WebCore::InlineStyleSheetOwner::styleSheetScope): Deleted.
+        * dom/ProcessingInstruction.cpp:
+        (WebCore::ProcessingInstruction::~ProcessingInstruction):
+        (WebCore::ProcessingInstruction::checkStyleSheet):
+        (WebCore::ProcessingInstruction::sheetLoaded):
+        (WebCore::ProcessingInstruction::insertedInto):
+        (WebCore::ProcessingInstruction::removedFrom):
+        * dom/ShadowRoot.cpp:
+        (WebCore::ShadowRoot::styleResolver):
+        (WebCore::ShadowRoot::styleScope):
+        (WebCore::ShadowRoot::updateStyle):
+        (WebCore::ShadowRoot::authorStyleSheets): Deleted.
+        * dom/ShadowRoot.h:
+        * html/HTMLLinkElement.cpp:
+        (WebCore::HTMLLinkElement::~HTMLLinkElement):
+        (WebCore::HTMLLinkElement::setDisabledState):
+        (WebCore::HTMLLinkElement::parseAttribute):
+        (WebCore::HTMLLinkElement::process):
+        (WebCore::HTMLLinkElement::insertedInto):
+        (WebCore::HTMLLinkElement::removedFrom):
+        (WebCore::HTMLLinkElement::addPendingSheet):
+        (WebCore::HTMLLinkElement::removePendingSheet):
+        * html/HTMLStyleElement.cpp:
+        * inspector/InspectorCSSAgent.cpp:
+        (WebCore::InspectorCSSAgent::collectAllDocumentStyleSheets):
+        (WebCore::InspectorCSSAgent::forcePseudoState):
+        (WebCore::InspectorCSSAgent::buildObjectForRule):
+        (WebCore::InspectorCSSAgent::resetPseudoStates):
+        * inspector/InspectorPageAgent.cpp:
+        (WebCore::InspectorPageAgent::setEmulatedMedia):
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::getMatchedCSSRules):
+        * page/Frame.cpp:
+        (WebCore::Frame::setPrinting):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::layout):
+        (WebCore::FrameView::setPagination):
+        (WebCore::FrameView::setViewportSizeForCSSViewportUnits):
+        * page/Page.cpp:
+        (WebCore::Page::setViewMode):
+        (WebCore::Page::setNeedsRecalcStyleInAllFrames):
+        (WebCore::Page::invalidateInjectedStyleSheetCacheInAllFrames):
+        * style/StyleScope.cpp: Copied from dom/AuthorStyleSheets.cpp.
+        (WebCore::Style::Scope::Scope):
+        (WebCore::Style::Scope::styleResolver):
+        (WebCore::Style::Scope::styleResolverIfExists):
+        (WebCore::Style::Scope::forNode):
+        (WebCore::Style::Scope::removePendingSheet):
+        (WebCore::Style::Scope::addStyleSheetCandidateNode):
+        (WebCore::Style::Scope::removeStyleSheetCandidateNode):
+        (WebCore::Style::Scope::collectActiveStyleSheets):
+        (WebCore::Style::Scope::analyzeStyleSheetChange):
+        (WebCore::Style::Scope::updateActiveStyleSheets):
+        (WebCore::Style::Scope::updateStyleResolver):
+        (WebCore::Style::Scope::activeStyleSheetsForInspector):
+        (WebCore::Style::Scope::activeStyleSheetsContains):
+        (WebCore::Style::Scope::flushPendingUpdate):
+        (WebCore::Style::Scope::clearPendingUpdate):
+        (WebCore::Style::Scope::scheduleActiveSetUpdate):
+        (WebCore::Style::Scope::didChangeCandidatesForActiveSet):
+        (WebCore::Style::Scope::didChangeContentsOrInterpretation):
+        (WebCore::Style::Scope::pendingUpdateTimerFired):
+        (WebCore::AuthorStyleSheets::AuthorStyleSheets): Deleted.
+        (WebCore::AuthorStyleSheets::styleResolver): Deleted.
+        (WebCore::AuthorStyleSheets::styleResolverIfExists): Deleted.
+        (WebCore::AuthorStyleSheets::forNode): Deleted.
+        (WebCore::AuthorStyleSheets::removePendingSheet): Deleted.
+        (WebCore::AuthorStyleSheets::addStyleSheetCandidateNode): Deleted.
+        (WebCore::AuthorStyleSheets::removeStyleSheetCandidateNode): Deleted.
+        (WebCore::AuthorStyleSheets::collectActiveStyleSheets): Deleted.
+        (WebCore::AuthorStyleSheets::analyzeStyleSheetChange): Deleted.
+        (WebCore::AuthorStyleSheets::updateActiveStyleSheets): Deleted.
+        (WebCore::AuthorStyleSheets::updateStyleResolver): Deleted.
+        (WebCore::AuthorStyleSheets::activeStyleSheetsForInspector): Deleted.
+        (WebCore::AuthorStyleSheets::activeStyleSheetsContains): Deleted.
+        (WebCore::AuthorStyleSheets::flushPendingUpdate): Deleted.
+        (WebCore::AuthorStyleSheets::clearPendingUpdate): Deleted.
+        (WebCore::AuthorStyleSheets::scheduleActiveSetUpdate): Deleted.
+        (WebCore::AuthorStyleSheets::didChangeCandidatesForActiveSet): Deleted.
+        (WebCore::AuthorStyleSheets::didChangeContentsOrInterpretation): Deleted.
+        (WebCore::AuthorStyleSheets::pendingUpdateTimerFired): Deleted.
+        * style/StyleScope.h: Copied from dom/AuthorStyleSheets.h.
+        * style/StyleTreeResolver.cpp:
+        * svg/SVGFontFaceElement.cpp:
+        (WebCore::SVGFontFaceElement::rebuildFontFace):
+        (WebCore::SVGFontFaceElement::removedFrom):
+        * xml/XMLTreeViewer.cpp:
+        (WebCore::XMLTreeViewer::transformDocumentToTreeView):
+        * xml/parser/XMLDocumentParser.cpp:
+        (WebCore::XMLDocumentParser::end):
+        * xml/parser/XMLDocumentParserLibxml2.cpp:
+        (WebCore::XMLDocumentParser::doEnd):
+
 2016-10-07  Zalan Bujtas  <zalan@apple.com>
 
         https://vuldb.com/?cvssv3.2012 takes long time to load.
diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
index f2a0cbb..75d29ad 100644
--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -6212,8 +6212,8 @@
 		E461802B1C8A06D90026C02C /* RenderTreeUpdater.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E461802A1C8A06D90026C02C /* RenderTreeUpdater.cpp */; };
 		E461802D1C8DD2900026C02C /* StyleRelations.h in Headers */ = {isa = PBXBuildFile; fileRef = E461802C1C8DD2900026C02C /* StyleRelations.h */; };
 		E461802F1C8DD4D20026C02C /* StyleRelations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E461802E1C8DD4D20026C02C /* StyleRelations.cpp */; };
-		E461D65D1BB0C7F000CB5645 /* AuthorStyleSheets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E461D65C1BB0C7F000CB5645 /* AuthorStyleSheets.cpp */; };
-		E461D65F1BB0C80D00CB5645 /* AuthorStyleSheets.h in Headers */ = {isa = PBXBuildFile; fileRef = E461D65E1BB0C80D00CB5645 /* AuthorStyleSheets.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		E461D65D1BB0C7F000CB5645 /* StyleScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E461D65C1BB0C7F000CB5645 /* StyleScope.cpp */; };
+		E461D65F1BB0C80D00CB5645 /* StyleScope.h in Headers */ = {isa = PBXBuildFile; fileRef = E461D65E1BB0C80D00CB5645 /* StyleScope.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E462A4A1113E71BE004A4220 /* IntPointHash.h in Headers */ = {isa = PBXBuildFile; fileRef = E462A4A0113E71BE004A4220 /* IntPointHash.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E46A2B1C17CA65B9000DBCD8 /* TypedElementDescendantIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E46A2B1B17CA65B9000DBCD8 /* TypedElementDescendantIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E46A2B1E17CA76B1000DBCD8 /* ElementChildIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E46A2B1D17CA76B1000DBCD8 /* ElementChildIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -13828,8 +13828,8 @@
 		E461802A1C8A06D90026C02C /* RenderTreeUpdater.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTreeUpdater.cpp; sourceTree = "<group>"; };
 		E461802C1C8DD2900026C02C /* StyleRelations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleRelations.h; sourceTree = "<group>"; };
 		E461802E1C8DD4D20026C02C /* StyleRelations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleRelations.cpp; sourceTree = "<group>"; };
-		E461D65C1BB0C7F000CB5645 /* AuthorStyleSheets.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AuthorStyleSheets.cpp; sourceTree = "<group>"; };
-		E461D65E1BB0C80D00CB5645 /* AuthorStyleSheets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthorStyleSheets.h; sourceTree = "<group>"; };
+		E461D65C1BB0C7F000CB5645 /* StyleScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleScope.cpp; sourceTree = "<group>"; };
+		E461D65E1BB0C80D00CB5645 /* StyleScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleScope.h; sourceTree = "<group>"; };
 		E462A4A0113E71BE004A4220 /* IntPointHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntPointHash.h; sourceTree = "<group>"; };
 		E46A2B1B17CA65B9000DBCD8 /* TypedElementDescendantIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypedElementDescendantIterator.h; sourceTree = "<group>"; };
 		E46A2B1D17CA76B1000DBCD8 /* ElementChildIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementChildIterator.h; sourceTree = "<group>"; };
@@ -22326,6 +22326,8 @@
 				E461802C1C8DD2900026C02C /* StyleRelations.h */,
 				E4D58EB217B4DBDC00CBDCA8 /* StyleResolveForDocument.cpp */,
 				E4D58EB317B4DBDC00CBDCA8 /* StyleResolveForDocument.h */,
+				E461D65C1BB0C7F000CB5645 /* StyleScope.cpp */,
+				E461D65E1BB0C80D00CB5645 /* StyleScope.h */,
 				E47A3AC21C5EABBE00CCBFA7 /* StyleSharingResolver.cpp */,
 				E47A3AC41C5EAC7900CCBFA7 /* StyleSharingResolver.h */,
 				E4DEAA1517A93DC3000E0430 /* StyleTreeResolver.cpp */,
@@ -22962,8 +22964,6 @@
 				A8C4A7FB09D563270003AC8D /* Attr.h */,
 				93EEC1E509C2877700C515D1 /* Attr.idl */,
 				A8C4A7F909D563270003AC8D /* Attribute.h */,
-				E461D65C1BB0C7F000CB5645 /* AuthorStyleSheets.cpp */,
-				E461D65E1BB0C80D00CB5645 /* AuthorStyleSheets.h */,
 				760847CD19A6A27700428CCC /* AutocompleteErrorEvent.h */,
 				760847CF19A6A28600428CCC /* AutocompleteErrorEvent.idl */,
 				BC9462D7107A7B4C00857193 /* BeforeLoadEvent.h */,
@@ -23925,7 +23925,7 @@
 				0704A4081D6DE9F10086DCDB /* OverconstrainedError.h in Headers */,
 				E124748410AA161D00B79493 /* AuthenticationClient.h in Headers */,
 				514C764C0CE9234E007EF3CD /* AuthenticationMac.h in Headers */,
-				E461D65F1BB0C80D00CB5645 /* AuthorStyleSheets.h in Headers */,
+				E461D65F1BB0C80D00CB5645 /* StyleScope.h in Headers */,
 				A501920E132EBF2E008BFE55 /* Autocapitalize.h in Headers */,
 				760847CE19A6A27800428CCC /* AutocompleteErrorEvent.h in Headers */,
 				7C1843FE1C8B7283002EB973 /* Autofill.h in Headers */,
@@ -27690,7 +27690,7 @@
 				7EE6845F12D26E3800E79415 /* AuthenticationCF.cpp in Sources */,
 				934F71380D5A6EFF00018D69 /* AuthenticationChallengeBase.cpp in Sources */,
 				514C764D0CE9234E007EF3CD /* AuthenticationMac.mm in Sources */,
-				E461D65D1BB0C7F000CB5645 /* AuthorStyleSheets.cpp in Sources */,
+				E461D65D1BB0C7F000CB5645 /* StyleScope.cpp in Sources */,
 				A5F6E16B132ED46E008EDAE3 /* Autocapitalize.cpp in Sources */,
 				5597F8261D91C3130066BC21 /* ImageFrameCache.cpp in Sources */,
 				7C1843FD1C8B7283002EB973 /* Autofill.cpp in Sources */,
diff --git a/Source/WebCore/css/CSSStyleSheet.cpp b/Source/WebCore/css/CSSStyleSheet.cpp
index 6c237f2..e77e397 100644
--- a/Source/WebCore/css/CSSStyleSheet.cpp
+++ b/Source/WebCore/css/CSSStyleSheet.cpp
@@ -21,7 +21,6 @@
 #include "config.h"
 #include "CSSStyleSheet.h"
 
-#include "AuthorStyleSheets.h"
 #include "CSSCharsetRule.h"
 #include "CSSFontFaceRule.h"
 #include "CSSImportRule.h"
@@ -44,7 +43,9 @@
 #include "ShadowRoot.h"
 #include "StyleResolver.h"
 #include "StyleRule.h"
+#include "StyleScope.h"
 #include "StyleSheetContents.h"
+
 #include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
@@ -170,7 +171,7 @@
     ASSERT(m_contents->isMutable());
     ASSERT(m_contents->hasOneClient());
 
-    auto* scope = styleSheetScope();
+    auto* scope = styleScope();
     if (!scope)
         return;
 
@@ -191,7 +192,7 @@
 
 void CSSStyleSheet::didMutate()
 {
-    auto* scope = styleSheetScope();
+    auto* scope = styleScope();
     if (!scope)
         return;
     scope->didChangeContentsOrInterpretation();
@@ -415,12 +416,12 @@
     return root.ownerNode() ? &root.ownerNode()->document() : nullptr;
 }
 
-AuthorStyleSheets* CSSStyleSheet::styleSheetScope()
+Style::Scope* CSSStyleSheet::styleScope()
 {
     auto* ownerNode = rootStyleSheet().ownerNode();
     if (!ownerNode)
         return nullptr;
-    return &AuthorStyleSheets::forNode(*ownerNode);
+    return &Style::Scope::forNode(*ownerNode);
 }
 
 void CSSStyleSheet::clearChildRuleCSSOMWrappers()
diff --git a/Source/WebCore/css/CSSStyleSheet.h b/Source/WebCore/css/CSSStyleSheet.h
index c5ca31f..e34e1d5 100644
--- a/Source/WebCore/css/CSSStyleSheet.h
+++ b/Source/WebCore/css/CSSStyleSheet.h
@@ -31,7 +31,6 @@
 
 namespace WebCore {
 
-class AuthorStyleSheets;
 class CSSCharsetRule;
 class CSSImportRule;
 class CSSParser;
@@ -45,6 +44,10 @@
 class StyleRuleKeyframes;
 class StyleSheetContents;
 
+namespace Style {
+class Scope;
+}
+
 typedef int ExceptionCode;
 
 class CSSStyleSheet final : public StyleSheet {
@@ -87,7 +90,7 @@
     Document* ownerDocument() const;
     CSSStyleSheet& rootStyleSheet();
     const CSSStyleSheet& rootStyleSheet() const;
-    AuthorStyleSheets* styleSheetScope();
+    Style::Scope* styleScope();
 
     MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); }
     void setMediaQueries(Ref<MediaQuerySet>&&);
diff --git a/Source/WebCore/css/InspectorCSSOMWrappers.cpp b/Source/WebCore/css/InspectorCSSOMWrappers.cpp
index ce98de3..f58ecab 100644
--- a/Source/WebCore/css/InspectorCSSOMWrappers.cpp
+++ b/Source/WebCore/css/InspectorCSSOMWrappers.cpp
@@ -29,7 +29,6 @@
 #include "config.h"
 #include "InspectorCSSOMWrappers.h"
 
-#include "AuthorStyleSheets.h"
 #include "CSSDefaultStyleSheets.h"
 #include "CSSImportRule.h"
 #include "CSSMediaRule.h"
@@ -38,6 +37,7 @@
 #include "CSSStyleSheet.h"
 #include "CSSSupportsRule.h"
 #include "ExtensionStyleSheets.h"
+#include "StyleScope.h"
 #include "StyleSheetContents.h"
 #include "WebKitCSSRegionRule.h"
 
@@ -96,7 +96,7 @@
         collect(sheets[i].get());
 }
 
-CSSStyleRule* InspectorCSSOMWrappers::getWrapperForRuleInSheets(StyleRule* rule, AuthorStyleSheets& authorStyleSheets, ExtensionStyleSheets& extensionStyleSheets)
+CSSStyleRule* InspectorCSSOMWrappers::getWrapperForRuleInSheets(StyleRule* rule, Style::Scope& styleScope, ExtensionStyleSheets& extensionStyleSheets)
 {
     if (m_styleRuleToCSSOMWrapperMap.isEmpty()) {
         collectFromStyleSheetContents(m_styleSheetCSSOMWrapperSet, CSSDefaultStyleSheets::simpleDefaultStyleSheet);
@@ -108,7 +108,7 @@
         collectFromStyleSheetContents(m_styleSheetCSSOMWrapperSet, CSSDefaultStyleSheets::fullscreenStyleSheet);
         collectFromStyleSheetContents(m_styleSheetCSSOMWrapperSet, CSSDefaultStyleSheets::plugInsStyleSheet);
 
-        collectFromStyleSheets(authorStyleSheets.activeStyleSheets());
+        collectFromStyleSheets(styleScope.activeStyleSheets());
         collect(extensionStyleSheets.pageUserSheet());
         collectFromStyleSheets(extensionStyleSheets.injectedUserStyleSheets());
         collectFromStyleSheets(extensionStyleSheets.documentUserStyleSheets());
diff --git a/Source/WebCore/css/InspectorCSSOMWrappers.h b/Source/WebCore/css/InspectorCSSOMWrappers.h
index ba19d00..539dd58 100644
--- a/Source/WebCore/css/InspectorCSSOMWrappers.h
+++ b/Source/WebCore/css/InspectorCSSOMWrappers.h
@@ -31,18 +31,21 @@
 
 namespace WebCore {
 
-class AuthorStyleSheets;
 class CSSStyleRule;
 class CSSStyleSheet;
 class ExtensionStyleSheets;
 class StyleRule;
 class StyleSheetContents;
 
+namespace Style {
+class Scope;
+}
+
 class InspectorCSSOMWrappers {
 public:
     // WARNING. This will construct CSSOM wrappers for all style rules and cache them in a map for significant memory cost.
     // It is here to support inspector. Don't use for any regular engine functions.
-    CSSStyleRule* getWrapperForRuleInSheets(StyleRule*, AuthorStyleSheets&, ExtensionStyleSheets&);
+    CSSStyleRule* getWrapperForRuleInSheets(StyleRule*, Style::Scope&, ExtensionStyleSheets&);
     void collectFromStyleSheetIfNeeded(CSSStyleSheet*);
 
 private:
diff --git a/Source/WebCore/css/StyleSheetList.cpp b/Source/WebCore/css/StyleSheetList.cpp
index 9f706fc..2d8945f 100644
--- a/Source/WebCore/css/StyleSheetList.cpp
+++ b/Source/WebCore/css/StyleSheetList.cpp
@@ -21,11 +21,11 @@
 #include "config.h"
 #include "StyleSheetList.h"
 
-#include "AuthorStyleSheets.h"
 #include "CSSStyleSheet.h"
 #include "Document.h"
 #include "HTMLNames.h"
 #include "HTMLStyleElement.h"
+#include "StyleScope.h"
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
@@ -45,12 +45,12 @@
 {
     if (!m_document)
         return m_detachedStyleSheets;
-    return m_document->authorStyleSheets().styleSheetsForStyleSheetList();
+    return m_document->styleScope().styleSheetsForStyleSheetList();
 }
 
 void StyleSheetList::detachFromDocument()
 {
-    m_detachedStyleSheets = m_document->authorStyleSheets().styleSheetsForStyleSheetList();
+    m_detachedStyleSheets = m_document->styleScope().styleSheetsForStyleSheetList();
     m_document = nullptr;
 }
 
diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp
index bf380e7..263f441 100644
--- a/Source/WebCore/dom/Document.cpp
+++ b/Source/WebCore/dom/Document.cpp
@@ -31,7 +31,6 @@
 #include "AXObjectCache.h"
 #include "AnimationController.h"
 #include "Attr.h"
-#include "AuthorStyleSheets.h"
 #include "CDATASection.h"
 #include "CSSFontSelector.h"
 #include "CSSStyleDeclaration.h"
@@ -168,6 +167,7 @@
 #include "StyleProperties.h"
 #include "StyleResolveForDocument.h"
 #include "StyleResolver.h"
+#include "StyleScope.h"
 #include "StyleSheetContents.h"
 #include "StyleSheetList.h"
 #include "StyleTreeResolver.h"
@@ -451,7 +451,7 @@
     , m_domTreeVersion(++s_globalTreeVersion)
     , m_listenerTypes(0)
     , m_mutationObserverTypes(0)
-    , m_authorStyleSheets(std::make_unique<AuthorStyleSheets>(*this))
+    , m_styleScope(std::make_unique<Style::Scope>(*this))
     , m_extensionStyleSheets(std::make_unique<ExtensionStyleSheets>(*this))
     , m_visitedLinkState(std::make_unique<VisitedLinkState>(*this))
     , m_visuallyOrdered(false)
@@ -1354,7 +1354,7 @@
     m_contentLanguage = language;
 
     // Recalculate style so language is used when selecting the initial font.
-    m_authorStyleSheets->didChangeContentsOrInterpretation();
+    m_styleScope->didChangeContentsOrInterpretation();
 }
 
 void Document::setXMLVersion(const String& version, ExceptionCode& ec)
@@ -1812,7 +1812,7 @@
     // re-attaching our containing iframe, which when asked HTMLFrameElementBase::isURLAllowed
     // hits a null-dereference due to security code always assuming the document has a SecurityOrigin.
 
-    authorStyleSheets().flushPendingUpdate();
+    styleScope().flushPendingUpdate();
 
     frameView.willRecalcStyle();
 
@@ -1895,7 +1895,7 @@
     if (pageCacheState() != NotInPageCache)
         return false;
 
-    return m_pendingStyleRecalcShouldForce || childNeedsStyleRecalc() || authorStyleSheets().hasPendingUpdate();
+    return m_pendingStyleRecalcShouldForce || childNeedsStyleRecalc() || styleScope().hasPendingUpdate();
 }
 
 void Document::updateStyleIfNeeded()
@@ -1906,7 +1906,7 @@
     if (!view() || view()->isInRenderTreeLayout())
         return;
 
-    authorStyleSheets().flushPendingUpdate();
+    styleScope().flushPendingUpdate();
 
     if (!needsStyleRecalc())
         return;
@@ -1960,7 +1960,7 @@
         HTMLElement* bodyElement = bodyOrFrameset();
         if (bodyElement && !bodyElement->renderer() && m_pendingSheetLayout == NoLayoutWithPendingSheets) {
             m_pendingSheetLayout = DidLayoutWithPendingSheets;
-            authorStyleSheets().didChangeContentsOrInterpretation();
+            styleScope().didChangeContentsOrInterpretation();
             recalcStyle(Style::Force);
         } else if (m_hasNodesWithPlaceholderStyle)
             // If new nodes have been added or style recalc has been done with style sheets still pending, some nodes 
@@ -2142,7 +2142,7 @@
 void Document::createStyleResolver()
 {
     m_styleResolver = std::make_unique<StyleResolver>(*this);
-    m_styleResolver->appendAuthorStyleSheets(authorStyleSheets().activeStyleSheets());
+    m_styleResolver->appendAuthorStyleSheets(styleScope().activeStyleSheets());
 }
 
 StyleResolver& Document::userAgentShadowTreeStyleResolver()
@@ -3085,7 +3085,7 @@
 {
     m_needsNotifyRemoveAllPendingStylesheet = false;
 
-    authorStyleSheets().didChangeCandidatesForActiveSet();
+    styleScope().didChangeCandidatesForActiveSet();
 
     if (m_pendingSheetLayout == DidLayoutWithPendingSheets) {
         m_pendingSheetLayout = IgnoreLayoutWithPendingSheets;
@@ -3108,9 +3108,9 @@
     ASSERT(!m_renderView || !m_renderView->frameView().isPainting());
     ASSERT(!m_inStyleRecalc);
 
-    auto& authorSheets = const_cast<AuthorStyleSheets&>(authorStyleSheets());
-    authorSheets.flushPendingUpdate();
-    return authorSheets.usesStyleBasedEditability();
+    auto& styleScope = const_cast<Style::Scope&>(this->styleScope());
+    styleScope.flushPendingUpdate();
+    return styleScope.usesStyleBasedEditability();
 }
 
 void Document::setHasElementUsingStyleBasedEditability()
@@ -3156,9 +3156,9 @@
         // For more info, see the test at:
         // http://www.hixie.ch/tests/evil/css/import/main/preferred.html
         // -dwh
-        authorStyleSheets().setSelectedStylesheetSetName(content);
-        authorStyleSheets().setPreferredStylesheetSetName(content);
-        authorStyleSheets().didChangeContentsOrInterpretation();
+        styleScope().setSelectedStylesheetSetName(content);
+        styleScope().setPreferredStylesheetSetName(content);
+        styleScope().didChangeContentsOrInterpretation();
         break;
 
     case HTTPHeaderName::Refresh: {
@@ -3452,18 +3452,18 @@
 
 String Document::preferredStylesheetSet() const
 {
-    return authorStyleSheets().preferredStylesheetSetName();
+    return styleScope().preferredStylesheetSetName();
 }
 
 String Document::selectedStylesheetSet() const
 {
-    return authorStyleSheets().selectedStylesheetSetName();
+    return styleScope().selectedStylesheetSetName();
 }
 
 void Document::setSelectedStylesheetSet(const String& aString)
 {
-    authorStyleSheets().setSelectedStylesheetSetName(aString);
-    authorStyleSheets().didChangeContentsOrInterpretation();
+    styleScope().setSelectedStylesheetSetName(aString);
+    styleScope().didChangeContentsOrInterpretation();
 }
 
 void Document::evaluateMediaQueryList()
@@ -6665,7 +6665,7 @@
 
 bool Document::haveStylesheetsLoaded() const
 {
-    return !authorStyleSheets().hasPendingSheets() || m_ignorePendingStylesheets;
+    return !styleScope().hasPendingSheets() || m_ignorePendingStylesheets;
 }
 
 Locale& Document::getCachedLocale(const AtomicString& locale)
diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h
index 0c3b3f5..7110142 100644
--- a/Source/WebCore/dom/Document.h
+++ b/Source/WebCore/dom/Document.h
@@ -74,7 +74,6 @@
 
 class AXObjectCache;
 class Attr;
-class AuthorStyleSheets;
 class CDATASection;
 class CSSFontSelector;
 class CSSStyleDeclaration;
@@ -224,6 +223,10 @@
 class MediaSession;
 #endif
 
+namespace Style {
+class Scope;
+};
+
 const uint64_t HTMLMediaElementInvalidID = 0;
 
 enum PageshowEventPersistence {
@@ -504,8 +507,8 @@
 
     WEBCORE_EXPORT StyleSheetList& styleSheets();
 
-    AuthorStyleSheets& authorStyleSheets() { return *m_authorStyleSheets; }
-    const AuthorStyleSheets& authorStyleSheets() const { return *m_authorStyleSheets; }
+    Style::Scope& styleScope() { return *m_styleScope; }
+    const Style::Scope& styleScope() const { return *m_styleScope; }
     ExtensionStyleSheets& extensionStyleSheets() { return *m_extensionStyleSheets; }
     const ExtensionStyleSheets& extensionStyleSheets() const { return *m_extensionStyleSheets; }
 
@@ -1469,7 +1472,7 @@
 
     MutationObserverOptions m_mutationObserverTypes;
 
-    std::unique_ptr<AuthorStyleSheets> m_authorStyleSheets;
+    std::unique_ptr<Style::Scope> m_styleScope;
     std::unique_ptr<ExtensionStyleSheets> m_extensionStyleSheets;
     RefPtr<StyleSheetList> m_styleSheetList;
 
diff --git a/Source/WebCore/dom/ExtensionStyleSheets.cpp b/Source/WebCore/dom/ExtensionStyleSheets.cpp
index 3b63c97..ed4bb84 100644
--- a/Source/WebCore/dom/ExtensionStyleSheets.cpp
+++ b/Source/WebCore/dom/ExtensionStyleSheets.cpp
@@ -28,7 +28,6 @@
 #include "config.h"
 #include "ExtensionStyleSheets.h"
 
-#include "AuthorStyleSheets.h"
 #include "CSSStyleSheet.h"
 #include "Element.h"
 #include "HTMLIFrameElement.h"
@@ -42,6 +41,7 @@
 #include "Settings.h"
 #include "StyleInvalidationAnalysis.h"
 #include "StyleResolver.h"
+#include "StyleScope.h"
 #include "StyleSheetContents.h"
 #include "StyleSheetList.h"
 #include "UserContentController.h"
@@ -83,7 +83,7 @@
 {
     if (m_pageUserSheet) {
         m_pageUserSheet = nullptr;
-        m_document.authorStyleSheets().didChangeContentsOrInterpretation();
+        m_document.styleScope().didChangeContentsOrInterpretation();
     }
 }
 
@@ -91,7 +91,7 @@
 {
     clearPageUserSheet();
     if (pageUserSheet())
-        m_document.authorStyleSheets().didChangeContentsOrInterpretation();
+        m_document.styleScope().didChangeContentsOrInterpretation();
 }
 
 const Vector<RefPtr<CSSStyleSheet>>& ExtensionStyleSheets::injectedUserStyleSheets() const
@@ -155,21 +155,21 @@
     m_injectedStyleSheetCacheValid = false;
     if (m_injectedUserStyleSheets.isEmpty() && m_injectedAuthorStyleSheets.isEmpty())
         return;
-    m_document.authorStyleSheets().didChangeContentsOrInterpretation();
+    m_document.styleScope().didChangeContentsOrInterpretation();
 }
 
 void ExtensionStyleSheets::addUserStyleSheet(Ref<StyleSheetContents>&& userSheet)
 {
     ASSERT(userSheet.get().isUserStyleSheet());
     m_userStyleSheets.append(CSSStyleSheet::create(WTFMove(userSheet), m_document));
-    m_document.authorStyleSheets().didChangeContentsOrInterpretation();
+    m_document.styleScope().didChangeContentsOrInterpretation();
 }
 
 void ExtensionStyleSheets::addAuthorStyleSheetForTesting(Ref<StyleSheetContents>&& authorSheet)
 {
     ASSERT(!authorSheet.get().isUserStyleSheet());
     m_authorStyleSheetsForTesting.append(CSSStyleSheet::create(WTFMove(authorSheet), m_document));
-    m_document.authorStyleSheets().didChangeContentsOrInterpretation();
+    m_document.styleScope().didChangeContentsOrInterpretation();
 }
 
 #if ENABLE(CONTENT_EXTENSIONS)
@@ -201,7 +201,7 @@
 
 void ExtensionStyleSheets::styleResolverChangedTimerFired()
 {
-    m_document.authorStyleSheets().didChangeContentsOrInterpretation();
+    m_document.styleScope().didChangeContentsOrInterpretation();
 }
 
 void ExtensionStyleSheets::detachFromDocument()
diff --git a/Source/WebCore/dom/InlineStyleSheetOwner.cpp b/Source/WebCore/dom/InlineStyleSheetOwner.cpp
index ec48fce..f64c47a 100644
--- a/Source/WebCore/dom/InlineStyleSheetOwner.cpp
+++ b/Source/WebCore/dom/InlineStyleSheetOwner.cpp
@@ -21,13 +21,13 @@
 #include "config.h"
 #include "InlineStyleSheetOwner.h"
 
-#include "AuthorStyleSheets.h"
 #include "ContentSecurityPolicy.h"
 #include "Element.h"
 #include "MediaList.h"
 #include "MediaQueryEvaluator.h"
 #include "ScriptableDocumentParser.h"
 #include "ShadowRoot.h"
+#include "StyleScope.h"
 #include "StyleSheetContents.h"
 #include "TextNodeTraversal.h"
 #include <wtf/NeverDestroyed.h>
@@ -51,8 +51,8 @@
 
 void InlineStyleSheetOwner::insertedIntoDocument(Element& element)
 {
-    m_styleSheetScope = &AuthorStyleSheets::forNode(element);
-    m_styleSheetScope->addStyleSheetCandidateNode(element, m_isParsingChildren);
+    m_styleScope = &Style::Scope::forNode(element);
+    m_styleScope->addStyleSheetCandidateNode(element, m_isParsingChildren);
 
     if (m_isParsingChildren)
         return;
@@ -61,9 +61,9 @@
 
 void InlineStyleSheetOwner::removedFromDocument(Element& element)
 {
-    if (m_styleSheetScope) {
-        m_styleSheetScope->removeStyleSheetCandidateNode(element);
-        m_styleSheetScope = nullptr;
+    if (m_styleScope) {
+        m_styleScope->removeStyleSheetCandidateNode(element);
+        m_styleScope = nullptr;
     }
     if (m_sheet)
         clearSheet();
@@ -74,9 +74,9 @@
     if (m_sheet)
         m_sheet->clearOwnerNode();
 
-    if (m_styleSheetScope) {
-        m_styleSheetScope->removeStyleSheetCandidateNode(element);
-        m_styleSheetScope = nullptr;
+    if (m_styleScope) {
+        m_styleScope->removeStyleSheetCandidateNode(element);
+        m_styleScope = nullptr;
     }
 }
 
@@ -124,8 +124,8 @@
     ASSERT(element.inDocument());
     Document& document = element.document();
     if (m_sheet) {
-        if (m_sheet->isLoading() && m_styleSheetScope)
-            m_styleSheetScope->removePendingSheet();
+        if (m_sheet->isLoading() && m_styleScope)
+            m_styleScope->removePendingSheet();
         clearSheet();
     }
 
@@ -149,8 +149,8 @@
     if (!screenEval.evaluate(*mediaQueries) && !printEval.evaluate(*mediaQueries))
         return;
 
-    if (m_styleSheetScope)
-        m_styleSheetScope->addPendingSheet();
+    if (m_styleScope)
+        m_styleScope->addPendingSheet();
 
     m_loading = true;
 
@@ -177,16 +177,16 @@
     if (isLoading())
         return false;
 
-    if (m_styleSheetScope)
-        m_styleSheetScope->removePendingSheet();
+    if (m_styleScope)
+        m_styleScope->removePendingSheet();
 
     return true;
 }
 
 void InlineStyleSheetOwner::startLoadingDynamicSheet(Element&)
 {
-    if (m_styleSheetScope)
-        m_styleSheetScope->addPendingSheet();
+    if (m_styleScope)
+        m_styleScope->addPendingSheet();
 }
 
 }
diff --git a/Source/WebCore/dom/InlineStyleSheetOwner.h b/Source/WebCore/dom/InlineStyleSheetOwner.h
index 6ddcdaf..ad58dd4 100644
--- a/Source/WebCore/dom/InlineStyleSheetOwner.h
+++ b/Source/WebCore/dom/InlineStyleSheetOwner.h
@@ -50,7 +50,7 @@
     void childrenChanged(Element&);
     void finishParsingChildren(Element&);
 
-    AuthorStyleSheets* styleSheetScope() { return m_styleSheetScope; }
+    Style::Scope* styleScope() { return m_styleScope; }
 
 private:
     void createSheet(Element&, const String& text);
@@ -63,7 +63,7 @@
     AtomicString m_contentType;
     AtomicString m_media;
     RefPtr<CSSStyleSheet> m_sheet;
-    AuthorStyleSheets* m_styleSheetScope { nullptr };
+    Style::Scope* m_styleScope { nullptr };
 };
 
 }
diff --git a/Source/WebCore/dom/ProcessingInstruction.cpp b/Source/WebCore/dom/ProcessingInstruction.cpp
index 73bbd22..9673dd2 100644
--- a/Source/WebCore/dom/ProcessingInstruction.cpp
+++ b/Source/WebCore/dom/ProcessingInstruction.cpp
@@ -22,7 +22,6 @@
 #include "config.h"
 #include "ProcessingInstruction.h"
 
-#include "AuthorStyleSheets.h"
 #include "CSSStyleSheet.h"
 #include "CachedCSSStyleSheet.h"
 #include "CachedResourceLoader.h"
@@ -35,6 +34,7 @@
 #include "XSLStyleSheet.h"
 #include "XMLDocumentParser.h" // for parseAttributes()
 #include "MediaList.h"
+#include "StyleScope.h"
 #include "StyleSheetContents.h"
 
 namespace WebCore {
@@ -59,7 +59,7 @@
         m_cachedSheet->removeClient(*this);
 
     if (inDocument())
-        document().authorStyleSheets().removeStyleSheetCandidateNode(*this);
+        document().styleScope().removeStyleSheetCandidateNode(*this);
 }
 
 String ProcessingInstruction::nodeName() const
@@ -135,7 +135,7 @@
                 return;
 
             m_loading = true;
-            document().authorStyleSheets().addPendingSheet();
+            document().styleScope().addPendingSheet();
 
 #if ENABLE(XSLT)
             if (m_isXSL) {
@@ -158,7 +158,7 @@
             else {
                 // The request may have been denied if (for example) the stylesheet is local and the document is remote.
                 m_loading = false;
-                document().authorStyleSheets().removePendingSheet();
+                document().styleScope().removePendingSheet();
             }
         }
     }
@@ -176,7 +176,7 @@
 bool ProcessingInstruction::sheetLoaded()
 {
     if (!isLoading()) {
-        document().authorStyleSheets().removePendingSheet();
+        document().styleScope().removePendingSheet();
         return true;
     }
     return false;
@@ -251,7 +251,7 @@
     CharacterData::insertedInto(insertionPoint);
     if (!insertionPoint.inDocument())
         return InsertionDone;
-    document().authorStyleSheets().addStyleSheetCandidateNode(*this, m_createdByParser);
+    document().styleScope().addStyleSheetCandidateNode(*this, m_createdByParser);
     checkStyleSheet();
     return InsertionDone;
 }
@@ -262,7 +262,7 @@
     if (!insertionPoint.inDocument())
         return;
     
-    document().authorStyleSheets().removeStyleSheetCandidateNode(*this);
+    document().styleScope().removeStyleSheetCandidateNode(*this);
 
     if (m_sheet) {
         ASSERT(m_sheet->ownerNode() == this);
@@ -272,12 +272,12 @@
 
     if (m_loading) {
         m_loading = false;
-        document().authorStyleSheets().removePendingSheet();
+        document().styleScope().removePendingSheet();
     }
 
     // If we're in document teardown, then we don't need to do any notification of our sheet's removal.
     if (document().hasLivingRenderTree())
-        document().authorStyleSheets().didChangeContentsOrInterpretation();
+        document().styleScope().didChangeContentsOrInterpretation();
 }
 
 void ProcessingInstruction::finishParsingChildren()
diff --git a/Source/WebCore/dom/ShadowRoot.cpp b/Source/WebCore/dom/ShadowRoot.cpp
index 0a14bc6..2dfc732 100644
--- a/Source/WebCore/dom/ShadowRoot.cpp
+++ b/Source/WebCore/dom/ShadowRoot.cpp
@@ -28,13 +28,13 @@
 #include "config.h"
 #include "ShadowRoot.h"
 
-#include "AuthorStyleSheets.h"
 #include "CSSStyleSheet.h"
 #include "ElementTraversal.h"
 #include "RenderElement.h"
 #include "RuntimeEnabledFeatures.h"
 #include "SlotAssignment.h"
 #include "StyleResolver.h"
+#include "StyleScope.h"
 #include "markup.h"
 
 namespace WebCore {
@@ -42,7 +42,7 @@
 struct SameSizeAsShadowRoot : public DocumentFragment, public TreeScope {
     unsigned countersAndFlags[1];
     void* styleResolver;
-    void* authorStyleSheets;
+    void* styleScope;
     void* host;
     void* slotAssignment;
 };
@@ -88,8 +88,8 @@
     if (!m_styleResolver) {
         // FIXME: We could share style resolver with shadow roots that have identical style.
         m_styleResolver = std::make_unique<StyleResolver>(document());
-        if (m_authorStyleSheets)
-            m_styleResolver->appendAuthorStyleSheets(m_authorStyleSheets->activeStyleSheets());
+        if (m_styleScope)
+            m_styleResolver->appendAuthorStyleSheets(m_styleScope->activeStyleSheets());
     }
     return *m_styleResolver;
 }
@@ -107,19 +107,19 @@
     m_styleResolver = nullptr;
 }
 
-AuthorStyleSheets& ShadowRoot::authorStyleSheets()
+Style::Scope& ShadowRoot::styleScope()
 {
-    if (!m_authorStyleSheets)
-        m_authorStyleSheets = std::make_unique<AuthorStyleSheets>(*this);
-    return *m_authorStyleSheets;
+    if (!m_styleScope)
+        m_styleScope = std::make_unique<Style::Scope>(*this);
+    return *m_styleScope;
 }
 
 void ShadowRoot::updateStyle()
 {
-    if (!m_authorStyleSheets)
+    if (!m_styleScope)
         return;
     // FIXME: Make optimized updated work.
-    m_authorStyleSheets->didChangeContentsOrInterpretation();
+    m_styleScope->didChangeContentsOrInterpretation();
 }
 
 String ShadowRoot::innerHTML() const
diff --git a/Source/WebCore/dom/ShadowRoot.h b/Source/WebCore/dom/ShadowRoot.h
index 355a532..4d3e304 100644
--- a/Source/WebCore/dom/ShadowRoot.h
+++ b/Source/WebCore/dom/ShadowRoot.h
@@ -36,7 +36,6 @@
 
 namespace WebCore {
 
-class AuthorStyleSheets;
 class HTMLSlotElement;
 class SlotAssignment;
 
@@ -64,7 +63,7 @@
 
     StyleResolver& styleResolver();
     StyleResolver* styleResolverIfExists();
-    AuthorStyleSheets& authorStyleSheets();
+    Style::Scope& styleScope();
 
     void updateStyle();
     void resetStyleResolver();
@@ -116,7 +115,7 @@
     Element* m_host { nullptr };
 
     std::unique_ptr<StyleResolver> m_styleResolver;
-    std::unique_ptr<AuthorStyleSheets> m_authorStyleSheets;
+    std::unique_ptr<Style::Scope> m_styleScope;
 
     std::unique_ptr<SlotAssignment> m_slotAssignment;
 };
diff --git a/Source/WebCore/html/HTMLLinkElement.cpp b/Source/WebCore/html/HTMLLinkElement.cpp
index 866d866..3f41d6a 100644
--- a/Source/WebCore/html/HTMLLinkElement.cpp
+++ b/Source/WebCore/html/HTMLLinkElement.cpp
@@ -26,7 +26,6 @@
 #include "HTMLLinkElement.h"
 
 #include "Attribute.h"
-#include "AuthorStyleSheets.h"
 #include "CachedCSSStyleSheet.h"
 #include "CachedResource.h"
 #include "CachedResourceLoader.h"
@@ -54,6 +53,7 @@
 #include "Settings.h"
 #include "StyleInheritedData.h"
 #include "StyleResolveForDocument.h"
+#include "StyleScope.h"
 #include "StyleSheetContents.h"
 #include <wtf/Ref.h>
 #include <wtf/StdLibExtras.h>
@@ -102,7 +102,7 @@
         m_cachedSheet->removeClient(*this);
 
     if (inDocument())
-        document().authorStyleSheets().removeStyleSheetCandidateNode(*this);
+        document().styleScope().removeStyleSheetCandidateNode(*this);
 
     linkLoadEventSender().cancelEvent(*this);
     linkErrorEventSender().cancelEvent(*this);
@@ -140,7 +140,7 @@
         if (!m_sheet && m_disabledState == EnabledViaScript)
             process();
         else
-            document().authorStyleSheets().didChangeContentsOrInterpretation();
+            document().styleScope().didChangeContentsOrInterpretation();
     }
 }
 
@@ -176,7 +176,7 @@
         m_media = value.string().convertToASCIILowercase();
         process();
         if (m_sheet && !isDisabled())
-            document().authorStyleSheets().didChangeContentsOrInterpretation();
+            document().styleScope().didChangeContentsOrInterpretation();
         return;
     }
     if (name == disabledAttr) {
@@ -283,7 +283,7 @@
     } else if (m_sheet) {
         // we no longer contain a stylesheet, e.g. perhaps rel or type was changed
         clearSheet();
-        document().authorStyleSheets().didChangeContentsOrInterpretation();
+        document().styleScope().didChangeContentsOrInterpretation();
     }
 }
 
@@ -305,7 +305,7 @@
     if (m_isInShadowTree)
         return InsertionDone;
 
-    document().authorStyleSheets().addStyleSheetCandidateNode(*this, m_createdByParser);
+    document().styleScope().addStyleSheetCandidateNode(*this, m_createdByParser);
 
     process();
     return InsertionDone;
@@ -321,7 +321,7 @@
         ASSERT(!m_sheet);
         return;
     }
-    document().authorStyleSheets().removeStyleSheetCandidateNode(*this);
+    document().styleScope().removeStyleSheetCandidateNode(*this);
 
     if (m_sheet)
         clearSheet();
@@ -544,7 +544,7 @@
 
     if (m_pendingSheetType == InactiveSheet)
         return;
-    document().authorStyleSheets().addPendingSheet();
+    document().styleScope().addPendingSheet();
 }
 
 void HTMLLinkElement::removePendingSheet(RemovePendingSheetNotificationType notification)
@@ -557,14 +557,14 @@
 
     if (type == InactiveSheet) {
         // Document just needs to know about the sheet for exposure through document.styleSheets
-        document().authorStyleSheets().didChangeCandidatesForActiveSet();
+        document().styleScope().didChangeCandidatesForActiveSet();
         return;
     }
 
-    document().authorStyleSheets().removePendingSheet(
+    document().styleScope().removePendingSheet(
         notification == RemovePendingSheetNotifyImmediately
-        ? AuthorStyleSheets::RemovePendingSheetNotifyImmediately
-        : AuthorStyleSheets::RemovePendingSheetNotifyLater);
+        ? Style::Scope::RemovePendingSheetNotifyImmediately
+        : Style::Scope::RemovePendingSheetNotifyLater);
 }
 
 } // namespace WebCore
diff --git a/Source/WebCore/html/HTMLStyleElement.cpp b/Source/WebCore/html/HTMLStyleElement.cpp
index 63f4a61..191a45ca 100644
--- a/Source/WebCore/html/HTMLStyleElement.cpp
+++ b/Source/WebCore/html/HTMLStyleElement.cpp
@@ -24,7 +24,6 @@
 #include "config.h"
 #include "HTMLStyleElement.h"
 
-#include "AuthorStyleSheets.h"
 #include "CachedResource.h"
 #include "Document.h"
 #include "Event.h"
@@ -35,6 +34,7 @@
 #include "RuntimeEnabledFeatures.h"
 #include "ScriptableDocumentParser.h"
 #include "ShadowRoot.h"
+#include "StyleScope.h"
 #include "StyleSheetContents.h"
 
 namespace WebCore {
@@ -76,7 +76,7 @@
         m_styleSheetOwner.setMedia(value);
         if (sheet()) {
             sheet()->setMediaQueries(MediaQuerySet::createAllowingDescriptionSyntax(value));
-            if (auto* scope = m_styleSheetOwner.styleSheetScope())
+            if (auto* scope = m_styleSheetOwner.styleScope())
                 scope->didChangeContentsOrInterpretation();
         } else
             m_styleSheetOwner.childrenChanged(*this);
diff --git a/Source/WebCore/inspector/InspectorCSSAgent.cpp b/Source/WebCore/inspector/InspectorCSSAgent.cpp
index 8f53793..aa3e0c4 100644
--- a/Source/WebCore/inspector/InspectorCSSAgent.cpp
+++ b/Source/WebCore/inspector/InspectorCSSAgent.cpp
@@ -26,7 +26,6 @@
 #include "config.h"
 #include "InspectorCSSAgent.h"
 
-#include "AuthorStyleSheets.h"
 #include "CSSComputedStyleDeclaration.h"
 #include "CSSImportRule.h"
 #include "CSSPropertyNames.h"
@@ -56,6 +55,7 @@
 #include "StylePropertyShorthand.h"
 #include "StyleResolver.h"
 #include "StyleRule.h"
+#include "StyleScope.h"
 #include "StyleSheetList.h"
 #include "WebKitNamedFlow.h"
 #include <inspector/InspectorProtocolObjects.h>
@@ -670,7 +670,7 @@
 
 void InspectorCSSAgent::collectAllDocumentStyleSheets(Document& document, Vector<CSSStyleSheet*>& result)
 {
-    auto cssStyleSheets = document.authorStyleSheets().activeStyleSheetsForInspector();
+    auto cssStyleSheets = document.styleScope().activeStyleSheetsForInspector();
     for (auto& cssStyleSheet : cssStyleSheets)
         collectStyleSheets(cssStyleSheet.get(), result);
 }
@@ -889,7 +889,7 @@
         m_nodeIdToForcedPseudoState.set(nodeId, forcedPseudoState);
     else
         m_nodeIdToForcedPseudoState.remove(nodeId);
-    element->document().authorStyleSheets().didChangeContentsOrInterpretation();
+    element->document().styleScope().didChangeContentsOrInterpretation();
 }
 
 void InspectorCSSAgent::getNamedFlowCollection(ErrorString& errorString, int documentNodeId, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::CSS::NamedFlow>>& result)
@@ -1015,7 +1015,7 @@
 
     // StyleRules returned by StyleResolver::styleRulesForElement lack parent pointers since that infomation is not cheaply available.
     // Since the inspector wants to walk the parent chain, we construct the full wrappers here.
-    CSSStyleRule* cssomWrapper = styleResolver.inspectorCSSOMWrappers().getWrapperForRuleInSheets(styleRule, styleResolver.document().authorStyleSheets(), styleResolver.document().extensionStyleSheets());
+    CSSStyleRule* cssomWrapper = styleResolver.inspectorCSSOMWrappers().getWrapperForRuleInSheets(styleRule, styleResolver.document().styleScope(), styleResolver.document().extensionStyleSheets());
     if (!cssomWrapper)
         return nullptr;
     InspectorStyleSheet* inspectorStyleSheet = bindStyleSheet(cssomWrapper->parentStyleSheet());
@@ -1189,7 +1189,7 @@
 
     m_nodeIdToForcedPseudoState.clear();
     for (auto& document : documentsToChange)
-        document->authorStyleSheets().didChangeContentsOrInterpretation();
+        document->styleScope().didChangeContentsOrInterpretation();
 }
 
 } // namespace WebCore
diff --git a/Source/WebCore/inspector/InspectorPageAgent.cpp b/Source/WebCore/inspector/InspectorPageAgent.cpp
index e551a63..2bed25f 100644
--- a/Source/WebCore/inspector/InspectorPageAgent.cpp
+++ b/Source/WebCore/inspector/InspectorPageAgent.cpp
@@ -32,7 +32,6 @@
 #include "config.h"
 #include "InspectorPageAgent.h"
 
-#include "AuthorStyleSheets.h"
 #include "CachedCSSStyleSheet.h"
 #include "CachedFont.h"
 #include "CachedImage.h"
@@ -67,6 +66,7 @@
 #include "ScriptController.h"
 #include "SecurityOrigin.h"
 #include "Settings.h"
+#include "StyleScope.h"
 #include "TextEncoding.h"
 #include "TextResourceDecoder.h"
 #include "UserGestureIndicator.h"
@@ -1002,7 +1002,7 @@
     m_emulatedMedia = media;
     Document* document = m_page.mainFrame().document();
     if (document) {
-        document->authorStyleSheets().didChangeContentsOrInterpretation();
+        document->styleScope().didChangeContentsOrInterpretation();
         document->updateLayout();
     }
 }
diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp
index ad376cf..5d88989 100644
--- a/Source/WebCore/page/DOMWindow.cpp
+++ b/Source/WebCore/page/DOMWindow.cpp
@@ -27,7 +27,6 @@
 #include "config.h"
 #include "DOMWindow.h"
 
-#include "AuthorStyleSheets.h"
 #include "BackForwardController.h"
 #include "BarProp.h"
 #include "BeforeUnloadEvent.h"
@@ -97,6 +96,7 @@
 #include "StorageNamespaceProvider.h"
 #include "StyleMedia.h"
 #include "StyleResolver.h"
+#include "StyleScope.h"
 #include "SuddenTermination.h"
 #include "URL.h"
 #include "UserGestureIndicator.h"
@@ -1432,7 +1432,7 @@
     if (pseudoType == CSSSelector::PseudoElementUnknown && !pseudoElement.isEmpty())
         return nullptr;
 
-    m_frame->document()->authorStyleSheets().flushPendingUpdate();
+    m_frame->document()->styleScope().flushPendingUpdate();
 
     unsigned rulesToInclude = StyleResolver::AuthorCSSRules;
     if (!authorOnly)
diff --git a/Source/WebCore/page/Frame.cpp b/Source/WebCore/page/Frame.cpp
index 5185af3..f742a57 100644
--- a/Source/WebCore/page/Frame.cpp
+++ b/Source/WebCore/page/Frame.cpp
@@ -32,7 +32,6 @@
 
 #include "AnimationController.h"
 #include "ApplyStyleCommand.h"
-#include "AuthorStyleSheets.h"
 #include "BackForwardController.h"
 #include "CSSComputedStyleDeclaration.h"
 #include "CSSPropertyNames.h"
@@ -93,6 +92,7 @@
 #include "ScrollingCoordinator.h"
 #include "Settings.h"
 #include "StyleProperties.h"
+#include "StyleScope.h"
 #include "TextNodeTraversal.h"
 #include "TextResourceDecoder.h"
 #include "UserContentController.h"
@@ -644,7 +644,7 @@
     m_doc->setPrinting(printing);
     view()->adjustMediaTypeForPrinting(printing);
 
-    m_doc->authorStyleSheets().didChangeContentsOrInterpretation();
+    m_doc->styleScope().didChangeContentsOrInterpretation();
     if (shouldUsePrintingLayout()) {
         view()->forceLayoutForPagination(pageSize, originalPageSize, maximumShrinkRatio, shouldAdjustViewSize);
     } else {
diff --git a/Source/WebCore/page/FrameView.cpp b/Source/WebCore/page/FrameView.cpp
index 924bf02..7d44724 100644
--- a/Source/WebCore/page/FrameView.cpp
+++ b/Source/WebCore/page/FrameView.cpp
@@ -29,7 +29,6 @@
 
 #include "AXObjectCache.h"
 #include "AnimationController.h"
-#include "AuthorStyleSheets.h"
 #include "BackForwardController.h"
 #include "CachedImage.h"
 #include "CachedResourceLoader.h"
@@ -92,6 +91,7 @@
 #include "ScrollingCoordinator.h"
 #include "Settings.h"
 #include "StyleResolver.h"
+#include "StyleScope.h"
 #include "TextResourceDecoder.h"
 #include "TextStream.h"
 #include "TiledBacking.h"
@@ -1335,7 +1335,7 @@
         StyleResolver* styleResolver = document.styleResolverIfExists();
         if (!styleResolver || styleResolver->hasMediaQueriesAffectedByViewportChange()) {
             LOG(Layout, "  hasMediaQueriesAffectedByViewportChange, enqueueing style recalc");
-            document.authorStyleSheets().didChangeContentsOrInterpretation();
+            document.styleScope().didChangeContentsOrInterpretation();
             // FIXME: This instrumentation event is not strictly accurate since cached media query results do not persist across StyleResolver rebuilds.
             InspectorInstrumentation::mediaQueryResultChanged(document);
         } else
@@ -3532,7 +3532,7 @@
 
     m_pagination = pagination;
 
-    frame().document()->authorStyleSheets().didChangeContentsOrInterpretation();
+    frame().document()->styleScope().didChangeContentsOrInterpretation();
 }
 
 IntRect FrameView::windowClipRect() const
@@ -5001,7 +5001,7 @@
     if (Document* document = frame().document()) {
         // FIXME: this should probably be updateViewportUnitsOnResize(), but synchronously
         // dirtying style here causes assertions on iOS (rdar://problem/19998166).
-        document->authorStyleSheets().didChangeContentsOrInterpretation();
+        document->styleScope().didChangeContentsOrInterpretation();
     }
 }
     
diff --git a/Source/WebCore/page/Page.cpp b/Source/WebCore/page/Page.cpp
index a9e2094..0caa171 100644
--- a/Source/WebCore/page/Page.cpp
+++ b/Source/WebCore/page/Page.cpp
@@ -23,7 +23,6 @@
 #include "AlternativeTextClient.h"
 #include "AnimationController.h"
 #include "ApplicationCacheStorage.h"
-#include "AuthorStyleSheets.h"
 #include "BackForwardClient.h"
 #include "BackForwardController.h"
 #include "Chrome.h"
@@ -90,6 +89,7 @@
 #include "StorageNamespace.h"
 #include "StorageNamespaceProvider.h"
 #include "StyleResolver.h"
+#include "StyleScope.h"
 #include "SubframeLoader.h"
 #include "TextResourceDecoder.h"
 #include "UserContentProvider.h"
@@ -424,7 +424,7 @@
         m_mainFrame->view()->forceLayout();
 
     if (m_mainFrame->document())
-        m_mainFrame->document()->authorStyleSheets().didChangeContentsOrInterpretation();
+        m_mainFrame->document()->styleScope().didChangeContentsOrInterpretation();
 }
 #endif // ENABLE(VIEW_MODE_CSS_MEDIA)
 
@@ -502,7 +502,7 @@
 {
     for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
         if (Document* document = frame->document())
-            document->authorStyleSheets().didChangeContentsOrInterpretation();
+            document->styleScope().didChangeContentsOrInterpretation();
     }
 }
 
@@ -1163,7 +1163,7 @@
         if (!document)
             continue;
         document->extensionStyleSheets().invalidateInjectedStyleSheetCache();
-        document->authorStyleSheets().didChangeContentsOrInterpretation();
+        document->styleScope().didChangeContentsOrInterpretation();
     }
 }
 
diff --git a/Source/WebCore/dom/AuthorStyleSheets.cpp b/Source/WebCore/style/StyleScope.cpp
similarity index 89%
rename from Source/WebCore/dom/AuthorStyleSheets.cpp
rename to Source/WebCore/style/StyleScope.cpp
index 8743b6f..d1ed51c 100644
--- a/Source/WebCore/dom/AuthorStyleSheets.cpp
+++ b/Source/WebCore/style/StyleScope.cpp
@@ -3,7 +3,7 @@
  *           (C) 1999 Antti Koivisto (koivisto@kde.org)
  *           (C) 2001 Dirk Mueller (mueller@kde.org)
  *           (C) 2006 Alexey Proskuryakov (ap@webkit.org)
- * Copyright (C) 2004-2009, 2011-2012, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2009, 2011-2012, 2015-2016 Apple Inc. All rights reserved.
  * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
  * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
@@ -26,7 +26,7 @@
  */
 
 #include "config.h"
-#include "AuthorStyleSheets.h"
+#include "StyleScope.h"
 
 #include "CSSStyleSheet.h"
 #include "Element.h"
@@ -56,20 +56,22 @@
 using namespace ContentExtensions;
 using namespace HTMLNames;
 
-AuthorStyleSheets::AuthorStyleSheets(Document& document)
+namespace Style {
+
+Scope::Scope(Document& document)
     : m_document(document)
-    , m_pendingUpdateTimer(*this, &AuthorStyleSheets::pendingUpdateTimerFired)
+    , m_pendingUpdateTimer(*this, &Scope::pendingUpdateTimerFired)
 {
 }
 
-AuthorStyleSheets::AuthorStyleSheets(ShadowRoot& shadowRoot)
+Scope::Scope(ShadowRoot& shadowRoot)
     : m_document(shadowRoot.documentScope())
     , m_shadowRoot(&shadowRoot)
-    , m_pendingUpdateTimer(*this, &AuthorStyleSheets::pendingUpdateTimerFired)
+    , m_pendingUpdateTimer(*this, &Scope::pendingUpdateTimerFired)
 {
 }
 
-StyleResolver& AuthorStyleSheets::styleResolver()
+StyleResolver& Scope::styleResolver()
 {
     if (m_shadowRoot)
         return m_shadowRoot->styleResolver();
@@ -77,7 +79,7 @@
     return m_document.ensureStyleResolver();
 }
 
-StyleResolver* AuthorStyleSheets::styleResolverIfExists()
+StyleResolver* Scope::styleResolverIfExists()
 {
     if (m_shadowRoot)
         return m_shadowRoot->styleResolverIfExists();
@@ -85,17 +87,17 @@
     return m_document.styleResolverIfExists();
 }
 
-AuthorStyleSheets& AuthorStyleSheets::forNode(Node& node)
+Scope& Scope::forNode(Node& node)
 {
     ASSERT(node.inDocument());
     auto* shadowRoot = node.containingShadowRoot();
     if (shadowRoot)
-        return shadowRoot->authorStyleSheets();
-    return node.document().authorStyleSheets();
+        return shadowRoot->styleScope();
+    return node.document().styleScope();
 }
 
 // This method is called whenever a top-level stylesheet has finished loading.
-void AuthorStyleSheets::removePendingSheet(RemovePendingSheetNotificationType notification)
+void Scope::removePendingSheet(RemovePendingSheetNotificationType notification)
 {
     // Make sure we knew this sheet was pending, and that our count isn't out of sync.
     ASSERT(m_pendingStyleSheetCount > 0);
@@ -123,7 +125,7 @@
     m_document.didRemoveAllPendingStylesheet();
 }
 
-void AuthorStyleSheets::addStyleSheetCandidateNode(Node& node, bool createdByParser)
+void Scope::addStyleSheetCandidateNode(Node& node, bool createdByParser)
 {
     if (!node.inDocument())
         return;
@@ -156,13 +158,13 @@
     m_styleSheetCandidateNodes.insertBefore(followingNode, &node);
 }
 
-void AuthorStyleSheets::removeStyleSheetCandidateNode(Node& node)
+void Scope::removeStyleSheetCandidateNode(Node& node)
 {
     if (m_styleSheetCandidateNodes.remove(&node))
         scheduleActiveSetUpdate();
 }
 
-void AuthorStyleSheets::collectActiveStyleSheets(Vector<RefPtr<StyleSheet>>& sheets)
+void Scope::collectActiveStyleSheets(Vector<RefPtr<StyleSheet>>& sheets)
 {
     if (m_document.settings() && !m_document.settings()->authorAndUserStylesEnabled())
         return;
@@ -240,7 +242,7 @@
     }
 }
 
-AuthorStyleSheets::StyleResolverUpdateType AuthorStyleSheets::analyzeStyleSheetChange(const Vector<RefPtr<CSSStyleSheet>>& newStylesheets, bool& requiresFullStyleRecalc)
+Scope::StyleResolverUpdateType Scope::analyzeStyleSheetChange(const Vector<RefPtr<CSSStyleSheet>>& newStylesheets, bool& requiresFullStyleRecalc)
 {
     requiresFullStyleRecalc = true;
     
@@ -307,7 +309,7 @@
     }
 }
 
-void AuthorStyleSheets::updateActiveStyleSheets(UpdateType updateType)
+void Scope::updateActiveStyleSheets(UpdateType updateType)
 {
     ASSERT(!m_pendingUpdateType);
 
@@ -373,7 +375,7 @@
     }
 }
 
-void AuthorStyleSheets::updateStyleResolver(Vector<RefPtr<CSSStyleSheet>>& activeStyleSheets, StyleResolverUpdateType updateType)
+void Scope::updateStyleResolver(Vector<RefPtr<CSSStyleSheet>>& activeStyleSheets, StyleResolverUpdateType updateType)
 {
     if (updateType == Reconstruct) {
         if (m_shadowRoot)
@@ -404,7 +406,7 @@
     }
 }
 
-const Vector<RefPtr<CSSStyleSheet>> AuthorStyleSheets::activeStyleSheetsForInspector() const
+const Vector<RefPtr<CSSStyleSheet>> Scope::activeStyleSheetsForInspector() const
 {
     Vector<RefPtr<CSSStyleSheet>> result;
 
@@ -425,7 +427,7 @@
     return result;
 }
 
-bool AuthorStyleSheets::activeStyleSheetsContains(const CSSStyleSheet* sheet) const
+bool Scope::activeStyleSheetsContains(const CSSStyleSheet* sheet) const
 {
     if (!m_weakCopyOfActiveStyleSheetListForFastLookup) {
         m_weakCopyOfActiveStyleSheetListForFastLookup = std::make_unique<HashSet<const CSSStyleSheet*>>();
@@ -435,7 +437,7 @@
     return m_weakCopyOfActiveStyleSheetListForFastLookup->contains(sheet);
 }
 
-void AuthorStyleSheets::flushPendingUpdate()
+void Scope::flushPendingUpdate()
 {
     if (!m_pendingUpdateType)
         return;
@@ -446,13 +448,13 @@
     updateActiveStyleSheets(updateType);
 }
 
-void AuthorStyleSheets::clearPendingUpdate()
+void Scope::clearPendingUpdate()
 {
     m_pendingUpdateTimer.stop();
     m_pendingUpdateType = { };
 }
 
-void AuthorStyleSheets::scheduleActiveSetUpdate()
+void Scope::scheduleActiveSetUpdate()
 {
     if (m_shadowRoot) {
         // FIXME: We need to flush updates recursively to support asynchronous updates in shadow trees.
@@ -466,22 +468,23 @@
     m_pendingUpdateTimer.startOneShot(0);
 }
 
-void AuthorStyleSheets::didChangeCandidatesForActiveSet()
+void Scope::didChangeCandidatesForActiveSet()
 {
     auto updateType = m_pendingUpdateType.valueOr(UpdateType::ActiveSet);
     clearPendingUpdate();
     updateActiveStyleSheets(updateType);
 }
 
-void AuthorStyleSheets::didChangeContentsOrInterpretation()
+void Scope::didChangeContentsOrInterpretation()
 {
     clearPendingUpdate();
     updateActiveStyleSheets(UpdateType::ContentsOrInterpretation);
 }
 
-void AuthorStyleSheets::pendingUpdateTimerFired()
+void Scope::pendingUpdateTimerFired()
 {
     flushPendingUpdate();
 }
 
 }
+}
diff --git a/Source/WebCore/dom/AuthorStyleSheets.h b/Source/WebCore/style/StyleScope.h
similarity index 91%
rename from Source/WebCore/dom/AuthorStyleSheets.h
rename to Source/WebCore/style/StyleScope.h
index a828440..c45ec12 100644
--- a/Source/WebCore/dom/AuthorStyleSheets.h
+++ b/Source/WebCore/style/StyleScope.h
@@ -3,7 +3,7 @@
  *           (C) 1999 Antti Koivisto (koivisto@kde.org)
  *           (C) 2001 Dirk Mueller (mueller@kde.org)
  *           (C) 2006 Alexey Proskuryakov (ap@webkit.org)
- * Copyright (C) 2004-2010, 2012-2013, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2010, 2012-2013, 2015-2016 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.
@@ -25,8 +25,7 @@
  *
  */
 
-#ifndef AuthorStyleSheets_h
-#define AuthorStyleSheets_h
+#pragma once
 
 #include "Timer.h"
 #include <memory>
@@ -49,11 +48,13 @@
 class ShadowRoot;
 class TreeScope;
 
-class AuthorStyleSheets {
+namespace Style {
+
+class Scope {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    explicit AuthorStyleSheets(Document&);
-    explicit AuthorStyleSheets(ShadowRoot&);
+    explicit Scope(Document&);
+    explicit Scope(ShadowRoot&);
 
     const Vector<RefPtr<CSSStyleSheet>>& activeStyleSheets() const { return m_activeStyleSheets; }
 
@@ -91,7 +92,7 @@
     StyleResolver& styleResolver();
     StyleResolver* styleResolverIfExists();
 
-    static AuthorStyleSheets& forNode(Node&);
+    static Scope& forNode(Node&);
 
 private:
     enum class UpdateType { ActiveSet, ContentsOrInterpretation };
@@ -118,7 +119,6 @@
 
     Timer m_pendingUpdateTimer;
 
-    // This is a mirror of m_activeAuthorStyleSheets that gets populated on demand for activeStyleSheetsContains().
     mutable std::unique_ptr<HashSet<const CSSStyleSheet*>> m_weakCopyOfActiveStyleSheetListForFastLookup;
 
     // Track the number of currently loading top-level stylesheets needed for rendering.
@@ -139,6 +139,4 @@
 };
 
 }
-
-#endif
-
+}
diff --git a/Source/WebCore/style/StyleTreeResolver.cpp b/Source/WebCore/style/StyleTreeResolver.cpp
index b4ae062..5afaaa0 100644
--- a/Source/WebCore/style/StyleTreeResolver.cpp
+++ b/Source/WebCore/style/StyleTreeResolver.cpp
@@ -26,7 +26,6 @@
 #include "config.h"
 #include "StyleTreeResolver.h"
 
-#include "AuthorStyleSheets.h"
 #include "CSSFontSelector.h"
 #include "ComposedTreeAncestorIterator.h"
 #include "ComposedTreeIterator.h"
@@ -45,6 +44,7 @@
 #include "ShadowRoot.h"
 #include "StyleFontSizeFunctions.h"
 #include "StyleResolver.h"
+#include "StyleScope.h"
 #include "Text.h"
 
 namespace WebCore {
diff --git a/Source/WebCore/svg/SVGFontFaceElement.cpp b/Source/WebCore/svg/SVGFontFaceElement.cpp
index 13442e0..84614af 100644
--- a/Source/WebCore/svg/SVGFontFaceElement.cpp
+++ b/Source/WebCore/svg/SVGFontFaceElement.cpp
@@ -24,7 +24,6 @@
 #if ENABLE(SVG_FONTS)
 #include "SVGFontFaceElement.h"
 
-#include "AuthorStyleSheets.h"
 #include "CSSFontFaceSrcValue.h"
 #include "CSSParser.h"
 #include "CSSPropertyNames.h"
@@ -42,6 +41,7 @@
 #include "StyleProperties.h"
 #include "StyleResolver.h"
 #include "StyleRule.h"
+#include "StyleScope.h"
 #include <math.h>
 
 namespace WebCore {
@@ -267,7 +267,7 @@
         }
     }
 
-    document().authorStyleSheets().didChangeContentsOrInterpretation();
+    document().styleScope().didChangeContentsOrInterpretation();
 }
 
 Node::InsertionNotificationRequest SVGFontFaceElement::insertedInto(ContainerNode& rootParent)
@@ -292,7 +292,7 @@
         document().accessSVGExtensions().unregisterSVGFontFaceElement(this);
         m_fontFaceRule->mutableProperties().clear();
 
-        document().authorStyleSheets().didChangeContentsOrInterpretation();
+        document().styleScope().didChangeContentsOrInterpretation();
     } else
         ASSERT(!m_fontElement);
 }
diff --git a/Source/WebCore/xml/XMLTreeViewer.cpp b/Source/WebCore/xml/XMLTreeViewer.cpp
index ddb9b6c..21df3ed 100644
--- a/Source/WebCore/xml/XMLTreeViewer.cpp
+++ b/Source/WebCore/xml/XMLTreeViewer.cpp
@@ -32,7 +32,6 @@
 
 #if ENABLE(XSLT)
 
-#include "AuthorStyleSheets.h"
 #include "Document.h"
 #include "Element.h"
 #include "ExceptionCodePlaceholder.h"
@@ -41,6 +40,7 @@
 #include "ScriptSourceCode.h"
 #include "SecurityOrigin.h"
 #include "SecurityOriginPolicy.h"
+#include "StyleScope.h"
 #include "Text.h"
 #include "XMLViewerCSS.h"
 #include "XMLViewerJS.h"
@@ -64,7 +64,7 @@
     String cssString = StringImpl::createWithoutCopying(XMLViewer_css, sizeof(XMLViewer_css));
     auto text = m_document.createTextNode(cssString);
     m_document.getElementById(String(ASCIILiteral("xml-viewer-style")))->appendChild(text, IGNORE_EXCEPTION);
-    m_document.authorStyleSheets().didChangeContentsOrInterpretation();
+    m_document.styleScope().didChangeContentsOrInterpretation();
 }
 
 } // namespace WebCore
diff --git a/Source/WebCore/xml/parser/XMLDocumentParser.cpp b/Source/WebCore/xml/parser/XMLDocumentParser.cpp
index be10cc8..bf742d8 100644
--- a/Source/WebCore/xml/parser/XMLDocumentParser.cpp
+++ b/Source/WebCore/xml/parser/XMLDocumentParser.cpp
@@ -26,7 +26,6 @@
 #include "config.h"
 #include "XMLDocumentParser.h"
 
-#include "AuthorStyleSheets.h"
 #include "CDATASection.h"
 #include "CachedScript.h"
 #include "Comment.h"
@@ -49,6 +48,7 @@
 #include "SVGStyleElement.h"
 #include "ScriptElement.h"
 #include "ScriptSourceCode.h"
+#include "StyleScope.h"
 #include "TextResourceDecoder.h"
 #include "TreeDepthLimit.h"
 #include <wtf/Ref.h>
@@ -200,7 +200,7 @@
         insertErrorMessageBlock();
     else {
         updateLeafTextNode();
-        document()->authorStyleSheets().didChangeContentsOrInterpretation();
+        document()->styleScope().didChangeContentsOrInterpretation();
     }
 
     if (isParsing())
diff --git a/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp b/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp
index 1cdc0ac..9db336e 100644
--- a/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp
+++ b/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp
@@ -28,7 +28,6 @@
 #include "config.h"
 #include "XMLDocumentParser.h"
 
-#include "AuthorStyleSheets.h"
 #include "CDATASection.h"
 #include "CachedScript.h"
 #include "Comment.h"
@@ -56,6 +55,7 @@
 #include "ScriptSourceCode.h"
 #include "SecurityOrigin.h"
 #include "Settings.h"
+#include "StyleScope.h"
 #include "TextResourceDecoder.h"
 #include "TransformSource.h"
 #include "XMLNSNames.h"
@@ -1387,7 +1387,7 @@
         document()->setTransformSource(std::make_unique<TransformSource>(doc));
 
         document()->setParsing(false); // Make the document think it's done, so it will apply XSL stylesheets.
-        document()->authorStyleSheets().didChangeContentsOrInterpretation();
+        document()->styleScope().didChangeContentsOrInterpretation();
 
         // styleResolverChanged() call can detach the parser and null out its document.
         // In that case, we just bail out.
diff --git a/Source/WebKit/mac/WebView/WebHTMLView.mm b/Source/WebKit/mac/WebView/WebHTMLView.mm
index bcf9c4a..749b0a1 100644
--- a/Source/WebKit/mac/WebView/WebHTMLView.mm
+++ b/Source/WebKit/mac/WebView/WebHTMLView.mm
@@ -72,7 +72,6 @@
 #import "WebTypesInternal.h"
 #import "WebUIDelegatePrivate.h"
 #import "WebViewInternal.h"
-#import <WebCore/AuthorStyleSheets.h>
 #import <WebCore/CSSStyleDeclaration.h>
 #import <WebCore/CachedImage.h>
 #import <WebCore/CachedResourceClient.h>
@@ -119,6 +118,7 @@
 #import <WebCore/RuntimeApplicationChecks.h>
 #import <WebCore/SharedBuffer.h>
 #import <WebCore/StyleProperties.h>
+#import <WebCore/StyleScope.h>
 #import <WebCore/Text.h>
 #import <WebCore/TextAlternativeWithRange.h>
 #import <WebCore/TextIndicator.h>
@@ -3612,7 +3612,7 @@
 #endif
 
     if (Frame* coreFrame = core([self _frame])) {
-        coreFrame->document()->authorStyleSheets().didChangeContentsOrInterpretation();
+        coreFrame->document()->styleScope().didChangeContentsOrInterpretation();
         coreFrame->document()->updateStyleIfNeeded();
     }
 
@@ -5007,7 +5007,7 @@
 
             document->setPaginatedForScreen(_private->paginateScreenContent);
             document->setPrinting(_private->printing);
-            document->authorStyleSheets().didChangeContentsOrInterpretation();
+            document->styleScope().didChangeContentsOrInterpretation();
         }
     }