| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 #include "core/dom/CustomEvent.h" | 27 #include "core/dom/CustomEvent.h" |
| 28 | 28 |
| 29 #include "core/dom/EventNames.h" | 29 #include "core/dom/EventNames.h" |
| 30 | 30 |
| 31 namespace WebCore { | 31 namespace WebCore { |
| 32 | 32 |
| 33 CustomEventInit::CustomEventInit() | |
| 34 { | |
| 35 } | |
| 36 | |
| 37 CustomEvent::CustomEvent() | 33 CustomEvent::CustomEvent() |
| 38 { | 34 { |
| 39 ScriptWrappable::init(this); | 35 ScriptWrappable::init(this); |
| 40 } | 36 } |
| 41 | 37 |
| 42 CustomEvent::CustomEvent(const AtomicString& type, const CustomEventInit& initia
lizer) | 38 CustomEvent::CustomEvent(const AtomicString& type, const CustomEventInit& initia
lizer) |
| 43 : Event(type, initializer) | 39 : Event(type, initializer) |
| 44 , m_detail(initializer.detail) | |
| 45 { | 40 { |
| 46 ScriptWrappable::init(this); | 41 ScriptWrappable::init(this); |
| 47 } | 42 } |
| 48 | 43 |
| 49 CustomEvent::~CustomEvent() | 44 CustomEvent::~CustomEvent() |
| 50 { | 45 { |
| 51 } | 46 } |
| 52 | 47 |
| 53 void CustomEvent::initCustomEvent(const AtomicString& type, bool canBubble, bool
cancelable, const ScriptValue& detail) | |
| 54 { | |
| 55 ASSERT(!m_serializedScriptValue.get()); | |
| 56 if (dispatched()) | |
| 57 return; | |
| 58 | |
| 59 initEvent(type, canBubble, cancelable); | |
| 60 | |
| 61 m_detail = detail; | |
| 62 } | |
| 63 | |
| 64 void CustomEvent::initCustomEvent(const AtomicString& type, bool canBubble, bool
cancelable, PassRefPtr<SerializedScriptValue> serializedScriptValue) | 48 void CustomEvent::initCustomEvent(const AtomicString& type, bool canBubble, bool
cancelable, PassRefPtr<SerializedScriptValue> serializedScriptValue) |
| 65 { | 49 { |
| 66 ASSERT(m_detail.hasNoValue()); | |
| 67 if (dispatched()) | 50 if (dispatched()) |
| 68 return; | 51 return; |
| 69 | 52 |
| 70 initEvent(type, canBubble, cancelable); | 53 initEvent(type, canBubble, cancelable); |
| 71 | 54 |
| 72 m_serializedScriptValue = serializedScriptValue; | 55 m_serializedScriptValue = serializedScriptValue; |
| 73 } | 56 } |
| 74 | 57 |
| 75 const AtomicString& CustomEvent::interfaceName() const | 58 const AtomicString& CustomEvent::interfaceName() const |
| 76 { | 59 { |
| 77 return eventNames().interfaceForCustomEvent; | 60 return eventNames().interfaceForCustomEvent; |
| 78 } | 61 } |
| 79 | 62 |
| 80 } // namespace WebCore | 63 } // namespace WebCore |
| OLD | NEW |