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

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

Issue 2873433003: Move MediaQuery classes off BlinkGC heap (Closed)
Patch Set: Created 3 years, 7 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 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 195 }
196 196
197 void CSSStyleSheet::setDisabled(bool disabled) { 197 void CSSStyleSheet::setDisabled(bool disabled) {
198 if (disabled == m_isDisabled) 198 if (disabled == m_isDisabled)
199 return; 199 return;
200 m_isDisabled = disabled; 200 m_isDisabled = disabled;
201 201
202 didMutate(); 202 didMutate();
203 } 203 }
204 204
205 void CSSStyleSheet::setMediaQueries(MediaQuerySet* mediaQueries) { 205 void CSSStyleSheet::setMediaQueries(RefPtr<MediaQuerySet> mediaQueries) {
206 m_mediaQueries = mediaQueries; 206 m_mediaQueries = std::move(mediaQueries);
207 if (m_mediaCSSOMWrapper && m_mediaQueries) 207 if (m_mediaCSSOMWrapper && m_mediaQueries)
208 m_mediaCSSOMWrapper->reattach(m_mediaQueries.get()); 208 m_mediaCSSOMWrapper->reattach(m_mediaQueries.get());
209 } 209 }
210 210
211 bool CSSStyleSheet::matchesMediaQueries(const MediaQueryEvaluator& evaluator) { 211 bool CSSStyleSheet::matchesMediaQueries(const MediaQueryEvaluator& evaluator) {
212 m_viewportDependentMediaQueryResults.clear(); 212 m_viewportDependentMediaQueryResults.clear();
213 m_deviceDependentMediaQueryResults.clear(); 213 m_deviceDependentMediaQueryResults.clear();
214 214
215 if (!m_mediaQueries) 215 if (!m_mediaQueries)
216 return true; 216 return true;
217 return evaluator.eval(m_mediaQueries, &m_viewportDependentMediaQueryResults, 217 return evaluator.eval(*m_mediaQueries, &m_viewportDependentMediaQueryResults,
218 &m_deviceDependentMediaQueryResults); 218 &m_deviceDependentMediaQueryResults);
219 } 219 }
220 220
221 unsigned CSSStyleSheet::length() const { 221 unsigned CSSStyleSheet::length() const {
222 return m_contents->ruleCount(); 222 return m_contents->ruleCount();
223 } 223 }
224 224
225 CSSRule* CSSStyleSheet::item(unsigned index) { 225 CSSRule* CSSStyleSheet::item(unsigned index) {
226 unsigned ruleCount = length(); 226 unsigned ruleCount = length();
227 if (index >= ruleCount) 227 if (index >= ruleCount)
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 void CSSStyleSheet::setText(const String& text) { 437 void CSSStyleSheet::setText(const String& text) {
438 m_childRuleCSSOMWrappers.clear(); 438 m_childRuleCSSOMWrappers.clear();
439 439
440 CSSStyleSheet::RuleMutationScope mutationScope(this); 440 CSSStyleSheet::RuleMutationScope mutationScope(this);
441 m_contents->clearRules(); 441 m_contents->clearRules();
442 m_contents->parseString(text); 442 m_contents->parseString(text);
443 } 443 }
444 444
445 DEFINE_TRACE(CSSStyleSheet) { 445 DEFINE_TRACE(CSSStyleSheet) {
446 visitor->trace(m_contents); 446 visitor->trace(m_contents);
447 visitor->trace(m_mediaQueries);
448 visitor->trace(m_viewportDependentMediaQueryResults);
449 visitor->trace(m_deviceDependentMediaQueryResults);
450 visitor->trace(m_ownerNode); 447 visitor->trace(m_ownerNode);
451 visitor->trace(m_ownerRule); 448 visitor->trace(m_ownerRule);
452 visitor->trace(m_mediaCSSOMWrapper); 449 visitor->trace(m_mediaCSSOMWrapper);
453 visitor->trace(m_childRuleCSSOMWrappers); 450 visitor->trace(m_childRuleCSSOMWrappers);
454 visitor->trace(m_ruleListCSSOMWrapper); 451 visitor->trace(m_ruleListCSSOMWrapper);
455 StyleSheet::trace(visitor); 452 StyleSheet::trace(visitor);
456 } 453 }
457 454
458 } // namespace blink 455 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSStyleSheet.h ('k') | third_party/WebKit/Source/core/css/MediaList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698