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, 2011, 2012 Apple Inc. All | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All |
7 * rights reserved. | 7 * rights reserved. |
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 | 271 |
272 void StyleEngine::mediaQueryAffectingValueChanged() { | 272 void StyleEngine::mediaQueryAffectingValueChanged() { |
273 if (documentStyleSheetCollection().mediaQueryAffectingValueChanged()) | 273 if (documentStyleSheetCollection().mediaQueryAffectingValueChanged()) |
274 setNeedsActiveStyleUpdate(document()); | 274 setNeedsActiveStyleUpdate(document()); |
275 mediaQueryAffectingValueChanged(m_activeTreeScopes); | 275 mediaQueryAffectingValueChanged(m_activeTreeScopes); |
276 if (m_resolver) | 276 if (m_resolver) |
277 m_resolver->updateMediaType(); | 277 m_resolver->updateMediaType(); |
278 } | 278 } |
279 | 279 |
280 void StyleEngine::updateStyleSheetsInImport( | 280 void StyleEngine::updateStyleSheetsInImport( |
| 281 StyleEngine& masterEngine, |
281 DocumentStyleSheetCollector& parentCollector) { | 282 DocumentStyleSheetCollector& parentCollector) { |
282 DCHECK(!isMaster()); | 283 DCHECK(!isMaster()); |
283 HeapVector<Member<StyleSheet>> sheetsForList; | 284 HeapVector<Member<StyleSheet>> sheetsForList; |
284 ImportedDocumentStyleSheetCollector subcollector(parentCollector, | 285 ImportedDocumentStyleSheetCollector subcollector(parentCollector, |
285 sheetsForList); | 286 sheetsForList); |
286 documentStyleSheetCollection().collectStyleSheets(subcollector); | 287 documentStyleSheetCollection().collectStyleSheets(masterEngine, subcollector); |
287 documentStyleSheetCollection().swapSheetsForSheetList(sheetsForList); | 288 documentStyleSheetCollection().swapSheetsForSheetList(sheetsForList); |
288 } | 289 } |
289 | 290 |
290 void StyleEngine::updateActiveStyleSheetsInShadow( | 291 void StyleEngine::updateActiveStyleSheetsInShadow( |
291 TreeScope* treeScope, | 292 TreeScope* treeScope, |
292 UnorderedTreeScopeSet& treeScopesRemoved) { | 293 UnorderedTreeScopeSet& treeScopesRemoved) { |
293 DCHECK_NE(treeScope, m_document); | 294 DCHECK_NE(treeScope, m_document); |
294 ShadowTreeStyleSheetCollection* collection = | 295 ShadowTreeStyleSheetCollection* collection = |
295 toShadowTreeStyleSheetCollection(styleSheetCollectionFor(*treeScope)); | 296 toShadowTreeStyleSheetCollection(styleSheetCollectionFor(*treeScope)); |
296 DCHECK(collection); | 297 DCHECK(collection); |
297 collection->updateActiveStyleSheets(); | 298 collection->updateActiveStyleSheets(*this); |
298 if (!collection->hasStyleSheetCandidateNodes()) { | 299 if (!collection->hasStyleSheetCandidateNodes()) { |
299 treeScopesRemoved.add(treeScope); | 300 treeScopesRemoved.add(treeScope); |
300 // When removing TreeScope from ActiveTreeScopes, | 301 // When removing TreeScope from ActiveTreeScopes, |
301 // its resolver should be destroyed by invoking resetAuthorStyle. | 302 // its resolver should be destroyed by invoking resetAuthorStyle. |
302 DCHECK(!treeScope->scopedStyleResolver()); | 303 DCHECK(!treeScope->scopedStyleResolver()); |
303 } | 304 } |
304 } | 305 } |
305 | 306 |
306 void StyleEngine::updateActiveStyleSheets() { | 307 void StyleEngine::updateActiveStyleSheets() { |
307 if (!needsActiveStyleSheetUpdate()) | 308 if (!needsActiveStyleSheetUpdate()) |
308 return; | 309 return; |
309 | 310 |
310 DCHECK(isMaster()); | 311 DCHECK(isMaster()); |
311 DCHECK(!document().inStyleRecalc()); | 312 DCHECK(!document().inStyleRecalc()); |
312 DCHECK(document().isActive()); | 313 DCHECK(document().isActive()); |
313 | 314 |
314 TRACE_EVENT0("blink,blink_style", "StyleEngine::updateActiveStyleSheets"); | 315 TRACE_EVENT0("blink,blink_style", "StyleEngine::updateActiveStyleSheets"); |
315 | 316 |
316 if (shouldUpdateDocumentStyleSheetCollection()) | 317 if (shouldUpdateDocumentStyleSheetCollection()) |
317 documentStyleSheetCollection().updateActiveStyleSheets(); | 318 documentStyleSheetCollection().updateActiveStyleSheets(*this); |
318 | 319 |
319 if (shouldUpdateShadowTreeStyleSheetCollection()) { | 320 if (shouldUpdateShadowTreeStyleSheetCollection()) { |
320 UnorderedTreeScopeSet treeScopesRemoved; | 321 UnorderedTreeScopeSet treeScopesRemoved; |
321 | 322 |
322 if (m_allTreeScopesDirty) { | 323 if (m_allTreeScopesDirty) { |
323 for (TreeScope* treeScope : m_activeTreeScopes) | 324 for (TreeScope* treeScope : m_activeTreeScopes) |
324 updateActiveStyleSheetsInShadow(treeScope, treeScopesRemoved); | 325 updateActiveStyleSheetsInShadow(treeScope, treeScopesRemoved); |
325 } else { | 326 } else { |
326 for (TreeScope* treeScope : m_dirtyTreeScopes) | 327 for (TreeScope* treeScope : m_dirtyTreeScopes) |
327 updateActiveStyleSheetsInShadow(treeScope, treeScopesRemoved); | 328 updateActiveStyleSheetsInShadow(treeScope, treeScopesRemoved); |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 } | 1132 } |
1132 | 1133 |
1133 DEFINE_TRACE_WRAPPERS(StyleEngine) { | 1134 DEFINE_TRACE_WRAPPERS(StyleEngine) { |
1134 for (auto sheet : m_injectedAuthorStyleSheets) { | 1135 for (auto sheet : m_injectedAuthorStyleSheets) { |
1135 visitor->traceWrappers(sheet); | 1136 visitor->traceWrappers(sheet); |
1136 } | 1137 } |
1137 visitor->traceWrappers(m_documentStyleSheetCollection); | 1138 visitor->traceWrappers(m_documentStyleSheetCollection); |
1138 } | 1139 } |
1139 | 1140 |
1140 } // namespace blink | 1141 } // namespace blink |
OLD | NEW |