| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 DocumentFragment* HTMLTemplateElement::content() const { | 48 DocumentFragment* HTMLTemplateElement::content() const { |
| 49 if (!m_content) | 49 if (!m_content) |
| 50 m_content = TemplateContentDocumentFragment::create( | 50 m_content = TemplateContentDocumentFragment::create( |
| 51 document().ensureTemplateDocument(), | 51 document().ensureTemplateDocument(), |
| 52 const_cast<HTMLTemplateElement*>(this)); | 52 const_cast<HTMLTemplateElement*>(this)); |
| 53 | 53 |
| 54 return m_content.get(); | 54 return m_content.get(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 Node* HTMLTemplateElement::cloneNode(bool deep) { | 57 Node* HTMLTemplateElement::cloneNode(bool deep, ExceptionState&) { |
| 58 if (!deep) | 58 if (!deep) |
| 59 return cloneElementWithoutChildren(); | 59 return cloneElementWithoutChildren(); |
| 60 | 60 |
| 61 Node* clone = cloneElementWithChildren(); | 61 Node* clone = cloneElementWithChildren(); |
| 62 if (m_content) | 62 if (m_content) |
| 63 content()->cloneChildNodes(toHTMLTemplateElement(clone)->content()); | 63 content()->cloneChildNodes(toHTMLTemplateElement(clone)->content()); |
| 64 return clone; | 64 return clone; |
| 65 } | 65 } |
| 66 | 66 |
| 67 void HTMLTemplateElement::didMoveToNewDocument(Document& oldDocument) { | 67 void HTMLTemplateElement::didMoveToNewDocument(Document& oldDocument) { |
| 68 HTMLElement::didMoveToNewDocument(oldDocument); | 68 HTMLElement::didMoveToNewDocument(oldDocument); |
| 69 if (!m_content) | 69 if (!m_content) |
| 70 return; | 70 return; |
| 71 document().ensureTemplateDocument().adoptIfNeeded(*m_content); | 71 document().ensureTemplateDocument().adoptIfNeeded(*m_content); |
| 72 } | 72 } |
| 73 | 73 |
| 74 DEFINE_TRACE(HTMLTemplateElement) { | 74 DEFINE_TRACE(HTMLTemplateElement) { |
| 75 visitor->trace(m_content); | 75 visitor->trace(m_content); |
| 76 HTMLElement::trace(visitor); | 76 HTMLElement::trace(visitor); |
| 77 } | 77 } |
| 78 | 78 |
| 79 DEFINE_TRACE_WRAPPERS(HTMLTemplateElement) { | 79 DEFINE_TRACE_WRAPPERS(HTMLTemplateElement) { |
| 80 visitor->traceWrappers(m_content); | 80 visitor->traceWrappers(m_content); |
| 81 HTMLElement::traceWrappers(visitor); | 81 HTMLElement::traceWrappers(visitor); |
| 82 } | 82 } |
| 83 | 83 |
| 84 } // namespace blink | 84 } // namespace blink |
| OLD | NEW |