Closed Bug 133426 Opened 22 years ago Closed 22 years ago

can't get coordinates from popup events

Categories

(Core :: XUL, defect, P2)

defect

Tracking

()

VERIFIED FIXED
mozilla1.0

People

(Reporter: hewitt, Assigned: hewitt)

Details

Attachments

(1 file, 1 obsolete file)

A long time ago I checked in something to allow event.clientX/Y properties to
work for popup events ("onpopupshowing" etc...).  This caused a crash and had to
be backed out (see bug 120237).

I need to fix this again so that tree (outliner) tooltips can be supported.
nominating, AIM needs this in order to restore the buddy tooltips feature
Status: NEW → ASSIGNED
Keywords: nsbeta1
Priority: -- → P2
Target Milestone: --- → mozilla1.0
Attached patch patch (obsolete) — Splinter Review
Comment on attachment 76153 [details] [diff] [review]
patch

>       mEvent = PR_NEWZAP(nsMutationEvent);
>       mEvent->eventStructType = NS_MUTATION_EVENT;
>     }
>+    else if (eventType.EqualsIgnoreCase("PopupEvents")) {
>+      mEvent = PR_NEWZAP(nsEvent);
>+      mEvent->eventStructType = NS_POPUP_EVENT;
>+    }
[...]
> NS_METHOD nsDOMEvent::GetClientX(PRInt32* aClientX)
> {
>   if (!mEvent || 
>-       (mEvent->eventStructType != NS_MOUSE_EVENT && mEvent->eventStructType != NS_DRAGDROP_EVENT) ||
>+       (mEvent->eventStructType != NS_MOUSE_EVENT &&
>+        mEvent->eventStructType != NS_POPUP_EVENT &&
>+        mEvent->eventStructType != NS_DRAGDROP_EVENT) ||
>       !mPresContext) {
>     *aClientX = 0;
>     return NS_OK;

This will cause the exact same problem that caused the original fix for this to
be backed out. nsDOMEvent::GetScreen[X|Y]() casts mEvent to nsGUIEvent, but
you're creating nsEvent objects for "PopupEvents" events, and not nsGUIEvent
objects. That needs fixin', make the nsDOMEvent constructor create nsGUIEvent
objects for "PopupEvents" events.

>-nsXULTooltipListener::GetTargetOutlinerBoxObject(nsIOutlinerBoxObject** aBoxObject)
>+nsXULTooltipListener::GetSourceOutlinerBoxObject(nsIOutlinerBoxObject** aBoxObject)
> {

This method needs to default *aBoxObject to nsnull.

[...]
>+  if (mIsSourceOutliner && mSourceNode) {
>+    nsCOMPtr<nsIContent> outlinerParent;
>+    mSourceNode->GetParent(*getter_AddRefs(outlinerParent));
>+    if (outlinerParent) {
>+      nsCOMPtr<nsIDOMXULElement> xulEl(do_QueryInterface(outlinerParent));

The above if (outlinerParent) check is unnecessary, do_QueryInterface() is null
safe.

>+      if (xulEl) {
>+        nsCOMPtr<nsIBoxObject> bx;
>+        xulEl->GetBoxObject(getter_AddRefs(bx));
>+        nsCOMPtr<nsIOutlinerBoxObject> obx(do_QueryInterface(bx));
>+        if (obx) {
>+          *aBoxObject = obx;
>+          NS_ADDREF(*aBoxObject);
>+          return NS_OK;
>+        }
>       }
>-    }
>+  }
>   }
>   return NS_ERROR_FAILURE;
> }

sr=jst if you fix that.
Attachment #76153 - Flags: superreview+
Attached patch new patchSplinter Review
Attachment #76153 - Attachment is obsolete: true
Comment on attachment 76337 [details] [diff] [review]
new patch

carrying over sr=jst
Attachment #76337 - Flags: superreview+
Comment on attachment 76337 [details] [diff] [review]
new patch

r=jgaunt
Attachment #76337 - Flags: review+
Comment on attachment 76337 [details] [diff] [review]
new patch

a=asa (on behalf of drivers) for checkin to the 1.0 trunk
Attachment #76337 - Flags: approval+
feexed
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Keywords: nsbeta1nsbeta1+
v(stamp)
Status: RESOLVED → VERIFIED
Component: XP Toolkit/Widgets: Menus → XUL
QA Contact: shrir → xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: