Bug 1064071: Remove obsolete Text Selection caret positioning logic; r=margaret
authorChristian Vielma <cvielma@gmail.com>
Sat, 18 Oct 2014 12:01:36 -0700
changeset 237829 1ab57d5a8e6ae0a773083d5856c1b11b37891609
parent 237828 511ddc0a0e58238bd858895df8169e75e8c9c7d4
child 237830 9601c62261c91481d43f27c482e40e02d8133979
push id660
push userraliiev@mozilla.com
push dateWed, 18 Feb 2015 20:30:48 +0000
treeherdermozilla-release@49e493494178 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs1064071
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1064071: Remove obsolete Text Selection caret positioning logic; r=margaret
mobile/android/chrome/content/SelectionHandler.js
widget/android/nsWindow.cpp
--- a/mobile/android/chrome/content/SelectionHandler.js
+++ b/mobile/android/chrome/content/SelectionHandler.js
@@ -97,22 +97,16 @@ var SelectionHandler = {
           this._updateCacheForSelection();
         }
         if (this._activeType != this.TYPE_NONE) {
           this._positionHandlesOnChange();
         }
         break;
       }
 
-      // Update caret position on keyboard activity
-      case "TextSelection:UpdateCaretPos":
-        // Generated by IME close, autoCorrection / styling
-        this._positionHandles();
-        break;
-
       case "Gesture:SingleTap": {
         if (this._activeType == this.TYPE_CURSOR) {
           // attachCaret() is called in the "Gesture:SingleTap" handler in BrowserEventHandler
           // We're guaranteed to call this first, because this observer was added last
           this._deactivate();
         }
         break;
       }
@@ -707,17 +701,16 @@ var SelectionHandler = {
     // Ensure it isn't disabled, isn't handled by Android native dialog, and is editable text element
     if (aElement.disabled || InputWidgetHelper.hasInputWidget(aElement) || !this.isElementEditableText(aElement)) {
       return false;
     }
 
     this._initTargetInfo(aElement, this.TYPE_CURSOR);
 
     // Caret-specific observer/listeners
-    Services.obs.addObserver(this, "TextSelection:UpdateCaretPos", false);
     BrowserApp.deck.addEventListener("keyup", this, false);
     BrowserApp.deck.addEventListener("compositionupdate", this, false);
     BrowserApp.deck.addEventListener("compositionend", this, false);
 
     this._activeType = this.TYPE_CURSOR;
 
     // Determine position and show caret, open actionbar
     this._positionHandles();
@@ -1009,17 +1002,16 @@ var SelectionHandler = {
     this._stopDraggingHandles();
     // Hide handle/caret, close actionbar
     Messaging.sendRequest({ type: "TextSelection:HideHandles" });
 
     this._removeObservers();
 
     // Only observed for caret positioning
     if (this._activeType == this.TYPE_CURSOR) {
-      Services.obs.removeObserver(this, "TextSelection:UpdateCaretPos");
       BrowserApp.deck.removeEventListener("keyup", this);
       BrowserApp.deck.removeEventListener("compositionupdate", this);
       BrowserApp.deck.removeEventListener("compositionend", this);
     }
 
     this._contentWindow = null;
     this._targetElement = null;
     this._isRTL = false;
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -1906,23 +1906,16 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *
             }
 
             selEvent.mOffset = std::min(start, end);
             selEvent.mLength = std::max(start, end) - selEvent.mOffset;
             selEvent.mReversed = start > end;
             selEvent.mExpandToClusterBoundary = false;
 
             DispatchEvent(&selEvent);
-
-            // Notify SelectionHandler of final caret position
-            // Required after IME hide via 'Back' button
-            AndroidGeckoEvent* broadcastEvent = AndroidGeckoEvent::MakeBroadcastEvent(
-                NS_LITERAL_CSTRING("TextSelection:UpdateCaretPos"),
-                NS_LITERAL_CSTRING(""));
-            nsAppShell::gAppShell->PostEvent(broadcastEvent);
         }
         break;
     case AndroidGeckoEvent::IME_ADD_COMPOSITION_RANGE:
         {
             TextRange range;
             range.mStartOffset = ae->Start();
             range.mEndOffset = ae->End();
             range.mRangeType = ae->RangeType();
@@ -2006,24 +1999,16 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *
 #ifdef DEBUG_ANDROID_IME
             const NS_ConvertUTF16toUTF8 data(event.mData);
             const char* text = data.get();
             ALOGIME("IME: IME_SET_TEXT: text=\"%s\", length=%u, range=%u",
                     text, event.mData.Length(), event.mRanges->Length());
 #endif // DEBUG_ANDROID_IME
 
             DispatchEvent(&event);
-
-            // Notify SelectionHandler of final caret position
-            // Required in cases of keyboards providing autoCorrections
-            AndroidGeckoEvent* broadcastEvent =
-                AndroidGeckoEvent::MakeBroadcastEvent(
-                    NS_LITERAL_CSTRING("TextSelection:UpdateCaretPos"),
-                    NS_LITERAL_CSTRING(""));
-            nsAppShell::gAppShell->PostEvent(broadcastEvent);
         }
         break;
 
     case AndroidGeckoEvent::IME_REMOVE_COMPOSITION:
         {
             /*
              *  Remove any previous composition.  This is only used for
              *    visual indication and does not affect the text content.