Bug 200098: Double click near beginning of word selects two words (fix for Windows). r+sr=roc

This commit is contained in:
uriber%gmail.com 2007-01-04 16:47:04 +00:00
parent 19e1764d12
commit 9133558e7b

View File

@ -2090,18 +2090,40 @@ nsFrame::PeekBackwardAndForward(nsSelectionAmount aAmountBack,
nsCOMPtr<nsIDOMNode> startNode;
nsCOMPtr<nsIContent> endContent;
nsCOMPtr<nsIDOMNode> endNode;
nsIFrame* baseFrame = this;
PRInt32 baseOffset = aStartPos;
if (aAmountBack == eSelectWord) {
// To avoid selecting the previous word when at start of word,
// first move one character forward.
nsPeekOffsetStruct pos;
pos.SetData(eSelectCharacter,
eDirNext,
aStartPos,
0,
aJumpLines,
PR_TRUE, //limit on scrolled views
PR_FALSE,
PR_FALSE);
rv = PeekOffset(&pos);
if (NS_SUCCEEDED(rv)) {
baseFrame = pos.mResultFrame;
baseOffset = pos.mContentOffset;
}
}
nsPeekOffsetStruct startpos;
startpos.SetData(aAmountBack,
eDirPrevious,
aStartPos,
baseOffset,
0,
aJumpLines,
PR_TRUE, //limit on scrolled views
PR_FALSE,
PR_FALSE);
rv = PeekOffset(&startpos);
rv = baseFrame->PeekOffset(&startpos);
if (NS_FAILED(rv))
return rv;
nsPeekOffsetStruct endpos;
endpos.SetData(aAmountForward,
eDirNext,