From be4b7eb8dc9cbac55cdfe9bc0c175cdf6d1090e5 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Thu, 18 Mar 2010 12:14:40 -0400 Subject: [PATCH] Bug 353539 - textarea.focus() puts caret at end without scrolling it into view; r=roc --HG-- extra : rebase_source : 775c2c16cfbb0ef9a9024dd53c42c803ee08e8ae --- layout/forms/nsTextControlFrame.cpp | 5 +++ layout/forms/test/Makefile.in | 1 + layout/forms/test/test_bug353539.html | 53 +++++++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 layout/forms/test/test_bug353539.html diff --git a/layout/forms/nsTextControlFrame.cpp b/layout/forms/nsTextControlFrame.cpp index 4a69689f7a79..2607d74b7792 100644 --- a/layout/forms/nsTextControlFrame.cpp +++ b/layout/forms/nsTextControlFrame.cpp @@ -1865,6 +1865,11 @@ void nsTextControlFrame::SetFocus(PRBool aOn, PRBool aRepaint) if (NS_SUCCEEDED(InitFocusedValue())) MaybeBeginSecureKeyboardInput(); + // Scroll the current selection into view + mSelCon->ScrollSelectionIntoView(nsISelectionController::SELECTION_NORMAL, + nsISelectionController::SELECTION_FOCUS_REGION, + PR_FALSE); + // tell the caret to use our selection nsCOMPtr ourSel; diff --git a/layout/forms/test/Makefile.in b/layout/forms/test/Makefile.in index 2c867d3e5124..c3109c7b780a 100644 --- a/layout/forms/test/Makefile.in +++ b/layout/forms/test/Makefile.in @@ -49,6 +49,7 @@ _TEST_FILES = test_bug231389.html \ bug287446_subframe.html \ test_bug345267.html \ test_bug348236.html \ + test_bug353539.html \ test_bug378670.html \ test_bug402198.html \ test_bug411236.html \ diff --git a/layout/forms/test/test_bug353539.html b/layout/forms/test/test_bug353539.html new file mode 100644 index 000000000000..a63d022fab8c --- /dev/null +++ b/layout/forms/test/test_bug353539.html @@ -0,0 +1,53 @@ + + + + + Test for Bug 353539 + + + + + +Mozilla Bug 353539 +

+ +

+ +
+
+
+ +