| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 } | 144 } |
| 145 | 145 |
| 146 CSSStyleSheet& StyleEngine::ensureInspectorStyleSheet() { | 146 CSSStyleSheet& StyleEngine::ensureInspectorStyleSheet() { |
| 147 if (m_inspectorStyleSheet) | 147 if (m_inspectorStyleSheet) |
| 148 return *m_inspectorStyleSheet; | 148 return *m_inspectorStyleSheet; |
| 149 | 149 |
| 150 StyleSheetContents* contents = | 150 StyleSheetContents* contents = |
| 151 StyleSheetContents::create(CSSParserContext(*m_document, nullptr)); | 151 StyleSheetContents::create(CSSParserContext(*m_document, nullptr)); |
| 152 m_inspectorStyleSheet = CSSStyleSheet::create(contents, *m_document); | 152 m_inspectorStyleSheet = CSSStyleSheet::create(contents, *m_document); |
| 153 markDocumentDirty(); | 153 markDocumentDirty(); |
| 154 // TODO(rune@opera.com): Making the active stylesheets up-to-date here is | 154 resolverChanged(AnalyzedStyleUpdate); |
| 155 // required by some inspector tests, at least. I theory this should not be | |
| 156 // necessary. Need to investigate to figure out if/why. | |
| 157 updateActiveStyle(); | |
| 158 return *m_inspectorStyleSheet; | 155 return *m_inspectorStyleSheet; |
| 159 } | 156 } |
| 160 | 157 |
| 161 void StyleEngine::addPendingSheet(StyleEngineContext& context) { | 158 void StyleEngine::addPendingSheet(StyleEngineContext& context) { |
| 162 m_pendingScriptBlockingStylesheets++; | 159 m_pendingScriptBlockingStylesheets++; |
| 163 | 160 |
| 164 context.addingPendingSheet(document()); | 161 context.addingPendingSheet(document()); |
| 165 if (context.addedPendingSheetBeforeBody()) | 162 if (context.addedPendingSheetBeforeBody()) |
| 166 m_pendingRenderBlockingStylesheets++; | 163 m_pendingRenderBlockingStylesheets++; |
| 167 } | 164 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 return m_allTreeScopesDirty || !m_dirtyTreeScopes.isEmpty(); | 260 return m_allTreeScopesDirty || !m_dirtyTreeScopes.isEmpty(); |
| 264 } | 261 } |
| 265 | 262 |
| 266 void StyleEngine::mediaQueryAffectingValueChanged( | 263 void StyleEngine::mediaQueryAffectingValueChanged( |
| 267 UnorderedTreeScopeSet& treeScopes) { | 264 UnorderedTreeScopeSet& treeScopes) { |
| 268 for (TreeScope* treeScope : treeScopes) { | 265 for (TreeScope* treeScope : treeScopes) { |
| 269 DCHECK(treeScope != m_document); | 266 DCHECK(treeScope != m_document); |
| 270 ShadowTreeStyleSheetCollection* collection = | 267 ShadowTreeStyleSheetCollection* collection = |
| 271 toShadowTreeStyleSheetCollection(styleSheetCollectionFor(*treeScope)); | 268 toShadowTreeStyleSheetCollection(styleSheetCollectionFor(*treeScope)); |
| 272 DCHECK(collection); | 269 DCHECK(collection); |
| 273 if (collection->mediaQueryAffectingValueChanged()) | 270 collection->clearMediaQueryRuleSetStyleSheets(); |
| 274 setNeedsActiveStyleUpdate(*treeScope); | |
| 275 } | 271 } |
| 276 } | 272 } |
| 277 | 273 |
| 278 void StyleEngine::mediaQueryAffectingValueChanged() { | 274 void StyleEngine::mediaQueryAffectingValueChanged() { |
| 279 if (documentStyleSheetCollection().mediaQueryAffectingValueChanged()) | 275 resolverChanged(FullStyleUpdate); |
| 280 setNeedsActiveStyleUpdate(document()); | 276 documentStyleSheetCollection().clearMediaQueryRuleSetStyleSheets(); |
| 281 mediaQueryAffectingValueChanged(m_activeTreeScopes); | 277 mediaQueryAffectingValueChanged(m_activeTreeScopes); |
| 282 if (m_resolver) | 278 if (m_resolver) |
| 283 m_resolver->updateMediaType(); | 279 m_resolver->updateMediaType(); |
| 284 } | 280 } |
| 285 | 281 |
| 286 void StyleEngine::updateStyleSheetsInImport( | 282 void StyleEngine::updateStyleSheetsInImport( |
| 287 DocumentStyleSheetCollector& parentCollector) { | 283 DocumentStyleSheetCollector& parentCollector) { |
| 288 DCHECK(!isMaster()); | 284 DCHECK(!isMaster()); |
| 289 HeapVector<Member<StyleSheet>> sheetsForList; | 285 HeapVector<Member<StyleSheet>> sheetsForList; |
| 290 ImportedDocumentStyleSheetCollector subcollector(parentCollector, | 286 ImportedDocumentStyleSheetCollector subcollector(parentCollector, |
| 291 sheetsForList); | 287 sheetsForList); |
| 292 documentStyleSheetCollection().collectStyleSheets(subcollector); | 288 documentStyleSheetCollection().collectStyleSheets(*this, subcollector); |
| 293 documentStyleSheetCollection().swapSheetsForSheetList(sheetsForList); | 289 documentStyleSheetCollection().swapSheetsForSheetList(sheetsForList); |
| 294 } | 290 } |
| 295 | 291 |
| 296 void StyleEngine::updateActiveStyleSheetsInShadow( | 292 void StyleEngine::updateActiveStyleSheetsInShadow( |
| 293 StyleResolverUpdateMode updateMode, |
| 297 TreeScope* treeScope, | 294 TreeScope* treeScope, |
| 298 UnorderedTreeScopeSet& treeScopesRemoved) { | 295 UnorderedTreeScopeSet& treeScopesRemoved) { |
| 299 DCHECK_NE(treeScope, m_document); | 296 DCHECK_NE(treeScope, m_document); |
| 300 ShadowTreeStyleSheetCollection* collection = | 297 ShadowTreeStyleSheetCollection* collection = |
| 301 toShadowTreeStyleSheetCollection(styleSheetCollectionFor(*treeScope)); | 298 toShadowTreeStyleSheetCollection(styleSheetCollectionFor(*treeScope)); |
| 302 DCHECK(collection); | 299 DCHECK(collection); |
| 303 collection->updateActiveStyleSheets(); | 300 collection->updateActiveStyleSheets(*this, updateMode); |
| 304 if (!collection->hasStyleSheetCandidateNodes()) { | 301 if (!collection->hasStyleSheetCandidateNodes()) { |
| 305 treeScopesRemoved.add(treeScope); | 302 treeScopesRemoved.add(treeScope); |
| 306 // When removing TreeScope from ActiveTreeScopes, | 303 // When removing TreeScope from ActiveTreeScopes, |
| 307 // its resolver should be destroyed by invoking resetAuthorStyle. | 304 // its resolver should be destroyed by invoking resetAuthorStyle. |
| 308 DCHECK(!treeScope->scopedStyleResolver()); | 305 DCHECK(!treeScope->scopedStyleResolver()); |
| 309 } | 306 } |
| 310 } | 307 } |
| 311 | 308 |
| 312 void StyleEngine::updateActiveStyleSheets() { | 309 void StyleEngine::updateActiveStyleSheets(StyleResolverUpdateMode updateMode) { |
| 313 if (!needsActiveStyleSheetUpdate()) | |
| 314 return; | |
| 315 | |
| 316 DCHECK(isMaster()); | 310 DCHECK(isMaster()); |
| 317 DCHECK(!document().inStyleRecalc()); | 311 DCHECK(!document().inStyleRecalc()); |
| 318 DCHECK(document().isActive()); | 312 |
| 313 if (!document().isActive()) |
| 314 return; |
| 319 | 315 |
| 320 TRACE_EVENT0("blink,blink_style", "StyleEngine::updateActiveStyleSheets"); | 316 TRACE_EVENT0("blink,blink_style", "StyleEngine::updateActiveStyleSheets"); |
| 321 | 317 |
| 322 if (shouldUpdateDocumentStyleSheetCollection()) | 318 if (shouldUpdateDocumentStyleSheetCollection()) |
| 323 documentStyleSheetCollection().updateActiveStyleSheets(); | 319 documentStyleSheetCollection().updateActiveStyleSheets(*this, updateMode); |
| 324 | 320 |
| 325 if (shouldUpdateShadowTreeStyleSheetCollection()) { | 321 if (shouldUpdateShadowTreeStyleSheetCollection()) { |
| 326 UnorderedTreeScopeSet treeScopesRemoved; | 322 UnorderedTreeScopeSet treeScopesRemoved; |
| 327 | 323 |
| 328 if (m_allTreeScopesDirty) { | 324 if (m_allTreeScopesDirty) { |
| 329 for (TreeScope* treeScope : m_activeTreeScopes) | 325 for (TreeScope* treeScope : m_activeTreeScopes) |
| 330 updateActiveStyleSheetsInShadow(treeScope, treeScopesRemoved); | 326 updateActiveStyleSheetsInShadow(updateMode, treeScope, |
| 327 treeScopesRemoved); |
| 331 } else { | 328 } else { |
| 332 for (TreeScope* treeScope : m_dirtyTreeScopes) | 329 for (TreeScope* treeScope : m_dirtyTreeScopes) |
| 333 updateActiveStyleSheetsInShadow(treeScope, treeScopesRemoved); | 330 updateActiveStyleSheetsInShadow(updateMode, treeScope, |
| 331 treeScopesRemoved); |
| 334 } | 332 } |
| 335 for (TreeScope* treeScope : treeScopesRemoved) | 333 for (TreeScope* treeScope : treeScopesRemoved) |
| 336 m_activeTreeScopes.remove(treeScope); | 334 m_activeTreeScopes.remove(treeScope); |
| 337 } | 335 } |
| 338 | 336 |
| 339 InspectorInstrumentation::activeStyleSheetsUpdated(m_document); | 337 InspectorInstrumentation::activeStyleSheetsUpdated(m_document); |
| 340 | 338 |
| 341 m_dirtyTreeScopes.clear(); | 339 m_dirtyTreeScopes.clear(); |
| 342 m_documentScopeDirty = false; | 340 m_documentScopeDirty = false; |
| 343 m_allTreeScopesDirty = false; | 341 m_allTreeScopesDirty = false; |
| 344 } | 342 } |
| 345 | 343 |
| 344 void StyleEngine::updateActiveStyleSheets() { |
| 345 // TODO(rune@opera.com): collect ActiveStyleSheets here. |
| 346 } |
| 347 |
| 346 void StyleEngine::updateViewport() { | 348 void StyleEngine::updateViewport() { |
| 347 if (m_viewportResolver) | 349 if (m_viewportResolver) |
| 348 m_viewportResolver->updateViewport(documentStyleSheetCollection()); | 350 m_viewportResolver->updateViewport(documentStyleSheetCollection()); |
| 349 } | 351 } |
| 350 | 352 |
| 351 bool StyleEngine::needsActiveStyleUpdate() const { | 353 bool StyleEngine::needsActiveStyleUpdate() const { |
| 352 return (m_viewportResolver && m_viewportResolver->needsUpdate()) || | 354 return m_viewportResolver && m_viewportResolver->needsUpdate(); |
| 353 needsActiveStyleSheetUpdate() || m_globalRuleSet.isDirty(); | |
| 354 } | 355 } |
| 355 | 356 |
| 356 void StyleEngine::updateActiveStyle() { | 357 void StyleEngine::updateActiveStyle() { |
| 357 DCHECK(document().isActive()); | |
| 358 updateViewport(); | 358 updateViewport(); |
| 359 updateActiveStyleSheets(); | 359 updateActiveStyleSheets(); |
| 360 m_globalRuleSet.update(document()); | 360 m_globalRuleSet.update(document()); |
| 361 } | 361 } |
| 362 | 362 |
| 363 const ActiveStyleSheetVector StyleEngine::activeStyleSheetsForInspector() { | 363 const HeapVector<Member<CSSStyleSheet>> |
| 364 if (document().isActive()) | 364 StyleEngine::activeStyleSheetsForInspector() const { |
| 365 updateActiveStyle(); | |
| 366 | |
| 367 if (m_activeTreeScopes.isEmpty()) | 365 if (m_activeTreeScopes.isEmpty()) |
| 368 return documentStyleSheetCollection().activeAuthorStyleSheets(); | 366 return documentStyleSheetCollection().activeAuthorStyleSheets(); |
| 369 | 367 |
| 370 ActiveStyleSheetVector activeStyleSheets; | 368 HeapVector<Member<CSSStyleSheet>> activeStyleSheets; |
| 371 | 369 |
| 372 activeStyleSheets.appendVector( | 370 activeStyleSheets.appendVector( |
| 373 documentStyleSheetCollection().activeAuthorStyleSheets()); | 371 documentStyleSheetCollection().activeAuthorStyleSheets()); |
| 374 for (TreeScope* treeScope : m_activeTreeScopes) { | 372 for (TreeScope* treeScope : m_activeTreeScopes) { |
| 375 if (TreeScopeStyleSheetCollection* collection = | 373 if (TreeScopeStyleSheetCollection* collection = |
| 376 m_styleSheetCollectionMap.get(treeScope)) | 374 m_styleSheetCollectionMap.get(treeScope)) |
| 377 activeStyleSheets.appendVector(collection->activeAuthorStyleSheets()); | 375 activeStyleSheets.appendVector(collection->activeAuthorStyleSheets()); |
| 378 } | 376 } |
| 379 | 377 |
| 380 // FIXME: Inspector needs a vector which has all active stylesheets. | 378 // FIXME: Inspector needs a vector which has all active stylesheets. |
| 381 // However, creating such a large vector might cause performance regression. | 379 // However, creating such a large vector might cause performance regression. |
| 382 // Need to implement some smarter solution. | 380 // Need to implement some smarter solution. |
| 383 return activeStyleSheets; | 381 return activeStyleSheets; |
| 384 } | 382 } |
| 385 | 383 |
| 386 void StyleEngine::shadowRootRemovedFromDocument(ShadowRoot* shadowRoot) { | 384 void StyleEngine::shadowRootRemovedFromDocument(ShadowRoot* shadowRoot) { |
| 385 if (StyleResolver* styleResolver = resolver()) { |
| 386 if (TreeScopeStyleSheetCollection* collection = |
| 387 styleSheetCollectionFor(*shadowRoot)) |
| 388 styleResolver->removePendingAuthorStyleSheets( |
| 389 collection->activeAuthorStyleSheets()); |
| 390 } |
| 387 m_styleSheetCollectionMap.remove(shadowRoot); | 391 m_styleSheetCollectionMap.remove(shadowRoot); |
| 388 m_activeTreeScopes.remove(shadowRoot); | 392 m_activeTreeScopes.remove(shadowRoot); |
| 389 m_dirtyTreeScopes.remove(shadowRoot); | 393 m_dirtyTreeScopes.remove(shadowRoot); |
| 390 resetAuthorStyle(*shadowRoot); | 394 resetAuthorStyle(*shadowRoot); |
| 391 } | 395 } |
| 392 | 396 |
| 393 void StyleEngine::addTreeBoundaryCrossingScope(const TreeScope& treeScope) { | 397 void StyleEngine::addTreeBoundaryCrossingScope(const TreeScope& treeScope) { |
| 394 m_treeBoundaryCrossingScopes.add(&treeScope.rootNode()); | 398 m_treeBoundaryCrossingScopes.add(&treeScope.rootNode()); |
| 395 } | 399 } |
| 396 | 400 |
| 397 void StyleEngine::resetAuthorStyle(TreeScope& treeScope) { | 401 void StyleEngine::resetAuthorStyle(TreeScope& treeScope) { |
| 398 m_treeBoundaryCrossingScopes.remove(&treeScope.rootNode()); | 402 m_treeBoundaryCrossingScopes.remove(&treeScope.rootNode()); |
| 399 | 403 |
| 400 ScopedStyleResolver* scopedResolver = treeScope.scopedStyleResolver(); | 404 ScopedStyleResolver* scopedResolver = treeScope.scopedStyleResolver(); |
| 401 if (!scopedResolver) | 405 if (!scopedResolver) |
| 402 return; | 406 return; |
| 403 | 407 |
| 404 m_globalRuleSet.markDirty(); | 408 m_globalRuleSet.markDirty(); |
| 405 if (treeScope.rootNode().isDocumentNode()) { | 409 if (treeScope.rootNode().isDocumentNode()) { |
| 406 scopedResolver->resetAuthorStyle(); | 410 scopedResolver->resetAuthorStyle(); |
| 407 return; | 411 return; |
| 408 } | 412 } |
| 409 | 413 |
| 410 treeScope.clearScopedStyleResolver(); | 414 treeScope.clearScopedStyleResolver(); |
| 411 } | 415 } |
| 412 | 416 |
| 417 void StyleEngine::finishAppendAuthorStyleSheets() { |
| 418 m_globalRuleSet.markDirty(); |
| 419 m_globalRuleSet.update(document()); |
| 420 |
| 421 if (!document().layoutViewItem().isNull() && |
| 422 document().layoutViewItem().style()) |
| 423 document().layoutViewItem().style()->font().update(fontSelector()); |
| 424 } |
| 425 |
| 426 void StyleEngine::appendActiveAuthorStyleSheets() { |
| 427 DCHECK(isMaster()); |
| 428 |
| 429 m_resolver->appendAuthorStyleSheets( |
| 430 documentStyleSheetCollection().activeAuthorStyleSheets()); |
| 431 for (TreeScope* treeScope : m_activeTreeScopes) { |
| 432 if (TreeScopeStyleSheetCollection* collection = |
| 433 m_styleSheetCollectionMap.get(treeScope)) |
| 434 m_resolver->appendAuthorStyleSheets( |
| 435 collection->activeAuthorStyleSheets()); |
| 436 } |
| 437 } |
| 438 |
| 413 void StyleEngine::setRuleUsageTracker(StyleRuleUsageTracker* tracker) { | 439 void StyleEngine::setRuleUsageTracker(StyleRuleUsageTracker* tracker) { |
| 414 m_tracker = tracker; | 440 m_tracker = tracker; |
| 415 | 441 |
| 416 if (m_resolver) | 442 if (m_resolver) |
| 417 m_resolver->setRuleUsageTracker(m_tracker); | 443 m_resolver->setRuleUsageTracker(m_tracker); |
| 418 } | 444 } |
| 419 | 445 |
| 420 RuleSet* StyleEngine::ruleSetForSheet(CSSStyleSheet& sheet) { | 446 RuleSet* StyleEngine::ruleSetForSheet(CSSStyleSheet& sheet) { |
| 421 if (!sheet.matchesMediaQueries(ensureMediaQueryEvaluator())) | 447 if (!sheet.matchesMediaQueries(ensureMediaQueryEvaluator())) |
| 422 return nullptr; | 448 return nullptr; |
| 423 | 449 |
| 424 AddRuleFlags addRuleFlags = RuleHasNoSpecialState; | 450 AddRuleFlags addRuleFlags = RuleHasNoSpecialState; |
| 425 if (m_document->getSecurityOrigin()->canRequest(sheet.baseURL())) | 451 if (m_document->getSecurityOrigin()->canRequest(sheet.baseURL())) |
| 426 addRuleFlags = RuleHasDocumentSecurityOrigin; | 452 addRuleFlags = RuleHasDocumentSecurityOrigin; |
| 427 return &sheet.contents()->ensureRuleSet(*m_mediaQueryEvaluator, addRuleFlags); | 453 return &sheet.contents()->ensureRuleSet(*m_mediaQueryEvaluator, addRuleFlags); |
| 428 } | 454 } |
| 429 | 455 |
| 430 void StyleEngine::createResolver() { | 456 void StyleEngine::createResolver() { |
| 431 m_resolver = StyleResolver::create(*m_document); | 457 m_resolver = StyleResolver::create(*m_document); |
| 458 |
| 432 m_resolver->setRuleUsageTracker(m_tracker); | 459 m_resolver->setRuleUsageTracker(m_tracker); |
| 460 |
| 461 // A scoped style resolver for document will be created during |
| 462 // appendActiveAuthorStyleSheets if needed. |
| 463 appendActiveAuthorStyleSheets(); |
| 464 finishAppendAuthorStyleSheets(); |
| 433 } | 465 } |
| 434 | 466 |
| 435 void StyleEngine::clearResolver() { | 467 void StyleEngine::clearResolver() { |
| 436 DCHECK(!document().inStyleRecalc()); | 468 DCHECK(!document().inStyleRecalc()); |
| 437 DCHECK(isMaster() || !m_resolver); | 469 DCHECK(isMaster() || !m_resolver); |
| 438 | 470 |
| 439 document().clearScopedStyleResolver(); | 471 document().clearScopedStyleResolver(); |
| 440 // TODO(rune@opera.com): The clearing of all shadow tree scoped style | 472 // TODO(rune@opera.com): The clearing of all shadow tree scoped style |
| 441 // resolvers below should not be necessary. It was introduced to fix a crash | 473 // resolvers below should not be necessary. It was introduced to fix a crash |
| 442 // bug (https://crbug.com/447976) when clearResolver is called from didDetach | 474 // bug (https://crbug.com/447976) when clearResolver is called from didDetach |
| (...skipping 12 matching lines...) Expand all Loading... |
| 455 m_treeBoundaryCrossingScopes.clear(); | 487 m_treeBoundaryCrossingScopes.clear(); |
| 456 | 488 |
| 457 if (m_resolver) { | 489 if (m_resolver) { |
| 458 TRACE_EVENT1("blink", "StyleEngine::clearResolver", "frame", | 490 TRACE_EVENT1("blink", "StyleEngine::clearResolver", "frame", |
| 459 document().frame()); | 491 document().frame()); |
| 460 m_resolver->dispose(); | 492 m_resolver->dispose(); |
| 461 m_resolver.clear(); | 493 m_resolver.clear(); |
| 462 } | 494 } |
| 463 } | 495 } |
| 464 | 496 |
| 497 void StyleEngine::clearMasterResolver() { |
| 498 if (Document* master = this->master()) |
| 499 master->styleEngine().clearResolver(); |
| 500 } |
| 501 |
| 465 void StyleEngine::didDetach() { | 502 void StyleEngine::didDetach() { |
| 466 clearResolver(); | 503 clearResolver(); |
| 467 m_viewportResolver = nullptr; | 504 m_viewportResolver = nullptr; |
| 468 m_mediaQueryEvaluator = nullptr; | 505 m_mediaQueryEvaluator = nullptr; |
| 469 } | 506 } |
| 470 | 507 |
| 508 bool StyleEngine::shouldClearResolver() const { |
| 509 return !m_didCalculateResolver && !haveScriptBlockingStylesheetsLoaded(); |
| 510 } |
| 511 |
| 512 void StyleEngine::resolverChanged(StyleResolverUpdateMode mode) { |
| 513 if (!isMaster()) { |
| 514 if (Document* master = this->master()) |
| 515 master->styleEngine().resolverChanged(mode); |
| 516 return; |
| 517 } |
| 518 |
| 519 // Don't bother updating, since we haven't loaded all our style info yet |
| 520 // and haven't calculated the style selector for the first time. |
| 521 if (!document().isActive() || shouldClearResolver()) { |
| 522 clearResolver(); |
| 523 return; |
| 524 } |
| 525 |
| 526 if (mode == FullStyleUpdate) |
| 527 markAllTreeScopesDirty(); |
| 528 m_didCalculateResolver = true; |
| 529 updateActiveStyleSheets(mode); |
| 530 } |
| 531 |
| 471 void StyleEngine::clearFontCache() { | 532 void StyleEngine::clearFontCache() { |
| 472 if (m_fontSelector) | 533 if (m_fontSelector) |
| 473 m_fontSelector->fontFaceCache()->clearCSSConnected(); | 534 m_fontSelector->fontFaceCache()->clearCSSConnected(); |
| 474 if (m_resolver) | 535 if (m_resolver) |
| 475 m_resolver->invalidateMatchedPropertiesCache(); | 536 m_resolver->invalidateMatchedPropertiesCache(); |
| 476 } | 537 } |
| 477 | 538 |
| 478 void StyleEngine::updateGenericFontFamilySettings() { | 539 void StyleEngine::updateGenericFontFamilySettings() { |
| 479 // FIXME: we should not update generic font family settings when | 540 // FIXME: we should not update generic font family settings when |
| 480 // document is inactive. | 541 // document is inactive. |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1177 } | 1238 } |
| 1178 | 1239 |
| 1179 DEFINE_TRACE_WRAPPERS(StyleEngine) { | 1240 DEFINE_TRACE_WRAPPERS(StyleEngine) { |
| 1180 for (auto sheet : m_injectedAuthorStyleSheets) { | 1241 for (auto sheet : m_injectedAuthorStyleSheets) { |
| 1181 visitor->traceWrappers(sheet); | 1242 visitor->traceWrappers(sheet); |
| 1182 } | 1243 } |
| 1183 visitor->traceWrappers(m_documentStyleSheetCollection); | 1244 visitor->traceWrappers(m_documentStyleSheetCollection); |
| 1184 } | 1245 } |
| 1185 | 1246 |
| 1186 } // namespace blink | 1247 } // namespace blink |
| OLD | NEW |