mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 749810 - getText(0, -1) fails with empty text, r=surkov, f=eeejay
This commit is contained in:
parent
0c51655fe0
commit
abfc1cc082
@ -423,11 +423,14 @@ nsHyperTextAccessible::GetText(PRInt32 aStartOffset, PRInt32 aEndOffset,
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRInt32 startOffset = ConvertMagicOffset(aStartOffset);
|
||||
PRInt32 startChildIdx = GetChildIndexAtOffset(startOffset);
|
||||
if (startChildIdx == -1)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
PRInt32 endOffset = ConvertMagicOffset(aEndOffset);
|
||||
|
||||
PRInt32 startChildIdx = GetChildIndexAtOffset(startOffset);
|
||||
if (startChildIdx == -1) {
|
||||
// 0 offsets are considered valid for empty text.
|
||||
return (startOffset == 0 && endOffset == 0) ? NS_OK : NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
PRInt32 endChildIdx = GetChildIndexAtOffset(endOffset);
|
||||
if (endChildIdx == -1)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
@ -21,6 +21,14 @@
|
||||
<script type="application/javascript">
|
||||
function doTest()
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// null getText
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var emptyTextAcc = getAccessible("nulltext", [nsIAccessibleText]);
|
||||
is(emptyTextAcc.getText(0, -1), "", "getText() END_OF_TEXT with null string");
|
||||
is(emptyTextAcc.getText(0, 0), "", "getText() Len==0 with null string");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// hypertext
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -85,11 +93,19 @@
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=638326">
|
||||
Bug 638326
|
||||
</a>
|
||||
<a target="_blank"
|
||||
title="getText(0, -1) fails with empty text"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=749810">
|
||||
Bug 749810
|
||||
</a>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
<div id="nulltext"></div>
|
||||
|
||||
<div id="hypertext">hello <a>friend</a> see <img></div>
|
||||
<div id="hypertext2">hello <a>friend</a> see <input></div>
|
||||
<ol id="list"><li id="listitem">foo</li></ol>
|
||||
|
Loading…
Reference in New Issue
Block a user