Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / dom / DocumentStyleSheetCollection.cpp
index 1a24de3..c252e12 100644 (file)
@@ -49,7 +49,7 @@ namespace WebCore {
 using namespace HTMLNames;
 
 DocumentStyleSheetCollection::DocumentStyleSheetCollection(TreeScope& treeScope)
-    : StyleSheetCollection(treeScope)
+    : TreeScopeStyleSheetCollection(treeScope)
 {
     ASSERT(treeScope.rootNode() == treeScope.rootNode().document());
 }
@@ -66,11 +66,11 @@ void DocumentStyleSheetCollection::collectStyleSheetsFromCandidates(StyleEngine*
             // Processing instruction (XML documents only).
             // We don't support linking to embedded CSS stylesheets, see <https://bugs.webkit.org/show_bug.cgi?id=49281> for discussion.
             // Don't apply XSL transforms to already transformed documents -- <rdar://problem/4132806>
-            if (RuntimeEnabledFeatures::xsltEnabled() && !document()->transformSourceDocument()) {
+            if (RuntimeEnabledFeatures::xsltEnabled() && !document().transformSourceDocument()) {
                 ProcessingInstruction* pi = toProcessingInstruction(n);
                 // Don't apply XSL transforms until loading is finished.
-                if (!document()->parsing() && !pi->isLoading())
-                    document()->applyXSLTransform(pi);
+                if (!document().parsing() && !pi->isLoading())
+                    document().applyXSLTransform(pi);
                 return;
             }
 
@@ -106,7 +106,7 @@ void DocumentStyleSheetCollection::collectStyleSheetsFromCandidates(StyleEngine*
 
 void DocumentStyleSheetCollection::collectStyleSheets(StyleEngine* engine, DocumentStyleSheetCollector& collector)
 {
-    ASSERT(document()->styleEngine() == engine);
+    ASSERT(document().styleEngine() == engine);
     collector.appendActiveStyleSheets(engine->injectedAuthorStyleSheets());
     collector.appendActiveStyleSheets(engine->documentAuthorStyleSheets());
     collectStyleSheetsFromCandidates(engine, collector);
@@ -114,7 +114,7 @@ void DocumentStyleSheetCollection::collectStyleSheets(StyleEngine* engine, Docum
 
 bool DocumentStyleSheetCollection::updateActiveStyleSheets(StyleEngine* engine, StyleResolverUpdateMode updateMode)
 {
-    StyleSheetCollectionBase collection;
+    StyleSheetCollection collection;
     ActiveDocumentStyleSheetCollector collector(collection);
     collectStyleSheets(engine, collector);
 
@@ -123,23 +123,22 @@ bool DocumentStyleSheetCollection::updateActiveStyleSheets(StyleEngine* engine,
 
     if (change.styleResolverUpdateType == Reconstruct) {
         engine->clearMasterResolver();
-        engine->resetFontSelector();
+        // FIMXE: The following depends on whether StyleRuleFontFace was modified or not.
+        // No need to always-clear font cache.
+        engine->clearFontCache();
     } else if (StyleResolver* styleResolver = engine->resolver()) {
         // FIXME: We might have already had styles in child treescope. In this case, we cannot use buildScopedStyleTreeInDocumentOrder.
         // Need to change "false" to some valid condition.
         styleResolver->setBuildScopedStyleTreeInDocumentOrder(false);
         if (change.styleResolverUpdateType != Additive) {
-            ASSERT(change.styleResolverUpdateType == Reset || change.styleResolverUpdateType == ResetStyleResolverAndFontSelector);
+            ASSERT(change.styleResolverUpdateType == Reset);
             resetAllRuleSetsInTreeScope(styleResolver);
-            if (change.styleResolverUpdateType == ResetStyleResolverAndFontSelector)
-                engine->resetFontSelector();
+            engine->removeFontFaceRules(change.fontFaceRulesToRemove);
             styleResolver->removePendingAuthorStyleSheets(m_activeAuthorStyleSheets);
             styleResolver->lazyAppendAuthorStyleSheets(0, collection.activeAuthorStyleSheets());
         } else {
             styleResolver->lazyAppendAuthorStyleSheets(m_activeAuthorStyleSheets.size(), collection.activeAuthorStyleSheets());
         }
-    } else if (change.styleResolverUpdateType == ResetStyleResolverAndFontSelector) {
-        engine->resetFontSelector();
     }
     m_scopingNodesForStyleScoped.didRemoveScopingNodes();