Fix up more XUL GetFrameForPoint impls to correctly handle paint layers. Bug

225732, r+sr=dbaron
This commit is contained in:
bzbarsky%mit.edu 2003-11-15 00:47:43 +00:00
Родитель 1402b75367
Коммит b381ebb111
4 изменённых файлов: 23 добавлений и 40 удалений

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

@ -258,18 +258,11 @@ nsDeckFrame::GetFrameForPoint(nsIPresContext* aPresContext,
nsFramePaintLayer aWhichLayer,
nsIFrame** aFrame)
{
if ((aWhichLayer != NS_FRAME_PAINT_LAYER_FOREGROUND))
return NS_ERROR_FAILURE;
// if it is not inside us fail
if (!mRect.Contains(aPoint)) {
return NS_ERROR_FAILURE;
}
// if its not in our child just return us.
*aFrame = this;
// get the selected frame and see if the point is in it.
nsIBox* selectedBox = GetSelectedBox();
if (selectedBox) {
@ -278,10 +271,18 @@ nsDeckFrame::GetFrameForPoint(nsIPresContext* aPresContext,
nsPoint tmp(aPoint.x - mRect.x, aPoint.y - mRect.y);
return selectedFrame->GetFrameForPoint(aPresContext, tmp, aWhichLayer, aFrame);
if (NS_SUCCEEDED(selectedFrame->GetFrameForPoint(aPresContext, tmp,
aWhichLayer, aFrame)))
return NS_OK;
}
return NS_OK;
// if its not in our child just return us.
if (aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND) {
*aFrame = this;
return NS_OK;
}
return NS_ERROR_FAILURE;
}

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

@ -356,15 +356,8 @@ nsMenuFrame::GetFrameForPoint(nsIPresContext* aPresContext,
nsFramePaintLayer aWhichLayer,
nsIFrame** aFrame)
{
if ((aWhichLayer != NS_FRAME_PAINT_LAYER_FOREGROUND))
return NS_ERROR_FAILURE;
// if it is not inside us or not in the layer in which we paint, fail
if (!mRect.Contains(aPoint))
return NS_ERROR_FAILURE;
nsresult result = nsBoxFrame::GetFrameForPoint(aPresContext, aPoint, aWhichLayer, aFrame);
if ((result != NS_OK) || (*aFrame == this)) {
if (NS_FAILED(result) || *aFrame == this) {
return result;
}
nsIContent* content = (*aFrame)->GetContent();

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

@ -859,9 +859,6 @@ NS_IMETHODIMP nsSliderFrame::GetFrameForPoint(nsIPresContext* aPresContext,
nsFramePaintLayer aWhichLayer,
nsIFrame** aFrame)
{
if ((aWhichLayer != NS_FRAME_PAINT_LAYER_FOREGROUND))
return NS_ERROR_FAILURE;
// This is EVIL, we shouldn't be messing with GetFrameForPoint just to get
// thumb mouse drag events to arrive at the slider!
if (isDraggingThumb())
@ -871,15 +868,11 @@ NS_IMETHODIMP nsSliderFrame::GetFrameForPoint(nsIPresContext* aPresContext,
return NS_OK;
}
if (!mRect.Contains(aPoint))
return NS_ERROR_FAILURE;
if (NS_SUCCEEDED(nsBoxFrame::GetFrameForPoint(aPresContext, aPoint, aWhichLayer, aFrame)))
return NS_OK;
// always return us (if visible)
if (GetStyleVisibility()->IsVisible()) {
if (mRect.Contains(aPoint) && GetStyleVisibility()->IsVisible()) {
*aFrame = this;
return NS_OK;
}

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

@ -449,28 +449,24 @@ NS_IMETHODIMP nsSplitterFrame::GetFrameForPoint(nsIPresContext* aPresContext,
nsFramePaintLayer aWhichLayer,
nsIFrame** aFrame)
{
if ((aWhichLayer != NS_FRAME_PAINT_LAYER_FOREGROUND))
return NS_ERROR_FAILURE;
// 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;
} else {
if (!mRect.Contains(aPoint))
return NS_ERROR_FAILURE;
nsresult rv = nsBoxFrame::GetFrameForPoint(aPresContext, aPoint, aWhichLayer, aFrame);
if (rv == NS_ERROR_FAILURE) {
*aFrame = this;
rv = NS_OK;
}
return rv;
}
nsresult rv = nsBoxFrame::GetFrameForPoint(aPresContext, aPoint, aWhichLayer, aFrame);
if (NS_FAILED(rv) &&
aWhichLayer == NS_FRAME_PAINT_LAYER_FOREGROUND &&
mRect.Contains(aPoint)) {
*aFrame = this;
rv = NS_OK;
}
return rv;
}
NS_IMETHODIMP