mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 1052000 - fix some handling of empty text leaves r=surkov
This commit is contained in:
parent
722b633e0e
commit
b8c122b731
@ -316,6 +316,8 @@ HyperTextAccessible::DOMPointToOffset(nsINode* aNode, int32_t aNodeOffset,
|
||||
TreeWalker walker(container, findNode->AsContent(),
|
||||
TreeWalker::eWalkContextTree);
|
||||
descendant = walker.NextChild();
|
||||
if (!descendant)
|
||||
descendant = container;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -439,9 +441,14 @@ HyperTextAccessible::FindOffset(uint32_t aOffset, nsDirection aDirection,
|
||||
|
||||
do {
|
||||
int32_t childIdx = text->GetChildIndexAtOffset(innerOffset);
|
||||
NS_ASSERTION(childIdx != -1, "Bad in offset!");
|
||||
if (childIdx == -1)
|
||||
return 0;
|
||||
|
||||
// We can have an empty text leaf as our only child. Since empty text
|
||||
// leaves are not accessible we then have no children, but 0 is a valid
|
||||
// innerOffset.
|
||||
if (childIdx == -1) {
|
||||
NS_ASSERTION(innerOffset == 0 && !text->ChildCount(), "No childIdx?");
|
||||
return DOMPointToOffset(text->GetNode(), 0, aDirection == eDirNext);
|
||||
}
|
||||
|
||||
child = text->GetChildAt(childIdx);
|
||||
|
||||
|
@ -13,6 +13,11 @@
|
||||
<script type="application/javascript">
|
||||
function doTest()
|
||||
{
|
||||
testTextAtOffset("line_test_1", BOUNDARY_LINE_START,
|
||||
[[0, 6, "Line 1 ", 0, 7],
|
||||
[7, 7, "", 7, 7],
|
||||
[8, 15, "Line 3 ", 8, 15]]);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// __h__e__l__l__o__ __m__y__ __f__r__i__e__n__d__
|
||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
||||
@ -250,6 +255,11 @@ two words
|
||||
<p>seciofarus</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="line_test_1">
|
||||
Line 1
|
||||
<center><input type="TEXT"><input value="Button" type="SUBMIT"></center>
|
||||
Line 3
|
||||
</div>
|
||||
</body>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user