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

Side by Side Diff: third_party/WebKit/Source/core/dom/StyleEngine.cpp

Issue 2149893003: Rename Node::inShadowIncludingDocument() to Node::isConnected() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed Created 4 years, 5 months 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
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, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 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) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 context.addingPendingSheet(document()); 140 context.addingPendingSheet(document());
141 if (context.addedPendingSheetBeforeBody()) 141 if (context.addedPendingSheetBeforeBody())
142 m_pendingRenderBlockingStylesheets++; 142 m_pendingRenderBlockingStylesheets++;
143 } 143 }
144 144
145 // This method is called whenever a top-level stylesheet has finished loading. 145 // This method is called whenever a top-level stylesheet has finished loading.
146 void StyleEngine::removePendingSheet(Node* styleSheetCandidateNode, const StyleE ngineContext &context) 146 void StyleEngine::removePendingSheet(Node* styleSheetCandidateNode, const StyleE ngineContext &context)
147 { 147 {
148 DCHECK(styleSheetCandidateNode); 148 DCHECK(styleSheetCandidateNode);
149 TreeScope* treeScope = isStyleElement(*styleSheetCandidateNode) ? &styleShee tCandidateNode->treeScope() : m_document.get(); 149 TreeScope* treeScope = isStyleElement(*styleSheetCandidateNode) ? &styleShee tCandidateNode->treeScope() : m_document.get();
150 if (styleSheetCandidateNode->inShadowIncludingDocument()) 150 if (styleSheetCandidateNode->isConnected())
151 markTreeScopeDirty(*treeScope); 151 markTreeScopeDirty(*treeScope);
152 152
153 if (context.addedPendingSheetBeforeBody()) { 153 if (context.addedPendingSheetBeforeBody()) {
154 DCHECK_GT(m_pendingRenderBlockingStylesheets, 0); 154 DCHECK_GT(m_pendingRenderBlockingStylesheets, 0);
155 m_pendingRenderBlockingStylesheets--; 155 m_pendingRenderBlockingStylesheets--;
156 } 156 }
157 157
158 // Make sure we knew this sheet was pending, and that our count isn't out of sync. 158 // Make sure we knew this sheet was pending, and that our count isn't out of sync.
159 DCHECK_GT(m_pendingScriptBlockingStylesheets, 0); 159 DCHECK_GT(m_pendingScriptBlockingStylesheets, 0);
160 160
161 m_pendingScriptBlockingStylesheets--; 161 m_pendingScriptBlockingStylesheets--;
162 if (m_pendingScriptBlockingStylesheets) 162 if (m_pendingScriptBlockingStylesheets)
163 return; 163 return;
164 164
165 document().didRemoveAllPendingStylesheet(); 165 document().didRemoveAllPendingStylesheet();
166 } 166 }
167 167
168 void StyleEngine::setNeedsActiveStyleUpdate(StyleSheet* sheet, StyleResolverUpda teMode updateMode) 168 void StyleEngine::setNeedsActiveStyleUpdate(StyleSheet* sheet, StyleResolverUpda teMode updateMode)
169 { 169 {
170 // resolverChanged() is called for inactive non-master documents because 170 // resolverChanged() is called for inactive non-master documents because
171 // import documents are inactive documents. resolverChanged() for imports 171 // import documents are inactive documents. resolverChanged() for imports
172 // will call resolverChanged() for the master document and update the active 172 // will call resolverChanged() for the master document and update the active
173 // stylesheets including the ones from the import. 173 // stylesheets including the ones from the import.
174 if (!document().isActive() && isMaster()) 174 if (!document().isActive() && isMaster())
175 return; 175 return;
176 176
177 if (sheet && document().isActive()) { 177 if (sheet && document().isActive()) {
178 Node* node = sheet->ownerNode(); 178 Node* node = sheet->ownerNode();
179 if (node && node->inShadowIncludingDocument()) { 179 if (node && node->isConnected()) {
180 TreeScope& treeScope = isStyleElement(*node) ? node->treeScope() : * m_document; 180 TreeScope& treeScope = isStyleElement(*node) ? node->treeScope() : * m_document;
181 DCHECK(isStyleElement(*node) || node->treeScope() == m_document); 181 DCHECK(isStyleElement(*node) || node->treeScope() == m_document);
182 markTreeScopeDirty(treeScope); 182 markTreeScopeDirty(treeScope);
183 } 183 }
184 } 184 }
185 185
186 resolverChanged(updateMode); 186 resolverChanged(updateMode);
187 } 187 }
188 188
189 void StyleEngine::addStyleSheetCandidateNode(Node* node) 189 void StyleEngine::addStyleSheetCandidateNode(Node* node)
190 { 190 {
191 if (!node->inShadowIncludingDocument() || document().isDetached()) 191 if (!node->isConnected() || document().isDetached())
192 return; 192 return;
193 193
194 TreeScope& treeScope = isStyleElement(*node) ? node->treeScope() : *m_docume nt; 194 TreeScope& treeScope = isStyleElement(*node) ? node->treeScope() : *m_docume nt;
195 DCHECK(isStyleElement(*node) || treeScope == m_document); 195 DCHECK(isStyleElement(*node) || treeScope == m_document);
196 DCHECK(!isXSLStyleSheet(*node)); 196 DCHECK(!isXSLStyleSheet(*node));
197 TreeScopeStyleSheetCollection* collection = ensureStyleSheetCollectionFor(tr eeScope); 197 TreeScopeStyleSheetCollection* collection = ensureStyleSheetCollectionFor(tr eeScope);
198 DCHECK(collection); 198 DCHECK(collection);
199 collection->addStyleSheetCandidateNode(node); 199 collection->addStyleSheetCandidateNode(node);
200 200
201 markTreeScopeDirty(treeScope); 201 markTreeScopeDirty(treeScope);
(...skipping 16 matching lines...) Expand all
218 // we should not update anything. Instead, just return. 218 // we should not update anything. Instead, just return.
219 if (!collection) 219 if (!collection)
220 return; 220 return;
221 collection->removeStyleSheetCandidateNode(node); 221 collection->removeStyleSheetCandidateNode(node);
222 222
223 markTreeScopeDirty(treeScope); 223 markTreeScopeDirty(treeScope);
224 } 224 }
225 225
226 void StyleEngine::modifiedStyleSheetCandidateNode(Node* node) 226 void StyleEngine::modifiedStyleSheetCandidateNode(Node* node)
227 { 227 {
228 if (!node->inShadowIncludingDocument()) 228 if (!node->isConnected())
229 return; 229 return;
230 230
231 TreeScope& treeScope = isStyleElement(*node) ? node->treeScope() : *m_docume nt; 231 TreeScope& treeScope = isStyleElement(*node) ? node->treeScope() : *m_docume nt;
232 DCHECK(isStyleElement(*node) || treeScope == m_document); 232 DCHECK(isStyleElement(*node) || treeScope == m_document);
233 markTreeScopeDirty(treeScope); 233 markTreeScopeDirty(treeScope);
234 resolverChanged(FullStyleUpdate); 234 resolverChanged(FullStyleUpdate);
235 } 235 }
236 236
237 void StyleEngine::watchedSelectorsChanged() 237 void StyleEngine::watchedSelectorsChanged()
238 { 238 {
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 829
830 DEFINE_TRACE_WRAPPERS(StyleEngine) 830 DEFINE_TRACE_WRAPPERS(StyleEngine)
831 { 831 {
832 for (auto sheet : m_injectedAuthorStyleSheets) { 832 for (auto sheet : m_injectedAuthorStyleSheets) {
833 visitor->traceWrappers(sheet); 833 visitor->traceWrappers(sheet);
834 } 834 }
835 visitor->traceWrappers(m_documentStyleSheetCollection); 835 visitor->traceWrappers(m_documentStyleSheetCollection);
836 } 836 }
837 837
838 } // namespace blink 838 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698