| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 ProcessingInstruction::~ProcessingInstruction() | 58 ProcessingInstruction::~ProcessingInstruction() |
| 59 { | 59 { |
| 60 #if !ENABLE(OILPAN) | 60 #if !ENABLE(OILPAN) |
| 61 if (m_sheet) | 61 if (m_sheet) |
| 62 clearSheet(); | 62 clearSheet(); |
| 63 | 63 |
| 64 // FIXME: ProcessingInstruction should not be in document here. | 64 // FIXME: ProcessingInstruction should not be in document here. |
| 65 // However, if we add ASSERT(!inDocument()), fast/xsl/xslt-entity.xml | 65 // However, if we add ASSERT(!inDocument()), fast/xsl/xslt-entity.xml |
| 66 // crashes. We need to investigate ProcessingInstruction lifetime. | 66 // crashes. We need to investigate ProcessingInstruction lifetime. |
| 67 if (inDocument() && m_isCSS) | 67 if (inDocument() && m_isCSS) |
| 68 document().styleEngine()->removeStyleSheetCandidateNode(this); | 68 document().styleEngine().removeStyleSheetCandidateNode(this); |
| 69 #endif | 69 #endif |
| 70 clearEventListenerForXSLT(); | 70 clearEventListenerForXSLT(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 EventListener* ProcessingInstruction::eventListenerForXSLT() | 73 EventListener* ProcessingInstruction::eventListenerForXSLT() |
| 74 { | 74 { |
| 75 if (!m_listenerForXSLT) | 75 if (!m_listenerForXSLT) |
| 76 return 0; | 76 return 0; |
| 77 | 77 |
| 78 return m_listenerForXSLT->toEventListener(); | 78 return m_listenerForXSLT->toEventListener(); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 if (RuntimeEnabledFeatures::xsltEnabled()) | 172 if (RuntimeEnabledFeatures::xsltEnabled()) |
| 173 resource = document().fetcher()->fetchXSLStyleSheet(request); | 173 resource = document().fetcher()->fetchXSLStyleSheet(request); |
| 174 } else { | 174 } else { |
| 175 request.setCharset(charset.isEmpty() ? document().charset() : charset); | 175 request.setCharset(charset.isEmpty() ? document().charset() : charset); |
| 176 resource = document().fetcher()->fetchCSSStyleSheet(request); | 176 resource = document().fetcher()->fetchCSSStyleSheet(request); |
| 177 } | 177 } |
| 178 | 178 |
| 179 if (resource) { | 179 if (resource) { |
| 180 m_loading = true; | 180 m_loading = true; |
| 181 if (!m_isXSL) | 181 if (!m_isXSL) |
| 182 document().styleEngine()->addPendingSheet(); | 182 document().styleEngine().addPendingSheet(); |
| 183 setResource(resource); | 183 setResource(resource); |
| 184 } | 184 } |
| 185 } | 185 } |
| 186 | 186 |
| 187 bool ProcessingInstruction::isLoading() const | 187 bool ProcessingInstruction::isLoading() const |
| 188 { | 188 { |
| 189 if (m_loading) | 189 if (m_loading) |
| 190 return true; | 190 return true; |
| 191 if (!m_sheet) | 191 if (!m_sheet) |
| 192 return false; | 192 return false; |
| 193 return m_sheet->isLoading(); | 193 return m_sheet->isLoading(); |
| 194 } | 194 } |
| 195 | 195 |
| 196 bool ProcessingInstruction::sheetLoaded() | 196 bool ProcessingInstruction::sheetLoaded() |
| 197 { | 197 { |
| 198 if (!isLoading()) { | 198 if (!isLoading()) { |
| 199 if (!DocumentXSLT::sheetLoaded(document(), this)) | 199 if (!DocumentXSLT::sheetLoaded(document(), this)) |
| 200 document().styleEngine()->removePendingSheet(this); | 200 document().styleEngine().removePendingSheet(this); |
| 201 return true; | 201 return true; |
| 202 } | 202 } |
| 203 return false; | 203 return false; |
| 204 } | 204 } |
| 205 | 205 |
| 206 void ProcessingInstruction::setCSSStyleSheet(const String& href, const KURL& bas
eURL, const String& charset, const CSSStyleSheetResource* sheet) | 206 void ProcessingInstruction::setCSSStyleSheet(const String& href, const KURL& bas
eURL, const String& charset, const CSSStyleSheetResource* sheet) |
| 207 { | 207 { |
| 208 if (!inDocument()) { | 208 if (!inDocument()) { |
| 209 ASSERT(!m_sheet); | 209 ASSERT(!m_sheet); |
| 210 return; | 210 return; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 Node::InsertionNotificationRequest ProcessingInstruction::insertedInto(Container
Node* insertionPoint) | 270 Node::InsertionNotificationRequest ProcessingInstruction::insertedInto(Container
Node* insertionPoint) |
| 271 { | 271 { |
| 272 CharacterData::insertedInto(insertionPoint); | 272 CharacterData::insertedInto(insertionPoint); |
| 273 if (!insertionPoint->inDocument()) | 273 if (!insertionPoint->inDocument()) |
| 274 return InsertionDone; | 274 return InsertionDone; |
| 275 | 275 |
| 276 String href; | 276 String href; |
| 277 String charset; | 277 String charset; |
| 278 bool isValid = checkStyleSheet(href, charset); | 278 bool isValid = checkStyleSheet(href, charset); |
| 279 if (!DocumentXSLT::processingInstructionInsertedIntoDocument(document(), thi
s)) | 279 if (!DocumentXSLT::processingInstructionInsertedIntoDocument(document(), thi
s)) |
| 280 document().styleEngine()->addStyleSheetCandidateNode(this, m_createdByPa
rser); | 280 document().styleEngine().addStyleSheetCandidateNode(this, m_createdByPar
ser); |
| 281 if (isValid) | 281 if (isValid) |
| 282 process(href, charset); | 282 process(href, charset); |
| 283 return InsertionDone; | 283 return InsertionDone; |
| 284 } | 284 } |
| 285 | 285 |
| 286 void ProcessingInstruction::removedFrom(ContainerNode* insertionPoint) | 286 void ProcessingInstruction::removedFrom(ContainerNode* insertionPoint) |
| 287 { | 287 { |
| 288 CharacterData::removedFrom(insertionPoint); | 288 CharacterData::removedFrom(insertionPoint); |
| 289 if (!insertionPoint->inDocument()) | 289 if (!insertionPoint->inDocument()) |
| 290 return; | 290 return; |
| 291 | 291 |
| 292 // No need to remove XSLStyleSheet from StyleEngine. | 292 // No need to remove XSLStyleSheet from StyleEngine. |
| 293 if (!DocumentXSLT::processingInstructionRemovedFromDocument(document(), this
)) | 293 if (!DocumentXSLT::processingInstructionRemovedFromDocument(document(), this
)) |
| 294 document().styleEngine()->removeStyleSheetCandidateNode(this); | 294 document().styleEngine().removeStyleSheetCandidateNode(this); |
| 295 | 295 |
| 296 RefPtrWillBeRawPtr<StyleSheet> removedSheet = m_sheet; | 296 RefPtrWillBeRawPtr<StyleSheet> removedSheet = m_sheet; |
| 297 if (m_sheet) { | 297 if (m_sheet) { |
| 298 ASSERT(m_sheet->ownerNode() == this); | 298 ASSERT(m_sheet->ownerNode() == this); |
| 299 clearSheet(); | 299 clearSheet(); |
| 300 } | 300 } |
| 301 | 301 |
| 302 // No need to remove pending sheets. | 302 // No need to remove pending sheets. |
| 303 clearResource(); | 303 clearResource(); |
| 304 | 304 |
| 305 // If we're in document teardown, then we don't need to do any notification
of our sheet's removal. | 305 // If we're in document teardown, then we don't need to do any notification
of our sheet's removal. |
| 306 if (document().isActive()) | 306 if (document().isActive()) |
| 307 document().removedStyleSheet(removedSheet.get()); | 307 document().removedStyleSheet(removedSheet.get()); |
| 308 } | 308 } |
| 309 | 309 |
| 310 void ProcessingInstruction::clearSheet() | 310 void ProcessingInstruction::clearSheet() |
| 311 { | 311 { |
| 312 ASSERT(m_sheet); | 312 ASSERT(m_sheet); |
| 313 if (m_sheet->isLoading()) | 313 if (m_sheet->isLoading()) |
| 314 document().styleEngine()->removePendingSheet(this); | 314 document().styleEngine().removePendingSheet(this); |
| 315 m_sheet.release()->clearOwnerNode(); | 315 m_sheet.release()->clearOwnerNode(); |
| 316 } | 316 } |
| 317 | 317 |
| 318 DEFINE_TRACE(ProcessingInstruction) | 318 DEFINE_TRACE(ProcessingInstruction) |
| 319 { | 319 { |
| 320 visitor->trace(m_sheet); | 320 visitor->trace(m_sheet); |
| 321 CharacterData::trace(visitor); | 321 CharacterData::trace(visitor); |
| 322 } | 322 } |
| 323 | 323 |
| 324 } // namespace | 324 } // namespace |
| OLD | NEW |