mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
backout 392c55ce512d bug 853340 to see if it somehow broke linux pgo landed on a CLOSED TREE
This commit is contained in:
parent
9fa1540293
commit
5ca1edd4b3
@ -287,8 +287,7 @@ HyperTextAccessible::GetPosAndText(int32_t& aStartOffset, int32_t& aEndOffset,
|
||||
// should go away after list bullet rewrite
|
||||
substringEndOffset = nsAccUtils::TextLength(childAcc);
|
||||
}
|
||||
if (startOffset < substringEndOffset ||
|
||||
(startOffset == substringEndOffset && (childIdx == childCount - 1))) {
|
||||
if (startOffset < substringEndOffset) {
|
||||
// Our start is within this substring
|
||||
if (startOffset > 0 || endOffset < substringEndOffset) {
|
||||
// We don't want the whole string for this accessible
|
||||
@ -693,14 +692,18 @@ HyperTextAccessible::GetRelativeOffset(nsIPresShell* aPresShell,
|
||||
Accessible* aFromAccessible,
|
||||
nsSelectionAmount aAmount,
|
||||
nsDirection aDirection,
|
||||
bool aNeedsStart,
|
||||
EWordMovementType aWordMovementType)
|
||||
bool aNeedsStart)
|
||||
{
|
||||
const bool kIsJumpLinesOk = true; // okay to jump lines
|
||||
const bool kIsScrollViewAStop = false; // do not stop at scroll views
|
||||
const bool kIsKeyboardSelect = true; // is keyboard selection
|
||||
const bool kIsVisualBidi = false; // use visual order for bidi text
|
||||
|
||||
EWordMovementType wordMovementType = aNeedsStart ? eStartWord : eEndWord;
|
||||
if (aAmount == eSelectLine) {
|
||||
aAmount = (aDirection == eDirNext) ? eSelectEndLine : eSelectBeginLine;
|
||||
}
|
||||
|
||||
// Ask layout for the new node and offset, after moving the appropriate amount
|
||||
|
||||
nsresult rv;
|
||||
@ -715,7 +718,7 @@ HyperTextAccessible::GetRelativeOffset(nsIPresShell* aPresShell,
|
||||
|
||||
nsPeekOffsetStruct pos(aAmount, aDirection, contentOffset,
|
||||
0, kIsJumpLinesOk, kIsScrollViewAStop, kIsKeyboardSelect, kIsVisualBidi,
|
||||
aWordMovementType);
|
||||
wordMovementType);
|
||||
rv = aFromFrame->PeekOffset(&pos);
|
||||
if (NS_FAILED(rv)) {
|
||||
if (aDirection == eDirPrevious) {
|
||||
@ -790,10 +793,8 @@ BOUNDARY_LINE_END From the line end before/at/after the offset to the ne
|
||||
*/
|
||||
|
||||
nsresult
|
||||
HyperTextAccessible::GetTextHelper(EGetTextType aType,
|
||||
AccessibleTextBoundary aBoundaryType,
|
||||
int32_t aOffset,
|
||||
int32_t* aStartOffset, int32_t* aEndOffset,
|
||||
HyperTextAccessible::GetTextHelper(EGetTextType aType, AccessibleTextBoundary aBoundaryType,
|
||||
int32_t aOffset, int32_t* aStartOffset, int32_t* aEndOffset,
|
||||
nsAString& aText)
|
||||
{
|
||||
aText.Truncate();
|
||||
@ -802,28 +803,45 @@ HyperTextAccessible::GetTextHelper(EGetTextType aType,
|
||||
NS_ENSURE_ARG_POINTER(aEndOffset);
|
||||
*aStartOffset = *aEndOffset = 0;
|
||||
|
||||
int32_t offset = ConvertMagicOffset(aOffset);
|
||||
if (offset < 0)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
if (!mDoc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (aOffset == nsIAccessibleText::TEXT_OFFSET_CARET && offset > 0 &&
|
||||
(aBoundaryType == BOUNDARY_LINE_START ||
|
||||
aBoundaryType == BOUNDARY_LINE_END)) {
|
||||
// It is the same character offset when the caret is visually at
|
||||
// the very end of a line or the start of a new line. Getting text at
|
||||
// the line should provide the line with the visual caret,
|
||||
// otherwise screen readers will announce the wrong line as the user
|
||||
// presses up or down arrow and land at the end of a line.
|
||||
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
|
||||
if (frameSelection &&
|
||||
frameSelection->GetHint() == nsFrameSelection::HINTLEFT) {
|
||||
-- offset; // We are at the start of a line
|
||||
nsIPresShell* presShell = mDoc->PresShell();
|
||||
if (!presShell) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (aOffset == nsIAccessibleText::TEXT_OFFSET_END_OF_TEXT) {
|
||||
aOffset = CharacterCount();
|
||||
}
|
||||
if (aOffset == nsIAccessibleText::TEXT_OFFSET_CARET) {
|
||||
GetCaretOffset(&aOffset);
|
||||
if (aOffset > 0 && (aBoundaryType == BOUNDARY_LINE_START ||
|
||||
aBoundaryType == BOUNDARY_LINE_END)) {
|
||||
// It is the same character offset when the caret is visually at the very end of a line
|
||||
// or the start of a new line. Getting text at the line should provide the line with the visual caret,
|
||||
// otherwise screen readers will announce the wrong line as the user presses up or down arrow and land
|
||||
// at the end of a line.
|
||||
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
|
||||
if (frameSelection &&
|
||||
frameSelection->GetHint() == nsFrameSelection::HINTLEFT) {
|
||||
-- aOffset; // We are at the start of a line
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (aOffset < 0) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsSelectionAmount amount;
|
||||
bool needsStart = false;
|
||||
switch (aBoundaryType) {
|
||||
case BOUNDARY_CHAR:
|
||||
amount = eSelectCluster;
|
||||
if (aType == eGetAt)
|
||||
aType = eGetAfter; // Avoid returning 2 characters
|
||||
break;
|
||||
|
||||
case BOUNDARY_WORD_START:
|
||||
needsStart = true;
|
||||
amount = eSelectWord;
|
||||
@ -850,7 +868,7 @@ HyperTextAccessible::GetTextHelper(EGetTextType aType,
|
||||
|
||||
case BOUNDARY_ATTRIBUTE_RANGE:
|
||||
{
|
||||
nsresult rv = GetTextAttributes(false, offset,
|
||||
nsresult rv = GetTextAttributes(false, aOffset,
|
||||
aStartOffset, aEndOffset, nullptr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -861,7 +879,7 @@ HyperTextAccessible::GetTextHelper(EGetTextType aType,
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
int32_t startOffset = offset + (aBoundaryType == BOUNDARY_LINE_END); // Avoid getting the previous line
|
||||
int32_t startOffset = aOffset + (aBoundaryType == BOUNDARY_LINE_END); // Avoid getting the previous line
|
||||
int32_t endOffset = startOffset;
|
||||
|
||||
// Convert offsets to frame-relative
|
||||
@ -871,13 +889,13 @@ HyperTextAccessible::GetTextHelper(EGetTextType aType,
|
||||
|
||||
if (!startFrame) {
|
||||
int32_t textLength = CharacterCount();
|
||||
if (aBoundaryType == BOUNDARY_LINE_START && offset > 0 && offset == textLength) {
|
||||
if (aBoundaryType == BOUNDARY_LINE_START && aOffset > 0 && aOffset == textLength) {
|
||||
// Asking for start of line, while on last character
|
||||
if (startAcc)
|
||||
startFrame = startAcc->GetFrame();
|
||||
}
|
||||
if (!startFrame) {
|
||||
return offset > textLength ? NS_ERROR_FAILURE : NS_OK;
|
||||
return aOffset > textLength ? NS_ERROR_FAILURE : NS_OK;
|
||||
}
|
||||
else {
|
||||
// We're on the last continuation since we're on the last character
|
||||
@ -885,26 +903,22 @@ HyperTextAccessible::GetTextHelper(EGetTextType aType,
|
||||
}
|
||||
}
|
||||
|
||||
int32_t finalStartOffset = 0, finalEndOffset = 0;
|
||||
EWordMovementType wordMovementType = needsStart ? eStartWord : eEndWord;
|
||||
int32_t finalStartOffset, finalEndOffset;
|
||||
|
||||
nsIPresShell* presShell = mDoc->PresShell();
|
||||
// If aType == eGetAt we'll change both the start and end offset from
|
||||
// the original offset
|
||||
if (aType == eGetAfter) {
|
||||
finalStartOffset = offset;
|
||||
finalStartOffset = aOffset;
|
||||
}
|
||||
else {
|
||||
finalStartOffset = GetRelativeOffset(presShell, startFrame, startOffset,
|
||||
startAcc,
|
||||
(amount == eSelectLine ? eSelectBeginLine : amount),
|
||||
eDirPrevious, needsStart,
|
||||
wordMovementType);
|
||||
startAcc, amount, eDirPrevious,
|
||||
needsStart);
|
||||
NS_ENSURE_TRUE(finalStartOffset >= 0, NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
if (aType == eGetBefore) {
|
||||
finalEndOffset = offset;
|
||||
finalEndOffset = aOffset;
|
||||
}
|
||||
else {
|
||||
// Start moving forward from the start so that we don't get
|
||||
@ -929,16 +943,14 @@ HyperTextAccessible::GetTextHelper(EGetTextType aType,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
finalEndOffset = GetRelativeOffset(presShell, endFrame, endOffset, endAcc,
|
||||
(amount == eSelectLine ? eSelectEndLine : amount),
|
||||
eDirNext, needsStart, wordMovementType);
|
||||
amount, eDirNext, needsStart);
|
||||
NS_ENSURE_TRUE(endOffset >= 0, NS_ERROR_FAILURE);
|
||||
if (finalEndOffset == offset) {
|
||||
if (finalEndOffset == aOffset) {
|
||||
if (aType == eGetAt && amount == eSelectWord) {
|
||||
// Fix word error for the first character in word: PeekOffset() will return the previous word when
|
||||
// offset points to the first character of the word, but accessibility APIs want the current word
|
||||
// aOffset points to the first character of the word, but accessibility APIs want the current word
|
||||
// that the first character is in
|
||||
return GetTextHelper(eGetAfter, aBoundaryType, offset,
|
||||
aStartOffset, aEndOffset, aText);
|
||||
return GetTextHelper(eGetAfter, aBoundaryType, aOffset, aStartOffset, aEndOffset, aText);
|
||||
}
|
||||
int32_t textLength = CharacterCount();
|
||||
if (finalEndOffset < textLength) {
|
||||
@ -953,8 +965,8 @@ HyperTextAccessible::GetTextHelper(EGetTextType aType,
|
||||
*aStartOffset = finalStartOffset;
|
||||
*aEndOffset = finalEndOffset;
|
||||
|
||||
NS_ASSERTION((finalStartOffset < offset && finalEndOffset >= offset) || aType != eGetBefore, "Incorrect results for GetTextHelper");
|
||||
NS_ASSERTION((finalStartOffset <= offset && finalEndOffset > offset) || aType == eGetBefore, "Incorrect results for GetTextHelper");
|
||||
NS_ASSERTION((finalStartOffset < aOffset && finalEndOffset >= aOffset) || aType != eGetBefore, "Incorrect results for GetTextHelper");
|
||||
NS_ASSERTION((finalStartOffset <= aOffset && finalEndOffset > aOffset) || aType == eGetBefore, "Incorrect results for GetTextHelper");
|
||||
|
||||
GetPosAndText(finalStartOffset, finalEndOffset, &aText);
|
||||
return NS_OK;
|
||||
@ -969,16 +981,12 @@ HyperTextAccessible::GetTextBeforeOffset(int32_t aOffset,
|
||||
int32_t* aStartOffset,
|
||||
int32_t* aEndOffset, nsAString& aText)
|
||||
{
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (aBoundaryType == BOUNDARY_CHAR) {
|
||||
GetCharAt(aOffset, eGetBefore, aText, aStartOffset, aEndOffset);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return GetTextHelper(eGetBefore, aBoundaryType, aOffset,
|
||||
aStartOffset, aEndOffset, aText);
|
||||
return GetTextHelper(eGetBefore, aBoundaryType, aOffset, aStartOffset, aEndOffset, aText);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -987,138 +995,24 @@ HyperTextAccessible::GetTextAtOffset(int32_t aOffset,
|
||||
int32_t* aStartOffset,
|
||||
int32_t* aEndOffset, nsAString& aText)
|
||||
{
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsSelectionAmount selectionAmount = eSelectWord;
|
||||
EWordMovementType wordMovementType = eDefaultBehavior;
|
||||
bool forwardBack = true;
|
||||
|
||||
switch (aBoundaryType) {
|
||||
case BOUNDARY_CHAR:
|
||||
return GetCharAt(aOffset, eGetAt, aText, aStartOffset, aEndOffset) ?
|
||||
NS_OK : NS_ERROR_INVALID_ARG;
|
||||
|
||||
case BOUNDARY_WORD_START:
|
||||
wordMovementType = eStartWord;
|
||||
break;
|
||||
|
||||
case BOUNDARY_WORD_END:
|
||||
wordMovementType = eEndWord;
|
||||
forwardBack = false;
|
||||
break;
|
||||
|
||||
case BOUNDARY_LINE_START:
|
||||
case BOUNDARY_LINE_END:
|
||||
return GetTextHelper(eGetAt, aBoundaryType, aOffset,
|
||||
aStartOffset, aEndOffset, aText);
|
||||
break;
|
||||
|
||||
case BOUNDARY_ATTRIBUTE_RANGE:
|
||||
{
|
||||
nsresult rv = GetTextAttributes(false, aOffset,
|
||||
aStartOffset, aEndOffset, nullptr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return GetText(*aStartOffset, *aEndOffset, aText);
|
||||
}
|
||||
|
||||
default:
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
if (aBoundaryType == BOUNDARY_CHAR) {
|
||||
GetCharAt(aOffset, eGetAt, aText, aStartOffset, aEndOffset);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
int32_t offset = ConvertMagicOffset(aOffset);
|
||||
if (offset < 0)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
uint32_t textLen = CharacterCount();
|
||||
if (forwardBack) {
|
||||
if (offset == textLen) {
|
||||
*aStartOffset = *aEndOffset = textLen;
|
||||
return NS_OK;
|
||||
}
|
||||
} else {
|
||||
if (offset == 0) {
|
||||
*aStartOffset = *aEndOffset = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
// Convert offsets to frame-relative
|
||||
int32_t startOffset = offset, endOffset = offset;
|
||||
nsRefPtr<Accessible> startAcc;
|
||||
nsIFrame* startFrame = GetPosAndText(startOffset, endOffset, nullptr, nullptr,
|
||||
nullptr, getter_AddRefs(startAcc));
|
||||
if (!startFrame) {
|
||||
if (offset == textLen) {
|
||||
// Asking for start of line, while on last character
|
||||
if (startAcc)
|
||||
startFrame = startAcc->GetFrame();
|
||||
}
|
||||
NS_ASSERTION(startFrame, "No start frame for text getting!");
|
||||
if (!startFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// We're on the last continuation since we're on the last character.
|
||||
startFrame = startFrame->GetLastContinuation();
|
||||
}
|
||||
|
||||
offset = GetRelativeOffset(mDoc->PresShell(), startFrame, startOffset,
|
||||
startAcc, selectionAmount,
|
||||
(forwardBack ? eDirNext : eDirPrevious),
|
||||
forwardBack, wordMovementType);
|
||||
|
||||
if (forwardBack)
|
||||
*aEndOffset = offset;
|
||||
else
|
||||
*aStartOffset = offset;
|
||||
|
||||
startOffset = endOffset = offset;
|
||||
startFrame = GetPosAndText(startOffset, endOffset, nullptr, nullptr,
|
||||
nullptr, getter_AddRefs(startAcc));
|
||||
if (!startFrame) {
|
||||
if (offset == textLen) {
|
||||
// Asking for start of line, while on last character
|
||||
if (startAcc)
|
||||
startFrame = startAcc->GetFrame();
|
||||
}
|
||||
NS_ASSERTION(startFrame, "No start frame for text getting!");
|
||||
if (!startFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// We're on the last continuation since we're on the last character.
|
||||
startFrame = startFrame->GetLastContinuation();
|
||||
}
|
||||
|
||||
offset = GetRelativeOffset(mDoc->PresShell(), startFrame, startOffset,
|
||||
startAcc, selectionAmount,
|
||||
(forwardBack ? eDirPrevious : eDirNext),
|
||||
forwardBack, wordMovementType);
|
||||
|
||||
if (forwardBack)
|
||||
*aStartOffset = offset;
|
||||
else
|
||||
*aEndOffset = offset;
|
||||
|
||||
return GetText(*aStartOffset, *aEndOffset, aText);
|
||||
return GetTextHelper(eGetAt, aBoundaryType, aOffset, aStartOffset, aEndOffset, aText);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HyperTextAccessible::GetTextAfterOffset(int32_t aOffset,
|
||||
AccessibleTextBoundary aBoundaryType,
|
||||
int32_t* aStartOffset,
|
||||
int32_t* aEndOffset, nsAString& aText)
|
||||
HyperTextAccessible::GetTextAfterOffset(int32_t aOffset, AccessibleTextBoundary aBoundaryType,
|
||||
int32_t* aStartOffset, int32_t* aEndOffset, nsAString& aText)
|
||||
{
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (aBoundaryType == BOUNDARY_CHAR) {
|
||||
GetCharAt(aOffset, eGetAfter, aText, aStartOffset, aEndOffset);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return GetTextHelper(eGetAfter, aBoundaryType, aOffset,
|
||||
aStartOffset, aEndOffset, aText);
|
||||
return GetTextHelper(eGetAfter, aBoundaryType, aOffset, aStartOffset, aEndOffset, aText);
|
||||
}
|
||||
|
||||
// nsIPersistentProperties
|
||||
|
@ -294,8 +294,7 @@ protected:
|
||||
int32_t GetRelativeOffset(nsIPresShell *aPresShell, nsIFrame *aFromFrame,
|
||||
int32_t aFromOffset, Accessible* aFromAccessible,
|
||||
nsSelectionAmount aAmount, nsDirection aDirection,
|
||||
bool aNeedsStart,
|
||||
EWordMovementType aWordMovementType);
|
||||
bool aNeedsStart);
|
||||
|
||||
/**
|
||||
* Provides information for substring that is defined by the given start
|
||||
|
@ -112,29 +112,16 @@ function testCharAtOffset(aIDs, aOffset, aChar, aStartOffset, aEndOffset)
|
||||
* @param aText [in] expected return text for getTextAtOffset
|
||||
* @param aStartOffset [in] expected return start offset for getTextAtOffset
|
||||
* @param aEndOffset [in] expected return end offset for getTextAtOffset
|
||||
* @param ... [in] list of ids or list of tuples made of:
|
||||
* @param ... [in] list of tuples made of:
|
||||
* element identifier
|
||||
* kTodo or kOk for returned text
|
||||
* kTodo or kOk for returned start offset
|
||||
* kTodo or kOk for returned offset result
|
||||
*
|
||||
*/
|
||||
function testTextAtOffset(aOffset, aBoundaryType, aText,
|
||||
aStartOffset, aEndOffset)
|
||||
{
|
||||
// List of IDs.
|
||||
if (arguments[5] instanceof Array) {
|
||||
var ids = arguments[5];
|
||||
for (var i = 0; i < ids.length; i++) {
|
||||
var acc = getAccessible(ids[i], nsIAccessibleText);
|
||||
testTextHelper(ids[i], aOffset, aBoundaryType,
|
||||
aText, aStartOffset, aEndOffset,
|
||||
kOk, kOk, kOk,
|
||||
acc.getTextAtOffset, "getTextAtOffset ");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 5; i < arguments.length; i = i + 4) {
|
||||
var ID = arguments[i];
|
||||
var acc = getAccessible(ID, nsIAccessibleText);
|
||||
@ -179,7 +166,7 @@ function testCharAfterOffset(aIDs, aOffset, aChar, aStartOffset, aEndOffset)
|
||||
* @param aText [in] expected return text for getTextAfterOffset
|
||||
* @param aStartOffset [in] expected return start offset for getTextAfterOffset
|
||||
* @param aEndOffset [in] expected return end offset for getTextAfterOffset
|
||||
* @param ... [in] list of ids or list of tuples made of:
|
||||
* @param ... [in] list of tuples made of:
|
||||
* element identifier
|
||||
* kTodo or kOk for returned text
|
||||
* kTodo or kOk for returned start offset
|
||||
@ -188,21 +175,6 @@ function testCharAfterOffset(aIDs, aOffset, aChar, aStartOffset, aEndOffset)
|
||||
function testTextAfterOffset(aOffset, aBoundaryType,
|
||||
aText, aStartOffset, aEndOffset)
|
||||
{
|
||||
// List of IDs.
|
||||
if (arguments[5] instanceof Array) {
|
||||
var ids = arguments[5];
|
||||
for (var i = 0; i < ids.length; i++) {
|
||||
var acc = getAccessible(ids[i], nsIAccessibleText);
|
||||
testTextHelper(ids[i], aOffset, aBoundaryType,
|
||||
aText, aStartOffset, aEndOffset,
|
||||
kOk, kOk, kOk,
|
||||
acc.getTextAfterOffset, "getTextAfterOffset ");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// List of tuples.
|
||||
for (var i = 5; i < arguments.length; i = i + 4) {
|
||||
var ID = arguments[i];
|
||||
var acc = getAccessible(ID, nsIAccessibleText);
|
||||
@ -247,29 +219,16 @@ function testCharBeforeOffset(aIDs, aOffset, aChar, aStartOffset, aEndOffset)
|
||||
* @param aText [in] expected return text for getTextBeforeOffset
|
||||
* @param aStartOffset [in] expected return start offset for getTextBeforeOffset
|
||||
* @param aEndOffset [in] expected return end offset for getTextBeforeOffset
|
||||
* @param ... [in] list of ids or list of tuples made of:
|
||||
* @param ... [in] list of tuples made of:
|
||||
* element identifier
|
||||
* kTodo or kOk for returned text
|
||||
* kTodo or kOk for returned start offset
|
||||
* kTodo or kOk for returned offset result
|
||||
*
|
||||
*/
|
||||
function testTextBeforeOffset(aOffset, aBoundaryType,
|
||||
aText, aStartOffset, aEndOffset)
|
||||
{
|
||||
// List of IDs.
|
||||
if (arguments[5] instanceof Array) {
|
||||
var ids = arguments[5];
|
||||
for (var i = 0; i < ids.length; i++) {
|
||||
var acc = getAccessible(ids[i], nsIAccessibleText);
|
||||
testTextHelper(ids[i], aOffset, aBoundaryType,
|
||||
aText, aStartOffset, aEndOffset,
|
||||
kOk, kOk, kOk,
|
||||
acc.getTextBeforeOffset, "getTextBeforeOffset ");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 5; i < arguments.length; i = i + 4) {
|
||||
var ID = arguments[i];
|
||||
var acc = getAccessible(ID, nsIAccessibleText);
|
||||
@ -308,9 +267,8 @@ function testWordCount(aElement, aCount, aToDoFlag)
|
||||
wordCount++;
|
||||
offset = endOffsetObj.value;
|
||||
}
|
||||
isFunc(wordCount, aCount,
|
||||
"wrong words count for '" + acc.getText(0, -1) + "': " + wordCount +
|
||||
" in " + prettyName(aElement));
|
||||
isFunc(wordCount, aCount, "wrong words count for '" + acc.getText(0, -1) + "': " +
|
||||
wordCount);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -325,47 +283,42 @@ function testWordAt(aElement, aWordIndex, aText, aToDoFlag)
|
||||
{
|
||||
var isFunc = (aToDoFlag == kTodo) ? todo_is : is;
|
||||
var acc = getAccessible(aElement, nsIAccessibleText);
|
||||
|
||||
var textLength = acc.characterCount;
|
||||
var wordIdx = aWordIndex;
|
||||
var startOffsetObj = { value: 0 }, endOffsetObj = { value: 0 };
|
||||
for (offset = 0; offset < textLength; offset = endOffsetObj.value) {
|
||||
acc.getTextAtOffset(offset, BOUNDARY_WORD_START,
|
||||
startOffsetObj, endOffsetObj);
|
||||
|
||||
wordIdx--;
|
||||
if (wordIdx < 0)
|
||||
var startOffsetObj = {}, endOffsetObj = {};
|
||||
var length = acc.characterCount;
|
||||
var offset = 0;
|
||||
var wordIndex = -1;
|
||||
var wordFountAtOffset = -1;
|
||||
while (true) {
|
||||
var text = acc.getTextAtOffset(offset, BOUNDARY_WORD_START,
|
||||
startOffsetObj, endOffsetObj);
|
||||
if (offset >= length)
|
||||
break;
|
||||
|
||||
wordIndex++;
|
||||
offset = endOffsetObj.value;
|
||||
if (wordIndex == aWordIndex) {
|
||||
wordFountAtOffset = startOffsetObj.value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (wordFountAtOffset >= 0) {
|
||||
var text = acc.getTextAtOffset(wordFountAtOffset, BOUNDARY_WORD_END,
|
||||
startOffsetObj, endOffsetObj);
|
||||
|
||||
if (endOffsetObj.value < wordFountAtOffset) {
|
||||
todo(false, "wrong start and end offset for word '" + aWordIndex + "': " +
|
||||
" of text '" + acc.getText(0, -1) + "'");
|
||||
return;
|
||||
}
|
||||
|
||||
text = acc.getText(wordFountAtOffset, endOffsetObj.value);
|
||||
isFunc(text, aText, "wrong text for word at pos '" + aWordIndex + "': " +
|
||||
" of text '" + acc.getText(0, -1) + "'");
|
||||
}
|
||||
|
||||
if (wordIdx >= 0) {
|
||||
ok(false,
|
||||
"the given word index '" + aWordIndex + "' exceeds words amount in " +
|
||||
prettyName(aElement));
|
||||
|
||||
return;
|
||||
else {
|
||||
isFunc(false, "failed to find word " + aText + " at word pos " + aWordIndex +
|
||||
" of text '" + acc.getText(0, -1) + "'");
|
||||
}
|
||||
|
||||
var startWordOffset = startOffsetObj.value;
|
||||
var endWordOffset = endOffsetObj.value;
|
||||
|
||||
// Calculate the end word offset.
|
||||
acc.getTextAtOffset(endOffsetObj.value, BOUNDARY_WORD_END,
|
||||
startOffsetObj, endOffsetObj);
|
||||
if (startOffsetObj.value != textLength)
|
||||
endWordOffset = startOffsetObj.value
|
||||
|
||||
if (endWordOffset <= startWordOffset) {
|
||||
todo(false,
|
||||
"wrong start and end offset for word at index '" + aWordIndex + "': " +
|
||||
" of text '" + acc.getText(0, -1) + "' in " + prettyName(aElement));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
text = acc.getText(startWordOffset, endWordOffset);
|
||||
isFunc(text, aText, "wrong text for word at index '" + aWordIndex + "': " +
|
||||
" of text '" + acc.getText(0, -1) + "' in " + prettyName(aElement));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -510,31 +463,26 @@ function testTextHelper(aID, aOffset, aBoundaryType,
|
||||
var exceptionFlag = aToDoFlag1 == undefined ||
|
||||
aToDoFlag2 == undefined ||
|
||||
aToDoFlag3 == undefined;
|
||||
|
||||
var startMsg = aTextFuncName + "(" + boundaryToString(aBoundaryType) + "): ";
|
||||
var endMsg = ", id: " + prettyName(aID) + ";";
|
||||
|
||||
try {
|
||||
var startOffsetObj = {}, endOffsetObj = {};
|
||||
var text = aTextFunc(aOffset, aBoundaryType,
|
||||
startOffsetObj, endOffsetObj);
|
||||
|
||||
if (exceptionFlag) {
|
||||
ok(false, startMsg + "no expected failure at offset " + aOffset + endMsg);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var isFunc1 = (aToDoFlag1 == kTodo) ? todo_is : is;
|
||||
var isFunc2 = (aToDoFlag2 == kTodo) ? todo_is : is;
|
||||
var isFunc3 = (aToDoFlag3 == kTodo) ? todo_is : is;
|
||||
|
||||
var startMsg = aTextFuncName + "(" + boundaryToString(aBoundaryType) + "): ";
|
||||
|
||||
var endMsg = ", id: '" + prettyName(aID) + "';";
|
||||
|
||||
isFunc1(text, aText,
|
||||
startMsg + "wrong text, offset: " + aOffset + endMsg);
|
||||
isFunc2(startOffsetObj.value, aStartOffset,
|
||||
startMsg + "wrong start offset, offset: " + aOffset + endMsg);
|
||||
isFunc3(endOffsetObj.value, aEndOffset,
|
||||
startMsg + "wrong end offset, offset: " + aOffset + endMsg);
|
||||
|
||||
|
||||
} catch (e) {
|
||||
var okFunc = exceptionFlag ? todo : ok;
|
||||
okFunc(false, startMsg + "failed at offset " + aOffset + endMsg);
|
||||
|
@ -44,7 +44,7 @@
|
||||
"textarea", kTodo, kOk, kTodo);
|
||||
|
||||
testTextAfterOffset(kCaretOffset, BOUNDARY_LINE_END, "", 15, 15,
|
||||
"textarea", kTodo, kOk, kTodo);
|
||||
"textarea", kOk, kTodo, kTodo);
|
||||
|
||||
testTextAtOffset(kCaretOffset, BOUNDARY_LINE_START, "", 15, 15,
|
||||
"textarea", kTodo, kTodo, kTodo);
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
function doTest()
|
||||
{
|
||||
SimpleTest.expectAssertions(54);
|
||||
SimpleTest.expectAssertions(52);
|
||||
|
||||
// __o__n__e__w__o__r__d__\n
|
||||
// 0 1 2 3 4 5 6 7
|
||||
@ -129,11 +129,11 @@
|
||||
"editablebr", kTodo, kTodo, kOk,
|
||||
"textarea", kTodo, kTodo, kOk);
|
||||
testTextAfterOffset(19, BOUNDARY_LINE_START, "", 19, 19,
|
||||
"div", kOk, kOk, kTodo,
|
||||
"divbr", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kTodo,
|
||||
"editablebr", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
"div", undefined, undefined, undefined,
|
||||
"divbr", undefined, undefined, undefined,
|
||||
"editable", undefined, undefined, undefined,
|
||||
"editablebr", undefined, undefined, undefined,
|
||||
"textarea", kTodo, undefined, kTodo);
|
||||
|
||||
// BOUNDARY_LINE_END
|
||||
testTextAfterOffset(0, BOUNDARY_LINE_END, "\n", 7, 8,
|
||||
@ -161,11 +161,11 @@
|
||||
"editablebr", kTodo, kTodo, kTodo,
|
||||
"textarea", kTodo, kTodo, kTodo);
|
||||
testTextAfterOffset(18, BOUNDARY_LINE_END, "\n", 18, 19,
|
||||
"div", kTodo, kOk, kTodo,
|
||||
"divbr", kOk, kOk, kOk,
|
||||
"editable", kTodo, kOk, kTodo,
|
||||
"editablebr", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
"div", kTodo, kTodo, kTodo,
|
||||
"divbr", kTodo, kTodo, kTodo,
|
||||
"editable", kTodo, kTodo, kTodo,
|
||||
"editablebr", kTodo, kTodo, kTodo,
|
||||
"textarea", kTodo, kTodo, kTodo);
|
||||
testTextAfterOffset(19, BOUNDARY_LINE_END, "", 19, 19,
|
||||
"div", kOk, kTodo, kTodo,
|
||||
"divbr", kOk, kTodo, kTodo,
|
||||
@ -391,21 +391,31 @@
|
||||
"editablebr", kOk, kOk, kOk,
|
||||
"textarea", kTodo, kOk, kTodo);
|
||||
testTextAtOffset(8, BOUNDARY_WORD_START, "oneword\n\n", 0, 9,
|
||||
"div", kTodo, kTodo, kOk,
|
||||
"divbr", kOk, kOk, kOk,
|
||||
"editable", kTodo, kTodo, kOk,
|
||||
"editablebr", kOk, kOk, kOk,
|
||||
"textarea", kTodo, kTodo, kOk);
|
||||
testTextAtOffset(9, BOUNDARY_WORD_START, "two ", 9, 13,
|
||||
"div", kTodo, kTodo, kTodo,
|
||||
"divbr", kOk, kOk, kOk,
|
||||
"editable", kTodo, kTodo, kTodo,
|
||||
"editablebr", kOk, kOk, kOk,
|
||||
"textarea", kTodo, kTodo, kTodo);
|
||||
testTextAtOffset(13, BOUNDARY_WORD_START, "words\n", 13, 19,
|
||||
"div", kOk, kOk, kOk,
|
||||
"divbr", kTodo, kTodo, kTodo,
|
||||
"divbr", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"editablebr", kTodo, kTodo, kTodo,
|
||||
"editablebr", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(9, BOUNDARY_WORD_START, "two ", 9, 13, IDs);
|
||||
testTextAtOffset(13, BOUNDARY_WORD_START, "words\n", 13, 19, IDs);
|
||||
|
||||
// BOUNDARY_WORD_END
|
||||
testTextAtOffset(0, BOUNDARY_WORD_END, "oneword", 0, 7,
|
||||
"div", kTodo, kOk, kTodo,
|
||||
"divbr", kTodo, kOk, kTodo,
|
||||
"editable", kTodo, kOk, kTodo,
|
||||
"editablebr", kTodo, kOk, kTodo,
|
||||
"textarea", kTodo, kOk, kTodo);
|
||||
"div", kOk, kOk, kOk,
|
||||
"divbr", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"editablebr", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(8, BOUNDARY_WORD_END, "\n\ntwo", 7, 12,
|
||||
"div", kOk, kOk, kOk,
|
||||
"divbr", kTodo, kTodo, kTodo,
|
||||
@ -419,11 +429,11 @@
|
||||
"editablebr", kTodo, kTodo, kTodo,
|
||||
"textarea", kTodo, kTodo, kOk);
|
||||
testTextAtOffset(12, BOUNDARY_WORD_END, "\n\ntwo", 7, 12,
|
||||
"div", kTodo, kTodo, kOk,
|
||||
"divbr", kOk, kOk, kOk,
|
||||
"editable", kTodo, kTodo, kOk,
|
||||
"editablebr", kOk, kOk, kOk,
|
||||
"textarea", kTodo, kTodo, kOk);
|
||||
"div", kTodo, kTodo, kTodo,
|
||||
"divbr", kTodo, kTodo, kTodo,
|
||||
"editable", kTodo, kTodo, kTodo,
|
||||
"editablebr", kTodo, kTodo, kTodo,
|
||||
"textarea", kTodo, kTodo, kTodo);
|
||||
testTextAtOffset(13, BOUNDARY_WORD_END, " words", 12, 18,
|
||||
"div", kOk, kOk, kOk,
|
||||
"divbr", kOk, kOk, kOk,
|
||||
@ -507,11 +517,11 @@
|
||||
"editablebr", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(18, BOUNDARY_LINE_END, "\ntwo words", 8, 18,
|
||||
"div", kTodo, kOk, kTodo,
|
||||
"divbr", kTodo, kOk, kTodo,
|
||||
"editable", kTodo, kOk, kTodo,
|
||||
"editablebr", kTodo, kOk, kTodo,
|
||||
"textarea", kTodo, kOk, kTodo);
|
||||
"div", kTodo, kTodo, kTodo,
|
||||
"divbr", kTodo, kTodo, kTodo,
|
||||
"editable", kTodo, kTodo, kTodo,
|
||||
"editablebr", kTodo, kTodo, kTodo,
|
||||
"textarea", kTodo, kTodo, kTodo);
|
||||
testTextAtOffset(19, BOUNDARY_LINE_END, "\n", 18, 19,
|
||||
"div", kTodo, kTodo, kTodo,
|
||||
"divbr", kTodo, kTodo, kTodo,
|
||||
@ -536,7 +546,6 @@
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
|
||||
<div id="div">oneword
|
||||
|
||||
two words
|
||||
|
@ -12,9 +12,9 @@
|
||||
src="../text.js"></script>
|
||||
<script type="application/javascript">
|
||||
if (navigator.platform.startsWith("Mac")) {
|
||||
SimpleTest.expectAssertions(0, 28);
|
||||
SimpleTest.expectAssertions(0, 19);
|
||||
} else {
|
||||
SimpleTest.expectAssertions(28);
|
||||
SimpleTest.expectAssertions(19);
|
||||
}
|
||||
|
||||
function doTest()
|
||||
@ -105,9 +105,9 @@
|
||||
"editable", kTodo, kTodo, kOk,
|
||||
"textarea", kTodo, kTodo, kOk);
|
||||
testTextAfterOffset(15, BOUNDARY_WORD_START, "", 15, 15,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"input", kOk, kTodo, kTodo,
|
||||
"div", kOk, kTodo, kTodo,
|
||||
"editable", kOk, kTodo, kTodo,
|
||||
"textarea", kTodo, kOk, kTodo);
|
||||
|
||||
// BOUNDARY_WORD_END
|
||||
@ -157,9 +157,9 @@
|
||||
"editable", kTodo, kTodo, kOk,
|
||||
"textarea", kTodo, kTodo, kOk);
|
||||
testTextAfterOffset(15, BOUNDARY_WORD_END, "", 15, 15,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"input", kOk, kTodo, kTodo,
|
||||
"div", kOk, kTodo, kTodo,
|
||||
"editable", kOk, kTodo, kTodo,
|
||||
"textarea", kTodo, kOk, kTodo);
|
||||
|
||||
// BOUNDARY_LINE_START
|
||||
@ -179,10 +179,10 @@
|
||||
"editable", kTodo, kTodo, kOk,
|
||||
"textarea", kTodo, kTodo, kTodo);
|
||||
testTextAfterOffset(15, BOUNDARY_LINE_START, "", 15, 15,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kTodo, kOk, kTodo);
|
||||
"input", undefined, undefined, undefined,
|
||||
"div", undefined, undefined, undefined,
|
||||
"editable", undefined, undefined, undefined,
|
||||
"textarea", kTodo, undefined, kTodo);
|
||||
|
||||
// BOUNDARY_LINE_END
|
||||
testTextAfterOffset(0, BOUNDARY_LINE_END, "", 15, 15,
|
||||
@ -196,15 +196,15 @@
|
||||
"editable", kTodo, kTodo, kOk,
|
||||
"textarea", kTodo, kTodo, kOk);
|
||||
testTextAfterOffset(14, BOUNDARY_LINE_END, "", 15, 15,
|
||||
"input", kTodo, kTodo, kOk,
|
||||
"div", kTodo, kTodo, kOk,
|
||||
"editable", kTodo, kTodo, kOk,
|
||||
"input", kOk, kTodo, kTodo,
|
||||
"div", kOk, kTodo, kTodo,
|
||||
"editable", kOk, kTodo, kTodo,
|
||||
"textarea", kTodo, kTodo, kOk);
|
||||
testTextAfterOffset(15, BOUNDARY_LINE_END, "", 15, 15,
|
||||
"input", kOk, kTodo, kTodo,
|
||||
"div", kOk, kTodo, kTodo,
|
||||
"editable", kOk, kTodo, kTodo,
|
||||
"textarea", kTodo, kOk, kTodo);
|
||||
"textarea", kOk, kTodo, kTodo);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// getTextBeforeOffset
|
||||
@ -355,15 +355,15 @@
|
||||
"editable", kTodo, kOk, kTodo,
|
||||
"textarea", kTodo, kOk, kTodo);
|
||||
testTextBeforeOffset(14, BOUNDARY_LINE_END, "", 0, 0,
|
||||
"input", kTodo, kOk, kTodo,
|
||||
"div", kTodo, kOk, kTodo,
|
||||
"editable", kTodo, kOk, kTodo,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kTodo, kOk, kTodo);
|
||||
testTextBeforeOffset(15, BOUNDARY_LINE_END, "", 0, 0,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kTodo, kOk, kTodo);
|
||||
"textarea", kOk, kOk, kOk);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// getTextAtOffset
|
||||
@ -381,32 +381,108 @@
|
||||
testCharAtOffset("textarea", 16, "", 16, 16);
|
||||
|
||||
// BOUNDARY_WORD_START
|
||||
testTextAtOffset(0, BOUNDARY_WORD_START, "hello ", 0, 6, IDs);
|
||||
testTextAtOffset(1, BOUNDARY_WORD_START, "hello ", 0, 6, IDs);
|
||||
testTextAtOffset(5, BOUNDARY_WORD_START, "hello ", 0, 6, IDs);
|
||||
testTextAtOffset(6, BOUNDARY_WORD_START, "my ", 6, 9, IDs);
|
||||
testTextAtOffset(7, BOUNDARY_WORD_START, "my ", 6, 9, IDs);
|
||||
testTextAtOffset(8, BOUNDARY_WORD_START, "my ", 6, 9, IDs);
|
||||
testTextAtOffset(9, BOUNDARY_WORD_START, "friend", 9, 15, IDs);
|
||||
testTextAtOffset(10, BOUNDARY_WORD_START, "friend", 9, 15, IDs);
|
||||
testTextAtOffset(14, BOUNDARY_WORD_START, "friend", 9, 15, IDs);
|
||||
testTextAtOffset(15, BOUNDARY_WORD_START, "", 15, 15,
|
||||
testTextAtOffset(0, BOUNDARY_WORD_START, "hello ", 0, 6,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kTodo, kTodo, kOk);
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(1, BOUNDARY_WORD_START, "hello ", 0, 6,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(5, BOUNDARY_WORD_START, "hello ", 0, 6,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(6, BOUNDARY_WORD_START, "my ", 6, 9,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(7, BOUNDARY_WORD_START, "my ", 6, 9,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(8, BOUNDARY_WORD_START, "my ", 6, 9,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(9, BOUNDARY_WORD_START, "friend", 9, 15,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(10, BOUNDARY_WORD_START, "friend", 9, 15,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(14, BOUNDARY_WORD_START, "friend", 9, 15,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(15, BOUNDARY_WORD_START, "friend", 9, 15,
|
||||
"input", kTodo, kTodo, kTodo,
|
||||
"div", kTodo, kTodo, kTodo,
|
||||
"editable", kTodo, kTodo, kTodo,
|
||||
"textarea", kTodo, kTodo, kTodo);
|
||||
|
||||
// BOUNDARY_WORD_END
|
||||
testTextAtOffset(0, BOUNDARY_WORD_END, "", 0, 0, IDs);
|
||||
testTextAtOffset(1, BOUNDARY_WORD_END, "hello", 0, 5, IDs);
|
||||
testTextAtOffset(5, BOUNDARY_WORD_END, "hello", 0, 5, IDs);
|
||||
testTextAtOffset(6, BOUNDARY_WORD_END, " my", 5, 8, IDs);
|
||||
testTextAtOffset(7, BOUNDARY_WORD_END, " my", 5, 8, IDs);
|
||||
testTextAtOffset(8, BOUNDARY_WORD_END, " my", 5, 8, IDs);
|
||||
testTextAtOffset(9, BOUNDARY_WORD_END, " friend", 8, 15, IDs);
|
||||
testTextAtOffset(10, BOUNDARY_WORD_END, " friend", 8, 15, IDs);
|
||||
testTextAtOffset(14, BOUNDARY_WORD_END, " friend", 8, 15, IDs);
|
||||
testTextAtOffset(15, BOUNDARY_WORD_END, " friend", 8, 15, IDs);
|
||||
testTextAtOffset(0, BOUNDARY_WORD_END, "hello", 0, 5,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(1, BOUNDARY_WORD_END, "hello", 0, 5,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(5, BOUNDARY_WORD_END, "hello", 0, 5,
|
||||
"input", kTodo, kTodo, kTodo,
|
||||
"div", kTodo, kTodo, kTodo,
|
||||
"editable", kTodo, kTodo, kTodo,
|
||||
"textarea", kTodo, kTodo, kTodo);
|
||||
testTextAtOffset(6, BOUNDARY_WORD_END, " my", 5, 8,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(7, BOUNDARY_WORD_END, " my", 5, 8,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(8, BOUNDARY_WORD_END, " my", 5, 8,
|
||||
"input", kTodo, kTodo, kTodo,
|
||||
"div", kTodo, kTodo, kTodo,
|
||||
"editable", kTodo, kTodo, kTodo,
|
||||
"textarea", kTodo, kTodo, kTodo);
|
||||
testTextAtOffset(9, BOUNDARY_WORD_END, " friend", 8, 15,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(10, BOUNDARY_WORD_END, " friend", 8, 15,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(14, BOUNDARY_WORD_END, " friend", 8, 15,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(15, BOUNDARY_WORD_END, " friend", 8, 15,
|
||||
"input", kTodo, kTodo, kTodo,
|
||||
"div", kTodo, kTodo, kTodo,
|
||||
"editable", kTodo, kTodo, kTodo,
|
||||
"textarea", kTodo, kTodo, kTodo);
|
||||
|
||||
// BOUNDARY_LINE_START
|
||||
testTextAtOffset(0, BOUNDARY_LINE_START, "hello my friend", 0, 15,
|
||||
@ -423,7 +499,7 @@
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kTodo, kOk, kTodo);
|
||||
"textarea", kTodo, kOk, kTodo);
|
||||
testTextAtOffset(15, BOUNDARY_LINE_START, "hello my friend", 0, 15,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
@ -442,9 +518,9 @@
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(14, BOUNDARY_LINE_END, "hello my friend", 0, 15,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"input", kTodo, kOk, kTodo,
|
||||
"div", kTodo, kOk, kTodo,
|
||||
"editable", kTodo, kOk, kTodo,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(15, BOUNDARY_LINE_END, "hello my friend", 0, 15,
|
||||
"input", kTodo, kOk, kTodo,
|
||||
|
@ -14,9 +14,9 @@
|
||||
src="../text.js"></script>
|
||||
<script type="application/javascript">
|
||||
if (navigator.platform.startsWith("Mac")) {
|
||||
SimpleTest.expectAssertions(0, 11);
|
||||
SimpleTest.expectAssertions(0, 8);
|
||||
} else {
|
||||
SimpleTest.expectAssertions(11);
|
||||
SimpleTest.expectAssertions(8);
|
||||
}
|
||||
|
||||
function doTest()
|
||||
@ -178,9 +178,9 @@
|
||||
"editable", kTodo, kTodo, kOk,
|
||||
"textarea", kTodo, kTodo, kOk);
|
||||
testTextAfterOffset(22, BOUNDARY_WORD_END, "", 22, 22,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"input", kOk, kTodo, kTodo,
|
||||
"div", kOk, kTodo, kTodo,
|
||||
"editable", kOk, kTodo, kTodo,
|
||||
"textarea", kTodo, kOk, kTodo);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@ -457,29 +457,93 @@
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kTodo, kOk, kTodo);
|
||||
testTextAtOffset(22, BOUNDARY_WORD_START, "", 22, 22,
|
||||
testTextAtOffset(22, BOUNDARY_WORD_START, "ran", 19, 22,
|
||||
"input", kTodo, kTodo, kTodo,
|
||||
"div", kTodo, kTodo, kTodo,
|
||||
"editable", kTodo, kTodo, kTodo,
|
||||
"textarea", kTodo, kOk, kTodo);
|
||||
|
||||
// BOUNDARY_WORD_END
|
||||
testTextAtOffset(0, BOUNDARY_WORD_END, "Brave", 0, 5,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(4, BOUNDARY_WORD_END, "Brave", 0, 5,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(5, BOUNDARY_WORD_END, "Brave", 0, 5,
|
||||
"input", kTodo, kTodo, kTodo,
|
||||
"div", kTodo, kTodo, kTodo,
|
||||
"editable", kTodo, kTodo, kTodo,
|
||||
"textarea", kTodo, kTodo, kTodo);
|
||||
testTextAtOffset(6, BOUNDARY_WORD_END, " Sir", 5, 9,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(8, BOUNDARY_WORD_END, " Sir", 5, 9,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(9, BOUNDARY_WORD_END, " Sir", 5, 9,
|
||||
"input", kTodo, kTodo, kTodo,
|
||||
"div", kTodo, kTodo, kTodo,
|
||||
"editable", kTodo, kTodo, kTodo,
|
||||
"textarea", kTodo, kTodo, kTodo);
|
||||
testTextAtOffset(10, BOUNDARY_WORD_END, " Robin", 9, 16,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(11, BOUNDARY_WORD_END, " Robin", 9, 16,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(15, BOUNDARY_WORD_END, " Robin", 9, 16,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(16, BOUNDARY_WORD_END, " Robin", 9, 16,
|
||||
"input", kTodo, kTodo, kTodo,
|
||||
"div", kTodo, kTodo, kTodo,
|
||||
"editable", kTodo, kTodo, kTodo,
|
||||
"textarea", kTodo, kTodo, kTodo);
|
||||
testTextAtOffset(17, BOUNDARY_WORD_END, " ran", 16, 22,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(18, BOUNDARY_WORD_END, " ran", 16, 22,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(19, BOUNDARY_WORD_END, " ran", 16, 22,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(20, BOUNDARY_WORD_END, " ran", 16, 22,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(21, BOUNDARY_WORD_END, " ran", 16, 22,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(22, BOUNDARY_WORD_END, " ran", 16, 22,
|
||||
"input", kTodo, kTodo, kTodo,
|
||||
"div", kTodo, kTodo, kTodo,
|
||||
"editable", kTodo, kTodo, kTodo,
|
||||
"textarea", kTodo, kTodo, kTodo);
|
||||
|
||||
// BOUNDARY_WORD_END
|
||||
testTextAtOffset(0, BOUNDARY_WORD_END, "", 0, 0, IDs);
|
||||
testTextAtOffset(4, BOUNDARY_WORD_END, "Brave", 0, 5, IDs);
|
||||
testTextAtOffset(5, BOUNDARY_WORD_END, "Brave", 0, 5, IDs);
|
||||
testTextAtOffset(6, BOUNDARY_WORD_END, " Sir", 5, 9, IDs);
|
||||
testTextAtOffset(8, BOUNDARY_WORD_END, " Sir", 5, 9, IDs);
|
||||
testTextAtOffset(9, BOUNDARY_WORD_END, " Sir", 5, 9, IDs);
|
||||
testTextAtOffset(10, BOUNDARY_WORD_END, " Robin", 9, 16, IDs);
|
||||
testTextAtOffset(11, BOUNDARY_WORD_END, " Robin", 9, 16, IDs);
|
||||
testTextAtOffset(15, BOUNDARY_WORD_END, " Robin", 9, 16, IDs);
|
||||
testTextAtOffset(16, BOUNDARY_WORD_END, " Robin", 9, 16, IDs);
|
||||
testTextAtOffset(17, BOUNDARY_WORD_END, " ran", 16, 22, IDs);
|
||||
testTextAtOffset(18, BOUNDARY_WORD_END, " ran", 16, 22, IDs);
|
||||
testTextAtOffset(19, BOUNDARY_WORD_END, " ran", 16, 22, IDs);
|
||||
testTextAtOffset(20, BOUNDARY_WORD_END, " ran", 16, 22, IDs);
|
||||
testTextAtOffset(21, BOUNDARY_WORD_END, " ran", 16, 22, IDs);
|
||||
testTextAtOffset(22, BOUNDARY_WORD_END, " ran", 16, 22, IDs);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
if (navigator.platform.startsWith("Mac")) {
|
||||
SimpleTest.expectAssertions(0, 1);
|
||||
} else {
|
||||
SimpleTest.expectAssertions(0, 1);
|
||||
SimpleTest.expectAssertions(1);
|
||||
}
|
||||
|
||||
function doTest()
|
||||
|
Loading…
Reference in New Issue
Block a user