Bug 277553 clicking on Textarea with a RTL direction doesnt work
patch by uriber@gmail.com r=bz sr=bz a=bsmedberg
This commit is contained in:
@@ -3249,11 +3249,7 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsPresContext* aPresContext,
|
|||||||
nsIView * view; //used for call of get offset from view
|
nsIView * view; //used for call of get offset from view
|
||||||
aBlockFrame->GetOffsetFromView(offset,&view);
|
aBlockFrame->GetOffsetFromView(offset,&view);
|
||||||
nscoord newDesiredX = aPos->mDesiredX - offset.x;//get desired x into blockframe coordinates!
|
nscoord newDesiredX = aPos->mDesiredX - offset.x;//get desired x into blockframe coordinates!
|
||||||
#ifdef IBMBIDI
|
|
||||||
result = it->FindFrameAt(searchingLine, newDesiredX, aPresContext->BidiEnabled(), &resultFrame, &isBeforeFirstFrame, &isAfterLastFrame);
|
|
||||||
#else
|
|
||||||
result = it->FindFrameAt(searchingLine, newDesiredX, &resultFrame, &isBeforeFirstFrame, &isAfterLastFrame);
|
result = it->FindFrameAt(searchingLine, newDesiredX, &resultFrame, &isBeforeFirstFrame, &isAfterLastFrame);
|
||||||
#endif // IBMBIDI
|
|
||||||
if(NS_FAILED(result))
|
if(NS_FAILED(result))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,10 +118,6 @@ public:
|
|||||||
// appropriately.
|
// appropriately.
|
||||||
NS_IMETHOD FindFrameAt(PRInt32 aLineNumber,
|
NS_IMETHOD FindFrameAt(PRInt32 aLineNumber,
|
||||||
nscoord aX,
|
nscoord aX,
|
||||||
#ifdef IBMBIDI
|
|
||||||
//This parameter determines whether to traverse the frames in logical or visual order
|
|
||||||
PRBool aCouldBeReordered,
|
|
||||||
#endif
|
|
||||||
nsIFrame** aFrameFound,
|
nsIFrame** aFrameFound,
|
||||||
PRBool* aXIsBeforeFirstFrame,
|
PRBool* aXIsBeforeFirstFrame,
|
||||||
PRBool* aXIsAfterLastFrame) = 0;
|
PRBool* aXIsAfterLastFrame) = 0;
|
||||||
|
|||||||
@@ -762,9 +762,6 @@ nsLineIterator::CheckLineOrder(PRInt32 aLine,
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsLineIterator::FindFrameAt(PRInt32 aLineNumber,
|
nsLineIterator::FindFrameAt(PRInt32 aLineNumber,
|
||||||
nscoord aX,
|
nscoord aX,
|
||||||
#ifdef IBMBIDI
|
|
||||||
PRBool aCouldBeReordered,
|
|
||||||
#endif // IBMBIDI
|
|
||||||
nsIFrame** aFrameFound,
|
nsIFrame** aFrameFound,
|
||||||
PRBool* aXIsBeforeFirstFrame,
|
PRBool* aXIsBeforeFirstFrame,
|
||||||
PRBool* aXIsAfterLastFrame)
|
PRBool* aXIsAfterLastFrame)
|
||||||
@@ -789,180 +786,53 @@ nsLineIterator::FindFrameAt(PRInt32 aLineNumber,
|
|||||||
if (line->mBounds.width == 0)
|
if (line->mBounds.width == 0)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
nsIFrame *stoppingFrame = nsnull;
|
|
||||||
|
|
||||||
if (aX < line->mBounds.x) {
|
|
||||||
nsIFrame* frame;
|
|
||||||
if (mRightToLeft) {
|
|
||||||
frame = line->LastChild();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
frame = line->mFirstChild;
|
|
||||||
}
|
|
||||||
if (frame->GetRect().width > 0)
|
|
||||||
{
|
|
||||||
*aFrameFound = frame;
|
|
||||||
*aXIsBeforeFirstFrame = PR_TRUE;
|
|
||||||
*aXIsAfterLastFrame = PR_FALSE;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
else if (mRightToLeft)
|
|
||||||
stoppingFrame = frame;
|
|
||||||
else
|
|
||||||
stoppingFrame = line->LastChild();
|
|
||||||
}
|
|
||||||
else if (aX >= line->mBounds.XMost()) {
|
|
||||||
nsIFrame* frame;
|
|
||||||
if (mRightToLeft) {
|
|
||||||
frame = line->mFirstChild;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
frame = line->LastChild();
|
|
||||||
}
|
|
||||||
if (frame->GetRect().width > 0)
|
|
||||||
{
|
|
||||||
*aFrameFound = frame;
|
|
||||||
*aXIsBeforeFirstFrame = PR_FALSE;
|
|
||||||
*aXIsAfterLastFrame = PR_TRUE;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
else if (mRightToLeft)
|
|
||||||
stoppingFrame = line->mFirstChild;
|
|
||||||
else
|
|
||||||
stoppingFrame = frame;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find the frame closest to the X coordinate. Gaps can occur
|
|
||||||
// between frames (because of margins) so we split the gap in two
|
|
||||||
// when checking.
|
|
||||||
*aXIsBeforeFirstFrame = PR_FALSE;
|
|
||||||
*aXIsAfterLastFrame = PR_FALSE;
|
|
||||||
#ifdef IBMBIDI
|
|
||||||
PRBool isReordered = PR_FALSE;
|
|
||||||
nsIFrame *firstVisual, *lastVisual;
|
|
||||||
if (aCouldBeReordered)
|
|
||||||
CheckLineOrder(aLineNumber, &isReordered, &firstVisual, &lastVisual);
|
|
||||||
#endif
|
|
||||||
nsIFrame* frame = line->mFirstChild;
|
nsIFrame* frame = line->mFirstChild;
|
||||||
#ifdef IBMBIDI
|
nsIFrame* closestFromLeft = nsnull;
|
||||||
if (isReordered)
|
nsIFrame* closestFromRight = nsnull;
|
||||||
frame = firstVisual;
|
|
||||||
#endif // IBMBIDI
|
|
||||||
PRInt32 n = line->GetChildCount();
|
PRInt32 n = line->GetChildCount();
|
||||||
if (mRightToLeft) {
|
while (n--) {
|
||||||
while (--n >= 0) {
|
nsRect rect = frame->GetRect();
|
||||||
nsIFrame* nextFrame;
|
if (rect.width > 0) {
|
||||||
#ifdef IBMBIDI
|
// If aX is inside this frame - this is it
|
||||||
if (!frame)
|
if (rect.x <= aX && rect.XMost() > aX) {
|
||||||
break;
|
closestFromLeft = closestFromRight = frame;
|
||||||
if (isReordered) {
|
|
||||||
nscoord maxX, limX;
|
|
||||||
PRInt32 testLine;
|
|
||||||
nsIFrame* tempFrame;
|
|
||||||
|
|
||||||
maxX = -0x7fffffff;
|
|
||||||
|
|
||||||
limX = frame->GetRect().x;
|
|
||||||
tempFrame = line->mFirstChild;
|
|
||||||
nextFrame = nsnull;
|
|
||||||
|
|
||||||
while (tempFrame) {
|
|
||||||
if (NS_SUCCEEDED(FindLineContaining(tempFrame, &testLine))
|
|
||||||
&& testLine == aLineNumber) {
|
|
||||||
nsRect tempRect = tempFrame->GetRect();
|
|
||||||
if (tempRect.x > maxX && tempRect.x < limX) { // we are looking for the highest value less than the current one
|
|
||||||
maxX = tempRect.x;
|
|
||||||
nextFrame = tempFrame;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tempFrame = tempFrame->GetNextSibling();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif // IBMBIDI
|
|
||||||
nextFrame = frame->GetNextSibling();
|
|
||||||
|
|
||||||
nsRect r1 = frame->GetRect();
|
|
||||||
if (r1.width && aX > r1.x) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (nextFrame) {
|
if (rect.x < aX) {
|
||||||
nsRect r2 = nextFrame->GetRect();
|
if (!closestFromLeft ||
|
||||||
if (r2.width && aX > r2.XMost()) {
|
rect.XMost() > closestFromLeft->GetRect().XMost())
|
||||||
nscoord rightEdge = r2.XMost();
|
closestFromLeft = frame;
|
||||||
nscoord delta = r1.x - rightEdge;
|
|
||||||
if (!r1.width || aX < rightEdge + delta/2) {
|
|
||||||
frame = nextFrame;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*aXIsBeforeFirstFrame = PR_TRUE;
|
if (!closestFromRight ||
|
||||||
|
rect.x < closestFromRight->GetRect().x)
|
||||||
|
closestFromRight = frame;
|
||||||
}
|
}
|
||||||
frame = nextFrame;
|
|
||||||
if (nextFrame == stoppingFrame)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
frame = frame->GetNextSibling();
|
||||||
}
|
}
|
||||||
else {
|
if (!closestFromLeft && !closestFromRight) {
|
||||||
while (--n >= 0) {
|
// All frames were zero-width. Just take the first one.
|
||||||
nsIFrame* nextFrame;
|
closestFromLeft = closestFromRight = line->mFirstChild;
|
||||||
#ifdef IBMBIDI
|
}
|
||||||
if (!frame)
|
*aXIsBeforeFirstFrame = mRightToLeft ? !closestFromRight : !closestFromLeft;
|
||||||
break;
|
*aXIsAfterLastFrame = mRightToLeft ? !closestFromLeft : !closestFromRight;
|
||||||
if (isReordered) {
|
if (closestFromLeft == closestFromRight) {
|
||||||
nsIFrame* tempFrame;
|
*aFrameFound = closestFromLeft;
|
||||||
nscoord minX, limX;
|
}
|
||||||
PRInt32 testLine;
|
else if (!closestFromLeft) {
|
||||||
|
*aFrameFound = closestFromRight;
|
||||||
minX = 0x7fffffff;
|
}
|
||||||
|
else if (!closestFromRight) {
|
||||||
limX = frame->GetRect().x;
|
*aFrameFound = closestFromLeft;
|
||||||
tempFrame = line->mFirstChild;
|
}
|
||||||
nextFrame = nsnull;
|
else { // we're between two frames
|
||||||
|
nscoord delta = closestFromRight->GetRect().x - closestFromLeft->GetRect().XMost();
|
||||||
while (tempFrame) {
|
if (aX < closestFromLeft->GetRect().XMost() + delta/2)
|
||||||
if (NS_SUCCEEDED(FindLineContaining(tempFrame, &testLine))
|
*aFrameFound = closestFromLeft;
|
||||||
&& testLine == aLineNumber) {
|
else
|
||||||
nsRect tempRect = tempFrame->GetRect();
|
*aFrameFound = closestFromRight;
|
||||||
if (tempRect.width && tempRect.x < minX && tempRect.x > limX) { // we are looking for the lowest value greater than the current one
|
|
||||||
minX = tempRect.x;
|
|
||||||
nextFrame = tempFrame;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tempFrame = tempFrame->GetNextSibling();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif // IBMBIDI
|
|
||||||
nextFrame = frame->GetNextSibling();
|
|
||||||
|
|
||||||
nsRect r1 = frame->GetRect();
|
|
||||||
if (r1.width && aX < r1.XMost()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (nextFrame) {
|
|
||||||
nsRect r2 = nextFrame->GetRect();
|
|
||||||
if (r2.width && aX < r2.x) {
|
|
||||||
nscoord rightEdge = r1.XMost();
|
|
||||||
nscoord delta = r2.x - rightEdge;
|
|
||||||
if (!r1.width || aX >= rightEdge + delta/2) {
|
|
||||||
frame = nextFrame;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
*aXIsAfterLastFrame = PR_TRUE;
|
|
||||||
}
|
|
||||||
frame = nextFrame;
|
|
||||||
if (nextFrame == stoppingFrame)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*aFrameFound = frame;
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1488,9 +1488,6 @@ public:
|
|||||||
PRInt32* aLineNumberResult);
|
PRInt32* aLineNumberResult);
|
||||||
NS_IMETHOD FindFrameAt(PRInt32 aLineNumber,
|
NS_IMETHOD FindFrameAt(PRInt32 aLineNumber,
|
||||||
nscoord aX,
|
nscoord aX,
|
||||||
#ifdef IBMBIDI
|
|
||||||
PRBool aCouldBeReordered,
|
|
||||||
#endif
|
|
||||||
nsIFrame** aFrameFound,
|
nsIFrame** aFrameFound,
|
||||||
PRBool* aXIsBeforeFirstFrame,
|
PRBool* aXIsBeforeFirstFrame,
|
||||||
PRBool* aXIsAfterLastFrame);
|
PRBool* aXIsAfterLastFrame);
|
||||||
|
|||||||
@@ -1937,9 +1937,6 @@ nsTableRowGroupFrame::CheckLineOrder(PRInt32 aLine,
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsTableRowGroupFrame::FindFrameAt(PRInt32 aLineNumber,
|
nsTableRowGroupFrame::FindFrameAt(PRInt32 aLineNumber,
|
||||||
nscoord aX,
|
nscoord aX,
|
||||||
#ifdef IBMBIDI
|
|
||||||
PRBool aCouldBeReordered,
|
|
||||||
#endif // IBMBIDI
|
|
||||||
nsIFrame** aFrameFound,
|
nsIFrame** aFrameFound,
|
||||||
PRBool* aXIsBeforeFirstFrame,
|
PRBool* aXIsBeforeFirstFrame,
|
||||||
PRBool* aXIsAfterLastFrame)
|
PRBool* aXIsAfterLastFrame)
|
||||||
|
|||||||
@@ -240,9 +240,6 @@ public:
|
|||||||
|
|
||||||
NS_IMETHOD FindFrameAt(PRInt32 aLineNumber,
|
NS_IMETHOD FindFrameAt(PRInt32 aLineNumber,
|
||||||
nscoord aX,
|
nscoord aX,
|
||||||
#ifdef IBMBIDI
|
|
||||||
PRBool aCouldBeReordered,
|
|
||||||
#endif
|
|
||||||
nsIFrame** aFrameFound,
|
nsIFrame** aFrameFound,
|
||||||
PRBool* aXIsBeforeFirstFrame,
|
PRBool* aXIsBeforeFirstFrame,
|
||||||
PRBool* aXIsAfterLastFrame);
|
PRBool* aXIsAfterLastFrame);
|
||||||
|
|||||||
Reference in New Issue
Block a user