OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 29 matching lines...) Expand all Loading... | |
40 using namespace HTMLNames; | 40 using namespace HTMLNames; |
41 | 41 |
42 inline HTMLTemplateElement::HTMLTemplateElement(Document& document) | 42 inline HTMLTemplateElement::HTMLTemplateElement(Document& document) |
43 : HTMLElement(templateTag, document) | 43 : HTMLElement(templateTag, document) |
44 { | 44 { |
45 ScriptWrappable::init(this); | 45 ScriptWrappable::init(this); |
46 } | 46 } |
47 | 47 |
48 HTMLTemplateElement::~HTMLTemplateElement() | 48 HTMLTemplateElement::~HTMLTemplateElement() |
49 { | 49 { |
50 #if !ENABLE(OILPAN) | |
50 if (m_content) | 51 if (m_content) |
51 m_content->clearHost(); | 52 m_content->clearHost(); |
53 #endif | |
52 } | 54 } |
53 | 55 |
54 PassRefPtrWillBeRawPtr<HTMLTemplateElement> HTMLTemplateElement::create(Document & document) | 56 PassRefPtrWillBeRawPtr<HTMLTemplateElement> HTMLTemplateElement::create(Document & document) |
55 { | 57 { |
56 return adoptRefWillBeRefCountedGarbageCollected(new HTMLTemplateElement(docu ment)); | 58 return adoptRefWillBeRefCountedGarbageCollected(new HTMLTemplateElement(docu ment)); |
57 } | 59 } |
58 | 60 |
59 DocumentFragment* HTMLTemplateElement::content() const | 61 DocumentFragment* HTMLTemplateElement::content() const |
60 { | 62 { |
61 if (!m_content) | 63 if (!m_content) |
62 m_content = TemplateContentDocumentFragment::create(document().ensureTem plateDocument(), const_cast<HTMLTemplateElement*>(this)); | 64 m_content = TemplateContentDocumentFragment::create(document().ensureTem plateDocument(), *const_cast<HTMLTemplateElement*>(this)); |
Mads Ager (chromium)
2014/05/13 15:52:26
Let's just keep it a pointer?
| |
63 | 65 |
64 return m_content.get(); | 66 return m_content.get(); |
65 } | 67 } |
66 | 68 |
67 PassRefPtr<Node> HTMLTemplateElement::cloneNode(bool deep) | 69 PassRefPtr<Node> HTMLTemplateElement::cloneNode(bool deep) |
68 { | 70 { |
69 if (!deep) | 71 if (!deep) |
70 return cloneElementWithoutChildren(); | 72 return cloneElementWithoutChildren(); |
71 | 73 |
72 RefPtr<Node> clone = cloneElementWithChildren(); | 74 RefPtr<Node> clone = cloneElementWithChildren(); |
73 if (m_content) | 75 if (m_content) |
74 content()->cloneChildNodes(toHTMLTemplateElement(clone.get())->content() ); | 76 content()->cloneChildNodes(toHTMLTemplateElement(clone.get())->content() ); |
75 return clone.release(); | 77 return clone.release(); |
76 } | 78 } |
77 | 79 |
78 void HTMLTemplateElement::didMoveToNewDocument(Document& oldDocument) | 80 void HTMLTemplateElement::didMoveToNewDocument(Document& oldDocument) |
79 { | 81 { |
80 HTMLElement::didMoveToNewDocument(oldDocument); | 82 HTMLElement::didMoveToNewDocument(oldDocument); |
81 if (!m_content) | 83 if (!m_content) |
82 return; | 84 return; |
83 document().ensureTemplateDocument().adoptIfNeeded(*m_content); | 85 document().ensureTemplateDocument().adoptIfNeeded(*m_content); |
84 } | 86 } |
85 | 87 |
88 void HTMLTemplateElement::trace(Visitor* visitor) | |
89 { | |
90 visitor->trace(m_content); | |
91 HTMLElement::trace(visitor); | |
92 } | |
93 | |
86 } // namespace WebCore | 94 } // namespace WebCore |
OLD | NEW |