Make sure that GetFrameForPoint checks all layers of each float before moving

on to the next one.  Bug 253572, r+sr=roc
This commit is contained in:
bzbarsky%mit.edu 2004-08-10 22:24:00 +00:00
parent b2444dace2
commit abb7d4ca9a
6 changed files with 46 additions and 36 deletions

View File

@ -224,9 +224,9 @@ typedef PRUint32 nsFrameState;
//----------------------------------------------------------------------
enum nsFramePaintLayer {
eFramePaintLayer_Underlay = 0,
eFramePaintLayer_Content = 1,
eFramePaintLayer_Overlay = 2
eFramePaintLayer_Underlay = 1,
eFramePaintLayer_Content = 2,
eFramePaintLayer_Overlay = 4
};
enum nsSelectionAmount {
@ -263,6 +263,10 @@ enum nsSpread {
#define NS_FRAME_PAINT_LAYER_FLOATS eFramePaintLayer_Content
#define NS_FRAME_PAINT_LAYER_FOREGROUND eFramePaintLayer_Overlay
#define NS_FRAME_PAINT_LAYER_DEBUG eFramePaintLayer_Overlay
#define NS_FRAME_PAINT_LAYER_ALL \
(nsFramePaintLayer(NS_FRAME_PAINT_LAYER_BACKGROUND | \
NS_FRAME_PAINT_LAYER_FLOATS | \
NS_FRAME_PAINT_LAYER_FOREGROUND))
/**
* Reflow status returned by the reflow methods.

View File

@ -5910,25 +5910,12 @@ nsBlockFrame::GetFrameForPoint(nsPresContext* aPresContext,
rv = GetFrameForPointUsing(aPresContext, aPoint,
nsLayoutAtoms::floatList,
NS_FRAME_PAINT_LAYER_FOREGROUND,
NS_FRAME_PAINT_LAYER_ALL,
PR_FALSE, aFrame);
if (NS_OK == rv) {
return NS_OK;
}
rv = GetFrameForPointUsing(aPresContext, aPoint,
nsLayoutAtoms::floatList,
NS_FRAME_PAINT_LAYER_FLOATS,
PR_FALSE, aFrame);
if (NS_OK == rv) {
return NS_OK;
}
return GetFrameForPointUsing(aPresContext, aPoint,
nsLayoutAtoms::floatList,
NS_FRAME_PAINT_LAYER_BACKGROUND,
PR_FALSE, aFrame);
} else {
return NS_ERROR_FAILURE;
}

View File

@ -354,7 +354,21 @@ nsContainerFrame::GetFrameForPointUsing(nsPresContext* aPresContext,
tmp += originOffset;
while (kid) {
rv = kid->GetFrameForPoint(aPresContext, tmp, aWhichLayer, &hit);
if (aWhichLayer == NS_FRAME_PAINT_LAYER_ALL) {
// Check all layers on this kid before moving on to the next one
rv = kid->GetFrameForPoint(aPresContext, tmp,
NS_FRAME_PAINT_LAYER_FOREGROUND, &hit);
if (NS_FAILED(rv) || !hit) {
rv = kid->GetFrameForPoint(aPresContext, tmp,
NS_FRAME_PAINT_LAYER_FLOATS, &hit);
if (NS_FAILED(rv) || !hit) {
rv = kid->GetFrameForPoint(aPresContext, tmp,
NS_FRAME_PAINT_LAYER_BACKGROUND, &hit);
}
}
} else {
rv = kid->GetFrameForPoint(aPresContext, tmp, aWhichLayer, &hit);
}
if (NS_SUCCEEDED(rv) && hit) {
*aFrame = hit;

View File

@ -224,9 +224,9 @@ typedef PRUint32 nsFrameState;
//----------------------------------------------------------------------
enum nsFramePaintLayer {
eFramePaintLayer_Underlay = 0,
eFramePaintLayer_Content = 1,
eFramePaintLayer_Overlay = 2
eFramePaintLayer_Underlay = 1,
eFramePaintLayer_Content = 2,
eFramePaintLayer_Overlay = 4
};
enum nsSelectionAmount {
@ -263,6 +263,10 @@ enum nsSpread {
#define NS_FRAME_PAINT_LAYER_FLOATS eFramePaintLayer_Content
#define NS_FRAME_PAINT_LAYER_FOREGROUND eFramePaintLayer_Overlay
#define NS_FRAME_PAINT_LAYER_DEBUG eFramePaintLayer_Overlay
#define NS_FRAME_PAINT_LAYER_ALL \
(nsFramePaintLayer(NS_FRAME_PAINT_LAYER_BACKGROUND | \
NS_FRAME_PAINT_LAYER_FLOATS | \
NS_FRAME_PAINT_LAYER_FOREGROUND))
/**
* Reflow status returned by the reflow methods.

View File

@ -5910,25 +5910,12 @@ nsBlockFrame::GetFrameForPoint(nsPresContext* aPresContext,
rv = GetFrameForPointUsing(aPresContext, aPoint,
nsLayoutAtoms::floatList,
NS_FRAME_PAINT_LAYER_FOREGROUND,
NS_FRAME_PAINT_LAYER_ALL,
PR_FALSE, aFrame);
if (NS_OK == rv) {
return NS_OK;
}
rv = GetFrameForPointUsing(aPresContext, aPoint,
nsLayoutAtoms::floatList,
NS_FRAME_PAINT_LAYER_FLOATS,
PR_FALSE, aFrame);
if (NS_OK == rv) {
return NS_OK;
}
return GetFrameForPointUsing(aPresContext, aPoint,
nsLayoutAtoms::floatList,
NS_FRAME_PAINT_LAYER_BACKGROUND,
PR_FALSE, aFrame);
} else {
return NS_ERROR_FAILURE;
}

View File

@ -354,7 +354,21 @@ nsContainerFrame::GetFrameForPointUsing(nsPresContext* aPresContext,
tmp += originOffset;
while (kid) {
rv = kid->GetFrameForPoint(aPresContext, tmp, aWhichLayer, &hit);
if (aWhichLayer == NS_FRAME_PAINT_LAYER_ALL) {
// Check all layers on this kid before moving on to the next one
rv = kid->GetFrameForPoint(aPresContext, tmp,
NS_FRAME_PAINT_LAYER_FOREGROUND, &hit);
if (NS_FAILED(rv) || !hit) {
rv = kid->GetFrameForPoint(aPresContext, tmp,
NS_FRAME_PAINT_LAYER_FLOATS, &hit);
if (NS_FAILED(rv) || !hit) {
rv = kid->GetFrameForPoint(aPresContext, tmp,
NS_FRAME_PAINT_LAYER_BACKGROUND, &hit);
}
}
} else {
rv = kid->GetFrameForPoint(aPresContext, tmp, aWhichLayer, &hit);
}
if (NS_SUCCEEDED(rv) && hit) {
*aFrame = hit;