| 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 13 matching lines...) Expand all Loading... |
| 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/DocumentEncodingData.h" | 27 #include "core/dom/DocumentEncodingData.h" |
| 28 #include "core/dom/DocumentFragment.h" | 28 #include "core/dom/DocumentFragment.h" |
| 29 #include "core/editing/markup.h" | 29 #include "core/editing/markup.h" |
| 30 #include "core/frame/LocalDOMWindow.h" | 30 #include "core/frame/LocalDOMWindow.h" |
| 31 #include "core/frame/FrameView.h" | 31 #include "core/frame/FrameView.h" |
| 32 #include "core/frame/LocalFrame.h" | 32 #include "core/frame/LocalFrame.h" |
| 33 #include "core/frame/csp/ContentSecurityPolicy.h" | 33 #include "core/frame/csp/ContentSecurityPolicy.h" |
| 34 #include "core/xml/DocumentXSLT.h" |
| 34 #include "platform/weborigin/SecurityOrigin.h" | 35 #include "platform/weborigin/SecurityOrigin.h" |
| 35 #include "wtf/Assertions.h" | 36 #include "wtf/Assertions.h" |
| 36 | 37 |
| 37 namespace blink { | 38 namespace blink { |
| 38 | 39 |
| 39 static inline void transformTextStringToXHTMLDocumentString(String& text) | 40 static inline void transformTextStringToXHTMLDocumentString(String& text) |
| 40 { | 41 { |
| 41 // Modify the output so that it is a well-formed XHTML document with a <pre>
tag enclosing the text. | 42 // Modify the output so that it is a well-formed XHTML document with a <pre>
tag enclosing the text. |
| 42 text.replaceWithLiteral('&', "&"); | 43 text.replaceWithLiteral('&', "&"); |
| 43 text.replaceWithLiteral('<', "<"); | 44 text.replaceWithLiteral('<', "<"); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 if (frame) { | 77 if (frame) { |
| 77 RefPtrWillBeRawPtr<Document> oldDocument = frame->document(); | 78 RefPtrWillBeRawPtr<Document> oldDocument = frame->document(); |
| 78 result = frame->localDOMWindow()->installNewDocument(sourceMIMEType, ini
t, forceXHTML); | 79 result = frame->localDOMWindow()->installNewDocument(sourceMIMEType, ini
t, forceXHTML); |
| 79 | 80 |
| 80 // Before parsing, we need to save & detach the old document and get the
new document | 81 // Before parsing, we need to save & detach the old document and get the
new document |
| 81 // in place. We have to do this only if we're rendering the result docum
ent. | 82 // in place. We have to do this only if we're rendering the result docum
ent. |
| 82 if (FrameView* view = frame->view()) | 83 if (FrameView* view = frame->view()) |
| 83 view->clear(); | 84 view->clear(); |
| 84 | 85 |
| 85 if (oldDocument) { | 86 if (oldDocument) { |
| 86 result->setTransformSourceDocument(oldDocument.get()); | 87 DocumentXSLT::from(*result).setTransformSourceDocument(oldDocument.g
et()); |
| 87 result->updateSecurityOrigin(oldDocument->securityOrigin()); | 88 result->updateSecurityOrigin(oldDocument->securityOrigin()); |
| 88 result->setCookieURL(oldDocument->cookieURL()); | 89 result->setCookieURL(oldDocument->cookieURL()); |
| 89 result->initContentSecurityPolicy(); | 90 |
| 91 RefPtr<ContentSecurityPolicy> csp = ContentSecurityPolicy::create(); |
| 92 csp->copyStateFrom(oldDocument->contentSecurityPolicy()); |
| 93 result->initContentSecurityPolicy(csp); |
| 90 } | 94 } |
| 91 } else { | 95 } else { |
| 92 result = LocalDOMWindow::createDocument(sourceMIMEType, init, forceXHTML
); | 96 result = LocalDOMWindow::createDocument(sourceMIMEType, init, forceXHTML
); |
| 93 } | 97 } |
| 94 | 98 |
| 95 DocumentEncodingData data; | 99 DocumentEncodingData data; |
| 96 data.setEncoding(sourceEncoding.isEmpty() ? UTF8Encoding() : WTF::TextEncodi
ng(sourceEncoding)); | 100 data.setEncoding(sourceEncoding.isEmpty() ? UTF8Encoding() : WTF::TextEncodi
ng(sourceEncoding)); |
| 97 result->setEncodingData(data); | 101 result->setEncodingData(data); |
| 98 result->setContent(documentSource); | 102 result->setContent(documentSource); |
| 99 | 103 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 } | 163 } |
| 160 | 164 |
| 161 void XSLTProcessor::trace(Visitor* visitor) | 165 void XSLTProcessor::trace(Visitor* visitor) |
| 162 { | 166 { |
| 163 visitor->trace(m_stylesheet); | 167 visitor->trace(m_stylesheet); |
| 164 visitor->trace(m_stylesheetRootNode); | 168 visitor->trace(m_stylesheetRootNode); |
| 165 visitor->trace(m_document); | 169 visitor->trace(m_document); |
| 166 } | 170 } |
| 167 | 171 |
| 168 } // namespace blink | 172 } // namespace blink |
| OLD | NEW |