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