зеркало из https://github.com/mozilla/gecko-dev.git
Bug 374100. Regression in GetTextAtOffset for forced line breaks. r=parente
This commit is contained in:
Родитель
d583a6fdcd
Коммит
52724056f8
|
@ -704,15 +704,17 @@ nsresult nsHyperTextAccessible::GetTextHelper(EGetTextType aType, nsAccessibleTe
|
||||||
return NS_ERROR_INVALID_ARG;
|
return NS_ERROR_INVALID_ARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PRInt32 finalStartOffset, finalEndOffset;
|
||||||
|
|
||||||
// If aType == eGetAt we'll change both the start and end offset from
|
// If aType == eGetAt we'll change both the start and end offset from
|
||||||
// the original offset
|
// the original offset
|
||||||
if (aType == eGetAfter) {
|
if (aType == eGetAfter) {
|
||||||
startOffset = aOffset;
|
finalStartOffset = aOffset;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
startOffset = GetRelativeOffset(presShell, startFrame, startOffset,
|
finalStartOffset = GetRelativeOffset(presShell, startFrame, startOffset,
|
||||||
amount, eDirPrevious, needsStart);
|
amount, eDirPrevious, needsStart);
|
||||||
NS_ENSURE_TRUE(startOffset >= 0, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(finalStartOffset >= 0, NS_ERROR_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aType == eGetBefore) {
|
if (aType == eGetBefore) {
|
||||||
|
@ -721,12 +723,13 @@ nsresult nsHyperTextAccessible::GetTextHelper(EGetTextType aType, nsAccessibleTe
|
||||||
else {
|
else {
|
||||||
// Start moving forward from the start so that we don't get
|
// Start moving forward from the start so that we don't get
|
||||||
// 2 words/lines if the offset occured on whitespace boundary
|
// 2 words/lines if the offset occured on whitespace boundary
|
||||||
endOffset = startOffset; // Passed by reference to GetPosAndText()
|
// Careful, startOffset and endOffset are passed by reference to GetPosAndText() and changed
|
||||||
|
startOffset = endOffset = finalStartOffset;
|
||||||
nsIFrame *endFrame = GetPosAndText(startOffset, endOffset);
|
nsIFrame *endFrame = GetPosAndText(startOffset, endOffset);
|
||||||
if (!endFrame) {
|
if (!endFrame) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
endOffset = GetRelativeOffset(presShell, endFrame, endOffset, amount,
|
finalEndOffset = GetRelativeOffset(presShell, endFrame, endOffset, amount,
|
||||||
eDirNext, needsStart);
|
eDirNext, needsStart);
|
||||||
NS_ENSURE_TRUE(endOffset >= 0, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(endOffset >= 0, NS_ERROR_FAILURE);
|
||||||
}
|
}
|
||||||
|
@ -738,13 +741,13 @@ nsresult nsHyperTextAccessible::GetTextHelper(EGetTextType aType, nsAccessibleTe
|
||||||
return GetTextHelper(eGetAfter, aBoundaryType, aOffset, aStartOffset, aEndOffset, aText);
|
return GetTextHelper(eGetAfter, aBoundaryType, aOffset, aStartOffset, aEndOffset, aText);
|
||||||
}
|
}
|
||||||
|
|
||||||
*aStartOffset = startOffset;
|
*aStartOffset = finalStartOffset;
|
||||||
*aEndOffset = endOffset;
|
*aEndOffset = finalEndOffset;
|
||||||
|
|
||||||
NS_ASSERTION((startOffset < aOffset && endOffset >= aOffset) || aType != eGetBefore, "Incorrect results for GetTextHelper");
|
NS_ASSERTION((finalStartOffset < aOffset && finalEndOffset >= aOffset) || aType != eGetBefore, "Incorrect results for GetTextHelper");
|
||||||
NS_ASSERTION((startOffset <= aOffset && endOffset > aOffset) || aType == eGetBefore, "Incorrect results for GetTextHelper");
|
NS_ASSERTION((finalStartOffset <= aOffset && finalEndOffset > aOffset) || aType == eGetBefore, "Incorrect results for GetTextHelper");
|
||||||
|
|
||||||
return GetPosAndText(startOffset, endOffset, &aText) ? NS_OK : NS_ERROR_FAILURE;
|
return GetPosAndText(finalStartOffset, finalEndOffset, &aText) ? NS_OK : NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Загрузка…
Ссылка в новой задаче