Move stylesheet change logic from Document to AuthorStyleSheets
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Sep 2016 16:35:04 +0000 (16:35 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Sep 2016 16:35:04 +0000 (16:35 +0000)
https://bugs.webkit.org/show_bug.cgi?id=162488

Reviewed by Andreas Kling.

That's where it belongs.

* WebCore.xcodeproj/project.pbxproj:
* css/CSSStyleSheet.cpp:
(WebCore::CSSStyleSheet::didMutateRules):
(WebCore::CSSStyleSheet::didMutate):
(WebCore::CSSStyleSheet::clearOwnerNode):
* dom/AuthorStyleSheets.cpp:
(WebCore::AuthorStyleSheets::AuthorStyleSheets):
(WebCore::AuthorStyleSheets::flushPendingUpdates):
(WebCore::AuthorStyleSheets::scheduleOptimizedUpdate):
(WebCore::AuthorStyleSheets::didChange):
(WebCore::AuthorStyleSheets::optimizedUpdateTimerFired):
* dom/AuthorStyleSheets.h:
(WebCore::AuthorStyleSheets::hasPendingUpdate):
(WebCore::AuthorStyleSheets::pendingUpdateType): Deleted.
(WebCore::AuthorStyleSheets::setPendingUpdateType): Deleted.
(WebCore::AuthorStyleSheets::flushPendingUpdates): Deleted.
* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::setContentLanguage):
(WebCore::Document::needsStyleRecalc):
(WebCore::Document::updateStyleIfNeeded):
(WebCore::Document::updateLayoutIgnorePendingStylesheets):
(WebCore::Document::didRemoveAllPendingStylesheet):
(WebCore::Document::processHttpEquiv):
(WebCore::Document::setSelectedStylesheetSet):
(WebCore::Document::updateHoverActiveState):
(WebCore::Document::optimizedStyleSheetUpdateTimerFired): Deleted.
(WebCore::Document::scheduleOptimizedStyleSheetUpdate): Deleted.
(WebCore::Document::styleResolverChanged): Deleted.
* dom/Document.h:
(WebCore::Document::needsStyleRecalc): 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::removedFromDocument):
* dom/ProcessingInstruction.cpp:
(WebCore::ProcessingInstruction::removedFrom):

    Also fix a bug that prevented document from rendering if a loading processing instruction was removed from the tree.
    This is tested by fast/dom/StyleSheet/detached-style-pi-2.xhtml (after other changes in this patch).

* dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::updateStyle):
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::setDisabledState):
(WebCore::HTMLLinkElement::parseAttribute):
(WebCore::HTMLLinkElement::process):
(WebCore::HTMLLinkElement::removedFrom):
(WebCore::HTMLLinkElement::removePendingSheet):
* html/HTMLStyleElement.cpp:
(WebCore::HTMLStyleElement::parseAttribute):
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::forcePseudoState):
(WebCore::InspectorCSSAgent::resetPseudoStates):
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::setEmulatedMedia):
* 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):
* 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@206311 268f45cc-cd09-0410-ab3c-d52691b4dbfc

23 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/css/CSSStyleSheet.cpp
Source/WebCore/dom/AuthorStyleSheets.cpp
Source/WebCore/dom/AuthorStyleSheets.h
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/ExtensionStyleSheets.cpp
Source/WebCore/dom/InlineStyleSheetOwner.cpp
Source/WebCore/dom/ProcessingInstruction.cpp
Source/WebCore/dom/ShadowRoot.cpp
Source/WebCore/html/HTMLLinkElement.cpp
Source/WebCore/html/HTMLStyleElement.cpp
Source/WebCore/inspector/InspectorCSSAgent.cpp
Source/WebCore/inspector/InspectorPageAgent.cpp
Source/WebCore/page/Frame.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/Page.cpp
Source/WebCore/svg/SVGFontFaceElement.cpp
Source/WebCore/xml/XMLTreeViewer.cpp
Source/WebCore/xml/parser/XMLDocumentParser.cpp
Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp
Source/WebKit/mac/WebView/WebHTMLView.mm

index c715962..2e558f5 100644 (file)
@@ -1,3 +1,93 @@
+2016-09-23  Antti Koivisto  <antti@apple.com>
+
+        Move stylesheet change logic from Document to AuthorStyleSheets
+        https://bugs.webkit.org/show_bug.cgi?id=162488
+
+        Reviewed by Andreas Kling.
+
+        That's where it belongs.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * css/CSSStyleSheet.cpp:
+        (WebCore::CSSStyleSheet::didMutateRules):
+        (WebCore::CSSStyleSheet::didMutate):
+        (WebCore::CSSStyleSheet::clearOwnerNode):
+        * dom/AuthorStyleSheets.cpp:
+        (WebCore::AuthorStyleSheets::AuthorStyleSheets):
+        (WebCore::AuthorStyleSheets::flushPendingUpdates):
+        (WebCore::AuthorStyleSheets::scheduleOptimizedUpdate):
+        (WebCore::AuthorStyleSheets::didChange):
+        (WebCore::AuthorStyleSheets::optimizedUpdateTimerFired):
+        * dom/AuthorStyleSheets.h:
+        (WebCore::AuthorStyleSheets::hasPendingUpdate):
+        (WebCore::AuthorStyleSheets::pendingUpdateType): Deleted.
+        (WebCore::AuthorStyleSheets::setPendingUpdateType): Deleted.
+        (WebCore::AuthorStyleSheets::flushPendingUpdates): Deleted.
+        * dom/Document.cpp:
+        (WebCore::Document::Document):
+        (WebCore::Document::setContentLanguage):
+        (WebCore::Document::needsStyleRecalc):
+        (WebCore::Document::updateStyleIfNeeded):
+        (WebCore::Document::updateLayoutIgnorePendingStylesheets):
+        (WebCore::Document::didRemoveAllPendingStylesheet):
+        (WebCore::Document::processHttpEquiv):
+        (WebCore::Document::setSelectedStylesheetSet):
+        (WebCore::Document::updateHoverActiveState):
+        (WebCore::Document::optimizedStyleSheetUpdateTimerFired): Deleted.
+        (WebCore::Document::scheduleOptimizedStyleSheetUpdate): Deleted.
+        (WebCore::Document::styleResolverChanged): Deleted.
+        * dom/Document.h:
+        (WebCore::Document::needsStyleRecalc): 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::removedFromDocument):
+        * dom/ProcessingInstruction.cpp:
+        (WebCore::ProcessingInstruction::removedFrom):
+
+            Also fix a bug that prevented document from rendering if a loading processing instruction was removed from the tree.
+            This is tested by fast/dom/StyleSheet/detached-style-pi-2.xhtml (after other changes in this patch).
+
+        * dom/ShadowRoot.cpp:
+        (WebCore::ShadowRoot::updateStyle):
+        * html/HTMLLinkElement.cpp:
+        (WebCore::HTMLLinkElement::setDisabledState):
+        (WebCore::HTMLLinkElement::parseAttribute):
+        (WebCore::HTMLLinkElement::process):
+        (WebCore::HTMLLinkElement::removedFrom):
+        (WebCore::HTMLLinkElement::removePendingSheet):
+        * html/HTMLStyleElement.cpp:
+        (WebCore::HTMLStyleElement::parseAttribute):
+        * inspector/InspectorCSSAgent.cpp:
+        (WebCore::InspectorCSSAgent::forcePseudoState):
+        (WebCore::InspectorCSSAgent::resetPseudoStates):
+        * inspector/InspectorPageAgent.cpp:
+        (WebCore::InspectorPageAgent::setEmulatedMedia):
+        * 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):
+        * 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-09-22  Sergio Villar Senin  <svillar@igalia.com>
 
         [css-grid] ASSERT when sizing tracks with percentages inside calc
index ad739dc..0a375f1 100644 (file)
                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 */; };
+               E461D65F1BB0C80D00CB5645 /* AuthorStyleSheets.h in Headers */ = {isa = PBXBuildFile; fileRef = E461D65E1BB0C80D00CB5645 /* AuthorStyleSheets.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, ); }; };
index 1167b03..ca963c7 100644 (file)
@@ -179,11 +179,11 @@ void CSSStyleSheet::didMutateRules(RuleMutationType mutationType, WhetherContent
                 resolver->addKeyframeStyle(*insertedKeyframesRule);
             return;
         }
-        owner->scheduleOptimizedStyleSheetUpdate();
+        owner->authorStyleSheets().scheduleOptimizedUpdate();
         return;
     }
 
-    owner->styleResolverChanged(DeferRecalcStyle);
+    owner->authorStyleSheets().didChange(DeferRecalcStyle);
 
     m_mutatedRules = true;
 }
@@ -193,7 +193,7 @@ void CSSStyleSheet::didMutate()
     Document* owner = ownerDocument();
     if (!owner)
         return;
-    owner->styleResolverChanged(DeferRecalcStyle);
+    owner->authorStyleSheets().didChange(DeferRecalcStyle);
 }
 
 void CSSStyleSheet::clearOwnerNode()
@@ -202,7 +202,7 @@ void CSSStyleSheet::clearOwnerNode()
     m_ownerNode = 0;
     if (!owner)
         return;
-    owner->styleResolverChanged(DeferRecalcStyleIfNeeded);
+    owner->authorStyleSheets().didChange(DeferRecalcStyleIfNeeded);
 }
 
 void CSSStyleSheet::reattachChildRuleCSSOMWrappers()
index 043422d..3e0ef14 100644 (file)
@@ -57,12 +57,14 @@ using namespace HTMLNames;
 
 AuthorStyleSheets::AuthorStyleSheets(Document& document)
     : m_document(document)
+    , m_optimizedUpdateTimer(*this, &AuthorStyleSheets::optimizedUpdateTimerFired)
 {
 }
 
 AuthorStyleSheets::AuthorStyleSheets(ShadowRoot& shadowRoot)
     : m_document(shadowRoot.documentScope())
     , m_shadowRoot(&shadowRoot)
+    , m_optimizedUpdateTimer(*this, &AuthorStyleSheets::optimizedUpdateTimerFired)
 {
 }
 
@@ -384,4 +386,64 @@ bool AuthorStyleSheets::activeStyleSheetsContains(const CSSStyleSheet* sheet) co
     return m_weakCopyOfActiveStyleSheetListForFastLookup->contains(sheet);
 }
 
+void AuthorStyleSheets::flushPendingUpdates()
+{
+    if (m_pendingUpdateType == NoUpdate)
+        return;
+    updateActiveStyleSheets(m_pendingUpdateType);
+}
+
+void AuthorStyleSheets::scheduleOptimizedUpdate()
+{
+    if (m_optimizedUpdateTimer.isActive())
+        return;
+    if (m_pendingUpdateType == NoUpdate)
+        m_pendingUpdateType = OptimizedUpdate;
+    m_optimizedUpdateTimer.startOneShot(0);
+}
+
+void AuthorStyleSheets::didChange(StyleResolverUpdateFlag updateFlag)
+{
+    m_optimizedUpdateTimer.stop();
+
+    // Don't bother updating, since we haven't loaded all our style info yet
+    // and haven't calculated the style resolver for the first time.
+    if (!m_document.hasLivingRenderTree() || (!m_shadowRoot && !m_didCalculateStyleResolver && m_pendingStyleSheetCount)) {
+        m_document.clearStyleResolver();
+        return;
+    }
+    m_didCalculateStyleResolver = true;
+
+    auto styleSheetUpdate = (updateFlag == RecalcStyleIfNeeded || updateFlag == DeferRecalcStyleIfNeeded)
+        ? AuthorStyleSheets::OptimizedUpdate
+        : AuthorStyleSheets::FullUpdate;
+    bool stylesheetChangeRequiresStyleRecalc = updateActiveStyleSheets(styleSheetUpdate);
+
+    auto scheduleStyleRecalc = [&] {
+        if (m_shadowRoot)
+            m_shadowRoot->setNeedsStyleRecalc();
+        else
+            m_document.scheduleForcedStyleRecalc();
+    };
+
+    if (updateFlag == DeferRecalcStyle) {
+        scheduleStyleRecalc();
+        return;
+    }
+
+    if (updateFlag == DeferRecalcStyleIfNeeded) {
+        if (stylesheetChangeRequiresStyleRecalc)
+            scheduleStyleRecalc();
+        return;
+    }
+
+    if (stylesheetChangeRequiresStyleRecalc)
+        m_document.recalcStyle(Style::Force);
+}
+
+void AuthorStyleSheets::optimizedUpdateTimerFired()
+{
+    didChange(RecalcStyleIfNeeded);
+}
+
 }
index 8fb0ad6..1ae396f 100644 (file)
@@ -48,6 +48,13 @@ class StyleSheetList;
 class ShadowRoot;
 class TreeScope;
 
+enum StyleResolverUpdateFlag {
+    RecalcStyleImmediately,
+    DeferRecalcStyle,
+    RecalcStyleIfNeeded,
+    DeferRecalcStyleIfNeeded
+};
+
 class AuthorStyleSheets {
     WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -62,22 +69,7 @@ public:
     void addStyleSheetCandidateNode(Node&, bool createdByParser);
     void removeStyleSheetCandidateNode(Node&);
 
-    enum UpdateFlag { NoUpdate = 0, OptimizedUpdate, FullUpdate };
-
-    UpdateFlag pendingUpdateType() const { return m_pendingUpdateType; }
-    void setPendingUpdateType(UpdateFlag updateType)
-    {
-        if (updateType > m_pendingUpdateType)
-            m_pendingUpdateType = updateType;
-    }
-
-    void flushPendingUpdates()
-    {
-        if (m_pendingUpdateType != NoUpdate)
-            updateActiveStyleSheets(m_pendingUpdateType);
-    }
-
-    bool updateActiveStyleSheets(UpdateFlag);
+    WEBCORE_EXPORT void didChange(StyleResolverUpdateFlag);
 
     String preferredStylesheetSetName() const { return m_preferredStylesheetSetName; }
     String selectedStylesheetSetName() const { return m_selectedStylesheetSetName; }
@@ -99,8 +91,16 @@ public:
 
     bool activeStyleSheetsContains(const CSSStyleSheet*) const;
 
+    void scheduleOptimizedUpdate();
+    bool hasPendingUpdate() const { return m_optimizedUpdateTimer.isActive(); }
+    void flushPendingUpdates();
+
 private:
+    enum UpdateFlag { NoUpdate = 0, OptimizedUpdate, FullUpdate };
+    bool updateActiveStyleSheets(UpdateFlag);
+
     void collectActiveStyleSheets(Vector<RefPtr<StyleSheet>>&);
+
     enum StyleResolverUpdateType {
         Reconstruct,
         Reset,
@@ -109,12 +109,16 @@ private:
     StyleResolverUpdateType analyzeStyleSheetChange(UpdateFlag, const Vector<RefPtr<CSSStyleSheet>>& newStylesheets, bool& requiresFullStyleRecalc);
     void updateStyleResolver(Vector<RefPtr<CSSStyleSheet>>&, StyleResolverUpdateType);
 
+    void optimizedUpdateTimerFired();
+
     Document& m_document;
     ShadowRoot* m_shadowRoot { nullptr };
 
     Vector<RefPtr<StyleSheet>> m_styleSheetsForStyleSheetList;
     Vector<RefPtr<CSSStyleSheet>> m_activeStyleSheets;
 
+    Timer m_optimizedUpdateTimer;
+
     // This is a mirror of m_activeAuthorStyleSheets that gets populated on demand for activeStyleSheetsContains().
     mutable std::unique_ptr<HashSet<const CSSStyleSheet*>> m_weakCopyOfActiveStyleSheetListForFastLookup;
 
@@ -123,6 +127,7 @@ private:
     // 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_pendingStyleSheetCount { 0 };
+    bool m_didCalculateStyleResolver { false };
 
     UpdateFlag m_pendingUpdateType { NoUpdate };
 
index 2147eb2..f442336 100644 (file)
@@ -435,7 +435,6 @@ Document::Document(Frame* frame, const URL& url, unsigned documentClasses, unsig
     , m_touchEventsChangedTimer(*this, &Document::touchEventsChangedTimerFired)
 #endif
     , m_referencingNodeCount(0)
-    , m_didCalculateStyleResolver(false)
     , m_hasNodesWithPlaceholderStyle(false)
     , m_needsNotifyRemoveAllPendingStylesheet(false)
     , m_ignorePendingStylesheets(false)
@@ -458,7 +457,6 @@ Document::Document(Frame* frame, const URL& url, unsigned documentClasses, unsig
     , m_visuallyOrdered(false)
     , m_readyState(Complete)
     , m_bParsing(false)
-    , m_optimizedStyleSheetUpdateTimer(*this, &Document::optimizedStyleSheetUpdateTimerFired)
     , m_styleRecalcTimer(*this, &Document::updateStyleIfNeeded)
     , m_pendingStyleRecalcShouldForce(false)
     , m_inStyleRecalc(false)
@@ -1357,7 +1355,7 @@ void Document::setContentLanguage(const String& language)
     m_contentLanguage = language;
 
     // Recalculate style so language is used when selecting the initial font.
-    styleResolverChanged(DeferRecalcStyle);
+    m_authorStyleSheets->didChange(DeferRecalcStyle);
 }
 
 void Document::setXMLVersion(const String& version, ExceptionCode& ec)
@@ -1945,6 +1943,14 @@ void Document::recalcStyle(Style::Change change)
         frameView.frame().mainFrame().eventHandler().dispatchFakeMouseMoveEventSoon();
 }
 
+bool Document::needsStyleRecalc() const
+{
+    if (pageCacheState() != NotInPageCache)
+        return false;
+
+    return m_pendingStyleRecalcShouldForce || childNeedsStyleRecalc() || authorStyleSheets().hasPendingUpdate();
+}
+
 void Document::updateStyleIfNeeded()
 {
     ASSERT(isMainThread());
@@ -1953,8 +1959,8 @@ void Document::updateStyleIfNeeded()
     if (!view() || view()->isInRenderTreeLayout())
         return;
 
-    if (m_optimizedStyleSheetUpdateTimer.isActive())
-        styleResolverChanged(RecalcStyleIfNeeded);
+    if (authorStyleSheets().hasPendingUpdate())
+        authorStyleSheets().didChange(RecalcStyleIfNeeded);
 
     if (!needsStyleRecalc())
         return;
@@ -2008,7 +2014,7 @@ void Document::updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasks
         HTMLElement* bodyElement = bodyOrFrameset();
         if (bodyElement && !bodyElement->renderer() && m_pendingSheetLayout == NoLayoutWithPendingSheets) {
             m_pendingSheetLayout = DidLayoutWithPendingSheets;
-            styleResolverChanged(RecalcStyleImmediately);
+            authorStyleSheets().didChange(RecalcStyleImmediately);
         } else if (m_hasNodesWithPlaceholderStyle)
             // If new nodes have been added or style recalc has been done with style sheets still pending, some nodes 
             // may not have had their real style calculated yet. Normally this gets cleaned when style sheets arrive 
@@ -3145,7 +3151,7 @@ void Document::didRemoveAllPendingStylesheet()
 {
     m_needsNotifyRemoveAllPendingStylesheet = false;
 
-    styleResolverChanged(DeferRecalcStyleIfNeeded);
+    authorStyleSheets().didChange(DeferRecalcStyleIfNeeded);
 
     if (m_pendingSheetLayout == DidLayoutWithPendingSheets) {
         m_pendingSheetLayout = IgnoreLayoutWithPendingSheets;
@@ -3220,7 +3226,7 @@ void Document::processHttpEquiv(const String& equiv, const String& content, bool
         // -dwh
         authorStyleSheets().setSelectedStylesheetSetName(content);
         authorStyleSheets().setPreferredStylesheetSetName(content);
-        styleResolverChanged(DeferRecalcStyle);
+        authorStyleSheets().didChange(DeferRecalcStyle);
         break;
 
     case HTTPHeaderName::Refresh: {
@@ -3524,7 +3530,7 @@ String Document::selectedStylesheetSet() const
 void Document::setSelectedStylesheetSet(const String& aString)
 {
     authorStyleSheets().setSelectedStylesheetSetName(aString);
-    styleResolverChanged(DeferRecalcStyle);
+    authorStyleSheets().didChange(DeferRecalcStyle);
 }
 
 void Document::evaluateMediaQueryList()
@@ -3547,19 +3553,6 @@ void Document::checkViewportDependentPictures()
         picture->sourcesChanged();
 }
 
-void Document::optimizedStyleSheetUpdateTimerFired()
-{
-    styleResolverChanged(RecalcStyleIfNeeded);
-}
-
-void Document::scheduleOptimizedStyleSheetUpdate()
-{
-    if (m_optimizedStyleSheetUpdateTimer.isActive())
-        return;
-    authorStyleSheets().setPendingUpdateType(AuthorStyleSheets::OptimizedUpdate);
-    m_optimizedStyleSheetUpdateTimer.startOneShot(0);
-}
-
 void Document::updateViewportUnitsOnResize()
 {
     if (!hasStyleWithViewportUnits())
@@ -3624,39 +3617,6 @@ void Document::pageMutedStateDidChange()
         audioProducer->pageMutedStateDidChange();
 }
 
-void Document::styleResolverChanged(StyleResolverUpdateFlag updateFlag)
-{
-    if (m_optimizedStyleSheetUpdateTimer.isActive())
-        m_optimizedStyleSheetUpdateTimer.stop();
-
-    // Don't bother updating, since we haven't loaded all our style info yet
-    // and haven't calculated the style selector for the first time.
-    if (!hasLivingRenderTree() || (!m_didCalculateStyleResolver && !haveStylesheetsLoaded())) {
-        m_styleResolver = nullptr;
-        return;
-    }
-    m_didCalculateStyleResolver = true;
-
-    auto styleSheetUpdate = (updateFlag == RecalcStyleIfNeeded || updateFlag == DeferRecalcStyleIfNeeded)
-        ? AuthorStyleSheets::OptimizedUpdate
-        : AuthorStyleSheets::FullUpdate;
-    bool stylesheetChangeRequiresStyleRecalc = authorStyleSheets().updateActiveStyleSheets(styleSheetUpdate);
-
-    if (updateFlag == DeferRecalcStyle) {
-        scheduleForcedStyleRecalc();
-        return;
-    }
-
-    if (updateFlag == DeferRecalcStyleIfNeeded) {
-        if (stylesheetChangeRequiresStyleRecalc)
-            scheduleForcedStyleRecalc();
-        return;
-    }
-
-    if (stylesheetChangeRequiresStyleRecalc)
-        recalcStyle(Style::Force);
-}
-
 static bool isNodeInSubtree(Node* node, Node* container, bool amongChildrenOnly)
 {
     bool nodeInSubtree = false;
@@ -6645,7 +6605,7 @@ static RenderElement* nearestCommonHoverAncestor(RenderElement* obj1, RenderElem
     return nullptr;
 }
 
-void Document::updateHoverActiveState(const HitTestRequest& request, Element* innerElement, StyleResolverUpdateFlag updateFlag)
+void Document::updateHoverActiveState(const HitTestRequest& request, Element* innerElement)
 {
     ASSERT(!request.readOnly());
 
@@ -6762,9 +6722,7 @@ void Document::updateHoverActiveState(const HitTestRequest& request, Element* in
         }
     }
 
-    ASSERT(updateFlag == RecalcStyleIfNeeded || updateFlag == DeferRecalcStyleIfNeeded);
-    if (updateFlag == RecalcStyleIfNeeded)
-        updateStyleIfNeeded();
+    updateStyleIfNeeded();
 }
 
 bool Document::haveStylesheetsLoaded() const
index d5861a6..fac508c 100644 (file)
@@ -231,8 +231,6 @@ enum PageshowEventPersistence {
     PageshowEventPersisted = 1
 };
 
-enum StyleResolverUpdateFlag { RecalcStyleImmediately, DeferRecalcStyle, RecalcStyleIfNeeded, DeferRecalcStyleIfNeeded };
-
 enum NodeListInvalidationType {
     DoNotInvalidateOnAttributeChanges = 0,
     InvalidateOnClassAttrChange,
@@ -517,19 +515,6 @@ public:
     bool gotoAnchorNeededAfterStylesheetsLoad() { return m_gotoAnchorNeededAfterStylesheetsLoad; }
     void setGotoAnchorNeededAfterStylesheetsLoad(bool b) { m_gotoAnchorNeededAfterStylesheetsLoad = b; }
 
-    /**
-     * Called when one or more stylesheets in the document may have been added, removed or changed.
-     *
-     * Creates a new style resolver and assign it to this document. This is done by iterating through all nodes in
-     * document (or those before <BODY> in a HTML document), searching for stylesheets. Stylesheets can be contained in
-     * <LINK>, <STYLE> or <BODY> elements, as well as processing instructions (XML documents only). A list is
-     * constructed from these which is used to create the a new style selector which collates all of the stylesheets
-     * found and is used to calculate the derived styles for all rendering objects.
-     */
-    WEBCORE_EXPORT void styleResolverChanged(StyleResolverUpdateFlag);
-
-    void scheduleOptimizedStyleSheetUpdate();
-
     void evaluateMediaQueryList();
 
     FormController& formController();
@@ -557,7 +542,7 @@ public:
 
     void recalcStyle(Style::Change = Style::NoChange);
     WEBCORE_EXPORT void updateStyleIfNeeded();
-    bool needsStyleRecalc() const { return pageCacheState() == NotInPageCache && (m_pendingStyleRecalcShouldForce || childNeedsStyleRecalc() || m_optimizedStyleSheetUpdateTimer.isActive()); }
+    bool needsStyleRecalc() const;
 
     WEBCORE_EXPORT void updateLayout();
     
@@ -736,7 +721,7 @@ public:
     void hoveredElementDidDetach(Element*);
     void elementInActiveChainDidDetach(Element*);
 
-    void updateHoverActiveState(const HitTestRequest&, Element*, StyleResolverUpdateFlag = RecalcStyleIfNeeded);
+    void updateHoverActiveState(const HitTestRequest&, Element*);
 
     // Updates for :target (CSS3 selector).
     void setCSSTarget(Element*);
@@ -748,7 +733,6 @@ public:
     void unscheduleStyleRecalc();
     bool hasPendingStyleRecalc() const;
     bool hasPendingForcedStyleRecalc() const;
-    void optimizedStyleSheetUpdateTimerFired();
 
     void registerNodeListForInvalidation(LiveNodeList&);
     void unregisterNodeListForInvalidation(LiveNodeList&);
@@ -1414,7 +1398,6 @@ private:
 
     std::unique_ptr<StyleResolver> m_styleResolver;
     std::unique_ptr<StyleResolver> m_userAgentShadowTreeStyleResolver;
-    bool m_didCalculateStyleResolver;
     bool m_hasNodesWithPlaceholderStyle;
     bool m_needsNotifyRemoveAllPendingStylesheet;
     // But sometimes you need to ignore pending stylesheet count to
@@ -1502,7 +1485,6 @@ private:
     ReadyState m_readyState;
     bool m_bParsing;
 
-    Timer m_optimizedStyleSheetUpdateTimer;
     Timer m_styleRecalcTimer;
     bool m_pendingStyleRecalcShouldForce;
     bool m_inStyleRecalc;
index f9ec4ed..c41b430 100644 (file)
@@ -28,6 +28,7 @@
 #include "config.h"
 #include "ExtensionStyleSheets.h"
 
+#include "AuthorStyleSheets.h"
 #include "CSSStyleSheet.h"
 #include "Element.h"
 #include "HTMLIFrameElement.h"
@@ -82,7 +83,7 @@ void ExtensionStyleSheets::clearPageUserSheet()
 {
     if (m_pageUserSheet) {
         m_pageUserSheet = nullptr;
-        m_document.styleResolverChanged(DeferRecalcStyle);
+        m_document.authorStyleSheets().didChange(DeferRecalcStyle);
     }
 }
 
@@ -90,7 +91,7 @@ void ExtensionStyleSheets::updatePageUserSheet()
 {
     clearPageUserSheet();
     if (pageUserSheet())
-        m_document.styleResolverChanged(RecalcStyleImmediately);
+        m_document.authorStyleSheets().didChange(RecalcStyleImmediately);
 }
 
 const Vector<RefPtr<CSSStyleSheet>>& ExtensionStyleSheets::injectedUserStyleSheets() const
@@ -154,21 +155,21 @@ void ExtensionStyleSheets::invalidateInjectedStyleSheetCache()
     m_injectedStyleSheetCacheValid = false;
     if (m_injectedUserStyleSheets.isEmpty() && m_injectedAuthorStyleSheets.isEmpty())
         return;
-    m_document.styleResolverChanged(DeferRecalcStyle);
+    m_document.authorStyleSheets().didChange(DeferRecalcStyle);
 }
 
 void ExtensionStyleSheets::addUserStyleSheet(Ref<StyleSheetContents>&& userSheet)
 {
     ASSERT(userSheet.get().isUserStyleSheet());
     m_userStyleSheets.append(CSSStyleSheet::create(WTFMove(userSheet), m_document));
-    m_document.styleResolverChanged(RecalcStyleImmediately);
+    m_document.authorStyleSheets().didChange(RecalcStyleImmediately);
 }
 
 void ExtensionStyleSheets::addAuthorStyleSheetForTesting(Ref<StyleSheetContents>&& authorSheet)
 {
     ASSERT(!authorSheet.get().isUserStyleSheet());
     m_authorStyleSheetsForTesting.append(CSSStyleSheet::create(WTFMove(authorSheet), m_document));
-    m_document.styleResolverChanged(RecalcStyleImmediately);
+    m_document.authorStyleSheets().didChange(RecalcStyleImmediately);
 }
 
 #if ENABLE(CONTENT_EXTENSIONS)
@@ -200,7 +201,7 @@ void ExtensionStyleSheets::maybeAddContentExtensionSheet(const String& identifie
 
 void ExtensionStyleSheets::styleResolverChangedTimerFired()
 {
-    m_document.styleResolverChanged(RecalcStyleImmediately);
+    m_document.authorStyleSheets().didChange(RecalcStyleImmediately);
 }
 
 void ExtensionStyleSheets::detachFromDocument()
index 1d599ad..b10226c 100644 (file)
@@ -73,7 +73,7 @@ void InlineStyleSheetOwner::removedFromDocument(Document& document, Element& ele
 
     // If we're in document teardown, then we don't need to do any notification of our sheet's removal.
     if (document.hasLivingRenderTree())
-        document.styleResolverChanged(DeferRecalcStyle);
+        document.authorStyleSheets().didChange(DeferRecalcStyle);
 }
 
 void InlineStyleSheetOwner::clearDocumentData(Document&, Element& element)
index a9bf8e1..e5a1884 100644 (file)
@@ -268,11 +268,17 @@ void ProcessingInstruction::removedFrom(ContainerNode& insertionPoint)
         ASSERT(m_sheet->ownerNode() == this);
         m_sheet->clearOwnerNode();
         m_sheet = nullptr;
+
+    }
+
+    if (m_loading) {
+        m_loading = false;
+        document().authorStyleSheets().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().styleResolverChanged(DeferRecalcStyle);
+        document().authorStyleSheets().didChange(DeferRecalcStyle);
 }
 
 void ProcessingInstruction::finishParsingChildren()
index 2abadbb..90eda44 100644 (file)
@@ -108,15 +108,10 @@ AuthorStyleSheets& ShadowRoot::authorStyleSheets()
 
 void ShadowRoot::updateStyle()
 {
-    bool shouldRecalcStyle = false;
-
-    if (m_authorStyleSheets) {
-        // FIXME: Make optimized updated work.
-        shouldRecalcStyle = m_authorStyleSheets->updateActiveStyleSheets(AuthorStyleSheets::FullUpdate);
-    }
-
-    if (shouldRecalcStyle)
-        setNeedsStyleRecalc();
+    if (!m_authorStyleSheets)
+        return;
+    // FIXME: Make optimized updated work.
+    m_authorStyleSheets->didChange(DeferRecalcStyle);
 }
 
 String ShadowRoot::innerHTML() const
index dd5810b..fe2e871 100644 (file)
@@ -140,7 +140,7 @@ void HTMLLinkElement::setDisabledState(bool disabled)
         if (!m_sheet && m_disabledState == EnabledViaScript)
             process();
         else
-            document().styleResolverChanged(DeferRecalcStyle); // Update the style selector.
+            document().authorStyleSheets().didChange(DeferRecalcStyle);
     }
 }
 
@@ -176,7 +176,7 @@ void HTMLLinkElement::parseAttribute(const QualifiedName& name, const AtomicStri
         m_media = value.string().convertToASCIILowercase();
         process();
         if (m_sheet && !isDisabled())
-            document().styleResolverChanged(DeferRecalcStyle);
+            document().authorStyleSheets().didChange(DeferRecalcStyle);
         return;
     }
     if (name == disabledAttr) {
@@ -283,7 +283,7 @@ void HTMLLinkElement::process()
     } else if (m_sheet) {
         // we no longer contain a stylesheet, e.g. perhaps rel or type was changed
         clearSheet();
-        document().styleResolverChanged(DeferRecalcStyle);
+        document().authorStyleSheets().didChange(DeferRecalcStyle);
     }
 }
 
@@ -330,7 +330,7 @@ void HTMLLinkElement::removedFrom(ContainerNode& insertionPoint)
         removePendingSheet(RemovePendingSheetNotifyLater);
 
     if (document().hasLivingRenderTree())
-        document().styleResolverChanged(DeferRecalcStyleIfNeeded);
+        document().authorStyleSheets().didChange(DeferRecalcStyleIfNeeded);
 }
 
 void HTMLLinkElement::finishParsingChildren()
@@ -555,7 +555,7 @@ void HTMLLinkElement::removePendingSheet(RemovePendingSheetNotificationType noti
 
     if (type == InactiveSheet) {
         // Document just needs to know about the sheet for exposure through document.styleSheets
-        document().authorStyleSheets().updateActiveStyleSheets(AuthorStyleSheets::OptimizedUpdate);
+        document().authorStyleSheets().didChange(DeferRecalcStyleIfNeeded);
         return;
     }
 
index ce963cd..4302472 100644 (file)
@@ -24,6 +24,7 @@
 #include "config.h"
 #include "HTMLStyleElement.h"
 
+#include "AuthorStyleSheets.h"
 #include "Document.h"
 #include "Event.h"
 #include "EventNames.h"
@@ -77,7 +78,7 @@ void HTMLStyleElement::parseAttribute(const QualifiedName& name, const AtomicStr
         if (sheet()) {
             sheet()->setMediaQueries(MediaQuerySet::createAllowingDescriptionSyntax(value));
             if (inDocument() && document().hasLivingRenderTree())
-                document().styleResolverChanged(RecalcStyleImmediately);
+                document().authorStyleSheets().didChange(RecalcStyleImmediately);
         }
     } else if (name == typeAttr)
         m_styleSheetOwner.setContentType(value);
index ff576cd..53abc7e 100644 (file)
@@ -889,7 +889,7 @@ void InspectorCSSAgent::forcePseudoState(ErrorString& errorString, int nodeId, c
         m_nodeIdToForcedPseudoState.set(nodeId, forcedPseudoState);
     else
         m_nodeIdToForcedPseudoState.remove(nodeId);
-    element->document().styleResolverChanged(RecalcStyleImmediately);
+    element->document().authorStyleSheets().didChange(RecalcStyleImmediately);
 }
 
 void InspectorCSSAgent::getNamedFlowCollection(ErrorString& errorString, int documentNodeId, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::CSS::NamedFlow>>& result)
@@ -1189,7 +1189,7 @@ void InspectorCSSAgent::resetPseudoStates()
 
     m_nodeIdToForcedPseudoState.clear();
     for (auto& document : documentsToChange)
-        document->styleResolverChanged(RecalcStyleImmediately);
+        document->authorStyleSheets().didChange(RecalcStyleImmediately);
 }
 
 } // namespace WebCore
index f8e6678..109a823 100644 (file)
@@ -32,6 +32,7 @@
 #include "config.h"
 #include "InspectorPageAgent.h"
 
+#include "AuthorStyleSheets.h"
 #include "CachedCSSStyleSheet.h"
 #include "CachedFont.h"
 #include "CachedImage.h"
@@ -1001,7 +1002,7 @@ void InspectorPageAgent::setEmulatedMedia(ErrorString&, const String& media)
     m_emulatedMedia = media;
     Document* document = m_page.mainFrame().document();
     if (document) {
-        document->styleResolverChanged(RecalcStyleImmediately);
+        document->authorStyleSheets().didChange(RecalcStyleImmediately);
         document->updateLayout();
     }
 }
index 0415388..972dc19 100644 (file)
@@ -32,6 +32,7 @@
 
 #include "AnimationController.h"
 #include "ApplyStyleCommand.h"
+#include "AuthorStyleSheets.h"
 #include "BackForwardController.h"
 #include "CSSComputedStyleDeclaration.h"
 #include "CSSPropertyNames.h"
@@ -643,7 +644,7 @@ void Frame::setPrinting(bool printing, const FloatSize& pageSize, const FloatSiz
     m_doc->setPrinting(printing);
     view()->adjustMediaTypeForPrinting(printing);
 
-    m_doc->styleResolverChanged(RecalcStyleImmediately);
+    m_doc->authorStyleSheets().didChange(RecalcStyleImmediately);
     if (shouldUsePrintingLayout()) {
         view()->forceLayoutForPagination(pageSize, originalPageSize, maximumShrinkRatio, shouldAdjustViewSize);
     } else {
index 947fc6b..450e4d2 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "AXObjectCache.h"
 #include "AnimationController.h"
+#include "AuthorStyleSheets.h"
 #include "BackForwardController.h"
 #include "CachedImage.h"
 #include "CachedResourceLoader.h"
@@ -1300,7 +1301,7 @@ void FrameView::layout(bool allowSubtree)
         StyleResolver* styleResolver = document.styleResolverIfExists();
         if (!styleResolver || styleResolver->hasMediaQueriesAffectedByViewportChange()) {
             LOG(Layout, "  hasMediaQueriesAffectedByViewportChange, enqueueing style recalc");
-            document.styleResolverChanged(DeferRecalcStyle);
+            document.authorStyleSheets().didChange(DeferRecalcStyle);
             // FIXME: This instrumentation event is not strictly accurate since cached media query results do not persist across StyleResolver rebuilds.
             InspectorInstrumentation::mediaQueryResultChanged(document);
         } else
@@ -3495,7 +3496,7 @@ void FrameView::setPagination(const Pagination& pagination)
 
     m_pagination = pagination;
 
-    frame().document()->styleResolverChanged(DeferRecalcStyle);
+    frame().document()->authorStyleSheets().didChange(DeferRecalcStyle);
 }
 
 IntRect FrameView::windowClipRect() const
@@ -4964,7 +4965,7 @@ void FrameView::setViewportSizeForCSSViewportUnits(IntSize size)
     if (Document* document = frame().document()) {
         // FIXME: this should probably be updateViewportUnitsOnResize(), but synchronously
         // dirtying style here causes assertions on iOS (rdar://problem/19998166).
-        document->styleResolverChanged(DeferRecalcStyle);
+        document->authorStyleSheets().didChange(DeferRecalcStyle);
     }
 }
     
index 30187a4..b8b1543 100644 (file)
@@ -23,6 +23,7 @@
 #include "AlternativeTextClient.h"
 #include "AnimationController.h"
 #include "ApplicationCacheStorage.h"
+#include "AuthorStyleSheets.h"
 #include "BackForwardClient.h"
 #include "BackForwardController.h"
 #include "Chrome.h"
@@ -422,7 +423,7 @@ void Page::setViewMode(ViewMode viewMode)
         m_mainFrame->view()->forceLayout();
 
     if (m_mainFrame->document())
-        m_mainFrame->document()->styleResolverChanged(RecalcStyleImmediately);
+        m_mainFrame->document()->authorStyleSheets().didChange(RecalcStyleImmediately);
 }
 #endif // ENABLE(VIEW_MODE_CSS_MEDIA)
 
@@ -500,7 +501,7 @@ void Page::setNeedsRecalcStyleInAllFrames()
 {
     for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
         if (Document* document = frame->document())
-            document->styleResolverChanged(DeferRecalcStyle);
+            document->authorStyleSheets().didChange(DeferRecalcStyle);
     }
 }
 
@@ -1161,7 +1162,7 @@ void Page::invalidateInjectedStyleSheetCacheInAllFrames()
         if (!document)
             continue;
         document->extensionStyleSheets().invalidateInjectedStyleSheetCache();
-        document->styleResolverChanged(DeferRecalcStyle);
+        document->authorStyleSheets().didChange(DeferRecalcStyle);
     }
 }
 
index 1de1fda..8e20c23 100644 (file)
@@ -24,6 +24,7 @@
 #if ENABLE(SVG_FONTS)
 #include "SVGFontFaceElement.h"
 
+#include "AuthorStyleSheets.h"
 #include "CSSFontFaceSrcValue.h"
 #include "CSSParser.h"
 #include "CSSPropertyNames.h"
@@ -266,7 +267,7 @@ void SVGFontFaceElement::rebuildFontFace()
         }
     }
 
-    document().styleResolverChanged(DeferRecalcStyle);
+    document().authorStyleSheets().didChange(DeferRecalcStyle);
 }
 
 Node::InsertionNotificationRequest SVGFontFaceElement::insertedInto(ContainerNode& rootParent)
@@ -291,7 +292,7 @@ void SVGFontFaceElement::removedFrom(ContainerNode& rootParent)
         document().accessSVGExtensions().unregisterSVGFontFaceElement(this);
         m_fontFaceRule->mutableProperties().clear();
 
-        document().styleResolverChanged(DeferRecalcStyle);
+        document().authorStyleSheets().didChange(DeferRecalcStyle);
     } else
         ASSERT(!m_fontElement);
 }
index 536e290..cdd43f3 100644 (file)
@@ -32,6 +32,7 @@
 
 #if ENABLE(XSLT)
 
+#include "AuthorStyleSheets.h"
 #include "Document.h"
 #include "Element.h"
 #include "ExceptionCodePlaceholder.h"
@@ -63,7 +64,7 @@ void XMLTreeViewer::transformDocumentToTreeView()
     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.styleResolverChanged(RecalcStyleImmediately);
+    m_document.authorStyleSheets().didChange(RecalcStyleImmediately);
 }
 
 } // namespace WebCore
index 0961c4d..a7ef6f9 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "XMLDocumentParser.h"
 
+#include "AuthorStyleSheets.h"
 #include "CDATASection.h"
 #include "CachedScript.h"
 #include "Comment.h"
@@ -199,7 +200,7 @@ void XMLDocumentParser::end()
         insertErrorMessageBlock();
     else {
         updateLeafTextNode();
-        document()->styleResolverChanged(RecalcStyleImmediately);
+        document()->authorStyleSheets().didChange(RecalcStyleImmediately);
     }
 
     if (isParsing())
index d594eac..69dafcc 100644 (file)
@@ -28,6 +28,7 @@
 #include "config.h"
 #include "XMLDocumentParser.h"
 
+#include "AuthorStyleSheets.h"
 #include "CDATASection.h"
 #include "CachedScript.h"
 #include "Comment.h"
@@ -1386,7 +1387,7 @@ void XMLDocumentParser::doEnd()
         document()->setTransformSource(std::make_unique<TransformSource>(doc));
 
         document()->setParsing(false); // Make the document think it's done, so it will apply XSL stylesheets.
-        document()->styleResolverChanged(RecalcStyleImmediately);
+        document()->authorStyleSheets().didChange(RecalcStyleImmediately);
 
         // styleResolverChanged() call can detach the parser and null out its document.
         // In that case, we just bail out.
index 43a612f..fc98768 100644 (file)
@@ -72,6 +72,7 @@
 #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>
@@ -3611,7 +3612,7 @@ WEBCORE_COMMAND(toggleUnderline)
 #endif
 
     if (Frame* coreFrame = core([self _frame]))
-        coreFrame->document()->styleResolverChanged(RecalcStyleImmediately);
+        coreFrame->document()->authorStyleSheets().didChange(RecalcStyleImmediately);
     
 #ifdef LOG_TIMES        
     double thisTime = CFAbsoluteTimeGetCurrent() - start;
@@ -5004,7 +5005,7 @@ static PassRefPtr<KeyboardEvent> currentKeyboardEvent(Frame* coreFrame)
 
             document->setPaginatedForScreen(_private->paginateScreenContent);
             document->setPrinting(_private->printing);
-            document->styleResolverChanged(RecalcStyleImmediately);
+            document->authorStyleSheets().didChange(RecalcStyleImmediately);
         }
     }