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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 } | 232 } |
233 | 233 |
234 if (!cachedStylesheet || !cachedStylesheet->document()) | 234 if (!cachedStylesheet || !cachedStylesheet->document()) |
235 return 0; | 235 return 0; |
236 | 236 |
237 return cachedStylesheet->compileStyleSheet(); | 237 return cachedStylesheet->compileStyleSheet(); |
238 } | 238 } |
239 | 239 |
240 static inline xmlDocPtr xmlDocPtrFromNode(Node* sourceNode, bool& shouldDelete) | 240 static inline xmlDocPtr xmlDocPtrFromNode(Node* sourceNode, bool& shouldDelete) |
241 { | 241 { |
242 RefPtr<Document> ownerDocument(sourceNode->document()); | 242 RefPtrWillBeRawPtr<Document> ownerDocument(sourceNode->document()); |
243 bool sourceIsDocument = (sourceNode == ownerDocument.get()); | 243 bool sourceIsDocument = (sourceNode == ownerDocument.get()); |
244 | 244 |
245 xmlDocPtr sourceDoc = 0; | 245 xmlDocPtr sourceDoc = 0; |
246 if (sourceIsDocument && ownerDocument->transformSource()) | 246 if (sourceIsDocument && ownerDocument->transformSource()) |
247 sourceDoc = (xmlDocPtr)ownerDocument->transformSource()->platformSource(
); | 247 sourceDoc = (xmlDocPtr)ownerDocument->transformSource()->platformSource(
); |
248 if (!sourceDoc) { | 248 if (!sourceDoc) { |
249 sourceDoc = (xmlDocPtr)xmlDocPtrForString(ownerDocument->fetcher(), crea
teMarkup(sourceNode), | 249 sourceDoc = (xmlDocPtr)xmlDocPtrForString(ownerDocument->fetcher(), crea
teMarkup(sourceNode), |
250 sourceIsDocument ? ownerDocument->url().string() : String()); | 250 sourceIsDocument ? ownerDocument->url().string() : String()); |
251 shouldDelete = sourceDoc; | 251 shouldDelete = sourceDoc; |
252 } | 252 } |
(...skipping 14 matching lines...) Expand all Loading... |
267 if (xmlStrEqual(resultType, (const xmlChar*)"html")) | 267 if (xmlStrEqual(resultType, (const xmlChar*)"html")) |
268 return "text/html"; | 268 return "text/html"; |
269 if (xmlStrEqual(resultType, (const xmlChar*)"text")) | 269 if (xmlStrEqual(resultType, (const xmlChar*)"text")) |
270 return "text/plain"; | 270 return "text/plain"; |
271 | 271 |
272 return "application/xml"; | 272 return "application/xml"; |
273 } | 273 } |
274 | 274 |
275 bool XSLTProcessor::transformToString(Node* sourceNode, String& mimeType, String
& resultString, String& resultEncoding) | 275 bool XSLTProcessor::transformToString(Node* sourceNode, String& mimeType, String
& resultString, String& resultEncoding) |
276 { | 276 { |
277 RefPtr<Document> ownerDocument(sourceNode->document()); | 277 RefPtrWillBeRawPtr<Document> ownerDocument(sourceNode->document()); |
278 | 278 |
279 setXSLTLoadCallBack(docLoaderFunc, this, ownerDocument->fetcher()); | 279 setXSLTLoadCallBack(docLoaderFunc, this, ownerDocument->fetcher()); |
280 xsltStylesheetPtr sheet = xsltStylesheetPointer(m_stylesheet, m_stylesheetRo
otNode.get()); | 280 xsltStylesheetPtr sheet = xsltStylesheetPointer(m_stylesheet, m_stylesheetRo
otNode.get()); |
281 if (!sheet) { | 281 if (!sheet) { |
282 setXSLTLoadCallBack(0, 0, 0); | 282 setXSLTLoadCallBack(0, 0, 0); |
283 m_stylesheet = nullptr; | 283 m_stylesheet = nullptr; |
284 return false; | 284 return false; |
285 } | 285 } |
286 m_stylesheet->clearDocuments(); | 286 m_stylesheet->clearDocuments(); |
287 | 287 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 | 338 |
339 sheet->method = origMethod; | 339 sheet->method = origMethod; |
340 setXSLTLoadCallBack(0, 0, 0); | 340 setXSLTLoadCallBack(0, 0, 0); |
341 xsltFreeStylesheet(sheet); | 341 xsltFreeStylesheet(sheet); |
342 m_stylesheet = nullptr; | 342 m_stylesheet = nullptr; |
343 | 343 |
344 return success; | 344 return success; |
345 } | 345 } |
346 | 346 |
347 } // namespace WebCore | 347 } // namespace WebCore |
OLD | NEW |