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

Side by Side Diff: sky/engine/core/dom/StyleSheetCollection.cpp

Issue 813493003: Only the main document should have a StyleEngine. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 | « sky/engine/core/dom/StyleEngine.cpp ('k') | sky/engine/core/html/HTMLStyleElement.cpp » ('j') | 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, 2010, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 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) 2010 Nokia Corporation and/or its subsidiary(-ies) 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
9 * Copyright (C) 2013 Google Inc. All rights reserved. 9 * Copyright (C) 2013 Google Inc. All rights reserved.
10 * 10 *
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 void StyleSheetCollection::updateActiveStyleSheets(StyleEngine* engine) 79 void StyleSheetCollection::updateActiveStyleSheets(StyleEngine* engine)
80 { 80 {
81 Vector<RefPtr<CSSStyleSheet>> candidateSheets; 81 Vector<RefPtr<CSSStyleSheet>> candidateSheets;
82 collectStyleSheets(candidateSheets); 82 collectStyleSheets(candidateSheets);
83 83
84 Node& root = m_treeScope.rootNode(); 84 Node& root = m_treeScope.rootNode();
85 85
86 // TODO(esprehn): Remove special casing for Document. 86 // TODO(esprehn): Remove special casing for Document.
87 if (root.isDocumentNode()) { 87 if (root.isDocumentNode()) {
88 engine->clearMasterResolver(); 88 engine->clearResolver();
89 // FIMXE: The following depends on whether StyleRuleFontFace was modifie d or not. 89 // FIMXE: The following depends on whether StyleRuleFontFace was modifie d or not.
90 // No need to always-clear font cache. 90 // No need to always-clear font cache.
91 engine->clearFontCache(); 91 engine->clearFontCache();
92 } else if (StyleResolver* styleResolver = engine->resolver()) { 92 } else if (StyleResolver* styleResolver = engine->resolver()) {
93 // We should not destroy StyleResolver when we find any stylesheet updat e in a shadow tree. 93 // We should not destroy StyleResolver when we find any stylesheet updat e in a shadow tree.
94 // In this case, we will reset rulesets created from style elements in t he shadow tree. 94 // In this case, we will reset rulesets created from style elements in t he shadow tree.
95 styleResolver->resetAuthorStyle(m_treeScope); 95 styleResolver->resetAuthorStyle(m_treeScope);
96 styleResolver->removePendingAuthorStyleSheets(m_activeAuthorStyleSheets) ; 96 styleResolver->removePendingAuthorStyleSheets(m_activeAuthorStyleSheets) ;
97 styleResolver->lazyAppendAuthorStyleSheets(0, candidateSheets); 97 styleResolver->lazyAppendAuthorStyleSheets(0, candidateSheets);
98 } 98 }
99 99
100 // TODO(esprehn): We should avoid subtree recalcs in sky when rules change 100 // TODO(esprehn): We should avoid subtree recalcs in sky when rules change
101 // and only recalc specific tree scopes. 101 // and only recalc specific tree scopes.
102 root.setNeedsStyleRecalc(SubtreeStyleChange); 102 root.setNeedsStyleRecalc(SubtreeStyleChange);
103 103
104 // TODO(esprehn): We should use LocalStyleChange, :host rule changes 104 // TODO(esprehn): We should use LocalStyleChange, :host rule changes
105 // can only impact the host directly as Sky has no descendant selectors. 105 // can only impact the host directly as Sky has no descendant selectors.
106 if (root.isShadowRoot()) 106 if (root.isShadowRoot())
107 toShadowRoot(root).host()->setNeedsStyleRecalc(SubtreeStyleChange); 107 toShadowRoot(root).host()->setNeedsStyleRecalc(SubtreeStyleChange);
108 108
109 m_activeAuthorStyleSheets.swap(candidateSheets); 109 m_activeAuthorStyleSheets.swap(candidateSheets);
110 } 110 }
111 111
112 } 112 }
OLDNEW
« no previous file with comments | « sky/engine/core/dom/StyleEngine.cpp ('k') | sky/engine/core/html/HTMLStyleElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698