| Index: Source/core/dom/CustomElementCallbackInvocation.cpp
|
| diff --git a/Source/core/dom/CustomElementCallbackQueue.h b/Source/core/dom/CustomElementCallbackInvocation.cpp
|
| similarity index 51%
|
| copy from Source/core/dom/CustomElementCallbackQueue.h
|
| copy to Source/core/dom/CustomElementCallbackInvocation.cpp
|
| index 236297d9f02c76b6a143bd90e70d10ad205be5e6..3b6aab9befaf419897f181b78258a1c9b330a3ec 100644
|
| --- a/Source/core/dom/CustomElementCallbackQueue.h
|
| +++ b/Source/core/dom/CustomElementCallbackInvocation.cpp
|
| @@ -28,48 +28,57 @@
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
|
|
| -#ifndef CustomElementCallbackQueue_h
|
| -#define CustomElementCallbackQueue_h
|
| +#include "config.h"
|
| +#include "core/dom/CustomElementCallbackInvocation.h"
|
|
|
| #include "core/dom/CustomElementLifecycleCallbacks.h"
|
| -#include "wtf/PassOwnPtr.h"
|
| -#include "wtf/PassRefPtr.h"
|
| -#include "wtf/RefPtr.h"
|
| -#include "wtf/Vector.h"
|
|
|
| namespace WebCore {
|
|
|
| -class CustomElementCallbackQueue {
|
| - WTF_MAKE_NONCOPYABLE(CustomElementCallbackQueue);
|
| +class AttributeChangedInvocation : public CustomElementCallbackInvocation {
|
| public:
|
| - static PassOwnPtr<CustomElementCallbackQueue> create(PassRefPtr<CustomElementLifecycleCallbacks>, PassRefPtr<Element>);
|
| + AttributeChangedInvocation(const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue);
|
|
|
| - typedef int ElementQueue;
|
| - ElementQueue owner() { return m_owner; }
|
| - void setOwner(ElementQueue newOwner)
|
| - {
|
| - // ElementCallbackQueues only migrate towards the top of the
|
| - // processing stack.
|
| - ASSERT(newOwner >= m_owner);
|
| - m_owner = newOwner;
|
| - }
|
| -
|
| - typedef CustomElementLifecycleCallbacks::CallbackType Invocation;
|
| - void append(const Invocation& invocation) { m_queue.append(invocation); }
|
| +private:
|
| + virtual void dispatch(CustomElementLifecycleCallbacks*, Element*) OVERRIDE;
|
|
|
| - void processInElementQueue(ElementQueue);
|
| + AtomicString m_name;
|
| + AtomicString m_oldValue;
|
| + AtomicString m_newValue;
|
| +};
|
|
|
| +class CreatedInvocation : public CustomElementCallbackInvocation {
|
| +public:
|
| + CreatedInvocation() { }
|
| private:
|
| - CustomElementCallbackQueue(PassRefPtr<CustomElementLifecycleCallbacks>, PassRefPtr<Element>);
|
| - void dispatch(const Invocation&);
|
| -
|
| - RefPtr<CustomElementLifecycleCallbacks> m_callbacks;
|
| - RefPtr<Element> m_element;
|
| - Vector<Invocation> m_queue;
|
| - ElementQueue m_owner;
|
| - size_t m_index;
|
| + virtual void dispatch(CustomElementLifecycleCallbacks*, Element*) OVERRIDE;
|
| };
|
|
|
| +PassOwnPtr<CustomElementCallbackInvocation> CustomElementCallbackInvocation::createCreatedInvocation()
|
| +{
|
| + return adoptPtr(new CreatedInvocation());
|
| +}
|
| +
|
| +PassOwnPtr<CustomElementCallbackInvocation> CustomElementCallbackInvocation::createAttributeChangedInvocation(const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue)
|
| +{
|
| + return adoptPtr(new AttributeChangedInvocation(name, oldValue, newValue));
|
| +}
|
| +
|
| +AttributeChangedInvocation::AttributeChangedInvocation(const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue)
|
| + : m_name(name)
|
| + , m_oldValue(oldValue)
|
| + , m_newValue(newValue)
|
| +{
|
| +}
|
| +
|
| +void AttributeChangedInvocation::dispatch(CustomElementLifecycleCallbacks* callbacks, Element* element)
|
| +{
|
| + callbacks->attributeChanged(element, m_name, m_oldValue, m_newValue);
|
| +}
|
| +
|
| +void CreatedInvocation::dispatch(CustomElementLifecycleCallbacks* callbacks, Element* element)
|
| +{
|
| + callbacks->created(element);
|
| }
|
|
|
| -#endif // CustomElementCallbackQueue_h
|
| +} // namespace WebCore
|
|
|