OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/xml/DocumentXSLT.h" | 5 #include "core/xml/DocumentXSLT.h" |
6 | 6 |
7 #include "bindings/core/v8/DOMWrapperWorld.h" | 7 #include "bindings/core/v8/DOMWrapperWorld.h" |
8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
9 #include "bindings/core/v8/V8AbstractEventListener.h" | 9 #include "bindings/core/v8/V8AbstractEventListener.h" |
10 #include "bindings/core/v8/V8Binding.h" | 10 #include "bindings/core/v8/V8Binding.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 processor->setXSLStyleSheet(toXSLStyleSheet(pi->sheet())); | 94 processor->setXSLStyleSheet(toXSLStyleSheet(pi->sheet())); |
95 String resultMIMEType; | 95 String resultMIMEType; |
96 String newSource; | 96 String newSource; |
97 String resultEncoding; | 97 String resultEncoding; |
98 document.setParsingState(Document::Parsing); | 98 document.setParsingState(Document::Parsing); |
99 if (!processor->transformToString(&document, resultMIMEType, newSource, | 99 if (!processor->transformToString(&document, resultMIMEType, newSource, |
100 resultEncoding)) { | 100 resultEncoding)) { |
101 document.setParsingState(Document::FinishedParsing); | 101 document.setParsingState(Document::FinishedParsing); |
102 return; | 102 return; |
103 } | 103 } |
104 // FIXME: If the transform failed we should probably report an error (like Moz
illa does). | 104 // FIXME: If the transform failed we should probably report an error (like |
| 105 // Mozilla does). |
105 LocalFrame* ownerFrame = document.frame(); | 106 LocalFrame* ownerFrame = document.frame(); |
106 processor->createDocumentFromSource(newSource, resultEncoding, resultMIMEType, | 107 processor->createDocumentFromSource(newSource, resultEncoding, resultMIMEType, |
107 &document, ownerFrame); | 108 &document, ownerFrame); |
108 InspectorInstrumentation::frameDocumentUpdated(ownerFrame); | 109 InspectorInstrumentation::frameDocumentUpdated(ownerFrame); |
109 document.setParsingState(Document::FinishedParsing); | 110 document.setParsingState(Document::FinishedParsing); |
110 } | 111 } |
111 | 112 |
112 ProcessingInstruction* DocumentXSLT::findXSLStyleSheet(Document& document) { | 113 ProcessingInstruction* DocumentXSLT::findXSLStyleSheet(Document& document) { |
113 for (Node* node = document.firstChild(); node; node = node->nextSibling()) { | 114 for (Node* node = document.firstChild(); node; node = node->nextSibling()) { |
114 if (node->getNodeType() != Node::kProcessingInstructionNode) | 115 if (node->getNodeType() != Node::kProcessingInstructionNode) |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 } | 188 } |
188 return *supplement; | 189 return *supplement; |
189 } | 190 } |
190 | 191 |
191 DEFINE_TRACE(DocumentXSLT) { | 192 DEFINE_TRACE(DocumentXSLT) { |
192 visitor->trace(m_transformSourceDocument); | 193 visitor->trace(m_transformSourceDocument); |
193 Supplement<Document>::trace(visitor); | 194 Supplement<Document>::trace(visitor); |
194 } | 195 } |
195 | 196 |
196 } // namespace blink | 197 } // namespace blink |
OLD | NEW |