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

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

Issue 2837023005: Move MediaQuery classes off BlinkGC heap (Closed)
Patch Set: fix 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 } 198 }
199 199
200 void CSSStyleSheet::setDisabled(bool disabled) { 200 void CSSStyleSheet::setDisabled(bool disabled) {
201 if (disabled == is_disabled_) 201 if (disabled == is_disabled_)
202 return; 202 return;
203 is_disabled_ = disabled; 203 is_disabled_ = disabled;
204 204
205 DidMutate(); 205 DidMutate();
206 } 206 }
207 207
208 void CSSStyleSheet::SetMediaQueries(MediaQuerySet* media_queries) { 208 void CSSStyleSheet::SetMediaQueries(PassRefPtr<MediaQuerySet> media_queries) {
209 media_queries_ = media_queries; 209 media_queries_ = media_queries;
210 if (media_cssom_wrapper_ && media_queries_) 210 if (media_cssom_wrapper_ && media_queries_)
211 media_cssom_wrapper_->Reattach(media_queries_.Get()); 211 media_cssom_wrapper_->Reattach(media_queries_.Get());
212 } 212 }
213 213
214 bool CSSStyleSheet::MatchesMediaQueries(const MediaQueryEvaluator& evaluator) { 214 bool CSSStyleSheet::MatchesMediaQueries(const MediaQueryEvaluator& evaluator) {
215 viewport_dependent_media_query_results_.clear(); 215 viewport_dependent_media_query_results_.clear();
216 device_dependent_media_query_results_.clear(); 216 device_dependent_media_query_results_.clear();
217 217
218 if (!media_queries_) 218 if (!media_queries_)
219 return true; 219 return true;
220 return evaluator.Eval(media_queries_, 220 return evaluator.Eval(*media_queries_,
221 &viewport_dependent_media_query_results_, 221 &viewport_dependent_media_query_results_,
222 &device_dependent_media_query_results_); 222 &device_dependent_media_query_results_);
223 } 223 }
224 224
225 unsigned CSSStyleSheet::length() const { 225 unsigned CSSStyleSheet::length() const {
226 return contents_->RuleCount(); 226 return contents_->RuleCount();
227 } 227 }
228 228
229 CSSRule* CSSStyleSheet::item(unsigned index) { 229 CSSRule* CSSStyleSheet::item(unsigned index) {
230 unsigned rule_count = length(); 230 unsigned rule_count = length();
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 void CSSStyleSheet::SetText(const String& text) { 435 void CSSStyleSheet::SetText(const String& text) {
436 child_rule_cssom_wrappers_.clear(); 436 child_rule_cssom_wrappers_.clear();
437 437
438 CSSStyleSheet::RuleMutationScope mutation_scope(this); 438 CSSStyleSheet::RuleMutationScope mutation_scope(this);
439 contents_->ClearRules(); 439 contents_->ClearRules();
440 contents_->ParseString(text); 440 contents_->ParseString(text);
441 } 441 }
442 442
443 DEFINE_TRACE(CSSStyleSheet) { 443 DEFINE_TRACE(CSSStyleSheet) {
444 visitor->Trace(contents_); 444 visitor->Trace(contents_);
445 visitor->Trace(media_queries_);
446 visitor->Trace(viewport_dependent_media_query_results_);
447 visitor->Trace(device_dependent_media_query_results_);
448 visitor->Trace(owner_node_); 445 visitor->Trace(owner_node_);
449 visitor->Trace(owner_rule_); 446 visitor->Trace(owner_rule_);
450 visitor->Trace(media_cssom_wrapper_); 447 visitor->Trace(media_cssom_wrapper_);
451 visitor->Trace(child_rule_cssom_wrappers_); 448 visitor->Trace(child_rule_cssom_wrappers_);
452 visitor->Trace(rule_list_cssom_wrapper_); 449 visitor->Trace(rule_list_cssom_wrapper_);
453 StyleSheet::Trace(visitor); 450 StyleSheet::Trace(visitor);
454 } 451 }
455 452
456 } // namespace blink 453 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698