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

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

Issue 1858163002: Rename inDocument() to inShadowIncludingDocument() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 void StyleEngine::addPendingSheet() 157 void StyleEngine::addPendingSheet()
158 { 158 {
159 m_pendingStylesheets++; 159 m_pendingStylesheets++;
160 } 160 }
161 161
162 // This method is called whenever a top-level stylesheet has finished loading. 162 // This method is called whenever a top-level stylesheet has finished loading.
163 void StyleEngine::removePendingSheet(Node* styleSheetCandidateNode) 163 void StyleEngine::removePendingSheet(Node* styleSheetCandidateNode)
164 { 164 {
165 ASSERT(styleSheetCandidateNode); 165 ASSERT(styleSheetCandidateNode);
166 TreeScope* treeScope = isStyleElement(*styleSheetCandidateNode) ? &styleShee tCandidateNode->treeScope() : m_document.get(); 166 TreeScope* treeScope = isStyleElement(*styleSheetCandidateNode) ? &styleShee tCandidateNode->treeScope() : m_document.get();
167 if (styleSheetCandidateNode->inDocument()) 167 if (styleSheetCandidateNode->inShadowIncludingDocument())
168 markTreeScopeDirty(*treeScope); 168 markTreeScopeDirty(*treeScope);
169 169
170 // Make sure we knew this sheet was pending, and that our count isn't out of sync. 170 // Make sure we knew this sheet was pending, and that our count isn't out of sync.
171 ASSERT(m_pendingStylesheets > 0); 171 ASSERT(m_pendingStylesheets > 0);
172 172
173 m_pendingStylesheets--; 173 m_pendingStylesheets--;
174 if (m_pendingStylesheets) 174 if (m_pendingStylesheets)
175 return; 175 return;
176 176
177 document().didRemoveAllPendingStylesheet(); 177 document().didRemoveAllPendingStylesheet();
178 } 178 }
179 179
180 void StyleEngine::setNeedsActiveStyleUpdate(StyleSheet* sheet, StyleResolverUpda teMode updateMode) 180 void StyleEngine::setNeedsActiveStyleUpdate(StyleSheet* sheet, StyleResolverUpda teMode updateMode)
181 { 181 {
182 // resolverChanged() is called for inactive non-master documents because 182 // resolverChanged() is called for inactive non-master documents because
183 // import documents are inactive documents. resolverChanged() for imports 183 // import documents are inactive documents. resolverChanged() for imports
184 // will call resolverChanged() for the master document and update the active 184 // will call resolverChanged() for the master document and update the active
185 // stylesheets including the ones from the import. 185 // stylesheets including the ones from the import.
186 if (!document().isActive() && isMaster()) 186 if (!document().isActive() && isMaster())
187 return; 187 return;
188 188
189 if (sheet && document().isActive()) { 189 if (sheet && document().isActive()) {
190 Node* node = sheet->ownerNode(); 190 Node* node = sheet->ownerNode();
191 if (node && node->inDocument()) { 191 if (node && node->inShadowIncludingDocument()) {
192 TreeScope& treeScope = isStyleElement(*node) ? node->treeScope() : * m_document; 192 TreeScope& treeScope = isStyleElement(*node) ? node->treeScope() : * m_document;
193 ASSERT(isStyleElement(*node) || node->treeScope() == m_document); 193 ASSERT(isStyleElement(*node) || node->treeScope() == m_document);
194 markTreeScopeDirty(treeScope); 194 markTreeScopeDirty(treeScope);
195 } 195 }
196 } 196 }
197 197
198 resolverChanged(updateMode); 198 resolverChanged(updateMode);
199 } 199 }
200 200
201 void StyleEngine::addStyleSheetCandidateNode(Node* node) 201 void StyleEngine::addStyleSheetCandidateNode(Node* node)
202 { 202 {
203 if (!node->inDocument() || document().isDetached()) 203 if (!node->inShadowIncludingDocument() || document().isDetached())
204 return; 204 return;
205 205
206 TreeScope& treeScope = isStyleElement(*node) ? node->treeScope() : *m_docume nt; 206 TreeScope& treeScope = isStyleElement(*node) ? node->treeScope() : *m_docume nt;
207 ASSERT(isStyleElement(*node) || treeScope == m_document); 207 ASSERT(isStyleElement(*node) || treeScope == m_document);
208 ASSERT(!isXSLStyleSheet(*node)); 208 ASSERT(!isXSLStyleSheet(*node));
209 TreeScopeStyleSheetCollection* collection = ensureStyleSheetCollectionFor(tr eeScope); 209 TreeScopeStyleSheetCollection* collection = ensureStyleSheetCollectionFor(tr eeScope);
210 ASSERT(collection); 210 ASSERT(collection);
211 collection->addStyleSheetCandidateNode(node); 211 collection->addStyleSheetCandidateNode(node);
212 212
213 markTreeScopeDirty(treeScope); 213 markTreeScopeDirty(treeScope);
(...skipping 16 matching lines...) Expand all
230 // we should not update anything. Instead, just return. 230 // we should not update anything. Instead, just return.
231 if (!collection) 231 if (!collection)
232 return; 232 return;
233 collection->removeStyleSheetCandidateNode(node); 233 collection->removeStyleSheetCandidateNode(node);
234 234
235 markTreeScopeDirty(treeScope); 235 markTreeScopeDirty(treeScope);
236 } 236 }
237 237
238 void StyleEngine::modifiedStyleSheetCandidateNode(Node* node) 238 void StyleEngine::modifiedStyleSheetCandidateNode(Node* node)
239 { 239 {
240 if (!node->inDocument()) 240 if (!node->inShadowIncludingDocument())
241 return; 241 return;
242 242
243 TreeScope& treeScope = isStyleElement(*node) ? node->treeScope() : *m_docume nt; 243 TreeScope& treeScope = isStyleElement(*node) ? node->treeScope() : *m_docume nt;
244 ASSERT(isStyleElement(*node) || treeScope == m_document); 244 ASSERT(isStyleElement(*node) || treeScope == m_document);
245 markTreeScopeDirty(treeScope); 245 markTreeScopeDirty(treeScope);
246 resolverChanged(FullStyleUpdate); 246 resolverChanged(FullStyleUpdate);
247 } 247 }
248 248
249 void StyleEngine::watchedSelectorsChanged() 249 void StyleEngine::watchedSelectorsChanged()
250 { 250 {
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 visitor->trace(m_styleInvalidator); 802 visitor->trace(m_styleInvalidator);
803 visitor->trace(m_dirtyTreeScopes); 803 visitor->trace(m_dirtyTreeScopes);
804 visitor->trace(m_activeTreeScopes); 804 visitor->trace(m_activeTreeScopes);
805 visitor->trace(m_fontSelector); 805 visitor->trace(m_fontSelector);
806 visitor->trace(m_textToSheetCache); 806 visitor->trace(m_textToSheetCache);
807 visitor->trace(m_sheetToTextCache); 807 visitor->trace(m_sheetToTextCache);
808 CSSFontSelectorClient::trace(visitor); 808 CSSFontSelectorClient::trace(visitor);
809 } 809 }
810 810
811 } // namespace blink 811 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698