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

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

Issue 2405143003: Separate @viewport from other RuleSet construction. (Closed)
Patch Set: Missing resolve() Created 4 years, 2 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
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 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 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) 2010 Nokia Corporation and/or its subsidiary(-ies) 10 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
(...skipping 11 matching lines...) Expand all
22 * 22 *
23 * You should have received a copy of the GNU Library General Public License 23 * You should have received a copy of the GNU Library General Public License
24 * along with this library; see the file COPYING.LIB. If not, write to 24 * along with this library; see the file COPYING.LIB. If not, write to
25 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 25 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26 * Boston, MA 02110-1301, USA. 26 * Boston, MA 02110-1301, USA.
27 */ 27 */
28 28
29 #include "core/dom/DocumentStyleSheetCollection.h" 29 #include "core/dom/DocumentStyleSheetCollection.h"
30 30
31 #include "core/css/resolver/StyleResolver.h" 31 #include "core/css/resolver/StyleResolver.h"
32 #include "core/css/resolver/ViewportStyleResolver.h"
32 #include "core/dom/Document.h" 33 #include "core/dom/Document.h"
33 #include "core/dom/DocumentStyleSheetCollector.h" 34 #include "core/dom/DocumentStyleSheetCollector.h"
34 #include "core/dom/ProcessingInstruction.h" 35 #include "core/dom/ProcessingInstruction.h"
35 #include "core/dom/StyleChangeReason.h" 36 #include "core/dom/StyleChangeReason.h"
36 #include "core/dom/StyleEngine.h" 37 #include "core/dom/StyleEngine.h"
37 #include "core/dom/StyleSheetCandidate.h" 38 #include "core/dom/StyleSheetCandidate.h"
38 #include "platform/RuntimeEnabledFeatures.h" 39 #include "platform/RuntimeEnabledFeatures.h"
39 40
40 namespace blink { 41 namespace blink {
41 42
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 124 }
124 if (change.requiresFullStyleRecalc) 125 if (change.requiresFullStyleRecalc)
125 document().setNeedsStyleRecalc( 126 document().setNeedsStyleRecalc(
126 SubtreeStyleChange, StyleChangeReasonForTracing::create( 127 SubtreeStyleChange, StyleChangeReasonForTracing::create(
127 StyleChangeReason::ActiveStylesheetsUpdate)); 128 StyleChangeReason::ActiveStylesheetsUpdate));
128 129
129 collection->swap(*this); 130 collection->swap(*this);
130 collection->dispose(); 131 collection->dispose();
131 } 132 }
132 133
134 void DocumentStyleSheetCollection::updateViewport() {
135 ViewportStyleResolver& resolver =
136 document().styleEngine().ensureViewportStyleResolver();
137 resolver.reset();
138 resolver.collectViewportRulesFromUASheets();
139
140 if (RuntimeEnabledFeatures::cssViewportEnabled()) {
141 for (Node* node : m_styleSheetCandidateNodes) {
142 StyleSheetCandidate candidate(*node);
143
144 if (candidate.isImport())
145 continue;
146 StyleSheet* sheet = candidate.sheet();
147 if (!sheet)
148 continue;
149 if (!candidate.canBeActivated(
150 document().styleEngine().preferredStylesheetSetName()))
151 continue;
152 resolver.collectViewportRulesFromAuthorSheet(*toCSSStyleSheet(sheet));
153 }
154 }
155 resolver.resolve();
156 }
157
133 DEFINE_TRACE_WRAPPERS(DocumentStyleSheetCollection) { 158 DEFINE_TRACE_WRAPPERS(DocumentStyleSheetCollection) {
134 for (auto sheet : m_styleSheetsForStyleSheetList) { 159 for (auto sheet : m_styleSheetsForStyleSheetList) {
135 visitor->traceWrappers(sheet); 160 visitor->traceWrappers(sheet);
136 } 161 }
137 } 162 }
138 } // namespace blink 163 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.h ('k') | third_party/WebKit/Source/core/dom/StyleEngine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698