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

Side by Side Diff: Source/core/dom/ShadowTreeStyleSheetCollection.cpp

Issue 975933002: Return reference from styleEngine() accessor. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 months 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 | « Source/core/dom/ShadowTreeStyleSheetCollection.h ('k') | Source/core/dom/StyleElement.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 27 matching lines...) Expand all
38 38
39 namespace blink { 39 namespace blink {
40 40
41 using namespace HTMLNames; 41 using namespace HTMLNames;
42 42
43 ShadowTreeStyleSheetCollection::ShadowTreeStyleSheetCollection(ShadowRoot& shado wRoot) 43 ShadowTreeStyleSheetCollection::ShadowTreeStyleSheetCollection(ShadowRoot& shado wRoot)
44 : TreeScopeStyleSheetCollection(shadowRoot) 44 : TreeScopeStyleSheetCollection(shadowRoot)
45 { 45 {
46 } 46 }
47 47
48 void ShadowTreeStyleSheetCollection::collectStyleSheets(StyleEngine* engine, Sty leSheetCollection& collection) 48 void ShadowTreeStyleSheetCollection::collectStyleSheets(StyleEngine& engine, Sty leSheetCollection& collection)
49 { 49 {
50 for (Node* n : m_styleSheetCandidateNodes) { 50 for (Node* n : m_styleSheetCandidateNodes) {
51 StyleSheetCandidate candidate(*n); 51 StyleSheetCandidate candidate(*n);
52 ASSERT(!candidate.isXSL()); 52 ASSERT(!candidate.isXSL());
53 53
54 if (!candidate.isCSSStyle()) 54 if (!candidate.isCSSStyle())
55 continue; 55 continue;
56 56
57 StyleSheet* sheet = candidate.sheet(); 57 StyleSheet* sheet = candidate.sheet();
58 if (!sheet) 58 if (!sheet)
59 continue; 59 continue;
60 60
61 // FIXME: clarify how PREFERRED or ALTERNATE works in shadow trees. 61 // FIXME: clarify how PREFERRED or ALTERNATE works in shadow trees.
62 // Should we set preferred/selected stylesheets name in shadow trees and 62 // Should we set preferred/selected stylesheets name in shadow trees and
63 // use the name in document? 63 // use the name in document?
64 if (candidate.hasPreferrableName(engine->preferredStylesheetSetName())) 64 if (candidate.hasPreferrableName(engine.preferredStylesheetSetName()))
65 engine->selectStylesheetSetName(candidate.title()); 65 engine.selectStylesheetSetName(candidate.title());
66 66
67 collection.appendSheetForList(sheet); 67 collection.appendSheetForList(sheet);
68 if (candidate.canBeActivated(engine->preferredStylesheetSetName())) 68 if (candidate.canBeActivated(engine.preferredStylesheetSetName()))
69 collection.appendActiveStyleSheet(toCSSStyleSheet(sheet)); 69 collection.appendActiveStyleSheet(toCSSStyleSheet(sheet));
70 } 70 }
71 } 71 }
72 72
73 void ShadowTreeStyleSheetCollection::updateActiveStyleSheets(StyleEngine* engine , StyleResolverUpdateMode updateMode) 73 void ShadowTreeStyleSheetCollection::updateActiveStyleSheets(StyleEngine& engine , StyleResolverUpdateMode updateMode)
74 { 74 {
75 StyleSheetCollection collection; 75 StyleSheetCollection collection;
76 collectStyleSheets(engine, collection); 76 collectStyleSheets(engine, collection);
77 77
78 StyleSheetChange change; 78 StyleSheetChange change;
79 analyzeStyleSheetChange(updateMode, collection, change); 79 analyzeStyleSheetChange(updateMode, collection, change);
80 80
81 if (StyleResolver* styleResolver = engine->resolver()) { 81 if (StyleResolver* styleResolver = engine.resolver()) {
82 if (change.styleResolverUpdateType != Additive) { 82 if (change.styleResolverUpdateType != Additive) {
83 // We should not destroy StyleResolver when we find any stylesheet u pdate in a shadow tree. 83 // We should not destroy StyleResolver when we find any stylesheet u pdate in a shadow tree.
84 // In this case, we will reset rulesets created from style elements in the shadow tree. 84 // In this case, we will reset rulesets created from style elements in the shadow tree.
85 styleResolver->resetAuthorStyle(treeScope()); 85 styleResolver->resetAuthorStyle(treeScope());
86 styleResolver->removePendingAuthorStyleSheets(m_activeAuthorStyleShe ets); 86 styleResolver->removePendingAuthorStyleSheets(m_activeAuthorStyleShe ets);
87 styleResolver->lazyAppendAuthorStyleSheets(0, collection.activeAutho rStyleSheets()); 87 styleResolver->lazyAppendAuthorStyleSheets(0, collection.activeAutho rStyleSheets());
88 } else { 88 } else {
89 styleResolver->lazyAppendAuthorStyleSheets(m_activeAuthorStyleSheets .size(), collection.activeAuthorStyleSheets()); 89 styleResolver->lazyAppendAuthorStyleSheets(m_activeAuthorStyleSheets .size(), collection.activeAuthorStyleSheets());
90 } 90 }
91 } 91 }
92 if (change.requiresFullStyleRecalc) 92 if (change.requiresFullStyleRecalc)
93 toShadowRoot(treeScope().rootNode()).host()->setNeedsStyleRecalc(Subtree StyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::ActiveStyles heetsUpdate)); 93 toShadowRoot(treeScope().rootNode()).host()->setNeedsStyleRecalc(Subtree StyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::ActiveStyles heetsUpdate));
94 94
95 collection.swap(*this); 95 collection.swap(*this);
96 updateUsesRemUnits(); 96 updateUsesRemUnits();
97 } 97 }
98 98
99 } 99 }
OLDNEW
« no previous file with comments | « Source/core/dom/ShadowTreeStyleSheetCollection.h ('k') | Source/core/dom/StyleElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698