Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(438)

Unified Diff: third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.h

Issue 2060753002: Implement script-side of callback reactions for Custom Elements V1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@callback-ce
Patch Set: rebase Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.h b/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.h
index 8d8cdd4be35f38cca3880114de36dd06b0f2603e..c8d7301f0e8b87f6b1d8dc07cdbe5765ffaa94b6 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.h
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.h
@@ -10,11 +10,8 @@
#include "core/CoreExport.h"
#include "core/dom/custom/CustomElementDefinition.h"
#include "v8.h"
-#include "wtf/HashSet.h"
#include "wtf/Noncopyable.h"
#include "wtf/RefPtr.h"
-#include "wtf/text/AtomicString.h"
-#include "wtf/text/AtomicStringHash.h"
namespace blink {
@@ -36,9 +33,9 @@ public:
const CustomElementDescriptor&,
const v8::Local<v8::Object>& constructor,
const v8::Local<v8::Object>& prototype,
- const v8::Local<v8::Object>& connectedCallback,
- const v8::Local<v8::Object>& disconnectedCallback,
- const v8::Local<v8::Object>& attributeChangedCallback,
+ const v8::Local<v8::Function>& connectedCallback,
+ const v8::Local<v8::Function>& disconnectedCallback,
+ const v8::Local<v8::Function>& attributeChangedCallback,
const HashSet<AtomicString>& observedAttributes);
virtual ~ScriptCustomElementDefinition() = default;
@@ -49,15 +46,23 @@ public:
HTMLElement* createElementSync(Document&, const QualifiedName&) override;
HTMLElement* createElementSync(Document&, const QualifiedName&, ExceptionState&) override;
+ bool hasConnectedCallback() const override;
+ bool hasDisconnectedCallback() const override;
+
+ void runConnectedCallback(Element*) override;
+ void runDisconnectedCallback(Element*) override;
+ void runAttributeChangedCallback(Element*, const QualifiedName&,
+ const AtomicString& oldValue, const AtomicString& newValue) override;
+
private:
ScriptCustomElementDefinition(
ScriptState*,
const CustomElementDescriptor&,
const v8::Local<v8::Object>& constructor,
const v8::Local<v8::Object>& prototype,
- const v8::Local<v8::Object>& connectedCallback,
- const v8::Local<v8::Object>& disconnectedCallback,
- const v8::Local<v8::Object>& attributeChangedCallback,
+ const v8::Local<v8::Function>& connectedCallback,
+ const v8::Local<v8::Function>& disconnectedCallback,
+ const v8::Local<v8::Function>& attributeChangedCallback,
const HashSet<AtomicString>& observedAttributes);
// Implementations of |CustomElementDefinition|
@@ -65,13 +70,15 @@ private:
bool runConstructor(Element*) override;
Element* runConstructor();
+ void runCallback(v8::Local<v8::Function>, Element*,
+ int argc = 0, v8::Local<v8::Value> argv[] = nullptr);
+
RefPtr<ScriptState> m_scriptState;
ScopedPersistent<v8::Object> m_constructor;
ScopedPersistent<v8::Object> m_prototype;
- ScopedPersistent<v8::Object> m_connectedCallback;
- ScopedPersistent<v8::Object> m_disconnectedCallback;
- ScopedPersistent<v8::Object> m_attributeChangedCallback;
- HashSet<AtomicString> m_observedAttributes;
+ ScopedPersistent<v8::Function> m_connectedCallback;
+ ScopedPersistent<v8::Function> m_disconnectedCallback;
+ ScopedPersistent<v8::Function> m_attributeChangedCallback;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698