Bug 1712834 - Adjust caret frame for a significant terminal newline r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D116155
This commit is contained in:
Kagami Sascha Rosylight
2021-05-29 12:01:30 +00:00
parent 7671862509
commit d6840d901b
6 changed files with 75 additions and 16 deletions

View File

@@ -1028,16 +1028,8 @@ nsresult nsTextControlFrame::OffsetToDOMPoint(uint32_t aOffset,
*aPosition = 0;
} else if (textNode) {
uint32_t textLength = textNode->Length();
if (length == 2 && aOffset == textLength) {
// If we're at the end of the text node and we have a trailing BR node,
// set the selection on the BR node.
rootNode.forget(aResult);
*aPosition = 1;
} else {
// Otherwise, set the selection on the textnode itself.
firstNode.forget(aResult);
*aPosition = std::min(aOffset, textLength);
}
firstNode.forget(aResult);
*aPosition = std::min(aOffset, textLength);
} else {
rootNode.forget(aResult);
*aPosition = 0;