| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #include "core/dom/Element.h" | 35 #include "core/dom/Element.h" |
| 36 #include "core/dom/custom/CustomElementScheduler.h" | 36 #include "core/dom/custom/CustomElementScheduler.h" |
| 37 | 37 |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 class AttachedDetachedInvocation final : public CustomElementCallbackInvocation
{ | 40 class AttachedDetachedInvocation final : public CustomElementCallbackInvocation
{ |
| 41 public: | 41 public: |
| 42 AttachedDetachedInvocation(PassRefPtrWillBeRawPtr<CustomElementLifecycleCall
backs>, CustomElementLifecycleCallbacks::CallbackType which); | 42 AttachedDetachedInvocation(PassRefPtrWillBeRawPtr<CustomElementLifecycleCall
backs>, CustomElementLifecycleCallbacks::CallbackType which); |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 virtual void dispatch(Element*) override; | 45 void dispatch(Element*) override; |
| 46 | 46 |
| 47 CustomElementLifecycleCallbacks::CallbackType m_which; | 47 CustomElementLifecycleCallbacks::CallbackType m_which; |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 AttachedDetachedInvocation::AttachedDetachedInvocation(PassRefPtrWillBeRawPtr<Cu
stomElementLifecycleCallbacks> callbacks, CustomElementLifecycleCallbacks::Callb
ackType which) | 50 AttachedDetachedInvocation::AttachedDetachedInvocation(PassRefPtrWillBeRawPtr<Cu
stomElementLifecycleCallbacks> callbacks, CustomElementLifecycleCallbacks::Callb
ackType which) |
| 51 : CustomElementCallbackInvocation(callbacks) | 51 : CustomElementCallbackInvocation(callbacks) |
| 52 , m_which(which) | 52 , m_which(which) |
| 53 { | 53 { |
| 54 ASSERT(m_which == CustomElementLifecycleCallbacks::AttachedCallback || m_whi
ch == CustomElementLifecycleCallbacks::DetachedCallback); | 54 ASSERT(m_which == CustomElementLifecycleCallbacks::AttachedCallback || m_whi
ch == CustomElementLifecycleCallbacks::DetachedCallback); |
| 55 } | 55 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 66 default: | 66 default: |
| 67 ASSERT_NOT_REACHED(); | 67 ASSERT_NOT_REACHED(); |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 class AttributeChangedInvocation final : public CustomElementCallbackInvocation
{ | 71 class AttributeChangedInvocation final : public CustomElementCallbackInvocation
{ |
| 72 public: | 72 public: |
| 73 AttributeChangedInvocation(PassRefPtrWillBeRawPtr<CustomElementLifecycleCall
backs>, const AtomicString& name, const AtomicString& oldValue, const AtomicStri
ng& newValue); | 73 AttributeChangedInvocation(PassRefPtrWillBeRawPtr<CustomElementLifecycleCall
backs>, const AtomicString& name, const AtomicString& oldValue, const AtomicStri
ng& newValue); |
| 74 | 74 |
| 75 private: | 75 private: |
| 76 virtual void dispatch(Element*) override; | 76 void dispatch(Element*) override; |
| 77 | 77 |
| 78 AtomicString m_name; | 78 AtomicString m_name; |
| 79 AtomicString m_oldValue; | 79 AtomicString m_oldValue; |
| 80 AtomicString m_newValue; | 80 AtomicString m_newValue; |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 AttributeChangedInvocation::AttributeChangedInvocation(PassRefPtrWillBeRawPtr<Cu
stomElementLifecycleCallbacks> callbacks, const AtomicString& name, const Atomic
String& oldValue, const AtomicString& newValue) | 83 AttributeChangedInvocation::AttributeChangedInvocation(PassRefPtrWillBeRawPtr<Cu
stomElementLifecycleCallbacks> callbacks, const AtomicString& name, const Atomic
String& oldValue, const AtomicString& newValue) |
| 84 : CustomElementCallbackInvocation(callbacks) | 84 : CustomElementCallbackInvocation(callbacks) |
| 85 , m_name(name) | 85 , m_name(name) |
| 86 , m_oldValue(oldValue) | 86 , m_oldValue(oldValue) |
| 87 , m_newValue(newValue) | 87 , m_newValue(newValue) |
| 88 { | 88 { |
| 89 } | 89 } |
| 90 | 90 |
| 91 void AttributeChangedInvocation::dispatch(Element* element) | 91 void AttributeChangedInvocation::dispatch(Element* element) |
| 92 { | 92 { |
| 93 callbacks()->attributeChanged(element, m_name, m_oldValue, m_newValue); | 93 callbacks()->attributeChanged(element, m_name, m_oldValue, m_newValue); |
| 94 } | 94 } |
| 95 | 95 |
| 96 class CreatedInvocation final : public CustomElementCallbackInvocation { | 96 class CreatedInvocation final : public CustomElementCallbackInvocation { |
| 97 public: | 97 public: |
| 98 explicit CreatedInvocation(PassRefPtrWillBeRawPtr<CustomElementLifecycleCall
backs> callbacks) | 98 explicit CreatedInvocation(PassRefPtrWillBeRawPtr<CustomElementLifecycleCall
backs> callbacks) |
| 99 : CustomElementCallbackInvocation(callbacks) | 99 : CustomElementCallbackInvocation(callbacks) |
| 100 { | 100 { |
| 101 } | 101 } |
| 102 | 102 |
| 103 private: | 103 private: |
| 104 virtual void dispatch(Element*) override; | 104 void dispatch(Element*) override; |
| 105 virtual bool isCreatedCallback() const override { return true; } | 105 bool isCreatedCallback() const override { return true; } |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 void CreatedInvocation::dispatch(Element* element) | 108 void CreatedInvocation::dispatch(Element* element) |
| 109 { | 109 { |
| 110 if (element->inDocument() && element->document().domWindow()) | 110 if (element->inDocument() && element->document().domWindow()) |
| 111 CustomElementScheduler::scheduleCallback(callbacks(), element, CustomEle
mentLifecycleCallbacks::AttachedCallback); | 111 CustomElementScheduler::scheduleCallback(callbacks(), element, CustomEle
mentLifecycleCallbacks::AttachedCallback); |
| 112 callbacks()->created(element); | 112 callbacks()->created(element); |
| 113 } | 113 } |
| 114 | 114 |
| 115 PassOwnPtrWillBeRawPtr<CustomElementCallbackInvocation> CustomElementCallbackInv
ocation::createInvocation(PassRefPtrWillBeRawPtr<CustomElementLifecycleCallbacks
> callbacks, CustomElementLifecycleCallbacks::CallbackType which) | 115 PassOwnPtrWillBeRawPtr<CustomElementCallbackInvocation> CustomElementCallbackInv
ocation::createInvocation(PassRefPtrWillBeRawPtr<CustomElementLifecycleCallbacks
> callbacks, CustomElementLifecycleCallbacks::CallbackType which) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 132 return adoptPtrWillBeNoop(new AttributeChangedInvocation(callbacks, name, ol
dValue, newValue)); | 132 return adoptPtrWillBeNoop(new AttributeChangedInvocation(callbacks, name, ol
dValue, newValue)); |
| 133 } | 133 } |
| 134 | 134 |
| 135 DEFINE_TRACE(CustomElementCallbackInvocation) | 135 DEFINE_TRACE(CustomElementCallbackInvocation) |
| 136 { | 136 { |
| 137 visitor->trace(m_callbacks); | 137 visitor->trace(m_callbacks); |
| 138 CustomElementProcessingStep::trace(visitor); | 138 CustomElementProcessingStep::trace(visitor); |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace blink | 141 } // namespace blink |
| OLD | NEW |