From 908c443de8090e84a89d872b8c7955eb1a1c9cd1 Mon Sep 17 00:00:00 2001 From: "gavin@gavinsharp.com" Date: Wed, 23 Apr 2008 15:33:14 -0700 Subject: [PATCH] Bug 423523: Caret can leave div w/ contenteditable = true with repeated arrow keys, patch by Chris Pearce , r+sr=peterv, a=beltzner --- layout/base/tests/Makefile.in | 1 + layout/base/tests/test_bug423523.html | 107 ++++++++++++++++++++++++++ layout/generic/nsSelection.cpp | 4 +- 3 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 layout/base/tests/test_bug423523.html diff --git a/layout/base/tests/Makefile.in b/layout/base/tests/Makefile.in index 820d353323d4..b0281bfb57c1 100644 --- a/layout/base/tests/Makefile.in +++ b/layout/base/tests/Makefile.in @@ -91,6 +91,7 @@ _TEST_FILES = \ test_bug404209.xhtml \ test_bug416896.html \ test_bug420499.xul \ + test_bug423523.html \ $(NULL) # test_bug396024.html is currently disabled because it interacts badly with # the "You can't print-preview while the page is loading" dialog. diff --git a/layout/base/tests/test_bug423523.html b/layout/base/tests/test_bug423523.html new file mode 100644 index 000000000000..fde70faaa8ae --- /dev/null +++ b/layout/base/tests/test_bug423523.html @@ -0,0 +1,107 @@ + + + + + Test for Bug 423523 + + + + + + +Mozilla Bug 423523 +

+ + + + + +
+

Some text...

+
This is some editable text.
+
+ + + +
+
+
+ + + diff --git a/layout/generic/nsSelection.cpp b/layout/generic/nsSelection.cpp index fb0b9a966b40..f4446999a5b8 100644 --- a/layout/generic/nsSelection.cpp +++ b/layout/generic/nsSelection.cpp @@ -2243,7 +2243,9 @@ nsFrameSelection::HandleClick(nsIContent *aNewFocus, if (!aContinueSelection) { mMaintainRange = nsnull; - mAncestorLimiter = nsnull; + if (!IsValidSelectionPoint(this, aNewFocus)) { + mAncestorLimiter = nsnull; + } } mHint = HINT(aHint);