| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 , m_oldValue(oldValue) | 85 , m_oldValue(oldValue) |
| 86 , m_newValue(newValue) | 86 , m_newValue(newValue) |
| 87 { | 87 { |
| 88 } | 88 } |
| 89 | 89 |
| 90 void AttributeChangedInvocation::dispatch(Element* element) | 90 void AttributeChangedInvocation::dispatch(Element* element) |
| 91 { | 91 { |
| 92 callbacks()->attributeChanged(element, m_name, m_oldValue, m_newValue); | 92 callbacks()->attributeChanged(element, m_name, m_oldValue, m_newValue); |
| 93 } | 93 } |
| 94 | 94 |
| 95 class CreatedInvocation : public CustomElementCallbackInvocation { |
| 96 public: |
| 97 CreatedInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callbacks) |
| 98 : CustomElementCallbackInvocation(callbacks) |
| 99 { |
| 100 } |
| 101 |
| 102 private: |
| 103 virtual void dispatch(Element*) OVERRIDE; |
| 104 virtual bool isCreated() const OVERRIDE { return true; } |
| 105 }; |
| 106 |
| 107 void CreatedInvocation::dispatch(Element* element) |
| 108 { |
| 109 if (element->inDocument() && element->document().domWindow()) |
| 110 CustomElementScheduler::scheduleAttachedCallback(callbacks(), element); |
| 111 callbacks()->created(element); |
| 112 } |
| 113 |
| 95 PassOwnPtr<CustomElementCallbackInvocation> CustomElementCallbackInvocation::cre
ateInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, CustomEleme
ntLifecycleCallbacks::CallbackType which) | 114 PassOwnPtr<CustomElementCallbackInvocation> CustomElementCallbackInvocation::cre
ateInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, CustomEleme
ntLifecycleCallbacks::CallbackType which) |
| 96 { | 115 { |
| 97 switch (which) { | 116 switch (which) { |
| 117 case CustomElementLifecycleCallbacks::Created: |
| 118 return adoptPtr(new CreatedInvocation(callbacks)); |
| 119 |
| 98 case CustomElementLifecycleCallbacks::Attached: | 120 case CustomElementLifecycleCallbacks::Attached: |
| 99 case CustomElementLifecycleCallbacks::Detached: | 121 case CustomElementLifecycleCallbacks::Detached: |
| 100 return adoptPtr(new AttachedDetachedInvocation(callbacks, which)); | 122 return adoptPtr(new AttachedDetachedInvocation(callbacks, which)); |
| 101 default: | 123 default: |
| 102 ASSERT_NOT_REACHED(); | 124 ASSERT_NOT_REACHED(); |
| 103 return PassOwnPtr<CustomElementCallbackInvocation>(); | 125 return PassOwnPtr<CustomElementCallbackInvocation>(); |
| 104 } | 126 } |
| 105 } | 127 } |
| 106 | 128 |
| 107 PassOwnPtr<CustomElementCallbackInvocation> CustomElementCallbackInvocation::cre
ateAttributeChangedInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callba
cks, const AtomicString& name, const AtomicString& oldValue, const AtomicString&
newValue) | 129 PassOwnPtr<CustomElementCallbackInvocation> CustomElementCallbackInvocation::cre
ateAttributeChangedInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callba
cks, const AtomicString& name, const AtomicString& oldValue, const AtomicString&
newValue) |
| 108 { | 130 { |
| 109 return adoptPtr(new AttributeChangedInvocation(callbacks, name, oldValue, ne
wValue)); | 131 return adoptPtr(new AttributeChangedInvocation(callbacks, name, oldValue, ne
wValue)); |
| 110 } | 132 } |
| 111 | 133 |
| 112 } // namespace WebCore | 134 } // namespace WebCore |
| OLD | NEW |