| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. |
| 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 9 * Copyright (C) 2013 Google Inc. All rights reserved. | 9 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 10 * | 10 * |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "core/dom/StyleChangeReason.h" | 33 #include "core/dom/StyleChangeReason.h" |
| 34 #include "core/dom/StyleEngine.h" | 34 #include "core/dom/StyleEngine.h" |
| 35 #include "core/dom/StyleSheetCandidate.h" | 35 #include "core/dom/StyleSheetCandidate.h" |
| 36 #include "platform/RuntimeEnabledFeatures.h" | 36 #include "platform/RuntimeEnabledFeatures.h" |
| 37 | 37 |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 DocumentStyleSheetCollection::DocumentStyleSheetCollection(TreeScope& treeScope) | 40 DocumentStyleSheetCollection::DocumentStyleSheetCollection(TreeScope& treeScope) |
| 41 : TreeScopeStyleSheetCollection(treeScope) | 41 : TreeScopeStyleSheetCollection(treeScope) |
| 42 { | 42 { |
| 43 ASSERT(treeScope.rootNode() == treeScope.rootNode().document()); | 43 DCHECK_EQ(treeScope.rootNode(), treeScope.rootNode().document()); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void DocumentStyleSheetCollection::collectStyleSheetsFromCandidates(StyleEngine&
engine, DocumentStyleSheetCollector& collector) | 46 void DocumentStyleSheetCollection::collectStyleSheetsFromCandidates(StyleEngine&
engine, DocumentStyleSheetCollector& collector) |
| 47 { | 47 { |
| 48 for (Node* n : m_styleSheetCandidateNodes) { | 48 for (Node* n : m_styleSheetCandidateNodes) { |
| 49 StyleSheetCandidate candidate(*n); | 49 StyleSheetCandidate candidate(*n); |
| 50 | 50 |
| 51 ASSERT(!candidate.isXSL()); | 51 DCHECK(!candidate.isXSL()); |
| 52 if (candidate.isImport()) { | 52 if (candidate.isImport()) { |
| 53 Document* document = candidate.importedDocument(); | 53 Document* document = candidate.importedDocument(); |
| 54 if (!document) | 54 if (!document) |
| 55 continue; | 55 continue; |
| 56 if (collector.hasVisited(document)) | 56 if (collector.hasVisited(document)) |
| 57 continue; | 57 continue; |
| 58 collector.willVisit(document); | 58 collector.willVisit(document); |
| 59 document->styleEngine().updateStyleSheetsInImport(collector); | 59 document->styleEngine().updateStyleSheetsInImport(collector); |
| 60 continue; | 60 continue; |
| 61 } | 61 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 74 if (candidate.hasPreferrableName()) | 74 if (candidate.hasPreferrableName()) |
| 75 engine.setPreferredStylesheetSetNameIfNotSet(candidate.title()); | 75 engine.setPreferredStylesheetSetNameIfNotSet(candidate.title()); |
| 76 collector.appendSheetForList(sheet); | 76 collector.appendSheetForList(sheet); |
| 77 if (candidate.canBeActivated(engine.preferredStylesheetSetName())) | 77 if (candidate.canBeActivated(engine.preferredStylesheetSetName())) |
| 78 collector.appendActiveStyleSheet(toCSSStyleSheet(sheet)); | 78 collector.appendActiveStyleSheet(toCSSStyleSheet(sheet)); |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 | 81 |
| 82 void DocumentStyleSheetCollection::collectStyleSheets(StyleEngine& engine, Docum
entStyleSheetCollector& collector) | 82 void DocumentStyleSheetCollection::collectStyleSheets(StyleEngine& engine, Docum
entStyleSheetCollector& collector) |
| 83 { | 83 { |
| 84 ASSERT(&document().styleEngine() == &engine); | 84 DCHECK_EQ(&document().styleEngine(), &engine); |
| 85 collector.appendActiveStyleSheets(engine.injectedAuthorStyleSheets()); | 85 collector.appendActiveStyleSheets(engine.injectedAuthorStyleSheets()); |
| 86 collectStyleSheetsFromCandidates(engine, collector); | 86 collectStyleSheetsFromCandidates(engine, collector); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void DocumentStyleSheetCollection::updateActiveStyleSheets(StyleEngine& engine,
StyleResolverUpdateMode updateMode) | 89 void DocumentStyleSheetCollection::updateActiveStyleSheets(StyleEngine& engine,
StyleResolverUpdateMode updateMode) |
| 90 { | 90 { |
| 91 StyleSheetCollection collection; | 91 StyleSheetCollection collection; |
| 92 ActiveDocumentStyleSheetCollector collector(collection); | 92 ActiveDocumentStyleSheetCollector collector(collection); |
| 93 collectStyleSheets(engine, collector); | 93 collectStyleSheets(engine, collector); |
| 94 | 94 |
| 95 StyleSheetChange change; | 95 StyleSheetChange change; |
| 96 analyzeStyleSheetChange(updateMode, collection, change); | 96 analyzeStyleSheetChange(updateMode, collection, change); |
| 97 | 97 |
| 98 if (change.styleResolverUpdateType == Reconstruct) { | 98 if (change.styleResolverUpdateType == Reconstruct) { |
| 99 engine.clearMasterResolver(); | 99 engine.clearMasterResolver(); |
| 100 // TODO(rune@opera.com): The following depends on whether StyleRuleFontF
ace was modified or not. | 100 // TODO(rune@opera.com): The following depends on whether StyleRuleFontF
ace was modified or not. |
| 101 // We should only remove modified/removed @font-face rules, or @font-fac
e rules from removed | 101 // We should only remove modified/removed @font-face rules, or @font-fac
e rules from removed |
| 102 // stylesheets. We currently avoid clearing the font cache when we have
had an analyzed update | 102 // stylesheets. We currently avoid clearing the font cache when we have
had an analyzed update |
| 103 // and no @font-face rules were removed, in which case requiresFullStyle
Recalc will be false. | 103 // and no @font-face rules were removed, in which case requiresFullStyle
Recalc will be false. |
| 104 if (change.requiresFullStyleRecalc) | 104 if (change.requiresFullStyleRecalc) |
| 105 engine.clearFontCache(); | 105 engine.clearFontCache(); |
| 106 } else if (StyleResolver* styleResolver = engine.resolver()) { | 106 } else if (StyleResolver* styleResolver = engine.resolver()) { |
| 107 if (change.styleResolverUpdateType != Additive) { | 107 if (change.styleResolverUpdateType != Additive) { |
| 108 ASSERT(change.styleResolverUpdateType == Reset); | 108 DCHECK_EQ(change.styleResolverUpdateType, Reset); |
| 109 styleResolver->resetAuthorStyle(treeScope()); | 109 styleResolver->resetAuthorStyle(treeScope()); |
| 110 engine.removeFontFaceRules(change.fontFaceRulesToRemove); | 110 engine.removeFontFaceRules(change.fontFaceRulesToRemove); |
| 111 styleResolver->removePendingAuthorStyleSheets(m_activeAuthorStyleShe
ets); | 111 styleResolver->removePendingAuthorStyleSheets(m_activeAuthorStyleShe
ets); |
| 112 styleResolver->lazyAppendAuthorStyleSheets(0, collection.activeAutho
rStyleSheets()); | 112 styleResolver->lazyAppendAuthorStyleSheets(0, collection.activeAutho
rStyleSheets()); |
| 113 } else { | 113 } else { |
| 114 styleResolver->lazyAppendAuthorStyleSheets(m_activeAuthorStyleSheets
.size(), collection.activeAuthorStyleSheets()); | 114 styleResolver->lazyAppendAuthorStyleSheets(m_activeAuthorStyleSheets
.size(), collection.activeAuthorStyleSheets()); |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 if (change.requiresFullStyleRecalc) | 117 if (change.requiresFullStyleRecalc) |
| 118 document().setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForT
racing::create(StyleChangeReason::ActiveStylesheetsUpdate)); | 118 document().setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForT
racing::create(StyleChangeReason::ActiveStylesheetsUpdate)); |
| 119 | 119 |
| 120 collection.swap(*this); | 120 collection.swap(*this); |
| 121 } | 121 } |
| 122 | 122 |
| 123 } // namespace blink | 123 } // namespace blink |
| OLD | NEW |