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. |
11 * | 11 * |
12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
16 * | 16 * |
17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
21 */ | 21 */ |
22 | 22 |
23 #include "config.h" | 23 #include "config.h" |
24 #include "core/xml/XSLTProcessor.h" | 24 #include "core/xml/XSLTProcessor.h" |
25 | 25 |
26 #include "core/dom/DOMImplementation.h" | 26 #include "core/dom/DOMImplementation.h" |
27 #include "core/dom/DocumentFragment.h" | 27 #include "core/dom/DocumentFragment.h" |
28 #include "core/editing/markup.h" | 28 #include "core/editing/markup.h" |
29 #include "core/loader/TextResourceDecoder.h" | |
30 #include "core/page/ContentSecurityPolicy.h" | 29 #include "core/page/ContentSecurityPolicy.h" |
31 #include "core/page/DOMWindow.h" | 30 #include "core/page/DOMWindow.h" |
32 #include "core/page/Frame.h" | 31 #include "core/page/Frame.h" |
33 #include "core/page/FrameView.h" | 32 #include "core/page/FrameView.h" |
34 #include "weborigin/SecurityOrigin.h" | 33 #include "weborigin/SecurityOrigin.h" |
35 #include "wtf/Assertions.h" | 34 #include "wtf/Assertions.h" |
36 #include "wtf/Vector.h" | 35 #include "wtf/Vector.h" |
37 | 36 |
38 namespace WebCore { | 37 namespace WebCore { |
39 | 38 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 if (Document* oldDocument = frame->document()) { | 80 if (Document* oldDocument = frame->document()) { |
82 result->setTransformSourceDocument(oldDocument); | 81 result->setTransformSourceDocument(oldDocument); |
83 result->setSecurityOrigin(oldDocument->securityOrigin()); | 82 result->setSecurityOrigin(oldDocument->securityOrigin()); |
84 result->setCookieURL(oldDocument->cookieURL()); | 83 result->setCookieURL(oldDocument->cookieURL()); |
85 result->contentSecurityPolicy()->copyStateFrom(oldDocument->contentS
ecurityPolicy()); | 84 result->contentSecurityPolicy()->copyStateFrom(oldDocument->contentS
ecurityPolicy()); |
86 } | 85 } |
87 | 86 |
88 frame->domWindow()->setDocument(result); | 87 frame->domWindow()->setDocument(result); |
89 } | 88 } |
90 | 89 |
91 RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create(sourceMIME
Type); | 90 result->setEncoding(sourceEncoding.isEmpty() ? UTF8Encoding() : WTF::TextEnc
oding(sourceEncoding)); |
92 decoder->setEncoding(sourceEncoding.isEmpty() ? UTF8Encoding() : WTF::TextEn
coding(sourceEncoding), TextResourceDecoder::EncodingFromXMLHeader); | |
93 result->setDecoder(decoder.release()); | |
94 | |
95 result->setContent(documentSource); | 91 result->setContent(documentSource); |
96 | 92 |
97 return result.release(); | 93 return result.release(); |
98 } | 94 } |
99 | 95 |
100 PassRefPtr<Document> XSLTProcessor::transformToDocument(Node* sourceNode) | 96 PassRefPtr<Document> XSLTProcessor::transformToDocument(Node* sourceNode) |
101 { | 97 { |
102 if (!sourceNode) | 98 if (!sourceNode) |
103 return 0; | 99 return 0; |
104 | 100 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 } | 145 } |
150 | 146 |
151 void XSLTProcessor::reset() | 147 void XSLTProcessor::reset() |
152 { | 148 { |
153 m_stylesheet.clear(); | 149 m_stylesheet.clear(); |
154 m_stylesheetRootNode.clear(); | 150 m_stylesheetRootNode.clear(); |
155 m_parameters.clear(); | 151 m_parameters.clear(); |
156 } | 152 } |
157 | 153 |
158 } // namespace WebCore | 154 } // namespace WebCore |
OLD | NEW |