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

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp

Issue 2420413005: Collect @viewport before constructing RuleSets. (Closed)
Patch Set: Rebased 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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * Copyright (C) 2012 Google Inc. All rights reserved. 5 * Copyright (C) 2012 Google Inc. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 20 matching lines...) Expand all
31 #include "core/HTMLNames.h" 31 #include "core/HTMLNames.h"
32 #include "core/animation/DocumentTimeline.h" 32 #include "core/animation/DocumentTimeline.h"
33 #include "core/css/CSSFontSelector.h" 33 #include "core/css/CSSFontSelector.h"
34 #include "core/css/CSSStyleSheet.h" 34 #include "core/css/CSSStyleSheet.h"
35 #include "core/css/FontFace.h" 35 #include "core/css/FontFace.h"
36 #include "core/css/PageRuleCollector.h" 36 #include "core/css/PageRuleCollector.h"
37 #include "core/css/RuleFeature.h" 37 #include "core/css/RuleFeature.h"
38 #include "core/css/StyleRule.h" 38 #include "core/css/StyleRule.h"
39 #include "core/css/StyleSheetContents.h" 39 #include "core/css/StyleSheetContents.h"
40 #include "core/css/resolver/MatchRequest.h" 40 #include "core/css/resolver/MatchRequest.h"
41 #include "core/css/resolver/ViewportStyleResolver.h"
42 #include "core/dom/Document.h" 41 #include "core/dom/Document.h"
43 #include "core/dom/StyleChangeReason.h" 42 #include "core/dom/StyleChangeReason.h"
44 #include "core/dom/StyleEngine.h" 43 #include "core/dom/StyleEngine.h"
45 #include "core/dom/shadow/ElementShadow.h" 44 #include "core/dom/shadow/ElementShadow.h"
46 #include "core/dom/shadow/ShadowRoot.h" 45 #include "core/dom/shadow/ShadowRoot.h"
47 #include "core/html/HTMLStyleElement.h" 46 #include "core/html/HTMLStyleElement.h"
48 #include "core/svg/SVGStyleElement.h" 47 #include "core/svg/SVGStyleElement.h"
49 48
50 namespace blink { 49 namespace blink {
51 50
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 } 252 }
254 253
255 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector) { 254 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector) {
256 // Only consider the global author RuleSet for @page rules, as per the HTML5 255 // Only consider the global author RuleSet for @page rules, as per the HTML5
257 // spec. 256 // spec.
258 ASSERT(m_scope->rootNode().isDocumentNode()); 257 ASSERT(m_scope->rootNode().isDocumentNode());
259 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) 258 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i)
260 collector.matchPageRules(&m_authorStyleSheets[i]->contents()->ruleSet()); 259 collector.matchPageRules(&m_authorStyleSheets[i]->contents()->ruleSet());
261 } 260 }
262 261
263 void ScopedStyleResolver::collectViewportRulesTo(
264 ViewportStyleResolver* resolver) const {
265 if (!m_scope->rootNode().isDocumentNode())
266 return;
267 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i)
268 resolver->collectViewportRules(
269 &m_authorStyleSheets[i]->contents()->ruleSet(),
270 ViewportStyleResolver::AuthorOrigin);
271 }
272
273 DEFINE_TRACE(ScopedStyleResolver) { 262 DEFINE_TRACE(ScopedStyleResolver) {
274 visitor->trace(m_scope); 263 visitor->trace(m_scope);
275 visitor->trace(m_authorStyleSheets); 264 visitor->trace(m_authorStyleSheets);
276 visitor->trace(m_keyframesRuleMap); 265 visitor->trace(m_keyframesRuleMap);
277 visitor->trace(m_treeBoundaryCrossingRuleSet); 266 visitor->trace(m_treeBoundaryCrossingRuleSet);
278 } 267 }
279 268
280 static void addRules(RuleSet* ruleSet, 269 static void addRules(RuleSet* ruleSet,
281 const HeapVector<MinimalRuleData>& rules) { 270 const HeapVector<MinimalRuleData>& rules) {
282 for (unsigned i = 0; i < rules.size(); ++i) { 271 for (unsigned i = 0; i < rules.size(); ++i) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 m_treeBoundaryCrossingRuleSet->append( 304 m_treeBoundaryCrossingRuleSet->append(
316 RuleSubSet::create(parentStyleSheet, sheetIndex, ruleSetForScope)); 305 RuleSubSet::create(parentStyleSheet, sheetIndex, ruleSetForScope));
317 } 306 }
318 307
319 DEFINE_TRACE(ScopedStyleResolver::RuleSubSet) { 308 DEFINE_TRACE(ScopedStyleResolver::RuleSubSet) {
320 visitor->trace(m_parentStyleSheet); 309 visitor->trace(m_parentStyleSheet);
321 visitor->trace(m_ruleSet); 310 visitor->trace(m_ruleSet);
322 } 311 }
323 312
324 } // namespace blink 313 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698