| Index: third_party/WebKit/Source/core/dom/custom/CustomElementCreationScope.h
|
| diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementCreationScope.h b/third_party/WebKit/Source/core/dom/custom/CustomElementCreationScope.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..d8f2dbd120ef60530bc7804f55c7054b7d073412
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/core/dom/custom/CustomElementCreationScope.h
|
| @@ -0,0 +1,40 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CustomElementCreationScope_h
|
| +#define CustomElementCreationScope_h
|
| +
|
| +#include "core/frame/LocalDOMWindow.h"
|
| +#include "platform/heap/Handle.h"
|
| +
|
| +namespace blink {
|
| +
|
| +class Document;
|
| +
|
| +class CustomElementCreationScope {
|
| + STACK_ALLOCATED();
|
| +public:
|
| + explicit CustomElementCreationScope(Document* document)
|
| + : m_document(document)
|
| + {
|
| + if (LocalDOMWindow* window = m_document->executingWindow()) {
|
| + m_prev = window->customElementCreationContext();
|
| + window->setCustomElementCreationContext(m_document);
|
| + }
|
| + }
|
| +
|
| + ~CustomElementCreationScope()
|
| + {
|
| + if (LocalDOMWindow* window = m_document->executingWindow())
|
| + window->setCustomElementCreationContext(m_prev);
|
| + }
|
| +
|
| +private:
|
| + Member<Document> m_document;
|
| + Member<Document> m_prev = nullptr;
|
| +};
|
| +
|
| +} // namespace blink
|
| +
|
| +#endif // CustomElementCreationScope_h
|
|
|