From a5e0d161b274d396c9ef8ed99da89f6c7f0603b6 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Wed, 31 Mar 2010 08:50:20 -0400 Subject: [PATCH] Bug 253889: DeCOMtaminate nsIPresShell - Clean up unnecessary initialization in HandleEventWithTarget(). r=roc --HG-- extra : rebase_source : 88fa8550cb112139008f04bee4ed6a0a5c7cb415 --- layout/base/nsIPresShell.h | 24 +++++++++---------- layout/base/nsPresShell.cpp | 46 +++++++++++++++++++------------------ 2 files changed, 36 insertions(+), 34 deletions(-) diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h index 21a5aa57049..5f8efec8d75 100644 --- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -127,8 +127,8 @@ typedef struct CapturingContentInfo { } CapturingContentInfo; #define NS_IPRESSHELL_IID \ -{ 0x3c00dd85, 0xdc61, 0x4acc, \ - { 0xa4, 0x0e, 0x9b, 0x91, 0xd2, 0xea, 0x4b, 0x27 } } +{ 0x6736ae7e, 0x25f9, 0x4594, \ + { 0xb5, 0x26, 0x49, 0x39, 0x17, 0x63, 0x2f, 0x94 } } // Constants for ScrollContentIntoView() function #define NS_PRESSHELL_SCROLL_TOP 0 @@ -630,26 +630,26 @@ public: * Interface to dispatch events via the presshell * @note The caller must have a strong reference to the PresShell. */ - NS_IMETHOD HandleEventWithTarget(nsEvent* aEvent, - nsIFrame* aFrame, - nsIContent* aContent, - nsEventStatus* aStatus) = 0; + virtual NS_HIDDEN_(nsresult) HandleEventWithTarget(nsEvent* aEvent, + nsIFrame* aFrame, + nsIContent* aContent, + nsEventStatus* aStatus) = 0; /** * Dispatch event to content only (NOT full processing) * @note The caller must have a strong reference to the PresShell. */ - NS_IMETHOD HandleDOMEventWithTarget(nsIContent* aTargetContent, - nsEvent* aEvent, - nsEventStatus* aStatus) = 0; + virtual NS_HIDDEN_(nsresult) HandleDOMEventWithTarget(nsIContent* aTargetContent, + nsEvent* aEvent, + nsEventStatus* aStatus) = 0; /** * Dispatch event to content only (NOT full processing) * @note The caller must have a strong reference to the PresShell. */ - NS_IMETHOD HandleDOMEventWithTarget(nsIContent* aTargetContent, - nsIDOMEvent* aEvent, - nsEventStatus* aStatus) = 0; + virtual NS_HIDDEN_(nsresult) HandleDOMEventWithTarget(nsIContent* aTargetContent, + nsIDOMEvent* aEvent, + nsEventStatus* aStatus) = 0; /** * Gets the current target event frame from the PresShell diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index cc5bf2a19eb..f5b2b3169d6 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -752,9 +752,9 @@ public: virtual nsresult AddOverrideStyleSheet(nsIStyleSheet *aSheet); virtual nsresult RemoveOverrideStyleSheet(nsIStyleSheet *aSheet); - NS_IMETHOD HandleEventWithTarget(nsEvent* aEvent, nsIFrame* aFrame, - nsIContent* aContent, - nsEventStatus* aStatus); + virtual NS_HIDDEN_(nsresult) HandleEventWithTarget(nsEvent* aEvent, nsIFrame* aFrame, + nsIContent* aContent, + nsEventStatus* aStatus); virtual NS_HIDDEN_(nsIFrame*) GetEventTargetFrame(); virtual NS_HIDDEN_(already_AddRefed) GetEventTargetContent(nsEvent* aEvent); @@ -795,12 +795,12 @@ public: NS_IMETHOD HandleEvent(nsIView* aView, nsGUIEvent* aEvent, nsEventStatus* aEventStatus); - NS_IMETHOD HandleDOMEventWithTarget(nsIContent* aTargetContent, - nsEvent* aEvent, - nsEventStatus* aStatus); - NS_IMETHOD HandleDOMEventWithTarget(nsIContent* aTargetContent, - nsIDOMEvent* aEvent, - nsEventStatus* aStatus); + virtual NS_HIDDEN_(nsresult) HandleDOMEventWithTarget(nsIContent* aTargetContent, + nsEvent* aEvent, + nsEventStatus* aStatus); + virtual NS_HIDDEN_(nsresult) HandleDOMEventWithTarget(nsIContent* aTargetContent, + nsIDOMEvent* aEvent, + nsEventStatus* aStatus); NS_IMETHOD ResizeReflow(nsIView *aView, nscoord aWidth, nscoord aHeight); NS_IMETHOD_(PRBool) IsVisible(); NS_IMETHOD_(void) WillPaint(); @@ -6285,16 +6285,14 @@ PresShell::HandlePositionedEvent(nsIView* aView, return rv; } -NS_IMETHODIMP +nsresult PresShell::HandleEventWithTarget(nsEvent* aEvent, nsIFrame* aFrame, nsIContent* aContent, nsEventStatus* aStatus) { - nsresult ret; - PushCurrentEventInfo(aFrame, aContent); - ret = HandleEventInternal(aEvent, nsnull, aStatus); + nsresult rv = HandleEventInternal(aEvent, nsnull, aStatus); PopCurrentEventInfo(); - return NS_OK; + return rv; } static inline PRBool @@ -6466,10 +6464,12 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsIView *aView, // Dispatch event to content only (NOT full processing) // See also HandleEventWithTarget which does full event processing. -NS_IMETHODIMP +nsresult PresShell::HandleDOMEventWithTarget(nsIContent* aTargetContent, nsEvent* aEvent, nsEventStatus* aStatus) { + nsresult rv = NS_OK; + PushCurrentEventInfo(nsnull, aTargetContent); // Bug 41013: Check if the event should be dispatched to content. @@ -6481,29 +6481,31 @@ PresShell::HandleDOMEventWithTarget(nsIContent* aTargetContent, nsEvent* aEvent, if (container) { // Dispatch event to content - nsEventDispatcher::Dispatch(aTargetContent, mPresContext, aEvent, nsnull, - aStatus); + rv = nsEventDispatcher::Dispatch(aTargetContent, mPresContext, aEvent, nsnull, + aStatus); } PopCurrentEventInfo(); - return NS_OK; + return rv; } // See the method above. -NS_IMETHODIMP +nsresult PresShell::HandleDOMEventWithTarget(nsIContent* aTargetContent, nsIDOMEvent* aEvent, nsEventStatus* aStatus) { + nsresult rv = NS_OK; + PushCurrentEventInfo(nsnull, aTargetContent); nsCOMPtr container = mPresContext->GetContainer(); if (container) { - nsEventDispatcher::DispatchDOMEvent(aTargetContent, nsnull, aEvent, - mPresContext, aStatus); + rv = nsEventDispatcher::DispatchDOMEvent(aTargetContent, nsnull, aEvent, + mPresContext, aStatus); } PopCurrentEventInfo(); - return NS_OK; + return rv; } PRBool