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