| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 6 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 6 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 7 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 7 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
| 8 * | 8 * |
| 9 * Redistribution and use in source and binary forms, with or without | 9 * Redistribution and use in source and binary forms, with or without |
| 10 * modification, are permitted provided that the following conditions | 10 * modification, are permitted provided that the following conditions |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 OwnPtr<FiringEventIteratorVector> firingEventIterators; | 68 OwnPtr<FiringEventIteratorVector> firingEventIterators; |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 // This is the base class for all DOM event targets. To make your class an | 71 // This is the base class for all DOM event targets. To make your class an |
| 72 // EventTarget, follow these steps: | 72 // EventTarget, follow these steps: |
| 73 // - Make your IDL interface inherit from EventTarget. | 73 // - Make your IDL interface inherit from EventTarget. |
| 74 // - Inherit from EventTargetWithInlineData (only in rare cases should you use | 74 // - Inherit from EventTargetWithInlineData (only in rare cases should you use |
| 75 // EventTarget directly). | 75 // EventTarget directly). |
| 76 // - Figure out if you now need to inherit from ActiveDOMObject as well. | 76 // - Figure out if you now need to inherit from ActiveDOMObject as well. |
| 77 // - In your class declaration, you will typically use | 77 // - In your class declaration, you will typically use |
| 78 // REFCOUNTED_EVENT_TARGET(YourClassName) and | 78 // REFCOUNTED_EVENT_TARGET(YourClassName). |
| 79 // WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(YourClassName). Make sure to include | |
| 80 // this header file in your .h file, or you will get very strange compiler | |
| 81 // errors. | |
| 82 // - Call ScriptWrappable::init(this) in your constructor, unless you are alread
y | 79 // - Call ScriptWrappable::init(this) in your constructor, unless you are alread
y |
| 83 // doing so. | 80 // doing so. |
| 84 // - Override EventTarget::interfaceName() and executionContext(). The former | 81 // - Override EventTarget::interfaceName() and executionContext(). The former |
| 85 // will typically return EventTargetNames::YourClassName. The latter will | 82 // will typically return EventTargetNames::YourClassName. The latter will |
| 86 // return ActiveDOMObject::executionContext (if you are an ActiveDOMObject) | 83 // return ActiveDOMObject::executionContext (if you are an ActiveDOMObject) |
| 87 // or the document you're in. | 84 // or the document you're in. |
| 88 // - Your trace() method will need to call EventTargetWithInlineData::trace. | 85 // - Your trace() method will need to call EventTargetWithInlineData::trace. |
| 89 // | 86 // |
| 90 // Optionally, add a FooEvent.idl class, but that's outside the scope of this | 87 // Optionally, add a FooEvent.idl class, but that's outside the scope of this |
| 91 // comment (and much more straightforward). | 88 // comment (and much more straightforward). |
| 92 class EventTarget : public DummyBase<void>, public ScriptWrappable { | 89 class EventTarget : public ScriptWrappable { |
| 93 DEFINE_WRAPPERTYPEINFO(); | 90 DEFINE_WRAPPERTYPEINFO(); |
| 94 public: | 91 public: |
| 95 #if !ENABLE(OILPAN) | 92 #if !ENABLE(OILPAN) |
| 96 void ref() { refEventTarget(); } | 93 void ref() { refEventTarget(); } |
| 97 void deref() { derefEventTarget(); } | 94 void deref() { derefEventTarget(); } |
| 98 #endif | 95 #endif |
| 99 | 96 |
| 100 virtual const AtomicString& interfaceName() const = 0; | 97 virtual const AtomicString& interfaceName() const = 0; |
| 101 virtual ExecutionContext* executionContext() const = 0; | 98 virtual ExecutionContext* executionContext() const = 0; |
| 102 | 99 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 typedef int thisIsHereToForceASemiColonAfterThisEventTargetMacro | 201 typedef int thisIsHereToForceASemiColonAfterThisEventTargetMacro |
| 205 #define DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(baseClass) DEFINE_EVENT_
TARGET_REFCOUNTING(baseClass) | 202 #define DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(baseClass) DEFINE_EVENT_
TARGET_REFCOUNTING(baseClass) |
| 206 #endif | 203 #endif |
| 207 | 204 |
| 208 // Use this macro if your EventTarget subclass is also a subclass of WTF::RefCou
nted. | 205 // Use this macro if your EventTarget subclass is also a subclass of WTF::RefCou
nted. |
| 209 // A ref-counted class that uses a different method of refcounting should use DE
FINE_EVENT_TARGET_REFCOUNTING directly. | 206 // A ref-counted class that uses a different method of refcounting should use DE
FINE_EVENT_TARGET_REFCOUNTING directly. |
| 210 // Both of these macros are meant to be placed just before the "public:" section
of the class declaration. | 207 // Both of these macros are meant to be placed just before the "public:" section
of the class declaration. |
| 211 #define REFCOUNTED_EVENT_TARGET(className) DEFINE_EVENT_TARGET_REFCOUNTING_WILL_
BE_REMOVED(RefCounted<className>) | 208 #define REFCOUNTED_EVENT_TARGET(className) DEFINE_EVENT_TARGET_REFCOUNTING_WILL_
BE_REMOVED(RefCounted<className>) |
| 212 | 209 |
| 213 #endif // EventTarget_h | 210 #endif // EventTarget_h |
| OLD | NEW |