Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(337)

Side by Side Diff: Source/core/events/EventTarget.h

Issue 203603005: Explicitly mark first 2 args of addEventListener/removeEventListener as optional (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update test result (addEventListener.length now 0, not 2) Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/events/EventTarget.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 void ref() { refEventTarget(); } 100 void ref() { refEventTarget(); }
101 void deref() { derefEventTarget(); } 101 void deref() { derefEventTarget(); }
102 102
103 virtual const AtomicString& interfaceName() const = 0; 103 virtual const AtomicString& interfaceName() const = 0;
104 virtual ExecutionContext* executionContext() const = 0; 104 virtual ExecutionContext* executionContext() const = 0;
105 105
106 virtual Node* toNode(); 106 virtual Node* toNode();
107 virtual DOMWindow* toDOMWindow(); 107 virtual DOMWindow* toDOMWindow();
108 virtual MessagePort* toMessagePort(); 108 virtual MessagePort* toMessagePort();
109 109
110 // FIXME: first 2 args to addEventListener and removeEventListener should
111 // be required (per spec), but throwing TypeError breaks legacy content.
112 // http://crbug.com/353484
113 bool addEventListener() { return false; }
114 bool addEventListener(const AtomicString& eventType) { return false; }
110 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<Even tListener>, bool useCapture = false); 115 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<Even tListener>, bool useCapture = false);
116 bool removeEventListener() { return false; }
117 bool removeEventListener(const AtomicString& eventType) { return false; }
111 virtual bool removeEventListener(const AtomicString& eventType, EventListene r*, bool useCapture = false); 118 virtual bool removeEventListener(const AtomicString& eventType, EventListene r*, bool useCapture = false);
112 virtual void removeAllEventListeners(); 119 virtual void removeAllEventListeners();
113 virtual bool dispatchEvent(PassRefPtr<Event>); 120 virtual bool dispatchEvent(PassRefPtr<Event>);
114 bool dispatchEvent(PassRefPtr<Event>, ExceptionState&); // DOM API 121 bool dispatchEvent(PassRefPtr<Event>, ExceptionState&); // DOM API
115 virtual void uncaughtExceptionInEventHandler(); 122 virtual void uncaughtExceptionInEventHandler();
116 123
117 // Used for legacy "onEvent" attribute APIs. 124 // Used for legacy "onEvent" attribute APIs.
118 bool setAttributeEventListener(const AtomicString& eventType, PassRefPtr<Eve ntListener>); 125 bool setAttributeEventListener(const AtomicString& eventType, PassRefPtr<Eve ntListener>);
119 EventListener* getAttributeEventListener(const AtomicString& eventType); 126 EventListener* getAttributeEventListener(const AtomicString& eventType);
120 127
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 virtual void refEventTarget() OVERRIDE FINAL { ref(); } \ 242 virtual void refEventTarget() OVERRIDE FINAL { ref(); } \
236 virtual void derefEventTarget() OVERRIDE FINAL { deref(); } \ 243 virtual void derefEventTarget() OVERRIDE FINAL { deref(); } \
237 typedef int thisIsHereToForceASemiColonAfterThisEventTargetMacro 244 typedef int thisIsHereToForceASemiColonAfterThisEventTargetMacro
238 245
239 // Use this macro if your EventTarget subclass is also a subclass of WTF::RefCou nted. 246 // Use this macro if your EventTarget subclass is also a subclass of WTF::RefCou nted.
240 // A ref-counted class that uses a different method of refcounting should use DE FINE_EVENT_TARGET_REFCOUNTING directly. 247 // A ref-counted class that uses a different method of refcounting should use DE FINE_EVENT_TARGET_REFCOUNTING directly.
241 // Both of these macros are meant to be placed just before the "public:" section of the class declaration. 248 // Both of these macros are meant to be placed just before the "public:" section of the class declaration.
242 #define REFCOUNTED_EVENT_TARGET(className) DEFINE_EVENT_TARGET_REFCOUNTING(RefCo unted<className>) 249 #define REFCOUNTED_EVENT_TARGET(className) DEFINE_EVENT_TARGET_REFCOUNTING(RefCo unted<className>)
243 250
244 #endif // EventTarget_h 251 #endif // EventTarget_h
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/events/EventTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698