On mouse down, make sure the frame capturing the mouse is the same one used as the selection anchor. bug=262306, r+sr=roc.

This commit is contained in:
Uri Bernstein 2008-08-15 09:41:05 +03:00
parent 0ef715372d
commit b62051b02f

View File

@ -1833,8 +1833,14 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
// NS_STYLE_USER_SELECT_TOGGLE, need to change this logic
PRBool useFrameSelection = (selectStyle == NS_STYLE_USER_SELECT_TEXT);
if (!IsMouseCaptured(aPresContext))
CaptureMouse(aPresContext, PR_TRUE);
nsPoint pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent, this);
ContentOffsets offsets = GetContentOffsetsFromPoint(pt);
if (!IsMouseCaptured(aPresContext) && offsets.content) {
nsIFrame* capturingFrame = shell->GetPrimaryFrameFor(offsets.content);
if (capturingFrame)
capturingFrame->CaptureMouse(aPresContext, PR_TRUE);
}
// XXX This is screwy; it really should use the selection frame, not the
// event frame
@ -1863,9 +1869,6 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
return HandleMultiplePress(aPresContext, aEvent, aEventStatus);
}
nsPoint pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent, this);
ContentOffsets offsets = GetContentOffsetsFromPoint(pt);
if (!offsets.content)
return NS_ERROR_FAILURE;