| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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). | 78 // REFCOUNTED_EVENT_TARGET(YourClassName). |
| 79 // - Call ScriptWrappable::init(this) in your constructor, unless you are alread
y | |
| 80 // doing so. | |
| 81 // - Override EventTarget::interfaceName() and executionContext(). The former | 79 // - Override EventTarget::interfaceName() and executionContext(). The former |
| 82 // will typically return EventTargetNames::YourClassName. The latter will | 80 // will typically return EventTargetNames::YourClassName. The latter will |
| 83 // return ActiveDOMObject::executionContext (if you are an ActiveDOMObject) | 81 // return ActiveDOMObject::executionContext (if you are an ActiveDOMObject) |
| 84 // or the document you're in. | 82 // or the document you're in. |
| 85 // - Your trace() method will need to call EventTargetWithInlineData::trace. | 83 // - Your trace() method will need to call EventTargetWithInlineData::trace. |
| 86 // | 84 // |
| 87 // Optionally, add a FooEvent.idl class, but that's outside the scope of this | 85 // Optionally, add a FooEvent.idl class, but that's outside the scope of this |
| 88 // comment (and much more straightforward). | 86 // comment (and much more straightforward). |
| 89 class EventTarget : public ScriptWrappable { | 87 class EventTarget : public ScriptWrappable { |
| 90 DEFINE_WRAPPERTYPEINFO(); | 88 DEFINE_WRAPPERTYPEINFO(); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 typedef int thisIsHereToForceASemiColonAfterThisEventTargetMacro | 199 typedef int thisIsHereToForceASemiColonAfterThisEventTargetMacro |
| 202 #define DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(baseClass) DEFINE_EVENT_
TARGET_REFCOUNTING(baseClass) | 200 #define DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(baseClass) DEFINE_EVENT_
TARGET_REFCOUNTING(baseClass) |
| 203 #endif | 201 #endif |
| 204 | 202 |
| 205 // Use this macro if your EventTarget subclass is also a subclass of WTF::RefCou
nted. | 203 // Use this macro if your EventTarget subclass is also a subclass of WTF::RefCou
nted. |
| 206 // A ref-counted class that uses a different method of refcounting should use DE
FINE_EVENT_TARGET_REFCOUNTING directly. | 204 // A ref-counted class that uses a different method of refcounting should use DE
FINE_EVENT_TARGET_REFCOUNTING directly. |
| 207 // Both of these macros are meant to be placed just before the "public:" section
of the class declaration. | 205 // Both of these macros are meant to be placed just before the "public:" section
of the class declaration. |
| 208 #define REFCOUNTED_EVENT_TARGET(className) DEFINE_EVENT_TARGET_REFCOUNTING_WILL_
BE_REMOVED(RefCounted<className>) | 206 #define REFCOUNTED_EVENT_TARGET(className) DEFINE_EVENT_TARGET_REFCOUNTING_WILL_
BE_REMOVED(RefCounted<className>) |
| 209 | 207 |
| 210 #endif // EventTarget_h | 208 #endif // EventTarget_h |
| OLD | NEW |