Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: Source/core/dom/DocumentStyleSheetCollection.cpp

Issue 85693009: Get rid of Reset and ResetStyleResolverAndFontSelector. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 namespace WebCore { 45 namespace WebCore {
46 46
47 using namespace HTMLNames; 47 using namespace HTMLNames;
48 48
49 DocumentStyleSheetCollection::DocumentStyleSheetCollection(TreeScope& treeScope) 49 DocumentStyleSheetCollection::DocumentStyleSheetCollection(TreeScope& treeScope)
50 : StyleSheetCollection(treeScope) 50 : StyleSheetCollection(treeScope)
51 { 51 {
52 ASSERT(treeScope.rootNode() == treeScope.rootNode()->document()); 52 ASSERT(treeScope.rootNode() == treeScope.rootNode()->document());
53 } 53 }
54 54
55 static void collectActiveCSSStyleSheetsFromSeamlessParents(StyleSheetCollectionB ase& collection, Document* document)
56 {
57 HTMLIFrameElement* seamlessParentIFrame = document->seamlessParentIFrame();
58 if (!seamlessParentIFrame)
59 return;
60 collection.appendActiveStyleSheets(seamlessParentIFrame->document().styleEng ine()->activeAuthorStyleSheets());
61 }
62
55 void DocumentStyleSheetCollection::collectStyleSheets(StyleEngine* engine, Style SheetCollectionBase& collection) 63 void DocumentStyleSheetCollection::collectStyleSheets(StyleEngine* engine, Style SheetCollectionBase& collection)
56 { 64 {
65 collection.appendActiveStyleSheets(engine->injectedAuthorStyleSheets());
66 collection.appendActiveStyleSheets(engine->documentAuthorStyleSheets());
67 collectActiveCSSStyleSheetsFromSeamlessParents(collection, document());
68
57 DocumentOrderedList::iterator begin = m_styleSheetCandidateNodes.begin(); 69 DocumentOrderedList::iterator begin = m_styleSheetCandidateNodes.begin();
58 DocumentOrderedList::iterator end = m_styleSheetCandidateNodes.end(); 70 DocumentOrderedList::iterator end = m_styleSheetCandidateNodes.end();
59 for (DocumentOrderedList::iterator it = begin; it != end; ++it) { 71 for (DocumentOrderedList::iterator it = begin; it != end; ++it) {
60 Node* n = *it; 72 Node* n = *it;
61 StyleSheet* sheet = 0; 73 StyleSheet* sheet = 0;
62 CSSStyleSheet* activeSheet = 0; 74 CSSStyleSheet* activeSheet = 0;
63 if (n->nodeType() == Node::PROCESSING_INSTRUCTION_NODE && !document()->i sHTMLDocument()) { 75 if (n->nodeType() == Node::PROCESSING_INSTRUCTION_NODE && !document()->i sHTMLDocument()) {
64 // Processing instruction (XML documents only). 76 // Processing instruction (XML documents only).
65 // We don't support linking to embedded CSS stylesheets, see <https: //bugs.webkit.org/show_bug.cgi?id=49281> for discussion. 77 // We don't support linking to embedded CSS stylesheets, see <https: //bugs.webkit.org/show_bug.cgi?id=49281> for discussion.
66 ProcessingInstruction* pi = toProcessingInstruction(n); 78 ProcessingInstruction* pi = toProcessingInstruction(n);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 activeSheet = 0; 142 activeSheet = 0;
131 } 143 }
132 144
133 if (sheet) 145 if (sheet)
134 collection.appendSheetForList(sheet); 146 collection.appendSheetForList(sheet);
135 if (activeSheet) 147 if (activeSheet)
136 collection.appendActiveStyleSheet(activeSheet); 148 collection.appendActiveStyleSheet(activeSheet);
137 } 149 }
138 } 150 }
139 151
140 static void collectActiveCSSStyleSheetsFromSeamlessParents(StyleSheetCollectionB ase& collection, Document* document)
141 {
142 HTMLIFrameElement* seamlessParentIFrame = document->seamlessParentIFrame();
143 if (!seamlessParentIFrame)
144 return;
145 collection.appendActiveStyleSheets(seamlessParentIFrame->document().styleEng ine()->activeAuthorStyleSheets());
146 } 152 }
147
148 bool DocumentStyleSheetCollection::updateActiveStyleSheets(StyleEngine* engine, StyleResolverUpdateMode updateMode)
149 {
150 StyleSheetCollectionBase collection;
151 collection.appendActiveStyleSheets(engine->injectedAuthorStyleSheets());
152 collection.appendActiveStyleSheets(engine->documentAuthorStyleSheets());
153 collectActiveCSSStyleSheetsFromSeamlessParents(collection, document());
154 collectStyleSheets(engine, collection);
155
156 StyleSheetChange change;
157 analyzeStyleSheetChange(updateMode, collection, change);
158
159 if (change.styleResolverUpdateType == Reconstruct) {
160 engine->clearResolver();
161 } else if (StyleResolver* styleResolver = engine->resolverIfExists()) {
162 // FIXME: We might have already had styles in child treescope. In this c ase, we cannot use buildScopedStyleTreeInDocumentOrder.
163 // Need to change "false" to some valid condition.
164 styleResolver->setBuildScopedStyleTreeInDocumentOrder(false);
165 if (change.styleResolverUpdateType != Additive) {
166 ASSERT(change.styleResolverUpdateType == Reset || change.styleResolv erUpdateType == ResetStyleResolverAndFontSelector);
167 resetAllRuleSetsInTreeScope(styleResolver);
168 if (change.styleResolverUpdateType == ResetStyleResolverAndFontSelec tor)
169 styleResolver->resetFontSelector();
170 styleResolver->removePendingAuthorStyleSheets(m_activeAuthorStyleShe ets);
171 styleResolver->lazyAppendAuthorStyleSheets(0, collection.activeAutho rStyleSheets());
172 } else {
173 styleResolver->lazyAppendAuthorStyleSheets(m_activeAuthorStyleSheets .size(), collection.activeAuthorStyleSheets());
174 }
175 }
176 m_scopingNodesForStyleScoped.didRemoveScopingNodes();
177 collection.swap(*this);
178 updateUsesRemUnits();
179
180 return change.requiresFullStyleRecalc;
181 }
182
183 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698