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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 } | 248 } |
249 | 249 |
250 void StyleEngine::watchedSelectorsChanged() { | 250 void StyleEngine::watchedSelectorsChanged() { |
251 m_globalRuleSet.initWatchedSelectorsRuleSet(document()); | 251 m_globalRuleSet.initWatchedSelectorsRuleSet(document()); |
252 // TODO(rune@opera.com): Should be able to use RuleSetInvalidation here. | 252 // TODO(rune@opera.com): Should be able to use RuleSetInvalidation here. |
253 document().setNeedsStyleRecalc(SubtreeStyleChange, | 253 document().setNeedsStyleRecalc(SubtreeStyleChange, |
254 StyleChangeReasonForTracing::create( | 254 StyleChangeReasonForTracing::create( |
255 StyleChangeReason::DeclarativeContent)); | 255 StyleChangeReason::DeclarativeContent)); |
256 } | 256 } |
257 | 257 |
258 bool StyleEngine::shouldUpdateDocumentStyleSheetCollection( | 258 bool StyleEngine::shouldUpdateDocumentStyleSheetCollection() const { |
259 StyleResolverUpdateMode updateMode) const { | 259 return m_allTreeScopesDirty || m_documentScopeDirty; |
260 return m_documentScopeDirty || updateMode == FullStyleUpdate; | |
261 } | 260 } |
262 | 261 |
263 bool StyleEngine::shouldUpdateShadowTreeStyleSheetCollection( | 262 bool StyleEngine::shouldUpdateShadowTreeStyleSheetCollection() const { |
264 StyleResolverUpdateMode updateMode) const { | 263 return m_allTreeScopesDirty || !m_dirtyTreeScopes.isEmpty(); |
265 return !m_dirtyTreeScopes.isEmpty() || updateMode == FullStyleUpdate; | |
266 } | 264 } |
267 | 265 |
268 void StyleEngine::mediaQueryAffectingValueChanged( | 266 void StyleEngine::mediaQueryAffectingValueChanged( |
269 UnorderedTreeScopeSet& treeScopes) { | 267 UnorderedTreeScopeSet& treeScopes) { |
270 for (TreeScope* treeScope : treeScopes) { | 268 for (TreeScope* treeScope : treeScopes) { |
271 DCHECK(treeScope != m_document); | 269 DCHECK(treeScope != m_document); |
272 ShadowTreeStyleSheetCollection* collection = | 270 ShadowTreeStyleSheetCollection* collection = |
273 toShadowTreeStyleSheetCollection(styleSheetCollectionFor(*treeScope)); | 271 toShadowTreeStyleSheetCollection(styleSheetCollectionFor(*treeScope)); |
274 DCHECK(collection); | 272 DCHECK(collection); |
275 collection->clearMediaQueryRuleSetStyleSheets(); | 273 collection->clearMediaQueryRuleSetStyleSheets(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 | 311 |
314 void StyleEngine::updateActiveStyleSheets(StyleResolverUpdateMode updateMode) { | 312 void StyleEngine::updateActiveStyleSheets(StyleResolverUpdateMode updateMode) { |
315 DCHECK(isMaster()); | 313 DCHECK(isMaster()); |
316 DCHECK(!document().inStyleRecalc()); | 314 DCHECK(!document().inStyleRecalc()); |
317 | 315 |
318 if (!document().isActive()) | 316 if (!document().isActive()) |
319 return; | 317 return; |
320 | 318 |
321 TRACE_EVENT0("blink,blink_style", "StyleEngine::updateActiveStyleSheets"); | 319 TRACE_EVENT0("blink,blink_style", "StyleEngine::updateActiveStyleSheets"); |
322 | 320 |
323 if (shouldUpdateDocumentStyleSheetCollection(updateMode)) | 321 if (shouldUpdateDocumentStyleSheetCollection()) |
324 documentStyleSheetCollection().updateActiveStyleSheets(*this, updateMode); | 322 documentStyleSheetCollection().updateActiveStyleSheets(*this, updateMode); |
325 | 323 |
326 if (shouldUpdateShadowTreeStyleSheetCollection(updateMode)) { | 324 if (shouldUpdateShadowTreeStyleSheetCollection()) { |
327 UnorderedTreeScopeSet treeScopesRemoved; | 325 UnorderedTreeScopeSet treeScopesRemoved; |
328 | 326 |
329 if (updateMode == FullStyleUpdate) { | 327 if (m_allTreeScopesDirty) { |
330 for (TreeScope* treeScope : m_activeTreeScopes) | 328 for (TreeScope* treeScope : m_activeTreeScopes) |
331 updateActiveStyleSheetsInShadow(updateMode, treeScope, | 329 updateActiveStyleSheetsInShadow(updateMode, treeScope, |
332 treeScopesRemoved); | 330 treeScopesRemoved); |
333 } else { | 331 } else { |
334 for (TreeScope* treeScope : m_dirtyTreeScopes) | 332 for (TreeScope* treeScope : m_dirtyTreeScopes) |
335 updateActiveStyleSheetsInShadow(updateMode, treeScope, | 333 updateActiveStyleSheetsInShadow(updateMode, treeScope, |
336 treeScopesRemoved); | 334 treeScopesRemoved); |
337 } | 335 } |
338 for (TreeScope* treeScope : treeScopesRemoved) | 336 for (TreeScope* treeScope : treeScopesRemoved) |
339 m_activeTreeScopes.remove(treeScope); | 337 m_activeTreeScopes.remove(treeScope); |
340 } | 338 } |
341 | 339 |
342 InspectorInstrumentation::activeStyleSheetsUpdated(m_document); | 340 InspectorInstrumentation::activeStyleSheetsUpdated(m_document); |
343 | 341 |
344 m_dirtyTreeScopes.clear(); | 342 m_dirtyTreeScopes.clear(); |
345 m_documentScopeDirty = false; | 343 m_documentScopeDirty = false; |
| 344 m_allTreeScopesDirty = false; |
346 } | 345 } |
347 | 346 |
348 void StyleEngine::updateActiveStyleSheets() { | 347 void StyleEngine::updateActiveStyleSheets() { |
349 // TODO(rune@opera.com): collect ActiveStyleSheets here. | 348 // TODO(rune@opera.com): collect ActiveStyleSheets here. |
350 } | 349 } |
351 | 350 |
352 void StyleEngine::updateViewport() { | 351 void StyleEngine::updateViewport() { |
353 if (m_viewportResolver) | 352 if (m_viewportResolver) |
354 m_viewportResolver->updateViewport(documentStyleSheetCollection()); | 353 m_viewportResolver->updateViewport(documentStyleSheetCollection()); |
355 } | 354 } |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 return; | 519 return; |
521 } | 520 } |
522 | 521 |
523 // Don't bother updating, since we haven't loaded all our style info yet | 522 // Don't bother updating, since we haven't loaded all our style info yet |
524 // and haven't calculated the style selector for the first time. | 523 // and haven't calculated the style selector for the first time. |
525 if (!document().isActive() || shouldClearResolver()) { | 524 if (!document().isActive() || shouldClearResolver()) { |
526 clearResolver(); | 525 clearResolver(); |
527 return; | 526 return; |
528 } | 527 } |
529 | 528 |
| 529 if (mode == FullStyleUpdate) |
| 530 markAllTreeScopesDirty(); |
530 m_didCalculateResolver = true; | 531 m_didCalculateResolver = true; |
531 updateActiveStyleSheets(mode); | 532 updateActiveStyleSheets(mode); |
532 } | 533 } |
533 | 534 |
534 void StyleEngine::clearFontCache() { | 535 void StyleEngine::clearFontCache() { |
535 if (m_fontSelector) | 536 if (m_fontSelector) |
536 m_fontSelector->fontFaceCache()->clearCSSConnected(); | 537 m_fontSelector->fontFaceCache()->clearCSSConnected(); |
537 if (m_resolver) | 538 if (m_resolver) |
538 m_resolver->invalidateMatchedPropertiesCache(); | 539 m_resolver->invalidateMatchedPropertiesCache(); |
539 } | 540 } |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1230 } | 1231 } |
1231 | 1232 |
1232 DEFINE_TRACE_WRAPPERS(StyleEngine) { | 1233 DEFINE_TRACE_WRAPPERS(StyleEngine) { |
1233 for (auto sheet : m_injectedAuthorStyleSheets) { | 1234 for (auto sheet : m_injectedAuthorStyleSheets) { |
1234 visitor->traceWrappers(sheet); | 1235 visitor->traceWrappers(sheet); |
1235 } | 1236 } |
1236 visitor->traceWrappers(m_documentStyleSheetCollection); | 1237 visitor->traceWrappers(m_documentStyleSheetCollection); |
1237 } | 1238 } |
1238 | 1239 |
1239 } // namespace blink | 1240 } // namespace blink |
OLD | NEW |