зеркало из https://github.com/mozilla/gecko-dev.git
Fix up more XUL GetFrameForPoint impls to correctly handle paint layers. Bug
225732, r+sr=dbaron
This commit is contained in:
Родитель
1402b75367
Коммит
b381ebb111
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче