JSCustomElementInterface.h [plain text]
#ifndef JSCustomElementInterface_h
#define JSCustomElementInterface_h
#if ENABLE(CUSTOM_ELEMENTS)
#include "ActiveDOMCallback.h"
#include "QualifiedName.h"
#include <heap/Weak.h>
#include <heap/WeakInlines.h>
#include <runtime/JSObject.h>
#include <wtf/Forward.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
namespace JSC {
class JSObject;
class PrivateName;
}
namespace WebCore {
class DOMWrapperWorld;
class Element;
class JSDOMGlobalObject;
class MathMLElement;
class SVGElement;
class JSCustomElementInterface : public RefCounted<JSCustomElementInterface>, public ActiveDOMCallback {
public:
static Ref<JSCustomElementInterface> create(const QualifiedName& name, JSC::JSObject* callback, JSDOMGlobalObject* globalObject)
{
return adoptRef(*new JSCustomElementInterface(name, callback, globalObject));
}
enum class ShouldClearException { Clear, DoNotClear };
RefPtr<Element> constructElement(const AtomicString&, ShouldClearException);
void upgradeElement(Element&);
void attributeChanged(Element&, const QualifiedName&, const AtomicString& oldValue, const AtomicString& newValue);
ScriptExecutionContext* scriptExecutionContext() const { return ContextDestructionObserver::scriptExecutionContext(); }
JSC::JSObject* constructor() { return m_constructor.get(); }
const QualifiedName& name() const { return m_name; }
bool isUpgradingElement() const { return !m_constructionStack.isEmpty(); }
Element* lastElementInConstructionStack() const { return m_constructionStack.last().get(); }
void didUpgradeLastElementInConstructionStack();
virtual ~JSCustomElementInterface();
private:
JSCustomElementInterface(const QualifiedName&, JSC::JSObject* callback, JSDOMGlobalObject*);
QualifiedName m_name;
mutable JSC::Weak<JSC::JSObject> m_constructor;
RefPtr<DOMWrapperWorld> m_isolatedWorld;
Vector<RefPtr<Element>, 1> m_constructionStack;
};
}
#endif
#endif