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

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

Issue 2443933002: Move TreeBoundaryCrossingScopes to StyleEngine. (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/StyleEngine.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 } 374 }
375 375
376 void StyleEngine::didRemoveShadowRoot(ShadowRoot* shadowRoot) { 376 void StyleEngine::didRemoveShadowRoot(ShadowRoot* shadowRoot) {
377 m_styleSheetCollectionMap.remove(shadowRoot); 377 m_styleSheetCollectionMap.remove(shadowRoot);
378 m_activeTreeScopes.remove(shadowRoot); 378 m_activeTreeScopes.remove(shadowRoot);
379 m_dirtyTreeScopes.remove(shadowRoot); 379 m_dirtyTreeScopes.remove(shadowRoot);
380 } 380 }
381 381
382 void StyleEngine::shadowRootRemovedFromDocument(ShadowRoot* shadowRoot) { 382 void StyleEngine::shadowRootRemovedFromDocument(ShadowRoot* shadowRoot) {
383 if (StyleResolver* styleResolver = resolver()) { 383 if (StyleResolver* styleResolver = resolver()) {
384 styleResolver->resetAuthorStyle(*shadowRoot); 384 styleResolver->resetRuleFeatures();
385 385
386 if (TreeScopeStyleSheetCollection* collection = 386 if (TreeScopeStyleSheetCollection* collection =
387 styleSheetCollectionFor(*shadowRoot)) 387 styleSheetCollectionFor(*shadowRoot))
388 styleResolver->removePendingAuthorStyleSheets( 388 styleResolver->removePendingAuthorStyleSheets(
389 collection->activeAuthorStyleSheets()); 389 collection->activeAuthorStyleSheets());
390 } 390 }
391 shadowRoot->clearScopedStyleResolver();
391 m_styleSheetCollectionMap.remove(shadowRoot); 392 m_styleSheetCollectionMap.remove(shadowRoot);
392 m_activeTreeScopes.remove(shadowRoot); 393 m_activeTreeScopes.remove(shadowRoot);
393 m_dirtyTreeScopes.remove(shadowRoot); 394 m_dirtyTreeScopes.remove(shadowRoot);
395 m_treeBoundaryCrossingScopes.remove(&shadowRoot->rootNode());
396 }
397
398 void StyleEngine::addTreeBoundaryCrossingScope(const TreeScope& treeScope) {
399 m_treeBoundaryCrossingScopes.add(&treeScope.rootNode());
400 }
401
402 void StyleEngine::resetAuthorStyle(TreeScope& treeScope) {
403 m_treeBoundaryCrossingScopes.remove(&treeScope.rootNode());
404
405 ScopedStyleResolver* scopedResolver = treeScope.scopedStyleResolver();
406 if (!scopedResolver)
407 return;
408
409 DCHECK(m_resolver);
410 m_resolver->resetRuleFeatures();
411 if (treeScope.rootNode().isDocumentNode()) {
412 scopedResolver->resetAuthorStyle();
413 return;
414 }
415
416 treeScope.clearScopedStyleResolver();
394 } 417 }
395 418
396 void StyleEngine::appendActiveAuthorStyleSheets() { 419 void StyleEngine::appendActiveAuthorStyleSheets() {
397 DCHECK(isMaster()); 420 DCHECK(isMaster());
398 421
399 viewportRulesChanged(); 422 viewportRulesChanged();
400 423
401 m_resolver->appendAuthorStyleSheets( 424 m_resolver->appendAuthorStyleSheets(
402 documentStyleSheetCollection().activeAuthorStyleSheets()); 425 documentStyleSheetCollection().activeAuthorStyleSheets());
403 for (TreeScope* treeScope : m_activeTreeScopes) { 426 for (TreeScope* treeScope : m_activeTreeScopes) {
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 visitor->trace(m_document); 1003 visitor->trace(m_document);
981 visitor->trace(m_injectedAuthorStyleSheets); 1004 visitor->trace(m_injectedAuthorStyleSheets);
982 visitor->trace(m_inspectorStyleSheet); 1005 visitor->trace(m_inspectorStyleSheet);
983 visitor->trace(m_documentStyleSheetCollection); 1006 visitor->trace(m_documentStyleSheetCollection);
984 visitor->trace(m_styleSheetCollectionMap); 1007 visitor->trace(m_styleSheetCollectionMap);
985 visitor->trace(m_resolver); 1008 visitor->trace(m_resolver);
986 visitor->trace(m_viewportResolver); 1009 visitor->trace(m_viewportResolver);
987 visitor->trace(m_styleInvalidator); 1010 visitor->trace(m_styleInvalidator);
988 visitor->trace(m_dirtyTreeScopes); 1011 visitor->trace(m_dirtyTreeScopes);
989 visitor->trace(m_activeTreeScopes); 1012 visitor->trace(m_activeTreeScopes);
1013 visitor->trace(m_treeBoundaryCrossingScopes);
990 visitor->trace(m_fontSelector); 1014 visitor->trace(m_fontSelector);
991 visitor->trace(m_textToSheetCache); 1015 visitor->trace(m_textToSheetCache);
992 visitor->trace(m_sheetToTextCache); 1016 visitor->trace(m_sheetToTextCache);
993 CSSFontSelectorClient::trace(visitor); 1017 CSSFontSelectorClient::trace(visitor);
994 } 1018 }
995 1019
996 DEFINE_TRACE_WRAPPERS(StyleEngine) { 1020 DEFINE_TRACE_WRAPPERS(StyleEngine) {
997 for (auto sheet : m_injectedAuthorStyleSheets) { 1021 for (auto sheet : m_injectedAuthorStyleSheets) {
998 visitor->traceWrappers(sheet); 1022 visitor->traceWrappers(sheet);
999 } 1023 }
1000 visitor->traceWrappers(m_documentStyleSheetCollection); 1024 visitor->traceWrappers(m_documentStyleSheetCollection);
1001 } 1025 }
1002 1026
1003 } // namespace blink 1027 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/StyleEngine.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698