diff --git a/content/events/src/nsDOMUIEvent.cpp b/content/events/src/nsDOMUIEvent.cpp index 90772904da84..459d5c05686c 100644 --- a/content/events/src/nsDOMUIEvent.cpp +++ b/content/events/src/nsDOMUIEvent.cpp @@ -142,6 +142,10 @@ nsPoint nsDOMUIEvent::GetClientPoint() { return nsPoint(0, 0); } + nsCOMPtr eventWidget = ((nsGUIEvent*)mEvent)->widget; + if (!eventWidget) + return mClientPoint; + //My god, man, there *must* be a better way to do this. nsCOMPtr docWidget; nsIPresShell *presShell = mPresContext->GetPresShell(); @@ -152,10 +156,6 @@ nsPoint nsDOMUIEvent::GetClientPoint() { } } - nsCOMPtr eventWidget = ((nsGUIEvent*)mEvent)->widget; - if (!eventWidget || !docWidget) - return mClientPoint; - nsPoint pt = mEvent->refPoint; // BUG 296004 (see also BUG 242833) diff --git a/content/events/src/nsEventListenerManager.cpp b/content/events/src/nsEventListenerManager.cpp index 3c3440230ea4..030ec1d763cc 100644 --- a/content/events/src/nsEventListenerManager.cpp +++ b/content/events/src/nsEventListenerManager.cpp @@ -1945,12 +1945,7 @@ nsEventListenerManager::FixContextMenuEvent(nsPresContext* aPresContext, nsEvent* aEvent, nsIDOMEvent** aDOMEvent) { - nsIPresShell* shell = aPresContext->GetPresShell(); - if (!shell) { - // Nothing to do. - return NS_OK; - } - + nsIPresShell* shell = aPresContext->PresShell(); nsresult ret = NS_OK; if (nsnull == *aDOMEvent) {