| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 void StyleElement::clearSheet() | 117 void StyleElement::clearSheet() |
| 118 { | 118 { |
| 119 ASSERT(m_sheet); | 119 ASSERT(m_sheet); |
| 120 m_sheet.release()->clearOwnerNode(); | 120 m_sheet.release()->clearOwnerNode(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void StyleElement::createSheet(Element* e, const String& text) | 123 void StyleElement::createSheet(Element* e, const String& text) |
| 124 { | 124 { |
| 125 ASSERT(e); | 125 ASSERT(e); |
| 126 ASSERT(e->inDocument()); | 126 ASSERT(e->inDocument()); |
| 127 Document* document = e->document(); | 127 Document& document = e->document(); |
| 128 if (m_sheet) { | 128 if (m_sheet) { |
| 129 if (m_sheet->isLoading()) | 129 if (m_sheet->isLoading()) |
| 130 document->styleSheetCollections()->removePendingSheet(e); | 130 document.styleSheetCollections()->removePendingSheet(e); |
| 131 clearSheet(); | 131 clearSheet(); |
| 132 } | 132 } |
| 133 | 133 |
| 134 // If type is empty or CSS, this is a CSS style sheet. | 134 // If type is empty or CSS, this is a CSS style sheet. |
| 135 const AtomicString& type = this->type(); | 135 const AtomicString& type = this->type(); |
| 136 if (document->contentSecurityPolicy()->allowInlineStyle(e->document()->url()
, m_startPosition.m_line) && isCSS(e, type)) { | 136 if (document.contentSecurityPolicy()->allowInlineStyle(e->document().url(),
m_startPosition.m_line) && isCSS(e, type)) { |
| 137 RefPtr<MediaQuerySet> mediaQueries = MediaQuerySet::create(media()); | 137 RefPtr<MediaQuerySet> mediaQueries = MediaQuerySet::create(media()); |
| 138 | 138 |
| 139 MediaQueryEvaluator screenEval("screen", true); | 139 MediaQueryEvaluator screenEval("screen", true); |
| 140 MediaQueryEvaluator printEval("print", true); | 140 MediaQueryEvaluator printEval("print", true); |
| 141 if (screenEval.eval(mediaQueries.get()) || printEval.eval(mediaQueries.g
et())) { | 141 if (screenEval.eval(mediaQueries.get()) || printEval.eval(mediaQueries.g
et())) { |
| 142 document->styleSheetCollections()->addPendingSheet(); | 142 document.styleSheetCollections()->addPendingSheet(); |
| 143 m_loading = true; | 143 m_loading = true; |
| 144 | 144 |
| 145 TextPosition startPosition = m_startPosition == TextPosition::belowR
angePosition() ? TextPosition::minimumPosition() : m_startPosition; | 145 TextPosition startPosition = m_startPosition == TextPosition::belowR
angePosition() ? TextPosition::minimumPosition() : m_startPosition; |
| 146 m_sheet = CSSStyleSheet::createInline(e, KURL(), startPosition, docu
ment->inputEncoding()); | 146 m_sheet = CSSStyleSheet::createInline(e, KURL(), startPosition, docu
ment.inputEncoding()); |
| 147 m_sheet->setMediaQueries(mediaQueries.release()); | 147 m_sheet->setMediaQueries(mediaQueries.release()); |
| 148 m_sheet->setTitle(e->title()); | 148 m_sheet->setTitle(e->title()); |
| 149 m_sheet->contents()->parseStringAtPosition(text, startPosition, m_cr
eatedByParser); | 149 m_sheet->contents()->parseStringAtPosition(text, startPosition, m_cr
eatedByParser); |
| 150 | 150 |
| 151 m_loading = false; | 151 m_loading = false; |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 | 154 |
| 155 if (m_sheet) | 155 if (m_sheet) |
| 156 m_sheet->contents()->checkLoaded(); | 156 m_sheet->contents()->checkLoaded(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 173 return true; | 173 return true; |
| 174 } | 174 } |
| 175 | 175 |
| 176 void StyleElement::startLoadingDynamicSheet(Document* document) | 176 void StyleElement::startLoadingDynamicSheet(Document* document) |
| 177 { | 177 { |
| 178 ASSERT(document); | 178 ASSERT(document); |
| 179 document->styleSheetCollections()->addPendingSheet(); | 179 document->styleSheetCollections()->addPendingSheet(); |
| 180 } | 180 } |
| 181 | 181 |
| 182 } | 182 } |
| OLD | NEW |