| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of the XSL implementation. | 2 * This file is part of the XSL implementation. |
| 3 * | 3 * |
| 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple, Inc. All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple, Inc. All rights reserved. |
| 5 * Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@webkit.org> | 5 * Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@webkit.org> |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 DocumentEncodingData data; | 99 DocumentEncodingData data; |
| 100 data.setEncoding(sourceEncoding.isEmpty() ? UTF8Encoding() : WTF::TextEncodi
ng(sourceEncoding)); | 100 data.setEncoding(sourceEncoding.isEmpty() ? UTF8Encoding() : WTF::TextEncodi
ng(sourceEncoding)); |
| 101 result->setEncodingData(data); | 101 result->setEncodingData(data); |
| 102 result->setContent(documentSource); | 102 result->setContent(documentSource); |
| 103 | 103 |
| 104 return result.release(); | 104 return result.release(); |
| 105 } | 105 } |
| 106 | 106 |
| 107 PassRefPtrWillBeRawPtr<Document> XSLTProcessor::transformToDocument(Node* source
Node) | 107 PassRefPtrWillBeRawPtr<Document> XSLTProcessor::transformToDocument(Node* source
Node) |
| 108 { | 108 { |
| 109 if (!sourceNode) | |
| 110 return nullptr; | |
| 111 | |
| 112 String resultMIMEType; | 109 String resultMIMEType; |
| 113 String resultString; | 110 String resultString; |
| 114 String resultEncoding; | 111 String resultEncoding; |
| 115 if (!transformToString(sourceNode, resultMIMEType, resultString, resultEncod
ing)) | 112 if (!transformToString(sourceNode, resultMIMEType, resultString, resultEncod
ing)) |
| 116 return nullptr; | 113 return nullptr; |
| 117 return createDocumentFromSource(resultString, resultEncoding, resultMIMEType
, sourceNode, 0); | 114 return createDocumentFromSource(resultString, resultEncoding, resultMIMEType
, sourceNode, 0); |
| 118 } | 115 } |
| 119 | 116 |
| 120 PassRefPtrWillBeRawPtr<DocumentFragment> XSLTProcessor::transformToFragment(Node
* sourceNode, Document* outputDoc) | 117 PassRefPtrWillBeRawPtr<DocumentFragment> XSLTProcessor::transformToFragment(Node
* sourceNode, Document* outputDoc) |
| 121 { | 118 { |
| 122 if (!sourceNode || !outputDoc) | |
| 123 return nullptr; | |
| 124 | |
| 125 String resultMIMEType; | 119 String resultMIMEType; |
| 126 String resultString; | 120 String resultString; |
| 127 String resultEncoding; | 121 String resultEncoding; |
| 128 | 122 |
| 129 // If the output document is HTML, default to HTML method. | 123 // If the output document is HTML, default to HTML method. |
| 130 if (outputDoc->isHTMLDocument()) | 124 if (outputDoc->isHTMLDocument()) |
| 131 resultMIMEType = "text/html"; | 125 resultMIMEType = "text/html"; |
| 132 | 126 |
| 133 if (!transformToString(sourceNode, resultMIMEType, resultString, resultEncod
ing)) | 127 if (!transformToString(sourceNode, resultMIMEType, resultString, resultEncod
ing)) |
| 134 return nullptr; | 128 return nullptr; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 163 } | 157 } |
| 164 | 158 |
| 165 DEFINE_TRACE(XSLTProcessor) | 159 DEFINE_TRACE(XSLTProcessor) |
| 166 { | 160 { |
| 167 visitor->trace(m_stylesheet); | 161 visitor->trace(m_stylesheet); |
| 168 visitor->trace(m_stylesheetRootNode); | 162 visitor->trace(m_stylesheetRootNode); |
| 169 visitor->trace(m_document); | 163 visitor->trace(m_document); |
| 170 } | 164 } |
| 171 | 165 |
| 172 } // namespace blink | 166 } // namespace blink |
| OLD | NEW |