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 #include "config.h" | |
6 #include "core/html/HTMLImportElement.h" | |
7 | |
8 #include "base/debug/stack_trace.h" | |
ojan
2014/11/03 18:08:29
leftover?
abarth-chromium
2014/11/03 20:37:02
Fixed!
| |
9 #include "core/dom/Document.h" | |
10 #include "core/html/imports/HTMLImportsController.h" | |
11 #include "core/html/imports/HTMLImportChild.h" | |
12 | |
13 namespace blink { | |
14 | |
15 HTMLImportElement::HTMLImportElement(Document& document) | |
16 : HTMLElement(HTMLNames::importTag, document) | |
17 , m_child(nullptr) | |
18 { | |
19 ScriptWrappable::init(this); | |
20 } | |
21 | |
22 PassRefPtr<HTMLImportElement> HTMLImportElement::create(Document& document) | |
23 { | |
24 return adoptRef(new HTMLImportElement(document)); | |
25 } | |
26 | |
27 Node::InsertionNotificationRequest HTMLImportElement::insertedInto(ContainerNode * insertionPoint) | |
28 { | |
29 HTMLElement::insertedInto(insertionPoint); | |
30 if (!insertionPoint->inDocument() || isInShadowTree()) | |
31 return InsertionDone; | |
32 | |
33 if (shouldLoad()) | |
34 load(); | |
35 | |
36 return InsertionDone; | |
37 } | |
38 | |
39 bool HTMLImportElement::shouldLoad() const | |
40 { | |
41 return document().frame() || document().importsController(); | |
42 } | |
43 | |
44 void HTMLImportElement::load() | |
45 { | |
46 if (m_child || !hasAttribute(HTMLNames::srcAttr)) | |
47 return; | |
48 KURL url = document().completeURL(getAttribute(HTMLNames::srcAttr)); | |
49 m_child = document().ensureImportsController().load(document().import(), thi s, FetchRequest(ResourceRequest(url))); | |
50 | |
51 if (m_child) | |
52 m_child->ownerInserted(); | |
53 } | |
54 | |
55 void HTMLImportElement::didFinish() | |
56 { | |
57 } | |
58 | |
59 void HTMLImportElement::importChildWasDestroyed(HTMLImportChild* child) | |
60 { | |
61 ASSERT(m_child == child); | |
62 m_child = nullptr; | |
63 } | |
64 | |
65 bool HTMLImportElement::isSync() const | |
66 { | |
67 return true; | |
68 } | |
69 | |
70 Element* HTMLImportElement::link() | |
71 { | |
72 return this; | |
73 } | |
74 | |
75 } | |
OLD | NEW |