| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2000 Peter Kelly (pmk@post.com) | 2 * Copyright (C) 2000 Peter Kelly (pmk@post.com) |
| 3 * Copyright (C) 2006, 2008, 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2006, 2008, 2009 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 30 matching lines...) Expand all Loading... |
| 41 : CharacterData(document, data, CreateOther) | 41 : CharacterData(document, data, CreateOther) |
| 42 , m_target(target) | 42 , m_target(target) |
| 43 , m_loading(false) | 43 , m_loading(false) |
| 44 , m_alternate(false) | 44 , m_alternate(false) |
| 45 , m_isCSS(false) | 45 , m_isCSS(false) |
| 46 , m_isXSL(false) | 46 , m_isXSL(false) |
| 47 , m_listenerForXSLT(nullptr) | 47 , m_listenerForXSLT(nullptr) |
| 48 { | 48 { |
| 49 } | 49 } |
| 50 | 50 |
| 51 PassRefPtrWillBeRawPtr<ProcessingInstruction> ProcessingInstruction::create(Docu
ment& document, const String& target, const String& data) | 51 RawPtr<ProcessingInstruction> ProcessingInstruction::create(Document& document,
const String& target, const String& data) |
| 52 { | 52 { |
| 53 return adoptRefWillBeNoop(new ProcessingInstruction(document, target, data))
; | 53 return new ProcessingInstruction(document, target, data); |
| 54 } | 54 } |
| 55 | 55 |
| 56 ProcessingInstruction::~ProcessingInstruction() | 56 ProcessingInstruction::~ProcessingInstruction() |
| 57 { | 57 { |
| 58 #if !ENABLE(OILPAN) | 58 #if !ENABLE(OILPAN) |
| 59 if (m_sheet) | 59 if (m_sheet) |
| 60 clearSheet(); | 60 clearSheet(); |
| 61 | 61 |
| 62 // FIXME: ProcessingInstruction should not be in document here. | 62 // FIXME: ProcessingInstruction should not be in document here. |
| 63 // However, if we add ASSERT(!inDocument()), fast/xsl/xslt-entity.xml | 63 // However, if we add ASSERT(!inDocument()), fast/xsl/xslt-entity.xml |
| (...skipping 23 matching lines...) Expand all Loading... |
| 87 String ProcessingInstruction::nodeName() const | 87 String ProcessingInstruction::nodeName() const |
| 88 { | 88 { |
| 89 return m_target; | 89 return m_target; |
| 90 } | 90 } |
| 91 | 91 |
| 92 Node::NodeType ProcessingInstruction::getNodeType() const | 92 Node::NodeType ProcessingInstruction::getNodeType() const |
| 93 { | 93 { |
| 94 return PROCESSING_INSTRUCTION_NODE; | 94 return PROCESSING_INSTRUCTION_NODE; |
| 95 } | 95 } |
| 96 | 96 |
| 97 PassRefPtrWillBeRawPtr<Node> ProcessingInstruction::cloneNode(bool /*deep*/) | 97 RawPtr<Node> ProcessingInstruction::cloneNode(bool /*deep*/) |
| 98 { | 98 { |
| 99 // FIXME: Is it a problem that this does not copy m_localHref? | 99 // FIXME: Is it a problem that this does not copy m_localHref? |
| 100 // What about other data members? | 100 // What about other data members? |
| 101 return create(document(), m_target, m_data); | 101 return create(document(), m_target, m_data); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void ProcessingInstruction::didAttributeChanged() | 104 void ProcessingInstruction::didAttributeChanged() |
| 105 { | 105 { |
| 106 if (m_sheet) | 106 if (m_sheet) |
| 107 clearSheet(); | 107 clearSheet(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 m_sheet = XSLStyleSheet::createEmbedded(this, finalURL); | 157 m_sheet = XSLStyleSheet::createEmbedded(this, finalURL); |
| 158 m_loading = false; | 158 m_loading = false; |
| 159 } | 159 } |
| 160 return; | 160 return; |
| 161 } | 161 } |
| 162 | 162 |
| 163 clearResource(); | 163 clearResource(); |
| 164 | 164 |
| 165 String url = document().completeURL(href).getString(); | 165 String url = document().completeURL(href).getString(); |
| 166 | 166 |
| 167 RefPtrWillBeRawPtr<StyleSheetResource> resource = nullptr; | 167 RawPtr<StyleSheetResource> resource = nullptr; |
| 168 FetchRequest request(ResourceRequest(document().completeURL(href)), FetchIni
tiatorTypeNames::processinginstruction); | 168 FetchRequest request(ResourceRequest(document().completeURL(href)), FetchIni
tiatorTypeNames::processinginstruction); |
| 169 if (m_isXSL) { | 169 if (m_isXSL) { |
| 170 if (RuntimeEnabledFeatures::xsltEnabled()) | 170 if (RuntimeEnabledFeatures::xsltEnabled()) |
| 171 resource = XSLStyleSheetResource::fetch(request, document().fetcher(
)); | 171 resource = XSLStyleSheetResource::fetch(request, document().fetcher(
)); |
| 172 } else { | 172 } else { |
| 173 request.setCharset(charset.isEmpty() ? document().characterSet() : chars
et); | 173 request.setCharset(charset.isEmpty() ? document().characterSet() : chars
et); |
| 174 resource = CSSStyleSheetResource::fetch(request, document().fetcher()); | 174 resource = CSSStyleSheetResource::fetch(request, document().fetcher()); |
| 175 } | 175 } |
| 176 | 176 |
| 177 if (resource) { | 177 if (resource) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 204 void ProcessingInstruction::setCSSStyleSheet(const String& href, const KURL& bas
eURL, const String& charset, const CSSStyleSheetResource* sheet) | 204 void ProcessingInstruction::setCSSStyleSheet(const String& href, const KURL& bas
eURL, const String& charset, const CSSStyleSheetResource* sheet) |
| 205 { | 205 { |
| 206 if (!inDocument()) { | 206 if (!inDocument()) { |
| 207 ASSERT(!m_sheet); | 207 ASSERT(!m_sheet); |
| 208 return; | 208 return; |
| 209 } | 209 } |
| 210 | 210 |
| 211 ASSERT(m_isCSS); | 211 ASSERT(m_isCSS); |
| 212 CSSParserContext parserContext(document(), 0, baseURL, charset); | 212 CSSParserContext parserContext(document(), 0, baseURL, charset); |
| 213 | 213 |
| 214 RefPtrWillBeRawPtr<StyleSheetContents> newSheet = StyleSheetContents::create
(href, parserContext); | 214 RawPtr<StyleSheetContents> newSheet = StyleSheetContents::create(href, parse
rContext); |
| 215 | 215 |
| 216 RefPtrWillBeRawPtr<CSSStyleSheet> cssSheet = CSSStyleSheet::create(newSheet,
this); | 216 RawPtr<CSSStyleSheet> cssSheet = CSSStyleSheet::create(newSheet, this); |
| 217 cssSheet->setDisabled(m_alternate); | 217 cssSheet->setDisabled(m_alternate); |
| 218 cssSheet->setTitle(m_title); | 218 cssSheet->setTitle(m_title); |
| 219 cssSheet->setMediaQueries(MediaQuerySet::create(m_media)); | 219 cssSheet->setMediaQueries(MediaQuerySet::create(m_media)); |
| 220 | 220 |
| 221 m_sheet = cssSheet.release(); | 221 m_sheet = cssSheet.release(); |
| 222 | 222 |
| 223 // We don't need the cross-origin security check here because we are | 223 // We don't need the cross-origin security check here because we are |
| 224 // getting the sheet text in "strict" mode. This enforces a valid CSS MIME | 224 // getting the sheet text in "strict" mode. This enforces a valid CSS MIME |
| 225 // type. | 225 // type. |
| 226 parseStyleSheet(sheet->sheetText()); | 226 parseStyleSheet(sheet->sheetText()); |
| 227 } | 227 } |
| 228 | 228 |
| 229 void ProcessingInstruction::setXSLStyleSheet(const String& href, const KURL& bas
eURL, const String& sheet) | 229 void ProcessingInstruction::setXSLStyleSheet(const String& href, const KURL& bas
eURL, const String& sheet) |
| 230 { | 230 { |
| 231 if (!inDocument()) { | 231 if (!inDocument()) { |
| 232 ASSERT(!m_sheet); | 232 ASSERT(!m_sheet); |
| 233 return; | 233 return; |
| 234 } | 234 } |
| 235 | 235 |
| 236 ASSERT(m_isXSL); | 236 ASSERT(m_isXSL); |
| 237 m_sheet = XSLStyleSheet::create(this, href, baseURL); | 237 m_sheet = XSLStyleSheet::create(this, href, baseURL); |
| 238 RefPtrWillBeRawPtr<Document> protect(&document()); | 238 RawPtr<Document> protect(&document()); |
| 239 OwnPtr<IncrementLoadEventDelayCount> delay = IncrementLoadEventDelayCount::c
reate(document()); | 239 OwnPtr<IncrementLoadEventDelayCount> delay = IncrementLoadEventDelayCount::c
reate(document()); |
| 240 parseStyleSheet(sheet); | 240 parseStyleSheet(sheet); |
| 241 } | 241 } |
| 242 | 242 |
| 243 void ProcessingInstruction::parseStyleSheet(const String& sheet) | 243 void ProcessingInstruction::parseStyleSheet(const String& sheet) |
| 244 { | 244 { |
| 245 if (m_isCSS) | 245 if (m_isCSS) |
| 246 toCSSStyleSheet(m_sheet.get())->contents()->parseString(sheet); | 246 toCSSStyleSheet(m_sheet.get())->contents()->parseString(sheet); |
| 247 else if (m_isXSL) | 247 else if (m_isXSL) |
| 248 toXSLStyleSheet(m_sheet.get())->parseString(sheet); | 248 toXSLStyleSheet(m_sheet.get())->parseString(sheet); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 275 void ProcessingInstruction::removedFrom(ContainerNode* insertionPoint) | 275 void ProcessingInstruction::removedFrom(ContainerNode* insertionPoint) |
| 276 { | 276 { |
| 277 CharacterData::removedFrom(insertionPoint); | 277 CharacterData::removedFrom(insertionPoint); |
| 278 if (!insertionPoint->inDocument()) | 278 if (!insertionPoint->inDocument()) |
| 279 return; | 279 return; |
| 280 | 280 |
| 281 // No need to remove XSLStyleSheet from StyleEngine. | 281 // No need to remove XSLStyleSheet from StyleEngine. |
| 282 if (!DocumentXSLT::processingInstructionRemovedFromDocument(document(), this
)) | 282 if (!DocumentXSLT::processingInstructionRemovedFromDocument(document(), this
)) |
| 283 document().styleEngine().removeStyleSheetCandidateNode(this); | 283 document().styleEngine().removeStyleSheetCandidateNode(this); |
| 284 | 284 |
| 285 RefPtrWillBeRawPtr<StyleSheet> removedSheet = m_sheet; | 285 RawPtr<StyleSheet> removedSheet = m_sheet; |
| 286 if (m_sheet) { | 286 if (m_sheet) { |
| 287 ASSERT(m_sheet->ownerNode() == this); | 287 ASSERT(m_sheet->ownerNode() == this); |
| 288 clearSheet(); | 288 clearSheet(); |
| 289 } | 289 } |
| 290 | 290 |
| 291 // No need to remove pending sheets. | 291 // No need to remove pending sheets. |
| 292 clearResource(); | 292 clearResource(); |
| 293 | 293 |
| 294 // If we're in document teardown, then we don't need to do any notification
of our sheet's removal. | 294 // If we're in document teardown, then we don't need to do any notification
of our sheet's removal. |
| 295 if (document().isActive()) | 295 if (document().isActive()) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 306 | 306 |
| 307 DEFINE_TRACE(ProcessingInstruction) | 307 DEFINE_TRACE(ProcessingInstruction) |
| 308 { | 308 { |
| 309 visitor->trace(m_sheet); | 309 visitor->trace(m_sheet); |
| 310 visitor->trace(m_listenerForXSLT); | 310 visitor->trace(m_listenerForXSLT); |
| 311 CharacterData::trace(visitor); | 311 CharacterData::trace(visitor); |
| 312 ResourceOwner<StyleSheetResource>::trace(visitor); | 312 ResourceOwner<StyleSheetResource>::trace(visitor); |
| 313 } | 313 } |
| 314 | 314 |
| 315 } // namespace blink | 315 } // namespace blink |
| OLD | NEW |