зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
f90032b6ba
Коммит
9d539a0e0f
|
@ -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,20 +1451,30 @@ 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 if we are dragging in a table cell
|
||||
nsCOMPtr<nsIContent> parentContent;
|
||||
PRInt32 contentOffset;
|
||||
PRInt32 target;
|
||||
nsMouseEvent *me = (nsMouseEvent *)aEvent;
|
||||
result = GetDataForTableSelection(frameselection, me, getter_AddRefs(parentContent), &contentOffset, &target);
|
||||
if (NS_SUCCEEDED(result) && parentContent)
|
||||
frameselection->HandleTableSelection(parentContent, contentOffset, target, me);
|
||||
else
|
||||
frameselection->HandleDrag(aPresContext, this, aEvent->point);
|
||||
|
||||
frameselection->StartAutoScrollTimer(aPresContext, this, aEvent->point, 30);
|
||||
// check for select: none
|
||||
if (selectable)
|
||||
{
|
||||
frameselection->StopAutoScrollTimer();
|
||||
// Check if we are dragging in a table cell
|
||||
nsCOMPtr<nsIContent> parentContent;
|
||||
PRInt32 contentOffset;
|
||||
PRInt32 target;
|
||||
nsMouseEvent *me = (nsMouseEvent *)aEvent;
|
||||
result = GetDataForTableSelection(frameselection, me, getter_AddRefs(parentContent), &contentOffset, &target);
|
||||
if (NS_SUCCEEDED(result) && parentContent)
|
||||
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;
|
||||
}
|
||||
}
|
||||
newFrame->IsSelectable(&selectable, nsnull);
|
||||
if (!selectable)
|
||||
lineJump = PR_FALSE;
|
||||
}
|
||||
#endif // IBMBIDI
|
||||
PRBool selectable;
|
||||
newFrame->IsSelectable(&selectable, nsnull);
|
||||
if (!selectable)
|
||||
return NS_ERROR_FAILURE;
|
||||
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,20 +1451,30 @@ 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 if we are dragging in a table cell
|
||||
nsCOMPtr<nsIContent> parentContent;
|
||||
PRInt32 contentOffset;
|
||||
PRInt32 target;
|
||||
nsMouseEvent *me = (nsMouseEvent *)aEvent;
|
||||
result = GetDataForTableSelection(frameselection, me, getter_AddRefs(parentContent), &contentOffset, &target);
|
||||
if (NS_SUCCEEDED(result) && parentContent)
|
||||
frameselection->HandleTableSelection(parentContent, contentOffset, target, me);
|
||||
else
|
||||
frameselection->HandleDrag(aPresContext, this, aEvent->point);
|
||||
|
||||
frameselection->StartAutoScrollTimer(aPresContext, this, aEvent->point, 30);
|
||||
// check for select: none
|
||||
if (selectable)
|
||||
{
|
||||
frameselection->StopAutoScrollTimer();
|
||||
// Check if we are dragging in a table cell
|
||||
nsCOMPtr<nsIContent> parentContent;
|
||||
PRInt32 contentOffset;
|
||||
PRInt32 target;
|
||||
nsMouseEvent *me = (nsMouseEvent *)aEvent;
|
||||
result = GetDataForTableSelection(frameselection, me, getter_AddRefs(parentContent), &contentOffset, &target);
|
||||
if (NS_SUCCEEDED(result) && parentContent)
|
||||
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;
|
||||
}
|
||||
}
|
||||
newFrame->IsSelectable(&selectable, nsnull);
|
||||
if (!selectable)
|
||||
lineJump = PR_FALSE;
|
||||
}
|
||||
#endif // IBMBIDI
|
||||
PRBool selectable;
|
||||
newFrame->IsSelectable(&selectable, nsnull);
|
||||
if (!selectable)
|
||||
return NS_ERROR_FAILURE;
|
||||
if (aPos->mDirection == eDirNext)
|
||||
aPos->mStartOffset = 0;
|
||||
else
|
||||
|
|
Загрузка…
Ссылка в новой задаче