OLD | NEW |
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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 Document* document = e->document(); | 153 Document* document = e->document(); |
154 if (m_sheet) { | 154 if (m_sheet) { |
155 if (m_sheet->isLoading()) | 155 if (m_sheet->isLoading()) |
156 document->styleSheetCollection()->removePendingSheet(); | 156 document->styleSheetCollection()->removePendingSheet(); |
157 clearSheet(); | 157 clearSheet(); |
158 } | 158 } |
159 | 159 |
160 // If type is empty or CSS, this is a CSS style sheet. | 160 // If type is empty or CSS, this is a CSS style sheet. |
161 const AtomicString& type = this->type(); | 161 const AtomicString& type = this->type(); |
162 if (document->contentSecurityPolicy()->allowInlineStyle(e->document()->url()
, m_startPosition.m_line) && isCSS(e, type)) { | 162 if (document->contentSecurityPolicy()->allowInlineStyle(e->document()->url()
, m_startPosition.m_line) && isCSS(e, type)) { |
163 RefPtr<MediaQuerySet> mediaQueries; | 163 RefPtr<MediaQuerySet> mediaQueries = MediaQuerySet::create(media()); |
164 if (e->isHTMLElement()) | |
165 mediaQueries = MediaQuerySet::createAllowingDescriptionSyntax(media(
)); | |
166 else | |
167 mediaQueries = MediaQuerySet::create(media()); | |
168 | 164 |
169 MediaQueryEvaluator screenEval("screen", true); | 165 MediaQueryEvaluator screenEval("screen", true); |
170 MediaQueryEvaluator printEval("print", true); | 166 MediaQueryEvaluator printEval("print", true); |
171 if (screenEval.eval(mediaQueries.get()) || printEval.eval(mediaQueries.g
et())) { | 167 if (screenEval.eval(mediaQueries.get()) || printEval.eval(mediaQueries.g
et())) { |
172 document->styleSheetCollection()->addPendingSheet(); | 168 document->styleSheetCollection()->addPendingSheet(); |
173 m_loading = true; | 169 m_loading = true; |
174 | 170 |
175 TextPosition startPosition = m_startPosition == TextPosition::belowR
angePosition() ? TextPosition::minimumPosition() : m_startPosition; | 171 TextPosition startPosition = m_startPosition == TextPosition::belowR
angePosition() ? TextPosition::minimumPosition() : m_startPosition; |
176 m_sheet = CSSStyleSheet::createInline(e, KURL(), startPosition, docu
ment->inputEncoding()); | 172 m_sheet = CSSStyleSheet::createInline(e, KURL(), startPosition, docu
ment->inputEncoding()); |
177 m_sheet->setMediaQueries(mediaQueries.release()); | 173 m_sheet->setMediaQueries(mediaQueries.release()); |
(...skipping 25 matching lines...) Expand all Loading... |
203 return true; | 199 return true; |
204 } | 200 } |
205 | 201 |
206 void StyleElement::startLoadingDynamicSheet(Document* document) | 202 void StyleElement::startLoadingDynamicSheet(Document* document) |
207 { | 203 { |
208 ASSERT(document); | 204 ASSERT(document); |
209 document->styleSheetCollection()->addPendingSheet(); | 205 document->styleSheetCollection()->addPendingSheet(); |
210 } | 206 } |
211 | 207 |
212 } | 208 } |
OLD | NEW |