Closed
Bug 363067
Opened 19 years ago
Closed 19 years ago
Add nsPIDOMEventTarget and kill nsIChromeEventHandler
Categories
(Core :: DOM: Events, defect)
Core
DOM: Events
Tracking
()
RESOLVED
FIXED
People
(Reporter: smaug, Assigned: smaug)
References
Details
Attachments
(2 files, 2 obsolete files)
|
110.92 KB,
patch
|
sicking
:
superreview+
|
Details | Diff | Splinter Review |
|
111.03 KB,
patch
|
Details | Diff | Splinter Review |
I think nsINode, nsGlobalWindow and nsWindowRoot could extend "nsPIDOMEventTarget". That interface should include all the methods
needed for event dispatching. This way nsIChromeEventHandler could
be removed and nsEventDispatcher simplified.
Patch coming.
| Assignee | ||
Comment 1•19 years ago
|
||
This saves few kBs on my x86_64 builds and reduces the size of nsXULElement.
| Assignee | ||
Comment 2•19 years ago
|
||
Comment on attachment 247826 [details] [diff] [review]
something like this
> nsresult
> nsContentUtils::GetListenerManager(nsINode *aNode,
> PRBool aCreateIfNotFound,
>- nsIEventListenerManager **aResult,
>- PRBool *aCreated)
>+ nsIEventListenerManager **aResult)
> {
> *aResult = nsnull;
>- *aCreated = PR_FALSE;
>
>+ if (!aCreateIfNotFound && !aNode->HasFlag(NODE_HAS_LISTENERMANAGER)) {
>+ *aResult = nsnull;
>+ return NS_OK;
+ *aResult = nsnull; isn't needed
>Index: xpfe/appshell/src/nsWebShellWindow.cpp
Changes to nsWebShellWindow.cpp aren't needed.
Comment 3•19 years ago
|
||
What is a PIDOMEventTarget? I know what DOMEventTarget means, but the PI part confuses me.
Comment 4•19 years ago
|
||
Hey, could we kill off nsIDOMEventReceiver in the process too? :)
Alex, look at the patch. This is an interface for the internal event dispatch methods.
| Assignee | ||
Comment 5•19 years ago
|
||
(In reply to comment #4)
> Hey, could we kill off nsIDOMEventReceiver in the process too? :)
Yes, yes!
But perhaps I could do that in a separate bug, please ;)
Comment 6•19 years ago
|
||
Sure thing. ;)
| Assignee | ||
Updated•19 years ago
|
Attachment #247826 -
Flags: review?(jst)
Please make HasFlag public rather than making nsContentUtils a friend.
| Assignee | ||
Comment 8•19 years ago
|
||
>
> >Index: xpfe/appshell/src/nsWebShellWindow.cpp
>
> Changes to nsWebShellWindow.cpp aren't needed.
>
Oops, yes those are needed.
| Assignee | ||
Comment 9•19 years ago
|
||
Attachment #247826 -
Attachment is obsolete: true
Attachment #249261 -
Flags: review?(jst)
Attachment #247826 -
Flags: review?(jst)
Comment 10•19 years ago
|
||
Comment on attachment 249261 [details] [diff] [review]
up-to-date
nsEventTargetChainItem::nsEventTargetChainItem(nsISupports* aTarget,
- PRBool aTargetIsChromeHandler,
nsEventTargetChainItem* aChild)
-: mNode(nsnull), mChild(aChild), mParent(nsnull), mFlags(0), mItemFlags(0)
+: mChild(aChild), mParent(nsnull), mFlags(0), mItemFlags(0)
{
[...]
+ mTarget = do_QueryInterface(aTarget);
This could also be initialized above combine calling the nsCOMPtr ctor w/o an argument and doing the assign here.
r=jst
Attachment #249261 -
Flags: review?(jst) → review+
| Assignee | ||
Updated•19 years ago
|
Attachment #249261 -
Flags: superreview?(bugmail)
| Assignee | ||
Comment 11•19 years ago
|
||
Now after Bug 333078, nsPIDOMEventTarget shouldn't inherit nsIDOMGCParticipant but nsISupports.
| Assignee | ||
Comment 12•19 years ago
|
||
Attachment #249261 -
Attachment is obsolete: true
Attachment #251889 -
Flags: superreview?(jonas)
Attachment #249261 -
Flags: superreview?(jonas)
Comment on attachment 251889 [details] [diff] [review]
up-to-date
You've left a few variables and functions named (Get|m|)ChromeEventHandler. Would be good to have those renamed, though if you want to do that as a separate file that's fine with me.
>Index: content/events/src/nsEventDispatcher.cpp
> nsEventTargetChainItem::nsEventTargetChainItem(nsISupports* aTarget,
>- PRBool aTargetIsChromeHandler,
> nsEventTargetChainItem* aChild)
>-: mNode(nsnull), mChild(aChild), mParent(nsnull), mFlags(0), mItemFlags(0)
>+: mChild(aChild), mParent(nsnull), mFlags(0), mItemFlags(0)
> {
...
>+ mTarget = do_QueryInterface(aTarget);
> }
You can put the mTarget initialization in the colon-list as well.
> nsEventTargetChainItem::CurrentTarget()
> {
...
>+ return mTarget;
> }
Inline this method?
>Index: docshell/base/nsDocShell.cpp
>+nsDocShell::GetChromeEventHandler(nsIDOMEventTarget** aChromeEventHandler)
> {
> NS_ENSURE_ARG_POINTER(aChromeEventHandler);
>-
>- *aChromeEventHandler = mChromeEventHandler;
>+ nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(mChromeEventHandler);
>+ *aChromeEventHandler = target;
> NS_IF_ADDREF(*aChromeEventHandler);
> return NS_OK;
> }
Use .swap here instead?
sr=me with that fixed.
Attachment #251889 -
Flags: superreview?(jonas) → superreview+
| Assignee | ||
Comment 14•19 years ago
|
||
| Assignee | ||
Updated•19 years ago
|
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•