Bug 602130 - Caret positioned incorrectly in input[type=text] when hidden and redisplayed; r=bzbarsky a=blocking-final+

This commit is contained in:
Ehsan Akhgari 2010-10-14 15:36:35 -04:00
parent e75e09ff61
commit c7f1418903
4 changed files with 23 additions and 2 deletions

View File

@ -1145,9 +1145,9 @@ nsTextEditorState::PrepareEditor(const nsAString *aValue)
rv = mBoundFrame->UpdateValueDisplay(PR_FALSE, PR_TRUE);
NS_ENSURE_SUCCESS(rv, rv);
} else {
if (aValue) {
if (aValue || !mEditorInitialized) {
// Set the correct value in the root node
rv = mBoundFrame->UpdateValueDisplay(PR_TRUE, PR_FALSE, aValue);
rv = mBoundFrame->UpdateValueDisplay(PR_TRUE, !mEditorInitialized, aValue);
NS_ENSURE_SUCCESS(rv, rv);
}

View File

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<body>
<input autofocus style="display:block">
</body>
</html>

View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html class="reftest-wait">
<body>
<input onfocus="focused()" autofocus>
<script>
function focused() {
var i = document.querySelector("input");
i.style.display = "block";
document.offsetWidth;
document.documentElement.removeAttribute("class");
}
</script>
</body>
</html>

View File

@ -21,3 +21,4 @@ include xul/reftest.list
!= caret_on_textarea_lastline.html caret_on_textarea_lastline-ref.html
== input-text-onfocus-reframe.html input-text-onfocus-reframe-ref.html
== input-text-notheme-onfocus-reframe.html input-text-notheme-onfocus-reframe-ref.html
== caret_after_reframe.html caret_after_reframe-ref.html