| 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" |
| 11 #include "core/dom/Document.h" | 11 #include "core/dom/Document.h" |
| 12 #include "core/dom/ExecutionContext.h" |
| 12 #include "core/dom/Node.h" | 13 #include "core/dom/Node.h" |
| 13 #include "core/dom/ProcessingInstruction.h" | 14 #include "core/dom/ProcessingInstruction.h" |
| 14 #include "core/events/Event.h" | 15 #include "core/events/Event.h" |
| 15 #include "core/events/EventListener.h" | 16 #include "core/events/EventListener.h" |
| 16 #include "core/frame/UseCounter.h" | 17 #include "core/frame/UseCounter.h" |
| 17 #include "core/probe/CoreProbes.h" | 18 #include "core/probe/CoreProbes.h" |
| 18 #include "core/xml/XSLStyleSheet.h" | 19 #include "core/xml/XSLStyleSheet.h" |
| 19 #include "core/xml/XSLTProcessor.h" | 20 #include "core/xml/XSLTProcessor.h" |
| 20 | 21 |
| 21 namespace blink { | 22 namespace blink { |
| 22 | 23 |
| 23 class DOMContentLoadedListener final | 24 class DOMContentLoadedListener final |
| 24 : public V8AbstractEventListener, | 25 : public V8AbstractEventListener, |
| 25 public ProcessingInstruction::DetachableEventListener { | 26 public ProcessingInstruction::DetachableEventListener { |
| 26 USING_GARBAGE_COLLECTED_MIXIN(DOMContentLoadedListener); | 27 USING_GARBAGE_COLLECTED_MIXIN(DOMContentLoadedListener); |
| 27 | 28 |
| 28 public: | 29 public: |
| 29 static DOMContentLoadedListener* Create(ScriptState* script_state, | 30 static DOMContentLoadedListener* Create(ScriptState* script_state, |
| 30 ProcessingInstruction* pi) { | 31 ProcessingInstruction* pi) { |
| 31 return new DOMContentLoadedListener(script_state, pi); | 32 return new DOMContentLoadedListener(script_state, pi); |
| 32 } | 33 } |
| 33 | 34 |
| 34 bool operator==(const EventListener&) const override { return true; } | 35 bool operator==(const EventListener&) const override { return true; } |
| 35 | 36 |
| 36 virtual void HandleEvent(ScriptState* script_state, Event* event) { | 37 virtual void HandleEvent(ScriptState* script_state, Event* event) { |
| 37 DCHECK(RuntimeEnabledFeatures::xsltEnabled()); | 38 DCHECK(RuntimeEnabledFeatures::xsltEnabled()); |
| 38 DCHECK_EQ(event->type(), "DOMContentLoaded"); | 39 DCHECK_EQ(event->type(), "DOMContentLoaded"); |
| 39 ScriptState::Scope scope(script_state); | 40 ScriptState::Scope scope(script_state); |
| 40 | 41 |
| 41 Document& document = *ToDocument(script_state->GetExecutionContext()); | 42 Document& document = *ToDocument(ExecutionContext::From(script_state)); |
| 42 DCHECK(!document.Parsing()); | 43 DCHECK(!document.Parsing()); |
| 43 | 44 |
| 44 // Processing instruction (XML documents only). | 45 // Processing instruction (XML documents only). |
| 45 // We don't support linking to embedded CSS stylesheets, | 46 // We don't support linking to embedded CSS stylesheets, |
| 46 // see <https://bugs.webkit.org/show_bug.cgi?id=49281> for discussion. | 47 // see <https://bugs.webkit.org/show_bug.cgi?id=49281> for discussion. |
| 47 // Don't apply XSL transforms to already transformed documents. | 48 // Don't apply XSL transforms to already transformed documents. |
| 48 if (DocumentXSLT::HasTransformSourceDocument(document)) | 49 if (DocumentXSLT::HasTransformSourceDocument(document)) |
| 49 return; | 50 return; |
| 50 | 51 |
| 51 ProcessingInstruction* pi = DocumentXSLT::FindXSLStyleSheet(document); | 52 ProcessingInstruction* pi = DocumentXSLT::FindXSLStyleSheet(document); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 } | 190 } |
| 190 return *supplement; | 191 return *supplement; |
| 191 } | 192 } |
| 192 | 193 |
| 193 DEFINE_TRACE(DocumentXSLT) { | 194 DEFINE_TRACE(DocumentXSLT) { |
| 194 visitor->Trace(transform_source_document_); | 195 visitor->Trace(transform_source_document_); |
| 195 Supplement<Document>::Trace(visitor); | 196 Supplement<Document>::Trace(visitor); |
| 196 } | 197 } |
| 197 | 198 |
| 198 } // namespace blink | 199 } // namespace blink |
| OLD | NEW |