Bug 1270030 - Remove "layout.accessiblecaret.extendedvisibility" pref from IMETextTxn. draft
authorTing-Yu Lin <tlin@mozilla.com>
Wed, 04 May 2016 17:05:35 +0800
changeset 363231 d25b93936f508d69d5e83596eedbd66a35318f2b
parent 362943 0a25833062a880f369e6f9f622413a94cc671bf4
child 519981 26652bb94fd1111468c4c17ab4d37f802b99b6b5
push id17144
push usertlin@mozilla.com
push dateWed, 04 May 2016 09:07:13 +0000
bugs1270030, 1249201
milestone49.0a1
Bug 1270030 - Remove "layout.accessiblecaret.extendedvisibility" pref from IMETextTxn. The pref had been removed in bug 1249201. Need to clean it up for IMETextTxn. MozReview-Commit-ID: EaFaN1yzoyP
editor/libeditor/IMETextTxn.cpp
editor/libeditor/IMETextTxn.h
--- a/editor/libeditor/IMETextTxn.cpp
+++ b/editor/libeditor/IMETextTxn.cpp
@@ -2,52 +2,41 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "IMETextTxn.h"
 
 #include "mozilla/dom/Selection.h"      // local var
 #include "mozilla/dom/Text.h"           // mTextNode
-#include "mozilla/Preferences.h"        // nsCaret Visibility
 #include "nsAString.h"                  // params
 #include "nsDebug.h"                    // for NS_ASSERTION, etc
 #include "nsEditor.h"                   // mEditor
 #include "nsError.h"                    // for NS_SUCCEEDED, NS_FAILED, etc
 #include "nsIPresShell.h"               // nsISelectionController constants
 #include "nsRange.h"                    // local var
 #include "nsQueryObject.h"              // for do_QueryObject
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
-/*static*/ bool
-IMETextTxn::sCaretsExtendedVisibility = false;
-
-
 IMETextTxn::IMETextTxn(Text& aTextNode, uint32_t aOffset,
                        uint32_t aReplaceLength,
                        TextRangeArray* aTextRangeArray,
                        const nsAString& aStringToInsert,
                        nsEditor& aEditor)
   : EditTxn()
   , mTextNode(&aTextNode)
   , mOffset(aOffset)
   , mReplaceLength(aReplaceLength)
   , mRanges(aTextRangeArray)
   , mStringToInsert(aStringToInsert)
   , mEditor(aEditor)
   , mFixed(false)
 {
-  static bool addedPrefs = false;
-  if (!addedPrefs) {
-    mozilla::Preferences::AddBoolVarCache(&sCaretsExtendedVisibility,
-                                          "layout.accessiblecaret.extendedvisibility");
-    addedPrefs = true;
-  }
 }
 
 IMETextTxn::~IMETextTxn()
 {
 }
 
 NS_IMPL_CYCLE_COLLECTION_INHERITED(IMETextTxn, EditTxn,
                                    mTextNode)
@@ -305,20 +294,17 @@ IMETextTxn::SetIMESelection(nsEditor& aE
       static_cast<int32_t>(aOffsetInNode + aLengthOfCompositionString);
     MOZ_ASSERT(caretOffset >= 0 &&
                static_cast<uint32_t>(caretOffset) <= maxOffset);
     rv = selection->Collapse(aTextNode, caretOffset);
     NS_ASSERTION(NS_SUCCEEDED(rv),
                  "Failed to set caret at the end of composition string");
 
     // If caret range isn't specified explicitly, we should hide the caret.
-    // Hiding the caret benefits a Windows build (see bug 555642 comment #6),
-    // but causes loss of Fennec AccessibleCaret visibility during Caret drag.
-    if (!sCaretsExtendedVisibility) {
-      aEditor.HideCaret(true);
-    }
+    // Hiding the caret benefits a Windows build (see bug 555642 comment #6).
+    aEditor.HideCaret(true);
   }
 
   rv = selection->EndBatchChangesInternal();
   NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to end batch changes");
 
   return rv;
 }
--- a/editor/libeditor/IMETextTxn.h
+++ b/editor/libeditor/IMETextTxn.h
@@ -78,23 +78,16 @@ private:
 
   /** The text to insert into mTextNode at mOffset */
   nsString mStringToInsert;
 
   /** The editor, which is used to get the selection controller */
   nsEditor& mEditor;
 
   bool mFixed;
-
-  /*
-   * AccessibleCaret visibility preference. Used to avoid hiding caret during
-   * handle drag, caused by dynamic eCompositionCommit events generated by
-   * the keyboard IME for autoSuggest/autoCorrect support.
-   */
-  static bool sCaretsExtendedVisibility;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(IMETextTxn, NS_IMETEXTTXN_IID)
 
 } // namespace dom
 } // namespace mozilla
 
 #endif