Bug 108310. Make GetFrameForPoint take frame-relative coordinates, not bogus relative-to-some-view-or-other, and simplify the signature. r+sr=roc, patch by Eli Friedman.

This commit is contained in:
roc+%cs.cmu.edu 2005-09-19 02:15:54 +00:00
Родитель 771fb185cb
Коммит b1e6622e4e
70 изменённых файлов: 476 добавлений и 660 удалений

Просмотреть файл

@ -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;
}
}
}

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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();

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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);

Просмотреть файл

@ -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

Просмотреть файл

@ -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,

Просмотреть файл

@ -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

Просмотреть файл

@ -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,

Просмотреть файл

@ -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

Просмотреть файл

@ -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,

Просмотреть файл

@ -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

Просмотреть файл

@ -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,

Просмотреть файл

@ -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

Просмотреть файл

@ -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);

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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,

Просмотреть файл

@ -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

Просмотреть файл

@ -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,

Просмотреть файл

@ -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

Просмотреть файл

@ -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);

Просмотреть файл

@ -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*

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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);

Просмотреть файл

@ -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...

Просмотреть файл

@ -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,

Просмотреть файл

@ -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

Просмотреть файл

@ -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,

Просмотреть файл

@ -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,

Просмотреть файл

@ -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,

Просмотреть файл

@ -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,

Просмотреть файл

@ -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

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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
*/

Просмотреть файл

@ -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,

Просмотреть файл

@ -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.

Просмотреть файл

@ -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.

Просмотреть файл

@ -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() ;

Просмотреть файл

@ -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

Просмотреть файл

@ -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.

Просмотреть файл

@ -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);

Просмотреть файл

@ -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*

Просмотреть файл

@ -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);

Просмотреть файл

@ -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

Просмотреть файл

@ -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,

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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,

Просмотреть файл

@ -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

Просмотреть файл

@ -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,

Просмотреть файл

@ -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 ///////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -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);

Просмотреть файл

@ -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

Просмотреть файл

@ -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,

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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);

Просмотреть файл

@ -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();

Просмотреть файл

@ -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*

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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,

Просмотреть файл

@ -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

Просмотреть файл

@ -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);

Просмотреть файл

@ -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

Просмотреть файл

@ -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);

Просмотреть файл

@ -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,

Просмотреть файл

@ -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,

Просмотреть файл

@ -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

Просмотреть файл

@ -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,