82993, 87662 fixes for caret going into generated content. adjusting the content snapping to the best X value not Y value for up/down clicking. This will not cause a problem with the different size text but it MAY cause a problem with inline positioned elements.

This commit is contained in:
mjudge%netscape.com 2001-07-19 23:32:07 +00:00
Родитель f90032b6ba
Коммит 9d539a0e0f
4 изменённых файлов: 70 добавлений и 44 удалений

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

@ -4827,7 +4827,6 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState,
nsReflowStatus frameReflowStatus;
nsresult rv = brc.ReflowBlock(floater, availSpace, PR_TRUE, 0, isAdjacentWithTop,
aComputedOffsetsResult, frameReflowStatus);
if (NS_SUCCEEDED(rv) && isAutoWidth) {
nscoord maxElementWidth = brc.GetMaxElementSize().width;
if (maxElementWidth > availSpace.width) {
@ -5416,9 +5415,12 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
}
nsCOMPtr<nsIFrameSelection> frameselection;
shell->GetFrameSelection(getter_AddRefs(frameselection));
PRBool mouseDown = aEvent->message == NS_MOUSE_MOVE;
if (frameselection)
{
result = frameselection->HandleClick(pos.mResultContent, pos.mContentOffset,
pos.mContentOffsetEnd, me->isShift, PR_FALSE, pos.mPreferLeft);
pos.mContentOffsetEnd, mouseDown || me->isShift, PR_FALSE, pos.mPreferLeft);
}
}
else
result = resultFrame->HandleEvent(aPresContext, aEvent, aEventStatus);//else let the frame/container do what it needs

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

@ -1451,8 +1451,18 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsIPresContext* aPresContext,
if (NS_SUCCEEDED(frameselection->GetMouseDownState(&mouseDown)) && !mouseDown)
return NS_OK;
frameselection->StopAutoScrollTimer();
// check whether style allows selection
// if not, don't tell selection the mouse event even occurred.
PRBool selectable;
PRUint8 selectStyle;
result = IsSelectable(&selectable, &selectStyle);
if (NS_FAILED(result))
return result;
// check for select: none
if (selectable)
{
frameselection->StopAutoScrollTimer();
// Check if we are dragging in a table cell
nsCOMPtr<nsIContent> parentContent;
PRInt32 contentOffset;
@ -1463,9 +1473,9 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsIPresContext* aPresContext,
frameselection->HandleTableSelection(parentContent, contentOffset, target, me);
else
frameselection->HandleDrag(aPresContext, this, aEvent->point);
frameselection->StartAutoScrollTimer(aPresContext, this, aEvent->point, 30);
}
}
return NS_OK;
}
@ -1700,8 +1710,8 @@ nsresult nsFrame::GetContentAndOffsetsFromPoint(nsIPresContext* aCX,
if (yDistance <= closestYDistance && rect.width > 0 && rect.height > 0)
{
if (yDistance < closestYDistance)
closestXDistance = HUGE_DISTANCE;
// if (yDistance < closestYDistance)
// closestXDistance = HUGE_DISTANCE;
nscoord xa = rect.x;
nscoord xb = rect.x + rect.width;
@ -3725,7 +3735,9 @@ nsFrame::GetFrameFromDirection(nsIPresContext* aPresContext, nsPeekOffsetStruct
nsRect testRect;
#ifdef IBMBIDI
nsIFrame *newFrame;
while (testRect.IsEmpty()) {
PRBool selectable = PR_TRUE; //usually fine
while (testRect.IsEmpty() || !selectable) {
if (lineIsRTL && lineJump)
if (aPos->mDirection == eDirPrevious)
result = frameTraversal->Next();
@ -3820,12 +3832,11 @@ nsFrame::GetFrameFromDirection(nsIPresContext* aPresContext, nsPeekOffsetStruct
newFrame = lastFrame;
}
}
}
#endif // IBMBIDI
PRBool selectable;
newFrame->IsSelectable(&selectable, nsnull);
if (!selectable)
return NS_ERROR_FAILURE;
lineJump = PR_FALSE;
}
#endif // IBMBIDI
if (aPos->mDirection == eDirNext)
aPos->mStartOffset = 0;
else

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

@ -4827,7 +4827,6 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState,
nsReflowStatus frameReflowStatus;
nsresult rv = brc.ReflowBlock(floater, availSpace, PR_TRUE, 0, isAdjacentWithTop,
aComputedOffsetsResult, frameReflowStatus);
if (NS_SUCCEEDED(rv) && isAutoWidth) {
nscoord maxElementWidth = brc.GetMaxElementSize().width;
if (maxElementWidth > availSpace.width) {
@ -5416,9 +5415,12 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
}
nsCOMPtr<nsIFrameSelection> frameselection;
shell->GetFrameSelection(getter_AddRefs(frameselection));
PRBool mouseDown = aEvent->message == NS_MOUSE_MOVE;
if (frameselection)
{
result = frameselection->HandleClick(pos.mResultContent, pos.mContentOffset,
pos.mContentOffsetEnd, me->isShift, PR_FALSE, pos.mPreferLeft);
pos.mContentOffsetEnd, mouseDown || me->isShift, PR_FALSE, pos.mPreferLeft);
}
}
else
result = resultFrame->HandleEvent(aPresContext, aEvent, aEventStatus);//else let the frame/container do what it needs

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

@ -1451,8 +1451,18 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsIPresContext* aPresContext,
if (NS_SUCCEEDED(frameselection->GetMouseDownState(&mouseDown)) && !mouseDown)
return NS_OK;
frameselection->StopAutoScrollTimer();
// check whether style allows selection
// if not, don't tell selection the mouse event even occurred.
PRBool selectable;
PRUint8 selectStyle;
result = IsSelectable(&selectable, &selectStyle);
if (NS_FAILED(result))
return result;
// check for select: none
if (selectable)
{
frameselection->StopAutoScrollTimer();
// Check if we are dragging in a table cell
nsCOMPtr<nsIContent> parentContent;
PRInt32 contentOffset;
@ -1463,9 +1473,9 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsIPresContext* aPresContext,
frameselection->HandleTableSelection(parentContent, contentOffset, target, me);
else
frameselection->HandleDrag(aPresContext, this, aEvent->point);
frameselection->StartAutoScrollTimer(aPresContext, this, aEvent->point, 30);
}
}
return NS_OK;
}
@ -1700,8 +1710,8 @@ nsresult nsFrame::GetContentAndOffsetsFromPoint(nsIPresContext* aCX,
if (yDistance <= closestYDistance && rect.width > 0 && rect.height > 0)
{
if (yDistance < closestYDistance)
closestXDistance = HUGE_DISTANCE;
// if (yDistance < closestYDistance)
// closestXDistance = HUGE_DISTANCE;
nscoord xa = rect.x;
nscoord xb = rect.x + rect.width;
@ -3725,7 +3735,9 @@ nsFrame::GetFrameFromDirection(nsIPresContext* aPresContext, nsPeekOffsetStruct
nsRect testRect;
#ifdef IBMBIDI
nsIFrame *newFrame;
while (testRect.IsEmpty()) {
PRBool selectable = PR_TRUE; //usually fine
while (testRect.IsEmpty() || !selectable) {
if (lineIsRTL && lineJump)
if (aPos->mDirection == eDirPrevious)
result = frameTraversal->Next();
@ -3820,12 +3832,11 @@ nsFrame::GetFrameFromDirection(nsIPresContext* aPresContext, nsPeekOffsetStruct
newFrame = lastFrame;
}
}
}
#endif // IBMBIDI
PRBool selectable;
newFrame->IsSelectable(&selectable, nsnull);
if (!selectable)
return NS_ERROR_FAILURE;
lineJump = PR_FALSE;
}
#endif // IBMBIDI
if (aPos->mDirection == eDirNext)
aPos->mStartOffset = 0;
else