202834 r=danm sr=kin fixes regression in line clicking and navigation.

This commit is contained in:
mjudge@netscape.com
2003-04-22 22:40:58 +00:00
parent 4d0cb4dc54
commit f253fe34b4
2 changed files with 26 additions and 0 deletions

View File

@@ -797,6 +797,7 @@ nsLineIterator::FindFrameAt(PRInt32 aLineNumber,
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
nsRect r1, r2; nsRect r1, r2;
nsIFrame *stoppingFrame = nsnull;
if (aX < line->mBounds.x) { if (aX < line->mBounds.x) {
nsIFrame* frame; nsIFrame* frame;
@@ -814,6 +815,10 @@ nsLineIterator::FindFrameAt(PRInt32 aLineNumber,
*aXIsAfterLastFrame = PR_FALSE; *aXIsAfterLastFrame = PR_FALSE;
return NS_OK; return NS_OK;
} }
else if (mRightToLeft)
stoppingFrame = frame;
else
stoppingFrame = line->LastChild();
} }
else if (aX >= line->mBounds.XMost()) { else if (aX >= line->mBounds.XMost()) {
nsIFrame* frame; nsIFrame* frame;
@@ -831,6 +836,10 @@ nsLineIterator::FindFrameAt(PRInt32 aLineNumber,
*aXIsAfterLastFrame = PR_TRUE; *aXIsAfterLastFrame = PR_TRUE;
return NS_OK; return NS_OK;
} }
else if (mRightToLeft)
stoppingFrame = line->mFirstChild;
else
stoppingFrame = frame;
} }
// Find the frame closest to the X coordinate. Gaps can occur // Find the frame closest to the X coordinate. Gaps can occur
@@ -884,6 +893,8 @@ nsLineIterator::FindFrameAt(PRInt32 aLineNumber,
else else
#endif // IBMBIDI #endif // IBMBIDI
frame->GetNextSibling(&nextFrame); frame->GetNextSibling(&nextFrame);
if (nextFrame == stoppingFrame)
break;
frame->GetRect(r1); frame->GetRect(r1);
if (r1.width && aX > r1.x) { if (r1.width && aX > r1.x) {
break; break;
@@ -939,6 +950,8 @@ nsLineIterator::FindFrameAt(PRInt32 aLineNumber,
else else
#endif // IBMBIDI #endif // IBMBIDI
frame->GetNextSibling(&nextFrame); frame->GetNextSibling(&nextFrame);
if (nextFrame == stoppingFrame)
break;
frame->GetRect(r1); frame->GetRect(r1);
if (r1.width && aX < r1.XMost()) { if (r1.width && aX < r1.XMost()) {
break; break;

View File

@@ -797,6 +797,7 @@ nsLineIterator::FindFrameAt(PRInt32 aLineNumber,
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
nsRect r1, r2; nsRect r1, r2;
nsIFrame *stoppingFrame = nsnull;
if (aX < line->mBounds.x) { if (aX < line->mBounds.x) {
nsIFrame* frame; nsIFrame* frame;
@@ -814,6 +815,10 @@ nsLineIterator::FindFrameAt(PRInt32 aLineNumber,
*aXIsAfterLastFrame = PR_FALSE; *aXIsAfterLastFrame = PR_FALSE;
return NS_OK; return NS_OK;
} }
else if (mRightToLeft)
stoppingFrame = frame;
else
stoppingFrame = line->LastChild();
} }
else if (aX >= line->mBounds.XMost()) { else if (aX >= line->mBounds.XMost()) {
nsIFrame* frame; nsIFrame* frame;
@@ -831,6 +836,10 @@ nsLineIterator::FindFrameAt(PRInt32 aLineNumber,
*aXIsAfterLastFrame = PR_TRUE; *aXIsAfterLastFrame = PR_TRUE;
return NS_OK; return NS_OK;
} }
else if (mRightToLeft)
stoppingFrame = line->mFirstChild;
else
stoppingFrame = frame;
} }
// Find the frame closest to the X coordinate. Gaps can occur // Find the frame closest to the X coordinate. Gaps can occur
@@ -884,6 +893,8 @@ nsLineIterator::FindFrameAt(PRInt32 aLineNumber,
else else
#endif // IBMBIDI #endif // IBMBIDI
frame->GetNextSibling(&nextFrame); frame->GetNextSibling(&nextFrame);
if (nextFrame == stoppingFrame)
break;
frame->GetRect(r1); frame->GetRect(r1);
if (r1.width && aX > r1.x) { if (r1.width && aX > r1.x) {
break; break;
@@ -939,6 +950,8 @@ nsLineIterator::FindFrameAt(PRInt32 aLineNumber,
else else
#endif // IBMBIDI #endif // IBMBIDI
frame->GetNextSibling(&nextFrame); frame->GetNextSibling(&nextFrame);
if (nextFrame == stoppingFrame)
break;
frame->GetRect(r1); frame->GetRect(r1);
if (r1.width && aX < r1.XMost()) { if (r1.width && aX < r1.XMost()) {
break; break;