From d48edb3f7d7a8f161d74a6c5878c078879b1e8d8 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Thu, 6 Jan 2011 17:13:51 -0500 Subject: [PATCH] Bug 622371 - Only set the selection to the beginning of the editable document if the editor is being initialized by entering designMode; r=bzbarsky a=blocking-final+ --- content/html/document/src/nsHTMLDocument.cpp | 2 +- editor/libeditor/html/tests/Makefile.in | 1 + .../libeditor/html/tests/test_bug622371.html | 41 +++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 editor/libeditor/html/tests/test_bug622371.html diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp index 1155db8a451..37e570fff81 100644 --- a/content/html/document/src/nsHTMLDocument.cpp +++ b/content/html/document/src/nsHTMLDocument.cpp @@ -3308,7 +3308,7 @@ nsHTMLDocument::EditingStateChanged() // If we're entering the design mode, put the selection at the beginning of // the document for compatibility reasons. - if (designMode) { + if (designMode && oldState == eOff) { rv = editor->BeginningOfDocument(); NS_ENSURE_SUCCESS(rv, rv); } diff --git a/editor/libeditor/html/tests/Makefile.in b/editor/libeditor/html/tests/Makefile.in index dcf12ca34d1..0110ec147c6 100644 --- a/editor/libeditor/html/tests/Makefile.in +++ b/editor/libeditor/html/tests/Makefile.in @@ -70,6 +70,7 @@ _TEST_FILES = \ test_bug611182.html \ test_bug612447.html \ test_bug620906.html \ + test_bug622371.html \ test_CF_HTML_clipboard.html \ test_contenteditable_focus.html \ test_contenteditable_text_input_handling.html \ diff --git a/editor/libeditor/html/tests/test_bug622371.html b/editor/libeditor/html/tests/test_bug622371.html new file mode 100644 index 00000000000..ea2a3fbc6e4 --- /dev/null +++ b/editor/libeditor/html/tests/test_bug622371.html @@ -0,0 +1,41 @@ + + + + + Test for Bug 622371 + + + + + + +Mozilla Bug 622371 +

+
+ +
+
+
+
+ +