diff --git a/mozilla/layout/base/nsPresShell.cpp b/mozilla/layout/base/nsPresShell.cpp index 2ce1d2350f1..ded6ffdd8d1 100644 --- a/mozilla/layout/base/nsPresShell.cpp +++ b/mozilla/layout/base/nsPresShell.cpp @@ -5960,31 +5960,19 @@ PresShell::HandleEvent(nsIView *aView, aHandled = PR_FALSE; rv = NS_OK; } else { + rv = NS_OK; nsPoint eventPoint; eventPoint = nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent, frame); - // XXX Until GetFrameForPoint is cleaned up, we need to account for the - // weird input the function takes. These adjustments counteract the - // adjustments GetFrameForPoint makes. - eventPoint += frame->GetPosition(); - nsPoint originOffset; - nsIView *view = nsnull; - frame->GetOriginToViewOffset(originOffset, &view); - NS_ASSERTION(view == aView, "view != aView"); - if (view == aView) - eventPoint -= originOffset; - rv = frame->GetFrameForPoint(eventPoint, - NS_FRAME_PAINT_LAYER_FOREGROUND, - &mCurrentEventFrame); - if (NS_FAILED(rv)) { - rv = frame->GetFrameForPoint(eventPoint, - NS_FRAME_PAINT_LAYER_FLOATS, - &mCurrentEventFrame); - if (NS_FAILED(rv)) { - rv = frame->GetFrameForPoint(eventPoint, - NS_FRAME_PAINT_LAYER_BACKGROUND, - &mCurrentEventFrame); - if (NS_FAILED (rv)) { + mCurrentEventFrame = frame->GetFrameForPoint(eventPoint, + NS_FRAME_PAINT_LAYER_FOREGROUND); + if (!mCurrentEventFrame) { + mCurrentEventFrame = frame->GetFrameForPoint(eventPoint, + NS_FRAME_PAINT_LAYER_FLOATS); + if (!mCurrentEventFrame) { + mCurrentEventFrame = frame->GetFrameForPoint(eventPoint, + NS_FRAME_PAINT_LAYER_BACKGROUND); + if (!mCurrentEventFrame) { if (aForceHandle) { mCurrentEventFrame = frame; } @@ -5992,7 +5980,6 @@ PresShell::HandleEvent(nsIView *aView, mCurrentEventFrame = nsnull; } aHandled = PR_FALSE; - rv = NS_OK; } } } diff --git a/mozilla/layout/forms/nsComboboxControlFrame.cpp b/mozilla/layout/forms/nsComboboxControlFrame.cpp index 1a64d65ab5c..1a73317da08 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.cpp +++ b/mozilla/layout/forms/nsComboboxControlFrame.cpp @@ -1633,10 +1633,9 @@ nsComboboxControlFrame::GetName(nsAString* aResult) return nsFormControlHelper::GetName(mContent, aResult); } -NS_IMETHODIMP +nsIFrame* nsComboboxControlFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) + nsFramePaintLayer aWhichLayer) { // The button is getting the hover events so... // None of the children frames of the combobox get @@ -1654,14 +1653,7 @@ nsComboboxControlFrame::GetFrameForPoint(const nsPoint& aPoint, // Now the functionality of the OPTIONs depends on the SELECT // being visible. Oh well... - if ( mRect.Contains(aPoint) && - (aWhichLayer == NS_FRAME_PAINT_LAYER_FOREGROUND) ) { - if (GetStyleVisibility()->IsVisible()) { - *aFrame = this; - return NS_OK; - } - } - return NS_ERROR_FAILURE; + return nsFrame::GetFrameForPoint(aPoint, aWhichLayer); } diff --git a/mozilla/layout/forms/nsComboboxControlFrame.h b/mozilla/layout/forms/nsComboboxControlFrame.h index 6e5d7f60eae..3ecc82d04b3 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.h +++ b/mozilla/layout/forms/nsComboboxControlFrame.h @@ -138,7 +138,8 @@ public: nsIFrame* aChildList); virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const; - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, nsFramePaintLayer aWhichLayer, nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); virtual nsIFrame* GetContentInsertionFrame(); diff --git a/mozilla/layout/forms/nsFieldSetFrame.cpp b/mozilla/layout/forms/nsFieldSetFrame.cpp index f48e214d877..70a5456019f 100644 --- a/mozilla/layout/forms/nsFieldSetFrame.cpp +++ b/mozilla/layout/forms/nsFieldSetFrame.cpp @@ -98,9 +98,8 @@ public: nsIFrame* aOldFrame, nsIFrame* aNewFrame); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); virtual nsIAtom* GetType() const; virtual PRBool IsContainingBlock() const; @@ -666,13 +665,13 @@ nsFieldSetFrame::ReplaceFrame(nsIAtom* aListName, return mContentFrame->ReplaceFrame(aListName, aOldFrame, aNewFrame); } -NS_IMETHODIMP -nsFieldSetFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) +nsIFrame* +nsFieldSetFrame::GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer) { // this should act like a block, so we need to override - return GetFrameForPointUsing(aPoint, nsnull, aWhichLayer, (aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND), aFrame); + return GetFrameForPointUsing(aPoint, nsnull, aWhichLayer, + aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND); } #ifdef ACCESSIBILITY diff --git a/mozilla/layout/forms/nsFileControlFrame.cpp b/mozilla/layout/forms/nsFileControlFrame.cpp index 7b0973a2f6c..7bda7d4d007 100644 --- a/mozilla/layout/forms/nsFileControlFrame.cpp +++ b/mozilla/layout/forms/nsFileControlFrame.cpp @@ -578,22 +578,21 @@ nsFileControlFrame::IsLeaf() const return PR_TRUE; } -NS_IMETHODIMP +nsIFrame* nsFileControlFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) + nsFramePaintLayer aWhichLayer) { #ifndef DEBUG_NEWFRAME - if ( nsFormControlHelper::GetDisabled(mContent) && mRect.Contains(aPoint) ) { + nsRect thisRect(nsPoint(0,0), GetSize()); + if (nsFormControlHelper::GetDisabled(mContent) && thisRect.Contains(aPoint)) { if (GetStyleVisibility()->IsVisible()) { - *aFrame = this; - return NS_OK; + return this; } } else { - return nsAreaFrame::GetFrameForPoint(aPoint, aWhichLayer, aFrame); + return nsAreaFrame::GetFrameForPoint(aPoint, aWhichLayer); } #endif - return NS_ERROR_FAILURE; + return nsnull; } #ifdef NS_DEBUG diff --git a/mozilla/layout/forms/nsFileControlFrame.h b/mozilla/layout/forms/nsFileControlFrame.h index 53f728efe63..cead4c81a97 100644 --- a/mozilla/layout/forms/nsFileControlFrame.h +++ b/mozilla/layout/forms/nsFileControlFrame.h @@ -93,7 +93,8 @@ public: NS_IMETHOD GetFrameName(nsAString& aResult) const; #endif NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight) { return NS_OK; }; - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, nsFramePaintLayer aWhichLayer, nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRInt32 aModType); diff --git a/mozilla/layout/forms/nsFormControlFrame.cpp b/mozilla/layout/forms/nsFormControlFrame.cpp index 95876fc83a8..e00cef65628 100644 --- a/mozilla/layout/forms/nsFormControlFrame.cpp +++ b/mozilla/layout/forms/nsFormControlFrame.cpp @@ -431,25 +431,24 @@ nsFormControlFrame::Paint(nsPresContext* aPresContext, return rv; } -NS_IMETHODIMP +nsIFrame* nsFormControlFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) + nsFramePaintLayer aWhichLayer) { - nsresult rv = NS_ERROR_FAILURE; + nsIFrame* frame = nsnull; if (aWhichLayer == NS_FRAME_PAINT_LAYER_FOREGROUND) { - rv = nsLeafFrame::GetFrameForPoint(aPoint, - NS_FRAME_PAINT_LAYER_FOREGROUND, aFrame); - if (NS_SUCCEEDED(rv)) - return NS_OK; - rv = nsLeafFrame::GetFrameForPoint(aPoint, - NS_FRAME_PAINT_LAYER_FLOATS, aFrame); - if (NS_SUCCEEDED(rv)) - return NS_OK; - rv = nsLeafFrame::GetFrameForPoint(aPoint, - NS_FRAME_PAINT_LAYER_BACKGROUND, aFrame); + frame = nsLeafFrame::GetFrameForPoint(aPoint, + NS_FRAME_PAINT_LAYER_FOREGROUND); + if (frame) + return frame; + frame = nsLeafFrame::GetFrameForPoint(aPoint, + NS_FRAME_PAINT_LAYER_FLOATS); + if (frame) + return frame; + frame = nsLeafFrame::GetFrameForPoint(aPoint, + NS_FRAME_PAINT_LAYER_BACKGROUND); } - return rv; + return frame; } void diff --git a/mozilla/layout/forms/nsFormControlFrame.h b/mozilla/layout/forms/nsFormControlFrame.h index cfb134aad1a..75b266fbfb1 100644 --- a/mozilla/layout/forms/nsFormControlFrame.h +++ b/mozilla/layout/forms/nsFormControlFrame.h @@ -114,9 +114,8 @@ public: nsFramePaintLayer aWhichLayer, PRUint32 aFlags = 0); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); NS_IMETHOD SetInitialChildList(nsPresContext* aPresContext, nsIAtom* aListName, diff --git a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp index c90bb77138c..c0aa90b60b4 100644 --- a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp @@ -278,19 +278,16 @@ nsHTMLButtonControlFrame::HandleEvent(nsPresContext* aPresContext, } -NS_IMETHODIMP +nsIFrame* nsHTMLButtonControlFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) + nsFramePaintLayer aWhichLayer) { + nsRect thisRect(nsPoint(0,0), GetSize()); if (aWhichLayer == NS_FRAME_PAINT_LAYER_FOREGROUND && - mRect.Contains(aPoint)) { - if (GetStyleVisibility()->IsVisible()) { - *aFrame = this; - return NS_OK; - } + thisRect.Contains(aPoint) && GetStyleVisibility()->IsVisible()) { + return this; } - return NS_ERROR_FAILURE; + return nsnull; } NS_IMETHODIMP diff --git a/mozilla/layout/forms/nsHTMLButtonControlFrame.h b/mozilla/layout/forms/nsHTMLButtonControlFrame.h index 294f1d688eb..762a7af84f7 100644 --- a/mozilla/layout/forms/nsHTMLButtonControlFrame.h +++ b/mozilla/layout/forms/nsHTMLButtonControlFrame.h @@ -85,7 +85,8 @@ public: nsGUIEvent* aEvent, nsEventStatus* aEventStatus); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, nsFramePaintLayer aWhichLayer, nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); NS_IMETHOD SetInitialChildList(nsPresContext* aPresContext, nsIAtom* aListName, diff --git a/mozilla/layout/forms/nsSelectsAreaFrame.cpp b/mozilla/layout/forms/nsSelectsAreaFrame.cpp index 416f68fcd5b..2abd2903b05 100644 --- a/mozilla/layout/forms/nsSelectsAreaFrame.cpp +++ b/mozilla/layout/forms/nsSelectsAreaFrame.cpp @@ -102,32 +102,31 @@ nsSelectsAreaFrame::IsOptionElementFrame(nsIFrame *aFrame) } //--------------------------------------------------------- -NS_IMETHODIMP +nsIFrame* nsSelectsAreaFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) + nsFramePaintLayer aWhichLayer) { + nsRect thisRect(nsPoint(0,0), GetSize()); + PRBool inThisFrame = thisRect.Contains(aPoint); - PRBool inThisFrame = mRect.Contains(aPoint); - - if (!((mState & NS_FRAME_OUTSIDE_CHILDREN) || inThisFrame )) { - return NS_ERROR_FAILURE; + if (!((mState & NS_FRAME_OUTSIDE_CHILDREN) || inThisFrame)) { + return nsnull; } - nsresult result = nsAreaFrame::GetFrameForPoint(aPoint, aWhichLayer, aFrame); + nsIFrame* frame = nsAreaFrame::GetFrameForPoint(aPoint, aWhichLayer); - if (result == NS_OK) { - nsIFrame* selectedFrame = *aFrame; + if (frame) { + nsIFrame* selectedFrame = frame; while (selectedFrame && !IsOptionElementFrame(selectedFrame)) { selectedFrame = selectedFrame->GetParent(); - } + } if (selectedFrame) { - *aFrame = selectedFrame; + return selectedFrame; } // else, keep the original result as *aFrame, which could be this frame } - return result; + return frame; } NS_IMETHODIMP diff --git a/mozilla/layout/forms/nsSelectsAreaFrame.h b/mozilla/layout/forms/nsSelectsAreaFrame.h index 10f1e561fc3..e3a0f5eff4d 100644 --- a/mozilla/layout/forms/nsSelectsAreaFrame.h +++ b/mozilla/layout/forms/nsSelectsAreaFrame.h @@ -54,7 +54,8 @@ public: // nsISupports //NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, nsFramePaintLayer aWhichLayer, nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); NS_IMETHOD Paint(nsPresContext* aPresContext, nsIRenderingContext& aRenderingContext, diff --git a/mozilla/layout/forms/nsTextControlFrame.cpp b/mozilla/layout/forms/nsTextControlFrame.cpp index e1037f8c887..2ab0b3091c5 100644 --- a/mozilla/layout/forms/nsTextControlFrame.cpp +++ b/mozilla/layout/forms/nsTextControlFrame.cpp @@ -2096,25 +2096,24 @@ nsTextControlFrame::Paint(nsPresContext* aPresContext, return rv; } -NS_IMETHODIMP +nsIFrame* nsTextControlFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) + nsFramePaintLayer aWhichLayer) { - nsresult rv = NS_ERROR_FAILURE; + nsIFrame* frame = nsnull; if (aWhichLayer == NS_FRAME_PAINT_LAYER_FOREGROUND) { - rv = nsStackFrame::GetFrameForPoint(aPoint, - NS_FRAME_PAINT_LAYER_FOREGROUND, aFrame); - if (NS_SUCCEEDED(rv)) - return NS_OK; - rv = nsStackFrame::GetFrameForPoint(aPoint, - NS_FRAME_PAINT_LAYER_FLOATS, aFrame); - if (NS_SUCCEEDED(rv)) - return NS_OK; - rv = nsStackFrame::GetFrameForPoint(aPoint, - NS_FRAME_PAINT_LAYER_BACKGROUND, aFrame); + frame = nsStackFrame::GetFrameForPoint(aPoint, + NS_FRAME_PAINT_LAYER_FOREGROUND); + if (frame) + return frame; + frame = nsStackFrame::GetFrameForPoint(aPoint, + NS_FRAME_PAINT_LAYER_FLOATS); + if (frame) + return frame; + frame = nsStackFrame::GetFrameForPoint(aPoint, + NS_FRAME_PAINT_LAYER_BACKGROUND); } - return rv; + return frame; } NS_IMETHODIMP diff --git a/mozilla/layout/forms/nsTextControlFrame.h b/mozilla/layout/forms/nsTextControlFrame.h index e6942e57d57..e30be494495 100644 --- a/mozilla/layout/forms/nsTextControlFrame.h +++ b/mozilla/layout/forms/nsTextControlFrame.h @@ -89,9 +89,8 @@ public: nsFramePaintLayer aWhichLayer, PRUint32 aFlags = 0); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); NS_IMETHOD HandleEvent(nsPresContext* aPresContext, nsGUIEvent* aEvent, diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index 29f21844c76..6281a5e0f40 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/layout/generic/nsBlockFrame.cpp @@ -6736,56 +6736,46 @@ nsLineBox* nsBlockFrame::GetFirstLineContaining(nscoord y) { return cursor.get(); } -static inline void -GetFrameFromLine(const nsRect& aLineArea, const nsPoint& aTmp, +static inline nsIFrame* +GetFrameFromLine(nsIFrame* aBlock, const nsRect& aLineArea, const nsPoint& aTmp, nsBlockFrame::line_iterator& aLine, - nsFramePaintLayer aWhichLayer, nsIFrame** aFrame) { + nsFramePaintLayer aWhichLayer) { + nsIFrame* frame = nsnull; if (aLineArea.Contains(aTmp)) { nsIFrame* kid = aLine->mFirstChild; PRInt32 n = aLine->GetChildCount(); while (--n >= 0) { - nsIFrame *hit; - nsresult rv = kid->GetFrameForPoint(aTmp, aWhichLayer, &hit); - - if (NS_SUCCEEDED(rv) && hit) { - *aFrame = hit; - } + nsIFrame *hit = kid->GetFrameForPoint(aTmp - kid->GetOffsetTo(aBlock), + aWhichLayer); + if (hit) + frame = hit; kid = kid->GetNextSibling(); } } + return frame; } // Optimized function that uses line combined areas to skip lines // we know can't contain the point -nsresult +nsIFrame* nsBlockFrame::GetFrameForPointUsing(const nsPoint& aPoint, nsIAtom* aList, nsFramePaintLayer aWhichLayer, - PRBool aConsiderSelf, - nsIFrame** aFrame) + PRBool aConsiderSelf) { - if (aList) { - return nsContainerFrame::GetFrameForPointUsing(aPoint, - aList, aWhichLayer, aConsiderSelf, aFrame); + if (aList) + return nsContainerFrame::GetFrameForPointUsing(aPoint, aList, aWhichLayer, + aConsiderSelf); + + nsRect thisRect(nsPoint(0,0), GetSize()); + nsIFrame* frame = nsnull; + PRBool inThisFrame = thisRect.Contains(aPoint); + + if (!((mState & NS_FRAME_OUTSIDE_CHILDREN) || inThisFrame)) { + return nsnull; } - PRBool inThisFrame = mRect.Contains(aPoint); - - if (! ((mState & NS_FRAME_OUTSIDE_CHILDREN) || inThisFrame ) ) { - return NS_ERROR_FAILURE; - } - - *aFrame = nsnull; - nsPoint tmp(aPoint.x - mRect.x, aPoint.y - mRect.y); - - nsPoint originOffset; - nsIView *view = nsnull; - nsresult rv = GetOriginToViewOffset(originOffset, &view); - - if (NS_SUCCEEDED(rv) && view) - tmp += originOffset; - - nsLineBox* cursor = GetFirstLineContaining(tmp.y); + nsLineBox* cursor = GetFirstLineContaining(aPoint.y); line_iterator line_end = end_lines(); if (cursor) { @@ -6797,10 +6787,13 @@ nsBlockFrame::GetFrameForPointUsing(const nsPoint& aPoint, // Because we have a cursor, the combinedArea.ys are non-decreasing. // Once we've passed tmp.y, we can never see it again. if (!lineArea.IsEmpty()) { - if (lineArea.y > tmp.y) { + if (lineArea.y > aPoint.y) { break; } - GetFrameFromLine(lineArea, tmp, line, aWhichLayer, aFrame); + nsIFrame* hit = GetFrameFromLine(this, lineArea, aPoint, line, + aWhichLayer); + if (hit) + frame = hit; } } } else { @@ -6820,7 +6813,10 @@ nsBlockFrame::GetFrameForPointUsing(const nsPoint& aPoint, lastY = lineArea.y; lastYMost = lineArea.YMost(); - GetFrameFromLine(lineArea, tmp, line, aWhichLayer, aFrame); + nsIFrame* hit = GetFrameFromLine(this, lineArea, aPoint, line, + aWhichLayer); + if (hit) + frame = hit; } lineCount++; } @@ -6830,71 +6826,53 @@ nsBlockFrame::GetFrameForPointUsing(const nsPoint& aPoint, } } - if (*aFrame) { - return NS_OK; - } + if (frame) + return frame; - if ( inThisFrame && aConsiderSelf ) { - if (GetStyleVisibility()->IsVisible()) { - *aFrame = this; - return NS_OK; - } - } + if (inThisFrame && aConsiderSelf && GetStyleVisibility()->IsVisible()) + return this; - return NS_ERROR_FAILURE; + return nsnull; } -NS_IMETHODIMP +nsIFrame* nsBlockFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) + nsFramePaintLayer aWhichLayer) { - nsresult rv; + nsIFrame* frame; switch (aWhichLayer) { case NS_FRAME_PAINT_LAYER_FOREGROUND: - rv = GetFrameForPointUsing(aPoint, nsnull, - NS_FRAME_PAINT_LAYER_FOREGROUND, PR_FALSE, - aFrame); - if (NS_OK == rv) { - return NS_OK; - } - if (nsnull != mBullet) { - rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::bulletList, - NS_FRAME_PAINT_LAYER_FOREGROUND, PR_FALSE, - aFrame); - } - return rv; - break; + frame = GetFrameForPointUsing(aPoint, nsnull, + NS_FRAME_PAINT_LAYER_FOREGROUND, PR_FALSE); + if (frame) + return frame; + if (mBullet) + return GetFrameForPointUsing(aPoint, nsLayoutAtoms::bulletList, + NS_FRAME_PAINT_LAYER_FOREGROUND, + PR_FALSE); + return nsnull; case NS_FRAME_PAINT_LAYER_FLOATS: // we painted our floats before our children, and thus // we should check floats within children first - rv = GetFrameForPointUsing(aPoint, nsnull, - NS_FRAME_PAINT_LAYER_FLOATS, PR_FALSE, - aFrame); - if (NS_OK == rv) { - return NS_OK; - } - if (mFloats.NotEmpty()) { + frame = GetFrameForPointUsing(aPoint, nsnull, + NS_FRAME_PAINT_LAYER_FLOATS, PR_FALSE); + if (frame) + return frame; + if (mFloats.NotEmpty()) return GetFrameForPointUsing(aPoint, nsLayoutAtoms::floatList, - NS_FRAME_PAINT_LAYER_ALL, PR_FALSE, - aFrame); - } else { - return NS_ERROR_FAILURE; - } - break; + NS_FRAME_PAINT_LAYER_ALL, PR_FALSE); + return nsnull; case NS_FRAME_PAINT_LAYER_BACKGROUND: - // we're a block, so PR_TRUE for consider self + // Because this frame is a block, pass PR_TRUE to consider this frame return GetFrameForPointUsing(aPoint, nsnull, - NS_FRAME_PAINT_LAYER_BACKGROUND, PR_TRUE, - aFrame); - break; + NS_FRAME_PAINT_LAYER_BACKGROUND, PR_TRUE); } // we shouldn't get here - NS_ASSERTION(PR_FALSE, "aWhichLayer was not understood"); - return NS_ERROR_FAILURE; + NS_NOTREACHED("aWhichLayer was not understood"); + return nsnull; } NS_IMETHODIMP diff --git a/mozilla/layout/generic/nsBlockFrame.h b/mozilla/layout/generic/nsBlockFrame.h index ada37810bbf..6dd2dbee1d7 100644 --- a/mozilla/layout/generic/nsBlockFrame.h +++ b/mozilla/layout/generic/nsBlockFrame.h @@ -200,12 +200,12 @@ public: // are non-decreasing. void SetupLineCursor(); - nsresult GetFrameForPointUsing(const nsPoint& aPoint, - nsIAtom* aList, - nsFramePaintLayer aWhichLayer, - PRBool aConsiderSelf, - nsIFrame** aFrame); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, nsFramePaintLayer aWhichLayer, nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPointUsing(const nsPoint& aPoint, + nsIAtom* aList, + nsFramePaintLayer aWhichLayer, + PRBool aConsiderSelf); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); NS_IMETHOD HandleEvent(nsPresContext* aPresContext, nsGUIEvent* aEvent, nsEventStatus* aEventStatus); diff --git a/mozilla/layout/generic/nsColumnSetFrame.cpp b/mozilla/layout/generic/nsColumnSetFrame.cpp index f09aed139d5..4088a2bbd2c 100644 --- a/mozilla/layout/generic/nsColumnSetFrame.cpp +++ b/mozilla/layout/generic/nsColumnSetFrame.cpp @@ -69,9 +69,8 @@ public: NS_IMETHOD RemoveFrame(nsIAtom* aListName, nsIFrame* aOldFrame); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); virtual nsIFrame* GetContentInsertionFrame() { return GetFirstChild(nsnull)->GetContentInsertionFrame(); @@ -168,14 +167,13 @@ nsColumnSetFrame::GetType() const return nsLayoutAtoms::columnSetFrame; } -NS_IMETHODIMP +nsIFrame* nsColumnSetFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) + nsFramePaintLayer aWhichLayer) { // This frame counts as part of the background. return GetFrameForPointUsing(aPoint, nsnull, aWhichLayer, - (aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND), aFrame); + aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND); } NS_IMETHODIMP diff --git a/mozilla/layout/generic/nsContainerFrame.cpp b/mozilla/layout/generic/nsContainerFrame.cpp index 79ba53020d3..32c81fb54b6 100644 --- a/mozilla/layout/generic/nsContainerFrame.cpp +++ b/mozilla/layout/generic/nsContainerFrame.cpp @@ -293,73 +293,60 @@ nsContainerFrame::PaintChild(nsPresContext* aPresContext, } } -NS_IMETHODIMP +nsIFrame* nsContainerFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) + nsFramePaintLayer aWhichLayer) { - return GetFrameForPointUsing(aPoint, nsnull, aWhichLayer, (aWhichLayer == NS_FRAME_PAINT_LAYER_FOREGROUND), aFrame); + return GetFrameForPointUsing(aPoint, nsnull, aWhichLayer, + aWhichLayer == NS_FRAME_PAINT_LAYER_FOREGROUND); } -nsresult +nsIFrame* nsContainerFrame::GetFrameForPointUsing(const nsPoint& aPoint, nsIAtom* aList, nsFramePaintLayer aWhichLayer, - PRBool aConsiderSelf, - nsIFrame** aFrame) + PRBool aConsiderSelf) { - nsIFrame *hit; - nsPoint tmp; + nsRect thisRect(nsPoint(0,0), GetSize()); + PRBool inThisFrame = thisRect.Contains(aPoint); - PRBool inThisFrame = mRect.Contains(aPoint); - - if (! ((mState & NS_FRAME_OUTSIDE_CHILDREN) || inThisFrame ) ) { - return NS_ERROR_FAILURE; - } + if (!((mState & NS_FRAME_OUTSIDE_CHILDREN) || inThisFrame)) + return nsnull; + nsIFrame* frame = nsnull; nsIFrame* kid = GetFirstChild(aList); - *aFrame = nsnull; - tmp.MoveTo(aPoint.x - mRect.x, aPoint.y - mRect.y); - - nsPoint originOffset; - nsIView *view = nsnull; - nsresult rv = GetOriginToViewOffset(originOffset, &view); - - if (NS_SUCCEEDED(rv) && view) - tmp += originOffset; while (kid) { + nsIFrame* hit; + nsPoint kidPoint = aPoint - kid->GetOffsetTo(this); if (aWhichLayer == NS_FRAME_PAINT_LAYER_ALL) { // Check all layers on this kid before moving on to the next one - rv = kid->GetFrameForPoint(tmp, NS_FRAME_PAINT_LAYER_FOREGROUND, &hit); - if (NS_FAILED(rv) || !hit) { - rv = kid->GetFrameForPoint(tmp, NS_FRAME_PAINT_LAYER_FLOATS, &hit); - if (NS_FAILED(rv) || !hit) { - rv = kid->GetFrameForPoint(tmp, NS_FRAME_PAINT_LAYER_BACKGROUND, &hit); + hit = kid->GetFrameForPoint(kidPoint, + NS_FRAME_PAINT_LAYER_FOREGROUND); + if (!hit) { + hit = kid->GetFrameForPoint(kidPoint, + NS_FRAME_PAINT_LAYER_FLOATS); + if (!hit) { + hit = kid->GetFrameForPoint(kidPoint, + NS_FRAME_PAINT_LAYER_BACKGROUND); } } } else { - rv = kid->GetFrameForPoint(tmp, aWhichLayer, &hit); + hit = kid->GetFrameForPoint(kidPoint, aWhichLayer); } - if (NS_SUCCEEDED(rv) && hit) { - *aFrame = hit; - } + if (hit) + frame = hit; kid = kid->GetNextSibling(); } - if (*aFrame) { - return NS_OK; - } + if (frame) + return frame; - if ( inThisFrame && aConsiderSelf ) { - if (GetStyleVisibility()->IsVisible()) { - *aFrame = this; - return NS_OK; - } - } + if (inThisFrame && aConsiderSelf && GetStyleVisibility()->IsVisible()) + return this; - return NS_ERROR_FAILURE; + return nsnull; } NS_IMETHODIMP diff --git a/mozilla/layout/generic/nsContainerFrame.h b/mozilla/layout/generic/nsContainerFrame.h index d4537fc8cb3..431bacc1b9a 100644 --- a/mozilla/layout/generic/nsContainerFrame.h +++ b/mozilla/layout/generic/nsContainerFrame.h @@ -70,9 +70,8 @@ public: const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer, PRUint32 aFlags = 0); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); NS_IMETHOD ReplaceFrame(nsIAtom* aListName, nsIFrame* aOldFrame, nsIFrame* aNewFrame); @@ -187,11 +186,10 @@ protected: nsContainerFrame(); ~nsContainerFrame(); - nsresult GetFrameForPointUsing(const nsPoint& aPoint, - nsIAtom* aList, - nsFramePaintLayer aWhichLayer, - PRBool aConsiderSelf, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPointUsing(const nsPoint& aPoint, + nsIAtom* aList, + nsFramePaintLayer aWhichLayer, + PRBool aConsiderSelf); virtual void PaintChildren(nsPresContext* aPresContext, nsIRenderingContext& aRenderingContext, diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index be0dbdff3b9..d178cac9d33 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -2057,19 +2057,16 @@ nsFrame::GetCursor(const nsPoint& aPoint, return NS_OK; } -NS_IMETHODIMP +nsIFrame* nsFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) + nsFramePaintLayer aWhichLayer) { - if ((aWhichLayer == NS_FRAME_PAINT_LAYER_FOREGROUND) && - (mRect.Contains(aPoint))) { - if (GetStyleVisibility()->IsVisible()) { - *aFrame = this; - return NS_OK; - } + nsRect thisRect(nsPoint(0,0), GetSize()); + if (aWhichLayer == NS_FRAME_PAINT_LAYER_FOREGROUND && + thisRect.Contains(aPoint) && GetStyleVisibility()->IsVisible()) { + return this; } - return NS_ERROR_FAILURE; + return nsnull; } // Resize and incremental reflow diff --git a/mozilla/layout/generic/nsFrame.h b/mozilla/layout/generic/nsFrame.h index 16bb3d552b5..c3d93144005 100644 --- a/mozilla/layout/generic/nsFrame.h +++ b/mozilla/layout/generic/nsFrame.h @@ -200,9 +200,8 @@ public: nsIContent** aContent); NS_IMETHOD GetCursor(const nsPoint& aPoint, nsIFrame::Cursor& aCursor); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); NS_IMETHOD GetPointFromOffset(nsPresContext* inPresContext, nsIRenderingContext* inRendContext, diff --git a/mozilla/layout/generic/nsFrameSetFrame.cpp b/mozilla/layout/generic/nsFrameSetFrame.cpp index 59041ba8e71..0cd5e18aff2 100644 --- a/mozilla/layout/generic/nsFrameSetFrame.cpp +++ b/mozilla/layout/generic/nsFrameSetFrame.cpp @@ -135,9 +135,8 @@ public: nsGUIEvent* aEvent, nsEventStatus* aEventStatus); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); NS_IMETHOD GetCursor(const nsPoint& aPoint, nsIFrame::Cursor& aCursor); @@ -840,18 +839,14 @@ nsHTMLFramesetFrame::GetCursor(const nsPoint& aPoint, return NS_OK; } -NS_IMETHODIMP +nsIFrame* nsHTMLFramesetFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) + nsFramePaintLayer aWhichLayer) { //XXX Temporary to deal with event handling in both this and FramsetBorderFrame - if (mDragger) { - *aFrame = this; - return NS_OK; - } else { - return nsContainerFrame::GetFrameForPoint(aPoint, aWhichLayer, aFrame); - } + if (mDragger) + return this; + return nsContainerFrame::GetFrameForPoint(aPoint, aWhichLayer); } NS_IMETHODIMP @@ -1761,19 +1756,15 @@ nsHTMLFramesetBorderFrame::HandleEvent(nsPresContext* aPresContext, return NS_OK; } -NS_IMETHODIMP +nsIFrame* nsHTMLFramesetBorderFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) + nsFramePaintLayer aWhichLayer) { - if ( (aWhichLayer != NS_FRAME_PAINT_LAYER_FOREGROUND) || - (!((mState & NS_FRAME_OUTSIDE_CHILDREN) || mRect.Contains(aPoint) ))) - { - return NS_ERROR_FAILURE; - } - - *aFrame = this; - return NS_OK; + nsRect thisRect(nsPoint(0,0), GetSize()); + if (aWhichLayer != NS_FRAME_PAINT_LAYER_FOREGROUND || + !((mState & NS_FRAME_OUTSIDE_CHILDREN) || thisRect.Contains(aPoint))) + return nsnull; + return this; } NS_IMETHODIMP diff --git a/mozilla/layout/generic/nsFrameSetFrame.h b/mozilla/layout/generic/nsFrameSetFrame.h index 3ac44cf5e35..f31d1ed01d4 100644 --- a/mozilla/layout/generic/nsFrameSetFrame.h +++ b/mozilla/layout/generic/nsFrameSetFrame.h @@ -134,9 +134,8 @@ public: nsGUIEvent* aEvent, nsEventStatus* aEventStatus); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); NS_IMETHOD GetCursor(const nsPoint& aPoint, nsIFrame::Cursor& aCursor); diff --git a/mozilla/layout/generic/nsHTMLFrame.cpp b/mozilla/layout/generic/nsHTMLFrame.cpp index c8f6bb5f038..9dddae091d4 100644 --- a/mozilla/layout/generic/nsHTMLFrame.cpp +++ b/mozilla/layout/generic/nsHTMLFrame.cpp @@ -112,9 +112,8 @@ public: NS_IMETHOD HandleEvent(nsPresContext* aPresContext, nsGUIEvent* aEvent, nsEventStatus* aEventStatus); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); virtual PRBool IsContainingBlock() const { return PR_TRUE; } NS_IMETHOD Paint(nsPresContext* aPresContext, @@ -606,13 +605,13 @@ CanvasFrame::HandleEvent(nsPresContext* aPresContext, return NS_OK; } -NS_IMETHODIMP +nsIFrame* CanvasFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) + nsFramePaintLayer aWhichLayer) { // this should act like a block, so we need to override - return GetFrameForPointUsing(aPoint, nsnull, aWhichLayer, (aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND), aFrame); + return GetFrameForPointUsing(aPoint, nsnull, aWhichLayer, + aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND); } nsIAtom* diff --git a/mozilla/layout/generic/nsIFrame.h b/mozilla/layout/generic/nsIFrame.h index 5a2d7c82b18..177635039b4 100644 --- a/mozilla/layout/generic/nsIFrame.h +++ b/mozilla/layout/generic/nsIFrame.h @@ -780,15 +780,13 @@ public: /** * Get the frame that should receive events for a given point in the - * coordinate space of this frame's parent, if the frame is painted in + * coordinate space of this frame, if the frame is painted in * the given paint layer. A frame should return itself if it should * recieve the events. A successful return value indicates that a * point was found. */ - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) = 0; - + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer) = 0; /** * Get a point (in the frame's coordinate space) given an offset into diff --git a/mozilla/layout/generic/nsViewportFrame.cpp b/mozilla/layout/generic/nsViewportFrame.cpp index c57727e9fa4..6db0b646d47 100644 --- a/mozilla/layout/generic/nsViewportFrame.cpp +++ b/mozilla/layout/generic/nsViewportFrame.cpp @@ -88,14 +88,13 @@ ViewportFrame::SetInitialChildList(nsPresContext* aPresContext, return rv; } -NS_IMETHODIMP -ViewportFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) +nsIFrame* +ViewportFrame::GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer) { // this should act like a block, so we need to override - return GetFrameForPointUsing(aPoint, nsnull, aWhichLayer, - (aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND), aFrame); + return GetFrameForPointUsing(aPoint, nsnull, aWhichLayer, + aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND); } NS_IMETHODIMP diff --git a/mozilla/layout/generic/nsViewportFrame.h b/mozilla/layout/generic/nsViewportFrame.h index cc40e797e8b..736498153e4 100644 --- a/mozilla/layout/generic/nsViewportFrame.h +++ b/mozilla/layout/generic/nsViewportFrame.h @@ -71,9 +71,8 @@ public: nsIAtom* aListName, nsIFrame* aChildList); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); NS_IMETHOD AppendFrames(nsIAtom* aListName, nsIFrame* aFrameList); diff --git a/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.cpp index 6bca37dfca2..76f29bdf55e 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.cpp @@ -250,17 +250,15 @@ nsMathMLmactionFrame::SetInitialChildList(nsPresContext* aPresContext, } // Return the selected frame ... -NS_IMETHODIMP +nsIFrame* nsMathMLmactionFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) + nsFramePaintLayer aWhichLayer) { nsIFrame* childFrame = GetSelectedFrame(); - if (childFrame) { - nsPoint pt(aPoint.x - mRect.x, aPoint.y - mRect.y); - return childFrame->GetFrameForPoint(pt, aWhichLayer, aFrame); - } - return nsFrame::GetFrameForPoint(aPoint, aWhichLayer, aFrame); + if (childFrame) + return childFrame->GetFrameForPoint(aPoint - childFrame->GetOffsetTo(this), + aWhichLayer); + return nsFrame::GetFrameForPoint(aPoint, aWhichLayer); } // Only paint the selected child... diff --git a/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.h b/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.h index 008afb26593..ddf94256116 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.h +++ b/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.h @@ -72,10 +72,8 @@ public: nsIAtom* aListName, nsIFrame* aChildList); - NS_IMETHOD - GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); NS_IMETHOD Paint(nsPresContext* aPresContext, diff --git a/mozilla/layout/tables/nsTableCellFrame.cpp b/mozilla/layout/tables/nsTableCellFrame.cpp index dd7026bd70d..c6358bc89bf 100644 --- a/mozilla/layout/tables/nsTableCellFrame.cpp +++ b/mozilla/layout/tables/nsTableCellFrame.cpp @@ -449,13 +449,13 @@ nsTableCellFrame::Paint(nsPresContext* aPresContext, aWhichLayer);*/ } -NS_IMETHODIMP +nsIFrame* nsTableCellFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) + nsFramePaintLayer aWhichLayer) { // this should act like a block, so we need to override - return GetFrameForPointUsing(aPoint, nsnull, aWhichLayer, (aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND), aFrame); + return GetFrameForPointUsing(aPoint, nsnull, aWhichLayer, + aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND); } //null range means the whole thing diff --git a/mozilla/layout/tables/nsTableCellFrame.h b/mozilla/layout/tables/nsTableCellFrame.h index ef48221030f..0ec24e04c53 100644 --- a/mozilla/layout/tables/nsTableCellFrame.h +++ b/mozilla/layout/tables/nsTableCellFrame.h @@ -129,9 +129,8 @@ public: nsFramePaintLayer aWhichLayer, PRUint32 aFlags = 0); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); NS_IMETHOD SetSelected(nsPresContext* aPresContext, nsIDOMRange *aRange, diff --git a/mozilla/layout/tables/nsTableColFrame.cpp b/mozilla/layout/tables/nsTableColFrame.cpp index 0cb2b1d595f..b24211bafcc 100644 --- a/mozilla/layout/tables/nsTableColFrame.cpp +++ b/mozilla/layout/tables/nsTableColFrame.cpp @@ -144,12 +144,11 @@ nsTableColFrame::Paint(nsPresContext* aPresContext, } // override, since we want to act like a block -NS_IMETHODIMP +nsIFrame* nsTableColFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) + nsFramePaintLayer aWhichLayer) { - return NS_ERROR_FAILURE; + return nsnull; } NS_METHOD nsTableColFrame::Reflow(nsPresContext* aPresContext, diff --git a/mozilla/layout/tables/nsTableColFrame.h b/mozilla/layout/tables/nsTableColFrame.h index 2755d34a5ad..e974ff8aea0 100644 --- a/mozilla/layout/tables/nsTableColFrame.h +++ b/mozilla/layout/tables/nsTableColFrame.h @@ -120,9 +120,8 @@ public: // column groups don't paint their own background -- the cells do virtual PRBool CanPaintBackground() { return PR_FALSE; } - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); NS_IMETHOD Reflow(nsPresContext* aPresContext, nsHTMLReflowMetrics& aDesiredSize, diff --git a/mozilla/layout/tables/nsTableColGroupFrame.cpp b/mozilla/layout/tables/nsTableColGroupFrame.cpp index 18e2b43dcb0..f0d8759267a 100644 --- a/mozilla/layout/tables/nsTableColGroupFrame.cpp +++ b/mozilla/layout/tables/nsTableColGroupFrame.cpp @@ -351,13 +351,12 @@ nsTableColGroupFrame::GetSkipSides() const return skip; } -NS_IMETHODIMP -nsTableColGroupFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) +nsIFrame* +nsTableColGroupFrame::GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer) { // this should act like a block, so we need to override - return GetFrameForPointUsing(aPoint, nsnull, aWhichLayer, PR_FALSE, aFrame); + return GetFrameForPointUsing(aPoint, nsnull, aWhichLayer, PR_FALSE); } NS_METHOD nsTableColGroupFrame::Reflow(nsPresContext* aPresContext, diff --git a/mozilla/layout/tables/nsTableColGroupFrame.h b/mozilla/layout/tables/nsTableColGroupFrame.h index 984719ded12..85ff9028c09 100644 --- a/mozilla/layout/tables/nsTableColGroupFrame.h +++ b/mozilla/layout/tables/nsTableColGroupFrame.h @@ -147,9 +147,8 @@ public: /** @see nsIFrame::GetFrameForPoint */ - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); /** reflow of a column group is a trivial matter of reflowing * the col group's children (columns), and setting this frame diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp index 6efccc8e5f5..8192bed6e24 100644 --- a/mozilla/layout/tables/nsTableFrame.cpp +++ b/mozilla/layout/tables/nsTableFrame.cpp @@ -1438,13 +1438,13 @@ nsTableFrame::Paint(nsPresContext* aPresContext, aWhichLayer);*/ } -NS_IMETHODIMP -nsTableFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) +nsIFrame* +nsTableFrame::GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer) { // this should act like a block, so we need to override - return GetFrameForPointUsing(aPoint, nsnull, aWhichLayer, (aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND), aFrame); + return GetFrameForPointUsing(aPoint, nsnull, aWhichLayer, + aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND); } diff --git a/mozilla/layout/tables/nsTableFrame.h b/mozilla/layout/tables/nsTableFrame.h index 537d02b979c..9d6297b6927 100644 --- a/mozilla/layout/tables/nsTableFrame.h +++ b/mozilla/layout/tables/nsTableFrame.h @@ -327,9 +327,8 @@ public: void PaintBCBorders(nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); /** nsIFrame method overridden to handle table specifics */ diff --git a/mozilla/layout/tables/nsTableOuterFrame.cpp b/mozilla/layout/tables/nsTableOuterFrame.cpp index 3e79a212a71..fe2245c1dbf 100644 --- a/mozilla/layout/tables/nsTableOuterFrame.cpp +++ b/mozilla/layout/tables/nsTableOuterFrame.cpp @@ -340,23 +340,20 @@ nsTableOuterFrame::Paint(nsPresContext* aPresContext, return NS_OK; } -NS_IMETHODIMP -nsTableOuterFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) +nsIFrame* +nsTableOuterFrame::GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer) { - nsresult rv; - // caption frames live in a different list which we need to check separately if (mCaptionFrame) { - rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::captionList, aWhichLayer, PR_FALSE, aFrame); - if (NS_OK == rv) { - return NS_OK; - } + nsIFrame* frame = GetFrameForPointUsing(aPoint, nsLayoutAtoms::captionList, + aWhichLayer, PR_FALSE); + if (frame) + return frame; } // This frame should never get events (it contains the margins of the // table), so always pass |PR_FALSE| for |aConsiderSelf|. - return GetFrameForPointUsing(aPoint, nsnull, aWhichLayer, PR_FALSE, aFrame); + return GetFrameForPointUsing(aPoint, nsnull, aWhichLayer, PR_FALSE); } NS_IMETHODIMP nsTableOuterFrame::SetSelected(nsPresContext* aPresContext, diff --git a/mozilla/layout/tables/nsTableOuterFrame.h b/mozilla/layout/tables/nsTableOuterFrame.h index c8480986282..c4ecad57599 100644 --- a/mozilla/layout/tables/nsTableOuterFrame.h +++ b/mozilla/layout/tables/nsTableOuterFrame.h @@ -134,9 +134,8 @@ public: // the outer table does not paint its entire background if it has margins and/or captions virtual PRBool CanPaintBackground() { return PR_FALSE; } - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); /** process a reflow command for the table. * This involves reflowing the caption and the inner table. diff --git a/mozilla/layout/tables/nsTableRowFrame.cpp b/mozilla/layout/tables/nsTableRowFrame.cpp index 2fc45568d9a..213ec988a4e 100644 --- a/mozilla/layout/tables/nsTableRowFrame.cpp +++ b/mozilla/layout/tables/nsTableRowFrame.cpp @@ -588,10 +588,9 @@ nsTableRowFrame::GetSkipSides() const * so the default "get the child rect, see if it contains the event point" action isn't * sufficient. We have to ask the row if it has a child that contains the point. */ -NS_IMETHODIMP +nsIFrame* nsTableRowFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) + nsFramePaintLayer aWhichLayer) { // XXX This would not need to exist (except as a one-liner, to make this // frame work like a block frame) if rows with rowspan cells made the @@ -606,26 +605,16 @@ nsTableRowFrame::GetFrameForPoint(const nsPoint& aPoint, // This is basically copied from nsContainerFrame::GetFrameForPointUsing, // except for one bit removed - nsIFrame *hit; - nsPoint tmp; - nsIFrame* kid = GetFirstChild(nsnull); - *aFrame = nsnull; - tmp.MoveTo(aPoint.x - mRect.x, aPoint.y - mRect.y); - while (nsnull != kid) { - nsresult rv = kid->GetFrameForPoint(tmp, aWhichLayer, &hit); - - if (NS_SUCCEEDED(rv) && hit) { - *aFrame = hit; - } + nsIFrame* frame = nsnull; + while (kid) { + nsIFrame* hit = kid->GetFrameForPoint(aPoint - kid->GetOffsetTo(this), + aWhichLayer); + if (hit) + frame = hit; kid = kid->GetNextSibling(); } - - if (*aFrame) { - return NS_OK; - } - - return NS_ERROR_FAILURE; + return frame; } // Calculate the cell's actual size given its pass2 desired width and height. diff --git a/mozilla/layout/tables/nsTableRowFrame.h b/mozilla/layout/tables/nsTableRowFrame.h index 9e9ca512988..8a5fb356576 100644 --- a/mozilla/layout/tables/nsTableRowFrame.h +++ b/mozilla/layout/tables/nsTableRowFrame.h @@ -103,9 +103,8 @@ public: // rows don't paint their own background -- the cells do virtual PRBool CanPaintBackground() { return PR_FALSE; } - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); nsTableCellFrame* GetFirstCell() ; diff --git a/mozilla/layout/tables/nsTableRowGroupFrame.cpp b/mozilla/layout/tables/nsTableRowGroupFrame.cpp index 579c3ef4a83..e52067c4a9a 100644 --- a/mozilla/layout/tables/nsTableRowGroupFrame.cpp +++ b/mozilla/layout/tables/nsTableRowGroupFrame.cpp @@ -248,14 +248,12 @@ nsTableRowGroupFrame::GetSkipSides() const return skip; } - -NS_IMETHODIMP +nsIFrame* nsTableRowGroupFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) + nsFramePaintLayer aWhichLayer) { // this should act like a block, so we need to override - return GetFrameForPointUsing(aPoint, nsnull, aWhichLayer, PR_FALSE, aFrame); + return GetFrameForPointUsing(aPoint, nsnull, aWhichLayer, PR_FALSE); } // Position and size aKidFrame and update our reflow state. The origin of diff --git a/mozilla/layout/tables/nsTableRowGroupFrame.h b/mozilla/layout/tables/nsTableRowGroupFrame.h index cb80f50d0a1..2bed7ad3d97 100644 --- a/mozilla/layout/tables/nsTableRowGroupFrame.h +++ b/mozilla/layout/tables/nsTableRowGroupFrame.h @@ -148,7 +148,8 @@ public: * Return PR_TRUE if a frame containing the point is found. * @see nsContainerFrame::GetFrameForPoint */ - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, nsFramePaintLayer aWhichLayer, nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); /** calls Reflow for all of its child rows. * Rows are all set to the same width and stacked vertically. diff --git a/mozilla/layout/xul/base/src/nsBox.cpp b/mozilla/layout/xul/base/src/nsBox.cpp index aa0d881a6a6..fd2e519504d 100644 --- a/mozilla/layout/xul/base/src/nsBox.cpp +++ b/mozilla/layout/xul/base/src/nsBox.cpp @@ -1297,7 +1297,8 @@ NS_IMETHODIMP nsBox::GetDebugBoxAt( const nsPoint& aPoint, nsIBox** aBox) { - if (!mRect.Contains(aPoint)) + nsRect thisRect(nsPoint(0,0), GetSize()); + if (!thisRect.Contains(aPoint)) return NS_ERROR_FAILURE; nsIBox* child = nsnull; @@ -1305,10 +1306,8 @@ nsBox::GetDebugBoxAt( const nsPoint& aPoint, GetChildBox(&child); *aBox = nsnull; - nsPoint tmp; - tmp.MoveTo(aPoint.x - mRect.x, aPoint.y - mRect.y); while (nsnull != child) { - nsresult rv = child->GetDebugBoxAt(tmp, &hit); + nsresult rv = child->GetDebugBoxAt(aPoint - child->GetOffsetTo(this), &hit); if (NS_SUCCEEDED(rv) && hit) { *aBox = hit; @@ -1325,7 +1324,7 @@ nsBox::GetDebugBoxAt( const nsPoint& aPoint, nsMargin m; GetBorderAndPadding(m); - nsRect rect(mRect); + nsRect rect(thisRect); rect.Deflate(m); if (rect.Contains(aPoint)) { GetInset(m); diff --git a/mozilla/layout/xul/base/src/nsBoxFrame.cpp b/mozilla/layout/xul/base/src/nsBoxFrame.cpp index 15394d6143b..e9771b8de55 100644 --- a/mozilla/layout/xul/base/src/nsBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsBoxFrame.cpp @@ -1737,25 +1737,21 @@ nsBoxFrame::GetDebug(PRBool& aDebug) } #endif -NS_IMETHODIMP -nsBoxFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) -{ - if (!mRect.Contains(aPoint)) - return NS_ERROR_FAILURE; +nsIFrame* +nsBoxFrame::GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer) +{ + nsRect thisRect(nsPoint(0,0), GetSize()); + if (!thisRect.Contains(aPoint)) + return nsnull; const nsStyleVisibility* vis = GetStyleVisibility(); if (vis->mVisible == NS_STYLE_VISIBILITY_COLLAPSE) - return NS_ERROR_FAILURE; - - nsIView* view = nsnull; - nsPoint originOffset; - GetOriginToViewOffset(originOffset, &view); + return nsnull; #ifdef DEBUG_LAYOUT // get the debug frame. - if (view || (mState & NS_STATE_IS_ROOT)) + if (HasView() || (mState & NS_STATE_IS_ROOT)) { nsIBox* box = nsnull; if (NS_SUCCEEDED(GetDebugBoxAt(aPoint, &box)) && box) @@ -1763,79 +1759,56 @@ nsBoxFrame::GetFrameForPoint(const nsPoint& aPoint, PRBool isDebug = PR_FALSE; box->GetDebug(isDebug); if (isDebug) { - *aFrame = box; - return NS_OK; + return box; } } } #endif nsIFrame *hit = nsnull; - nsPoint tmp; - - *aFrame = nsnull; - tmp.MoveTo(aPoint.x - mRect.x, aPoint.y - mRect.y); - - if (view) - tmp += originOffset; - nsIBox* kid = nsnull; GetChildBox(&kid); - while (nsnull != kid) { - GetFrameForPointChild(tmp, aWhichLayer, kid, hit != nsnull, &hit); + while (kid) { + nsIFrame* frame = GetFrameForPointChild(aPoint, aWhichLayer, kid, + hit != nsnull); + if (frame) + hit = frame; kid->GetNextBox(&kid); } if (hit) - *aFrame = hit; - - if (*aFrame) { - return NS_OK; - } + return hit; // if no kids were hit then select us - if (aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND && vis->IsVisible()) { - *aFrame = this; - return NS_OK; - } + if (aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND && vis->IsVisible()) + return this; - return NS_ERROR_FAILURE; + return nsnull; } -/* virtual */ nsresult +/* virtual */ nsIFrame* nsBoxFrame::GetFrameForPointChild(const nsPoint& aPoint, nsFramePaintLayer aWhichLayer, nsIFrame* aChild, - PRBool aCheckMouseThrough, - nsIFrame** aFrame) + PRBool aCheckMouseThrough) { - nsIFrame *hit = nsnull; - nsresult rv = - aChild->GetFrameForPoint(aPoint, aWhichLayer, &hit); - - if (NS_SUCCEEDED(rv) && hit) { - rv = NS_ERROR_FAILURE; - if (!aCheckMouseThrough) { - *aFrame = hit; - rv = NS_OK; - } - else - { - // If we had a lower frame for this point, check whether hit's box has - // mouse through. If so, stick with the lower frame that we found. - PRBool isAdaptor = PR_FALSE; - nsIBox *box = GetBoxForFrame(hit, isAdaptor); - if (box) { - PRBool mouseThrough = PR_FALSE; - box->GetMouseThrough(mouseThrough); - // if the child says it can never mouse though ignore it. - if (!mouseThrough) { - *aFrame = hit; - rv = NS_OK; - } - } + nsIFrame *hit = aChild->GetFrameForPoint(aPoint - aChild->GetOffsetTo(this), + aWhichLayer); + if (hit) { + if (!aCheckMouseThrough) + return hit; + // If we had a lower frame for this point, check whether hit's box has + // mouse through. If so, stick with the lower frame that we found. + PRBool isAdaptor = PR_FALSE; + nsIBox *box = GetBoxForFrame(hit, isAdaptor); + if (box) { + PRBool mouseThrough = PR_FALSE; + box->GetMouseThrough(mouseThrough); + // if the child says it can never mouse though ignore it. + if (!mouseThrough) + return hit; } } - return rv; + return nsnull; } nsIBox* diff --git a/mozilla/layout/xul/base/src/nsBoxFrame.h b/mozilla/layout/xul/base/src/nsBoxFrame.h index c495b7be28a..d45800d794e 100644 --- a/mozilla/layout/xul/base/src/nsBoxFrame.h +++ b/mozilla/layout/xul/base/src/nsBoxFrame.h @@ -123,9 +123,8 @@ public: // ----- public methods ------- - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); NS_IMETHOD GetCursor(const nsPoint& aPoint, nsIFrame::Cursor& aCursor); @@ -252,11 +251,10 @@ protected: protected: nsresult RegUnregAccessKey(nsPresContext* aPresContext, PRBool aDoReg); - virtual nsresult GetFrameForPointChild(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, + virtual nsIFrame* GetFrameForPointChild(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer, nsIFrame* aChild, - PRBool aCheckMouseThrough, - nsIFrame** aFrame); + PRBool aCheckMouseThrough); NS_HIDDEN_(void) CheckBoxOrder(nsBoxLayoutState& aState); diff --git a/mozilla/layout/xul/base/src/nsButtonBoxFrame.cpp b/mozilla/layout/xul/base/src/nsButtonBoxFrame.cpp index d4554db2b05..b49fdc0b414 100644 --- a/mozilla/layout/xul/base/src/nsButtonBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsButtonBoxFrame.cpp @@ -86,12 +86,12 @@ nsButtonBoxFrame::GetMouseThrough(PRBool& aMouseThrough) return NS_OK; } -NS_IMETHODIMP nsButtonBoxFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) +nsIFrame* +nsButtonBoxFrame::GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer) { // override, since we don't want children to get events - return nsFrame::GetFrameForPoint(aPoint, aWhichLayer, aFrame); + return nsFrame::GetFrameForPoint(aPoint, aWhichLayer); } NS_IMETHODIMP diff --git a/mozilla/layout/xul/base/src/nsButtonBoxFrame.h b/mozilla/layout/xul/base/src/nsButtonBoxFrame.h index 102472afbf1..8f78fd7cb19 100644 --- a/mozilla/layout/xul/base/src/nsButtonBoxFrame.h +++ b/mozilla/layout/xul/base/src/nsButtonBoxFrame.h @@ -47,9 +47,8 @@ public: nsButtonBoxFrame(nsIPresShell* aPresShell); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); NS_IMETHOD HandleEvent(nsPresContext* aPresContext, nsGUIEvent* aEvent, diff --git a/mozilla/layout/xul/base/src/nsDeckFrame.cpp b/mozilla/layout/xul/base/src/nsDeckFrame.cpp index 07d5f67ac78..b1b5e98917f 100644 --- a/mozilla/layout/xul/base/src/nsDeckFrame.cpp +++ b/mozilla/layout/xul/base/src/nsDeckFrame.cpp @@ -239,32 +239,30 @@ nsDeckFrame::Paint(nsPresContext* aPresContext, } -NS_IMETHODIMP -nsDeckFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) +nsIFrame* +nsDeckFrame::GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer) { // if it is not inside us fail - if (!mRect.Contains(aPoint)) { - return NS_ERROR_FAILURE; - } + nsRect thisRect(nsPoint(0,0), GetSize()); + if (!thisRect.Contains(aPoint)) + return nsnull; // get the selected frame and see if the point is in it. nsIBox* selectedBox = GetSelectedBox(); if (selectedBox) { - nsPoint tmp(aPoint.x - mRect.x, aPoint.y - mRect.y); - - if (NS_SUCCEEDED(selectedBox->GetFrameForPoint(tmp, aWhichLayer, aFrame))) - return NS_OK; + nsIFrame* frame; + if (frame = selectedBox->GetFrameForPoint(aPoint - + selectedBox->GetOffsetTo(this), + aWhichLayer)) + return frame; } - + // if its not in our child just return us. - if (aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND) { - *aFrame = this; - return NS_OK; - } + if (aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND) + return this; - return NS_ERROR_FAILURE; + return nsnull; } diff --git a/mozilla/layout/xul/base/src/nsDeckFrame.h b/mozilla/layout/xul/base/src/nsDeckFrame.h index 964547d57c6..ebf402cd5b7 100644 --- a/mozilla/layout/xul/base/src/nsDeckFrame.h +++ b/mozilla/layout/xul/base/src/nsDeckFrame.h @@ -68,10 +68,8 @@ public: nsFramePaintLayer aWhichLayer, PRUint32 aFlags = 0); - - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); NS_IMETHOD Init(nsPresContext* aPresContext, nsIContent* aContent, diff --git a/mozilla/layout/xul/base/src/nsLeafBoxFrame.cpp b/mozilla/layout/xul/base/src/nsLeafBoxFrame.cpp index 6cc584a11d7..99bb389d592 100644 --- a/mozilla/layout/xul/base/src/nsLeafBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsLeafBoxFrame.cpp @@ -183,19 +183,18 @@ nsLeafBoxFrame::GetMouseThrough(PRBool& aMouseThrough) return NS_ERROR_FAILURE; } -NS_IMETHODIMP -nsLeafBoxFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) +nsIFrame* +nsLeafBoxFrame::GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer) { if ((aWhichLayer != NS_FRAME_PAINT_LAYER_FOREGROUND)) - return NS_ERROR_FAILURE; + return nsnull; - if (!mRect.Contains(aPoint)) - return NS_ERROR_FAILURE; + nsRect thisRect(nsPoint(0,0), GetSize()); + if (!thisRect.Contains(aPoint)) + return nsnull; - *aFrame = this; - return NS_OK; + return this; } NS_IMETHODIMP diff --git a/mozilla/layout/xul/base/src/nsLeafBoxFrame.h b/mozilla/layout/xul/base/src/nsLeafBoxFrame.h index 453c8a483ea..6f3be8a8b31 100644 --- a/mozilla/layout/xul/base/src/nsLeafBoxFrame.h +++ b/mozilla/layout/xul/base/src/nsLeafBoxFrame.h @@ -82,9 +82,8 @@ public: nsStyleContext* aContext, nsIFrame* asPrevInFlow); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID, nsIAtom* aAttribute, diff --git a/mozilla/layout/xul/base/src/nsListItemFrame.cpp b/mozilla/layout/xul/base/src/nsListItemFrame.cpp index 3d46e559239..735c56affd2 100644 --- a/mozilla/layout/xul/base/src/nsListItemFrame.cpp +++ b/mozilla/layout/xul/base/src/nsListItemFrame.cpp @@ -79,23 +79,20 @@ nsListItemFrame::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize) return NS_OK; } -NS_IMETHODIMP -nsListItemFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) +nsIFrame* +nsListItemFrame::GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer) { nsAutoString value; mContent->GetAttr(kNameSpaceID_None, nsXULAtoms::allowevents, value); if (value.EqualsLiteral("true")) { - return nsBoxFrame::GetFrameForPoint(aPoint, aWhichLayer, aFrame); + return nsBoxFrame::GetFrameForPoint(aPoint, aWhichLayer); } - else if (mRect.Contains(aPoint)) { - if (GetStyleVisibility()->IsVisible()) { - *aFrame = this; // Capture all events so that we can perform selection and expand/collapse. - return NS_OK; - } - } - return NS_ERROR_FAILURE; + nsRect thisRect(nsPoint(0,0), GetSize()); + if (thisRect.Contains(aPoint) && GetStyleVisibility()->IsVisible()) + // Capture all events so that we can perform selection and expand/collapse. + return this; + return nsnull; } // Creation Routine /////////////////////////////////////////////////////////////////////// diff --git a/mozilla/layout/xul/base/src/nsListItemFrame.h b/mozilla/layout/xul/base/src/nsListItemFrame.h index 49b8de3c043..33dc6c1c67c 100644 --- a/mozilla/layout/xul/base/src/nsListItemFrame.h +++ b/mozilla/layout/xul/base/src/nsListItemFrame.h @@ -57,9 +57,8 @@ public: // overridden so that children of listitems don't handle mouse events, // unless allowevents="true" is specified on the listitem - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); // nsIBox NS_IMETHOD GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize); diff --git a/mozilla/layout/xul/base/src/nsMenuFrame.cpp b/mozilla/layout/xul/base/src/nsMenuFrame.cpp index 42b1289197f..8fe4bedb9b4 100644 --- a/mozilla/layout/xul/base/src/nsMenuFrame.cpp +++ b/mozilla/layout/xul/base/src/nsMenuFrame.cpp @@ -348,28 +348,25 @@ nsMenuFrame::Destroy(nsPresContext* aPresContext) } // Called to prevent events from going to anything inside the menu. -NS_IMETHODIMP +nsIFrame* nsMenuFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) + nsFramePaintLayer aWhichLayer) { - nsresult result = nsBoxFrame::GetFrameForPoint(aPoint, aWhichLayer, aFrame); - if (NS_FAILED(result) || *aFrame == this) { - return result; + nsIFrame* frame = nsBoxFrame::GetFrameForPoint(aPoint, aWhichLayer); + if (!frame || frame == this) { + return frame; } - nsIContent* content = (*aFrame)->GetContent(); + nsIContent* content = frame->GetContent(); if (content) { // This allows selective overriding for subcontent. nsAutoString value; content->GetAttr(kNameSpaceID_None, nsXULAtoms::allowevents, value); if (value.EqualsLiteral("true")) - return result; + return frame; } - if (GetStyleVisibility()->IsVisible()) { - *aFrame = this; // Capture all events so that we can perform selection - return NS_OK; - } - return NS_ERROR_FAILURE; + if (GetStyleVisibility()->IsVisible()) + return this; // Capture all events so that we can perform selection + return nsnull; } NS_IMETHODIMP diff --git a/mozilla/layout/xul/base/src/nsMenuFrame.h b/mozilla/layout/xul/base/src/nsMenuFrame.h index 784a3d94552..6fffd727f90 100644 --- a/mozilla/layout/xul/base/src/nsMenuFrame.h +++ b/mozilla/layout/xul/base/src/nsMenuFrame.h @@ -107,9 +107,8 @@ public: NS_IMETHOD Destroy(nsPresContext* aPresContext); // Overridden to prevent events from ever going to children of the menu. - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); NS_IMETHOD HandleEvent(nsPresContext* aPresContext, nsGUIEvent* aEvent, diff --git a/mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp b/mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp index 4ce0b3233fb..d08b46c208e 100644 --- a/mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp +++ b/mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp @@ -1975,12 +1975,11 @@ nsMenuPopupFrame::Destroy(nsPresContext* aPresContext) return nsBoxFrame::Destroy(aPresContext); } -NS_IMETHODIMP +nsIFrame* nsMenuPopupFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) + nsFramePaintLayer aWhichLayer) { - return nsBoxFrame::GetFrameForPoint(aPoint, aWhichLayer, aFrame); + return nsBoxFrame::GetFrameForPoint(aPoint, aWhichLayer); } diff --git a/mozilla/layout/xul/base/src/nsMenuPopupFrame.h b/mozilla/layout/xul/base/src/nsMenuPopupFrame.h index be792272d19..ba530dd62b2 100644 --- a/mozilla/layout/xul/base/src/nsMenuPopupFrame.h +++ b/mozilla/layout/xul/base/src/nsMenuPopupFrame.h @@ -133,9 +133,8 @@ public: NS_IMETHOD Destroy(nsPresContext* aPresContext); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); NS_IMETHOD MarkStyleChange(nsBoxLayoutState& aState); NS_IMETHOD MarkDirty(nsBoxLayoutState& aState); diff --git a/mozilla/layout/xul/base/src/nsPopupSetFrame.cpp b/mozilla/layout/xul/base/src/nsPopupSetFrame.cpp index e66357e7669..5a134208237 100644 --- a/mozilla/layout/xul/base/src/nsPopupSetFrame.cpp +++ b/mozilla/layout/xul/base/src/nsPopupSetFrame.cpp @@ -583,11 +583,11 @@ nsPopupSetFrame::OnCreate(PRInt32 aX, PRInt32 aY, nsIContent* aPopupContent) nsEventStatus status = nsEventStatus_eIgnore; nsMouseEvent event(PR_TRUE, NS_XUL_POPUP_SHOWING, nsnull, nsMouseEvent::eReal); - // XXX The client point storage was moved to the DOM event, so now this can't - // work. A real fix would require fixing the mess that is popup coordinates - // in layout. For now, don't bother setting the point. - //event.point.x = aX; - //event.point.y = aY; + // XXX This is messed up: it needs to account for widgets. + nsPoint dummy; + event.widget = GetClosestView()->GetNearestWidget(&dummy); + event.refPoint.x = aX; + event.refPoint.y = aY; if (aPopupContent) { nsIPresShell *shell = mPresContext->GetPresShell(); diff --git a/mozilla/layout/xul/base/src/nsRootBoxFrame.cpp b/mozilla/layout/xul/base/src/nsRootBoxFrame.cpp index 3fc7ae85f42..39462773471 100644 --- a/mozilla/layout/xul/base/src/nsRootBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsRootBoxFrame.cpp @@ -96,9 +96,8 @@ public: NS_IMETHOD HandleEvent(nsPresContext* aPresContext, nsGUIEvent* aEvent, nsEventStatus* aEventStatus); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); /** * Get the "type" of the frame @@ -245,13 +244,12 @@ nsRootBoxFrame::HandleEvent(nsPresContext* aPresContext, return NS_OK; } -NS_IMETHODIMP -nsRootBoxFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) +nsIFrame* +nsRootBoxFrame::GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer) { // this should act like a block, so we need to override - return nsBoxFrame::GetFrameForPoint(aPoint, aWhichLayer, aFrame); + return nsBoxFrame::GetFrameForPoint(aPoint, aWhichLayer); } nsIAtom* diff --git a/mozilla/layout/xul/base/src/nsSliderFrame.cpp b/mozilla/layout/xul/base/src/nsSliderFrame.cpp index 0894e22655d..59457f5e810 100644 --- a/mozilla/layout/xul/base/src/nsSliderFrame.cpp +++ b/mozilla/layout/xul/base/src/nsSliderFrame.cpp @@ -725,29 +725,25 @@ nsSliderFrame::SetCurrentPosition(nsIContent* scrollbar, nsIFrame* aThumbFrame, } -NS_IMETHODIMP nsSliderFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) +nsIFrame* nsSliderFrame::GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer) { // This is EVIL, we shouldn't be messing with GetFrameForPoint just to get // thumb mouse drag events to arrive at the slider! if (isDraggingThumb()) - { // XXX I assume it's better not to test for visibility here. - *aFrame = this; - return NS_OK; - } + return this; - if (NS_SUCCEEDED(nsBoxFrame::GetFrameForPoint(aPoint, aWhichLayer, aFrame))) - return NS_OK; + nsIFrame* frame; + if ((frame = nsBoxFrame::GetFrameForPoint(aPoint, aWhichLayer))) + return frame; // always return us (if visible) - if (mRect.Contains(aPoint) && GetStyleVisibility()->IsVisible()) { - *aFrame = this; - return NS_OK; - } + nsRect thisRect(nsPoint(0,0), GetSize()); + if (thisRect.Contains(aPoint) && GetStyleVisibility()->IsVisible()) + return this; - return NS_ERROR_FAILURE; + return nsnull; } diff --git a/mozilla/layout/xul/base/src/nsSliderFrame.h b/mozilla/layout/xul/base/src/nsSliderFrame.h index cbdeff803eb..188fd4c2fce 100644 --- a/mozilla/layout/xul/base/src/nsSliderFrame.h +++ b/mozilla/layout/xul/base/src/nsSliderFrame.h @@ -176,9 +176,8 @@ public: nsGUIEvent* aEvent, nsEventStatus* aEventStatus); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); NS_IMETHOD SetInitialChildList(nsPresContext* aPresContext, nsIAtom* aListName, diff --git a/mozilla/layout/xul/base/src/nsSplitterFrame.cpp b/mozilla/layout/xul/base/src/nsSplitterFrame.cpp index 1065334aec2..55b5ca55e6d 100644 --- a/mozilla/layout/xul/base/src/nsSplitterFrame.cpp +++ b/mozilla/layout/xul/base/src/nsSplitterFrame.cpp @@ -442,28 +442,25 @@ nsSplitterFrame::HandleRelease(nsPresContext* aPresContext, return NS_OK; } -NS_IMETHODIMP nsSplitterFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) -{ +nsIFrame* nsSplitterFrame::GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer) +{ // if the mouse is captured always return us as the frame. if (mInner->mDragging) { // XXX It's probably better not to check visibility here, right? - *aFrame = this; - return NS_OK; + return this; } - nsresult rv = nsBoxFrame::GetFrameForPoint(aPoint, aWhichLayer, aFrame); + nsIFrame* frame = nsBoxFrame::GetFrameForPoint(aPoint, aWhichLayer); - if (NS_FAILED(rv) && - aWhichLayer == NS_FRAME_PAINT_LAYER_FOREGROUND && - mRect.Contains(aPoint)) { - *aFrame = this; - rv = NS_OK; - } + nsRect thisRect(nsPoint(0,0), GetSize()); + if (!frame && aWhichLayer == NS_FRAME_PAINT_LAYER_FOREGROUND && + thisRect.Contains(aPoint)) { + return this; + } - return rv; + return frame; } NS_IMETHODIMP diff --git a/mozilla/layout/xul/base/src/nsSplitterFrame.h b/mozilla/layout/xul/base/src/nsSplitterFrame.h index 9d0fbdd1f8d..9917a5fbd14 100644 --- a/mozilla/layout/xul/base/src/nsSplitterFrame.h +++ b/mozilla/layout/xul/base/src/nsSplitterFrame.h @@ -102,9 +102,8 @@ public: nsGUIEvent* aEvent, nsEventStatus* aEventStatus); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); virtual void GetInitialOrientation(PRBool& aIsHorizontal); diff --git a/mozilla/layout/xul/base/src/nsStackFrame.cpp b/mozilla/layout/xul/base/src/nsStackFrame.cpp index 825e0acfd96..2343ee9ab21 100644 --- a/mozilla/layout/xul/base/src/nsStackFrame.cpp +++ b/mozilla/layout/xul/base/src/nsStackFrame.cpp @@ -88,35 +88,33 @@ nsStackFrame::nsStackFrame(nsIPresShell* aPresShell, nsIBoxLayout* aLayoutManage } -NS_IMETHODIMP -nsStackFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) +nsIFrame* +nsStackFrame::GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer) { if (aWhichLayer != NS_FRAME_PAINT_LAYER_BACKGROUND) - return NS_ERROR_FAILURE; + return nsnull; - return nsBoxFrame::GetFrameForPoint(aPoint, aWhichLayer, aFrame); + return nsBoxFrame::GetFrameForPoint(aPoint, aWhichLayer); } -/* virtual */ nsresult +/* virtual */ nsIFrame* nsStackFrame::GetFrameForPointChild(const nsPoint& aPoint, nsFramePaintLayer aWhichLayer, nsIFrame* aChild, - PRBool aCheckMouseThrough, - nsIFrame** aFrame) + PRBool aCheckMouseThrough) { if (aWhichLayer != NS_FRAME_PAINT_LAYER_BACKGROUND) - return NS_ERROR_FAILURE; + return nsnull; - nsresult rv = nsBoxFrame::GetFrameForPointChild(aPoint, + nsIFrame* frame = nsBoxFrame::GetFrameForPointChild(aPoint, NS_FRAME_PAINT_LAYER_FOREGROUND, - aChild, aCheckMouseThrough, aFrame); - if (NS_SUCCEEDED(rv)) - return rv; + aChild, aCheckMouseThrough); + if (frame) + return frame; return nsBoxFrame::GetFrameForPointChild(aPoint, NS_FRAME_PAINT_LAYER_BACKGROUND, - aChild, aCheckMouseThrough, aFrame); + aChild, aCheckMouseThrough); } void diff --git a/mozilla/layout/xul/base/src/nsStackFrame.h b/mozilla/layout/xul/base/src/nsStackFrame.h index 6c5c7f6b018..cdf0846d6d3 100644 --- a/mozilla/layout/xul/base/src/nsStackFrame.h +++ b/mozilla/layout/xul/base/src/nsStackFrame.h @@ -75,17 +75,15 @@ public: nsFramePaintLayer aWhichLayer, PRUint32 aFlags = 0); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); protected: - virtual nsresult GetFrameForPointChild(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame* aChild, - PRBool aCheckMouseThrough, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPointChild(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer, + nsIFrame* aChild, + PRBool aCheckMouseThrough); nsStackFrame(nsIPresShell* aPresShell, nsIBoxLayout* aLayout = nsnull); diff --git a/mozilla/layout/xul/base/src/nsTitleBarFrame.cpp b/mozilla/layout/xul/base/src/nsTitleBarFrame.cpp index 70d6daf7a80..99541d1e783 100644 --- a/mozilla/layout/xul/base/src/nsTitleBarFrame.cpp +++ b/mozilla/layout/xul/base/src/nsTitleBarFrame.cpp @@ -103,19 +103,14 @@ nsTitleBarFrame::GetMouseThrough(PRBool& aMouseThrough) return NS_OK; } -NS_IMETHODIMP nsTitleBarFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) +nsIFrame* +nsTitleBarFrame::GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer) { // override, since we don't want children to get events - return nsFrame::GetFrameForPoint(aPoint, aWhichLayer, aFrame); + return nsFrame::GetFrameForPoint(aPoint, aWhichLayer); } - - - - - NS_IMETHODIMP nsTitleBarFrame::HandleEvent(nsPresContext* aPresContext, nsGUIEvent* aEvent, diff --git a/mozilla/layout/xul/base/src/nsTitleBarFrame.h b/mozilla/layout/xul/base/src/nsTitleBarFrame.h index 5d175f79685..e5310a7418e 100644 --- a/mozilla/layout/xul/base/src/nsTitleBarFrame.h +++ b/mozilla/layout/xul/base/src/nsTitleBarFrame.h @@ -54,9 +54,8 @@ public: nsStyleContext* aContext, nsIFrame* asPrevInFlow); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); NS_IMETHOD HandleEvent(nsPresContext* aPresContext, nsGUIEvent* aEvent, diff --git a/mozilla/layout/xul/base/src/tree/src/nsTreeColFrame.cpp b/mozilla/layout/xul/base/src/tree/src/nsTreeColFrame.cpp index 140cab1dc0d..f65f0a2c44b 100644 --- a/mozilla/layout/xul/base/src/tree/src/nsTreeColFrame.cpp +++ b/mozilla/layout/xul/base/src/tree/src/nsTreeColFrame.cpp @@ -124,21 +124,21 @@ nsTreeColFrame::Destroy(nsPresContext* aPresContext) return nsBoxFrame::Destroy(aPresContext); } -NS_IMETHODIMP -nsTreeColFrame::GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) +nsIFrame* +nsTreeColFrame::GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer) { - if (!(mRect.Contains(aPoint) || (mState & NS_FRAME_OUTSIDE_CHILDREN))) - return NS_ERROR_FAILURE; + nsRect thisRect(nsPoint(0,0), GetSize()); + if (!(thisRect.Contains(aPoint) || (mState & NS_FRAME_OUTSIDE_CHILDREN))) + return nsnull; // If we are in either the first 2 pixels or the last 2 pixels, we're going to // do something really strange. Check for an adjacent splitter. PRBool left = PR_FALSE; PRBool right = PR_FALSE; - if (mRect.x + mRect.width - 60 < aPoint.x) + if (mRect.width - 60 < aPoint.x) right = PR_TRUE; - else if (mRect.x + 60 > aPoint.x) + else if (60 > aPoint.x) left = PR_TRUE; if (left || right) { @@ -153,30 +153,27 @@ nsTreeColFrame::GetFrameForPoint(const nsPoint& aPoint, if (child) { nsINodeInfo *ni = child->GetContent()->GetNodeInfo(); if (ni && ni->Equals(nsXULAtoms::splitter, kNameSpaceID_XUL)) { - *aFrame = child; - return NS_OK; + return child; } } } - nsresult result = nsBoxFrame::GetFrameForPoint(aPoint, aWhichLayer, aFrame); - if (result == NS_OK) { - nsIContent* content = (*aFrame)->GetContent(); + nsIFrame* frame = nsBoxFrame::GetFrameForPoint(aPoint, aWhichLayer); + if (frame) { + nsIContent* content = frame->GetContent(); if (content) { // This allows selective overriding for subcontent. nsAutoString value; content->GetAttr(kNameSpaceID_None, nsXULAtoms::allowevents, value); if (value.EqualsLiteral("true")) - return result; + return frame; } } - if (mRect.Contains(aPoint)) { - if (GetStyleVisibility()->IsVisible()) { - *aFrame = this; // Capture all events. - return NS_OK; - } + + if (thisRect.Contains(aPoint) && GetStyleVisibility()->IsVisible()) { + return this; // Capture all events. } - return NS_ERROR_FAILURE; + return nsnull; } NS_IMETHODIMP diff --git a/mozilla/layout/xul/base/src/tree/src/nsTreeColFrame.h b/mozilla/layout/xul/base/src/tree/src/nsTreeColFrame.h index 0bd00ed5cf8..7fea547ae3a 100644 --- a/mozilla/layout/xul/base/src/tree/src/nsTreeColFrame.h +++ b/mozilla/layout/xul/base/src/tree/src/nsTreeColFrame.h @@ -58,9 +58,8 @@ public: NS_IMETHOD Destroy(nsPresContext* aPresContext); // Overridden to capture events. - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); + virtual nsIFrame* GetFrameForPoint(const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer); NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID, nsIAtom* aAttribute,