OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef DocumentFragmentPluginPlaceholder_h | |
6 #define DocumentFragmentPluginPlaceholder_h | |
7 | |
8 #include "core/dom/Document.h" | |
9 #include "core/dom/DocumentFragment.h" | |
10 #include "core/plugins/PluginPlaceholder.h" | |
11 | |
12 namespace blink { | |
13 | |
14 // Populates plugin placeholder content with a document fragment. | |
15 // Used for layout tests that contain a <template>. | |
16 class DocumentFragmentPluginPlaceholder final : public NoBaseWillBeGarbageCollec
ted<DocumentFragmentPluginPlaceholder>, public PluginPlaceholder { | |
17 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(DocumentFragmentPluginPlaceholder); | |
18 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(DocumentFragmentPluginPlaceholder); | |
19 public: | |
20 static PassOwnPtrWillBeRawPtr<DocumentFragmentPluginPlaceholder> create(Pass
RefPtrWillBeRawPtr<DocumentFragment> fragment) | |
21 { | |
22 return adoptPtrWillBeNoop(new DocumentFragmentPluginPlaceholder(fragment
)); | |
23 } | |
24 | |
25 #if !ENABLE(OILPAN) | |
26 ~DocumentFragmentPluginPlaceholder() override { } | |
27 #endif | |
28 DEFINE_INLINE_VIRTUAL_TRACE() { visitor->trace(m_fragment); } | |
29 | |
30 void loadIntoContainer(ContainerNode& container) override | |
31 { | |
32 RefPtrWillBeRawPtr<Node> clonedFragment = container.document().importNod
e(m_fragment.get(), true /* deep */, ASSERT_NO_EXCEPTION); | |
33 container.appendChild(clonedFragment.release(), ASSERT_NO_EXCEPTION); | |
34 } | |
35 | |
36 private: | |
37 DocumentFragmentPluginPlaceholder(PassRefPtrWillBeRawPtr<DocumentFragment> f
ragment) : m_fragment(fragment) { } | |
38 | |
39 RefPtrWillBeMember<DocumentFragment> m_fragment; | |
40 }; | |
41 | |
42 } // namespace blink | |
43 | |
44 #endif // DocumentFragmentPluginPlaceholder_h | |
OLD | NEW |