Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1004)

Side by Side Diff: Source/core/xml/XSLTProcessorLibxslt.cpp

Issue 507583002: XSLImportRule should not be ResourceClient. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 if (!params) 211 if (!params)
212 return; 212 return;
213 213
214 while (*temp) { 214 while (*temp) {
215 fastFree(const_cast<char*>(*(temp++))); 215 fastFree(const_cast<char*>(*(temp++)));
216 fastFree(const_cast<char*>(*(temp++))); 216 fastFree(const_cast<char*>(*(temp++)));
217 } 217 }
218 fastFree(params); 218 fastFree(params);
219 } 219 }
220 220
221 static xsltStylesheetPtr xsltStylesheetPointer(RefPtrWillBeMember<XSLStyleSheet> & cachedStylesheet, Node* stylesheetRootNode) 221 static xsltStylesheetPtr xsltStylesheetPointer(Document* document, RefPtrWillBeM ember<XSLStyleSheet>& cachedStylesheet, Node* stylesheetRootNode)
222 { 222 {
223 if (!cachedStylesheet && stylesheetRootNode) { 223 if (!cachedStylesheet && stylesheetRootNode) {
224 // When using importStylesheet, we will use the given document as the im ported stylesheet's owner.
224 cachedStylesheet = XSLStyleSheet::createForXSLTProcessor( 225 cachedStylesheet = XSLStyleSheet::createForXSLTProcessor(
225 stylesheetRootNode->parentNode() ? stylesheetRootNode->parentNode() : stylesheetRootNode, 226 stylesheetRootNode->parentNode() ? &stylesheetRootNode->parentNode() ->document() : document,
227 stylesheetRootNode,
226 stylesheetRootNode->document().url().string(), 228 stylesheetRootNode->document().url().string(),
227 stylesheetRootNode->document().url()); // FIXME: Should we use baseU RL here? 229 stylesheetRootNode->document().url()); // FIXME: Should we use baseU RL here?
228 230
229 // According to Mozilla documentation, the node must be a Document node, 231 // According to Mozilla documentation, the node must be a Document node,
230 // an xsl:stylesheet or xsl:transform element. But we just use text 232 // an xsl:stylesheet or xsl:transform element. But we just use text
231 // content regardless of node type. 233 // content regardless of node type.
232 cachedStylesheet->parseString(createMarkup(stylesheetRootNode)); 234 cachedStylesheet->parseString(createMarkup(stylesheetRootNode));
233 } 235 }
234 236
235 if (!cachedStylesheet || !cachedStylesheet->document()) 237 if (!cachedStylesheet || !cachedStylesheet->document())
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 return "text/plain"; 273 return "text/plain";
272 274
273 return "application/xml"; 275 return "application/xml";
274 } 276 }
275 277
276 bool XSLTProcessor::transformToString(Node* sourceNode, String& mimeType, String & resultString, String& resultEncoding) 278 bool XSLTProcessor::transformToString(Node* sourceNode, String& mimeType, String & resultString, String& resultEncoding)
277 { 279 {
278 RefPtrWillBeRawPtr<Document> ownerDocument(sourceNode->document()); 280 RefPtrWillBeRawPtr<Document> ownerDocument(sourceNode->document());
279 281
280 setXSLTLoadCallBack(docLoaderFunc, this, ownerDocument->fetcher()); 282 setXSLTLoadCallBack(docLoaderFunc, this, ownerDocument->fetcher());
281 xsltStylesheetPtr sheet = xsltStylesheetPointer(m_stylesheet, m_stylesheetRo otNode.get()); 283 xsltStylesheetPtr sheet = xsltStylesheetPointer(m_document.get(), m_styleshe et, m_stylesheetRootNode.get());
282 if (!sheet) { 284 if (!sheet) {
283 setXSLTLoadCallBack(0, 0, 0); 285 setXSLTLoadCallBack(0, 0, 0);
284 m_stylesheet = nullptr; 286 m_stylesheet = nullptr;
285 return false; 287 return false;
286 } 288 }
287 m_stylesheet->clearDocuments(); 289 m_stylesheet->clearDocuments();
288 290
289 xmlChar* origMethod = sheet->method; 291 xmlChar* origMethod = sheet->method;
290 if (!origMethod && mimeType == "text/html") 292 if (!origMethod && mimeType == "text/html")
291 sheet->method = (xmlChar*)"html"; 293 sheet->method = (xmlChar*)"html";
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 345
344 sheet->method = origMethod; 346 sheet->method = origMethod;
345 setXSLTLoadCallBack(0, 0, 0); 347 setXSLTLoadCallBack(0, 0, 0);
346 xsltFreeStylesheet(sheet); 348 xsltFreeStylesheet(sheet);
347 m_stylesheet = nullptr; 349 m_stylesheet = nullptr;
348 350
349 return success; 351 return success;
350 } 352 }
351 353
352 } // namespace blink 354 } // namespace blink
OLDNEW
« Source/core/xml/XSLImportRule.cpp ('K') | « Source/core/xml/XSLTProcessor.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698