Chromium Code Reviews| 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 28 matching lines...) Expand all Loading... | |
| 39 using namespace HTMLNames; | 39 using namespace HTMLNames; |
| 40 | 40 |
| 41 inline HTMLTemplateElement::HTMLTemplateElement(Document& document) | 41 inline HTMLTemplateElement::HTMLTemplateElement(Document& document) |
| 42 : HTMLElement(templateTag, document), content_(this, nullptr) {} | 42 : HTMLElement(templateTag, document), content_(this, nullptr) {} |
| 43 | 43 |
| 44 DEFINE_NODE_FACTORY(HTMLTemplateElement) | 44 DEFINE_NODE_FACTORY(HTMLTemplateElement) |
| 45 | 45 |
| 46 HTMLTemplateElement::~HTMLTemplateElement() {} | 46 HTMLTemplateElement::~HTMLTemplateElement() {} |
| 47 | 47 |
| 48 DocumentFragment* HTMLTemplateElement::content() const { | 48 DocumentFragment* HTMLTemplateElement::content() const { |
| 49 if (!content_) | 49 if (!content_) { |
| 50 content_ = TemplateContentDocumentFragment::Create( | 50 content_ = TemplateContentDocumentFragment::Create( |
| 51 GetDocument().EnsureTemplateDocument(), | 51 GetDocument().EnsureTemplateDocument(), |
| 52 const_cast<HTMLTemplateElement*>(this)); | 52 const_cast<HTMLTemplateElement*>(this)); |
| 53 content_->GetDocument().SetURL(GetDocument().Url()); | |
|
fs
2017/04/25 09:13:45
Shouldn't this rather be handled when creating the
foolip
2017/04/25 09:23:44
The relevant bit of spec:
https://html.spec.whatwg
fs
2017/04/25 10:20:47
Right, https://dom.spec.whatwg.org/#interface-docu
foolip
2017/04/25 14:23:28
Do you mean "The Document() constructor, when invo
fs
2017/04/25 14:39:26
That may very well be the case. But shouldn't the
fs
2017/04/25 14:51:08
Found what I was looking for:
'Unless stated othe
| |
| 54 } | |
| 53 | 55 |
| 54 return content_.Get(); | 56 return content_.Get(); |
| 55 } | 57 } |
| 56 | 58 |
| 57 Node* HTMLTemplateElement::cloneNode(bool deep, ExceptionState&) { | 59 Node* HTMLTemplateElement::cloneNode(bool deep, ExceptionState&) { |
| 58 if (!deep) | 60 if (!deep) |
| 59 return CloneElementWithoutChildren(); | 61 return CloneElementWithoutChildren(); |
| 60 | 62 |
| 61 Node* clone = CloneElementWithChildren(); | 63 Node* clone = CloneElementWithChildren(); |
| 62 if (content_) | 64 if (content_) |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 75 visitor->Trace(content_); | 77 visitor->Trace(content_); |
| 76 HTMLElement::Trace(visitor); | 78 HTMLElement::Trace(visitor); |
| 77 } | 79 } |
| 78 | 80 |
| 79 DEFINE_TRACE_WRAPPERS(HTMLTemplateElement) { | 81 DEFINE_TRACE_WRAPPERS(HTMLTemplateElement) { |
| 80 visitor->TraceWrappers(content_); | 82 visitor->TraceWrappers(content_); |
| 81 HTMLElement::TraceWrappers(visitor); | 83 HTMLElement::TraceWrappers(visitor); |
| 82 } | 84 } |
| 83 | 85 |
| 84 } // namespace blink | 86 } // namespace blink |
| OLD | NEW |