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

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

Issue 2837023005: Move MediaQuery classes off BlinkGC heap (Closed)
Patch Set: fix Created 3 years, 8 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) 2006, 2007 Rob Buis 2 * Copyright (C) 2006, 2007 Rob Buis
3 * Copyright (C) 2008 Apple, Inc. All rights reserved. 3 * Copyright (C) 2008 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 element.FastGetAttribute(HTMLNames::nonceAttr), 145 element.FastGetAttribute(HTMLNames::nonceAttr),
146 start_position_.line_, text); 146 start_position_.line_, text);
147 147
148 // Clearing the current sheet may remove the cache entry so create the new 148 // Clearing the current sheet may remove the cache entry so create the new
149 // sheet first 149 // sheet first
150 CSSStyleSheet* new_sheet = nullptr; 150 CSSStyleSheet* new_sheet = nullptr;
151 151
152 // If type is empty or CSS, this is a CSS style sheet. 152 // If type is empty or CSS, this is a CSS style sheet.
153 const AtomicString& type = this->type(); 153 const AtomicString& type = this->type();
154 if (IsCSS(element, type) && passes_content_security_policy_checks) { 154 if (IsCSS(element, type) && passes_content_security_policy_checks) {
155 MediaQuerySet* media_queries = MediaQuerySet::Create(media()); 155 RefPtr<MediaQuerySet> media_queries = MediaQuerySet::Create(media());
156 156
157 MediaQueryEvaluator screen_eval("screen"); 157 MediaQueryEvaluator screen_eval("screen");
158 MediaQueryEvaluator print_eval("print"); 158 MediaQueryEvaluator print_eval("print");
159 if (screen_eval.Eval(media_queries) || print_eval.Eval(media_queries)) { 159 if (screen_eval.Eval(*media_queries) || print_eval.Eval(*media_queries)) {
160 loading_ = true; 160 loading_ = true;
161 TextPosition start_position = 161 TextPosition start_position =
162 start_position_ == TextPosition::BelowRangePosition() 162 start_position_ == TextPosition::BelowRangePosition()
163 ? TextPosition::MinimumPosition() 163 ? TextPosition::MinimumPosition()
164 : start_position_; 164 : start_position_;
165 new_sheet = document.GetStyleEngine().CreateSheet( 165 new_sheet = document.GetStyleEngine().CreateSheet(
166 element, text, start_position, style_engine_context_); 166 element, text, start_position, style_engine_context_);
167 new_sheet->SetMediaQueries(media_queries); 167 new_sheet->SetMediaQueries(media_queries);
168 loading_ = false; 168 loading_ = false;
169 } 169 }
(...skipping 27 matching lines...) Expand all
197 197
198 void StyleElement::StartLoadingDynamicSheet(Document& document) { 198 void StyleElement::StartLoadingDynamicSheet(Document& document) {
199 document.GetStyleEngine().AddPendingSheet(style_engine_context_); 199 document.GetStyleEngine().AddPendingSheet(style_engine_context_);
200 } 200 }
201 201
202 DEFINE_TRACE(StyleElement) { 202 DEFINE_TRACE(StyleElement) {
203 visitor->Trace(sheet_); 203 visitor->Trace(sheet_);
204 } 204 }
205 205
206 } // namespace blink 206 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698