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 : public CustomElementCallbackInvocation { | 40 class AttachedDetachedInvocation : public CustomElementCallbackInvocation { |
41 public: | 41 public: |
42 AttachedDetachedInvocation(PassRefPtr<CustomElementLifecycleCallbacks>, Cust
omElementLifecycleCallbacks::CallbackType which); | 42 AttachedDetachedInvocation(PassRefPtr<CustomElementLifecycleCallbacks>, Cust
omElementLifecycleCallbacks::CallbackType which); |
43 | 43 |
44 private: | 44 private: |
45 virtual void dispatch(Element*) OVERRIDE; | 45 virtual void dispatch(Element*) override; |
46 | 46 |
47 CustomElementLifecycleCallbacks::CallbackType m_which; | 47 CustomElementLifecycleCallbacks::CallbackType m_which; |
48 }; | 48 }; |
49 | 49 |
50 AttachedDetachedInvocation::AttachedDetachedInvocation(PassRefPtr<CustomElementL
ifecycleCallbacks> callbacks, CustomElementLifecycleCallbacks::CallbackType whic
h) | 50 AttachedDetachedInvocation::AttachedDetachedInvocation(PassRefPtr<CustomElementL
ifecycleCallbacks> callbacks, CustomElementLifecycleCallbacks::CallbackType whic
h) |
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 : public CustomElementCallbackInvocation { | 71 class AttributeChangedInvocation : public CustomElementCallbackInvocation { |
72 public: | 72 public: |
73 AttributeChangedInvocation(PassRefPtr<CustomElementLifecycleCallbacks>, cons
t AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue
); | 73 AttributeChangedInvocation(PassRefPtr<CustomElementLifecycleCallbacks>, cons
t AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue
); |
74 | 74 |
75 private: | 75 private: |
76 virtual void dispatch(Element*) OVERRIDE; | 76 virtual 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(PassRefPtr<CustomElementL
ifecycleCallbacks> callbacks, const AtomicString& name, const AtomicString& oldV
alue, const AtomicString& newValue) | 83 AttributeChangedInvocation::AttributeChangedInvocation(PassRefPtr<CustomElementL
ifecycleCallbacks> callbacks, const AtomicString& name, const AtomicString& oldV
alue, 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 : public CustomElementCallbackInvocation { | 96 class CreatedInvocation : public CustomElementCallbackInvocation { |
97 public: | 97 public: |
98 CreatedInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callbacks) | 98 CreatedInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callbacks) |
99 : CustomElementCallbackInvocation(callbacks) | 99 : CustomElementCallbackInvocation(callbacks) |
100 { | 100 { |
101 } | 101 } |
102 | 102 |
103 private: | 103 private: |
104 virtual void dispatch(Element*) OVERRIDE; | 104 virtual void dispatch(Element*) override; |
105 virtual bool isCreatedCallback() const OVERRIDE { return true; } | 105 virtual 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 PassOwnPtr<CustomElementCallbackInvocation> CustomElementCallbackInvocation::cre
ateInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, CustomEleme
ntLifecycleCallbacks::CallbackType which) | 115 PassOwnPtr<CustomElementCallbackInvocation> CustomElementCallbackInvocation::cre
ateInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, CustomEleme
ntLifecycleCallbacks::CallbackType which) |
(...skipping 10 matching lines...) Expand all Loading... |
126 return PassOwnPtr<CustomElementCallbackInvocation>(); | 126 return PassOwnPtr<CustomElementCallbackInvocation>(); |
127 } | 127 } |
128 } | 128 } |
129 | 129 |
130 PassOwnPtr<CustomElementCallbackInvocation> CustomElementCallbackInvocation::cre
ateAttributeChangedInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callba
cks, const AtomicString& name, const AtomicString& oldValue, const AtomicString&
newValue) | 130 PassOwnPtr<CustomElementCallbackInvocation> CustomElementCallbackInvocation::cre
ateAttributeChangedInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callba
cks, const AtomicString& name, const AtomicString& oldValue, const AtomicString&
newValue) |
131 { | 131 { |
132 return adoptPtr(new AttributeChangedInvocation(callbacks, name, oldValue, ne
wValue)); | 132 return adoptPtr(new AttributeChangedInvocation(callbacks, name, oldValue, ne
wValue)); |
133 } | 133 } |
134 | 134 |
135 } // namespace blink | 135 } // namespace blink |
OLD | NEW |