mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 240933 - Part 12: Avoid injecting textnodes as children of br nodes; r,a=roc
--HG-- extra : rebase_source : 5b6a4d870c1f95da0d2a1233d1648096ae599174
This commit is contained in:
parent
8afe6b0c89
commit
578ac0b85f
@ -2332,6 +2332,28 @@ NS_IMETHODIMP nsEditor::InsertTextImpl(const nsAString& aStringToInsert,
|
||||
}
|
||||
}
|
||||
}
|
||||
// Sometimes, aInOutNode is the mozBR element itself. In that case, we'll
|
||||
// adjust the insertion point to the previous text node, if one exists, or
|
||||
// to the parent anonymous DIV.
|
||||
if (nsTextEditUtils::IsMozBR(*aInOutNode) && *aInOutOffset == 0) {
|
||||
nsCOMPtr<nsIDOMNode> previous;
|
||||
(*aInOutNode)->GetPreviousSibling(getter_AddRefs(previous));
|
||||
nodeAsText = do_QueryInterface(previous);
|
||||
if (nodeAsText) {
|
||||
PRUint32 length;
|
||||
res = nodeAsText->GetLength(&length);
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
*aInOutOffset = PRInt32(length);
|
||||
*aInOutNode = previous;
|
||||
}
|
||||
} else {
|
||||
nsCOMPtr<nsIDOMNode> parent;
|
||||
(*aInOutNode)->GetParentNode(getter_AddRefs(parent));
|
||||
if (parent == GetRoot()) {
|
||||
*aInOutNode = parent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
PRInt32 offset = *aInOutOffset;
|
||||
if (mInIMEMode)
|
||||
|
@ -33,6 +33,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=240933
|
||||
synthesizeMouse(t, t.clientWidth / 2, 5, {}, window);
|
||||
is(t.selectionStart, 3, "The selection should be set before the newline");
|
||||
is(t.selectionEnd, 3, "The selection should be set before the newline");
|
||||
|
||||
t = document.getElementById("ta");
|
||||
t.focus();
|
||||
var val = t.value;
|
||||
synthesizeKey("VK_ENTER", {});
|
||||
is(t.value, val + "\n", "Pressing enter right after focusing the textarea should work");
|
||||
SimpleTest.finish();
|
||||
});
|
||||
|
||||
@ -40,6 +46,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=240933
|
||||
</pre>
|
||||
|
||||
<textarea id="t" rows="10" cols="10">abc
|
||||
</textarea>
|
||||
<textarea id="ta" rows="10" cols="10">
|
||||
test
|
||||
|
||||
</textarea>
|
||||
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user