From cc6b0f11e7ea4b8192aa7b2a85140cc6dd3f6709 Mon Sep 17 00:00:00 2001 From: Job Bautista Date: Thu, 9 Feb 2023 20:51:34 +0800 Subject: [PATCH] Issue #2107 - Clean up caret when destroying editor. Editor changes caret visibility during drag and drop. But when destroying editor, we don't restore caret state. So we should restore it when destroying editor. Co-authored-by: Makoto Kato --- editor/libeditor/EditorEventListener.cpp | 2 + layout/base/tests/bug1496118-ref.html | 24 ++++++++++++ layout/base/tests/bug1496118.html | 37 +++++++++++++++++++ layout/base/tests/mochitest.ini | 2 + .../base/tests/test_reftests_with_caret.html | 1 + 5 files changed, 66 insertions(+) create mode 100644 layout/base/tests/bug1496118-ref.html create mode 100644 layout/base/tests/bug1496118.html diff --git a/editor/libeditor/EditorEventListener.cpp b/editor/libeditor/EditorEventListener.cpp index 1a3beca6e6..32f3585288 100644 --- a/editor/libeditor/EditorEventListener.cpp +++ b/editor/libeditor/EditorEventListener.cpp @@ -238,6 +238,8 @@ EditorEventListener::Disconnect() void EditorEventListener::UninstallFromEditor() { + CleanupDragDropCaret(); + nsCOMPtr piTarget = mEditorBase->GetDOMEventTarget(); if (!piTarget) { return; diff --git a/layout/base/tests/bug1496118-ref.html b/layout/base/tests/bug1496118-ref.html new file mode 100644 index 0000000000..feaf31476b --- /dev/null +++ b/layout/base/tests/bug1496118-ref.html @@ -0,0 +1,24 @@ + + + + + + + + + +
+ +
+ + + diff --git a/layout/base/tests/bug1496118.html b/layout/base/tests/bug1496118.html new file mode 100644 index 0000000000..7656e010ba --- /dev/null +++ b/layout/base/tests/bug1496118.html @@ -0,0 +1,37 @@ + + + + + + + + + +
+ +
+ + + diff --git a/layout/base/tests/mochitest.ini b/layout/base/tests/mochitest.ini index fc616b1ef8..846ab52813 100644 --- a/layout/base/tests/mochitest.ini +++ b/layout/base/tests/mochitest.ini @@ -179,6 +179,8 @@ support-files = bug1263357-4-ref.html bug1263357-5.html bug1263357-5-ref.html + bug1496118.html + bug1496118-ref.html input-maxlength-valid-before-change.html input-maxlength-valid-change.html input-maxlength-invalid-change.html diff --git a/layout/base/tests/test_reftests_with_caret.html b/layout/base/tests/test_reftests_with_caret.html index 062c605b98..d39dd737ad 100644 --- a/layout/base/tests/test_reftests_with_caret.html +++ b/layout/base/tests/test_reftests_with_caret.html @@ -186,6 +186,7 @@ var tests = [ [ 'bug1263357-3.html' , 'bug1263357-3-ref.html'] , [ 'bug1263357-4.html' , 'bug1263357-4-ref.html'] , [ 'bug1263357-5.html' , 'bug1263357-5-ref.html'] , + [ 'bug1496118.html' , 'bug1496118-ref.html' ] , function() {SpecialPowers.pushPrefEnv({'clear': [['layout.accessiblecaret.enabled']]}, nextTest);} , ];