Backed out changeset 456038b0bdb5 (bug 1121313) for M1,M2 bustage
authorNigel Babu <nigelbabu@gmail.com>
Tue, 17 Feb 2015 10:15:44 +0530
changeset 258203 9fc9d2e35916ccaadd06c98095808361e7b2ed5a
parent 258202 dad2b32454574aabe1b66d5ee36ecd18a3bd3de7
child 258204 3cac512f3ec5f33181da20660cc26187a59c3961
push id721
push userjlund@mozilla.com
push dateTue, 21 Apr 2015 23:03:33 +0000
treeherdermozilla-release@d27c9211ebb3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1121313
milestone38.0a1
backs out456038b0bdb5e2c3948c89714da94ef9491f34af
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
Backed out changeset 456038b0bdb5 (bug 1121313) for M1,M2 bustage
dom/ipc/PBrowser.ipdl
dom/ipc/TabParent.cpp
dom/ipc/TabParent.h
widget/PuppetWidget.cpp
widget/PuppetWidget.h
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -262,28 +262,25 @@ parent:
      */
     prio(urgent) async NotifyIMEPositionChange(LayoutDeviceIntRect editorRect,
                                                LayoutDeviceIntRect[] compositionRects,
                                                LayoutDeviceIntRect caretRect);
 
     /**
      * Instructs chrome to end any pending composition
      *
-     *  cancel       true if composition should be cancelled
-     *  noCompositionEvent   true if no composition event is fired by commit or
-     *                       cancel
+     *  cancel       PR_TRUE if composition should be cancelled
      *  composition  Text to commit before ending the composition
      *
-     *  if cancel is true,
+     *  if cancel is PR_TRUE,
      *    widget should return empty string for composition
-     *  if cancel is false,
+     *  if cancel is PR_FALSE,
      *    widget should return the current composition text
      */
-    prio(urgent) sync EndIMEComposition(bool cancel)
-                        returns (bool noCompositionEvent, nsString composition);
+    prio(urgent) sync EndIMEComposition(bool cancel) returns (nsString composition);
 
     /**
      * Request that the parent process move focus to the browser's frame. If
      * canRaise is true, the window can be raised if it is inactive.
      */
     RequestFocus(bool canRaise);
 
     /**
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -254,17 +254,16 @@ TabParent::TabParent(nsIContentParent* a
                      uint32_t aChromeFlags)
   : TabContext(aContext)
   , mFrameElement(nullptr)
   , mIMESelectionAnchor(0)
   , mIMESelectionFocus(0)
   , mWritingMode()
   , mIMEComposing(false)
   , mIMECompositionEnding(false)
-  , mIMEEventCountAfterEnding(0)
   , mIMECompositionStart(0)
   , mIMESeqno(0)
   , mIMECompositionRectOffset(0)
   , mEventCaptureDepth(0)
   , mRect(0, 0, 0, 0)
   , mDimensions(0, 0)
   , mOrientation(0)
   , mDPI(0)
@@ -1996,20 +1995,18 @@ TabParent::SendCompositionEvent(WidgetCo
   }
 
   if (event.CausesDOMTextEvent()) {
     return SendCompositionChangeEvent(event);
   }
 
   mIMEComposing = !event.CausesDOMCompositionEndEvent();
   mIMECompositionStart = std::min(mIMESelectionAnchor, mIMESelectionFocus);
-  if (mIMECompositionEnding) {
-    mIMEEventCountAfterEnding++;
+  if (mIMECompositionEnding)
     return true;
-  }
   event.mSeqno = ++mIMESeqno;
   return PBrowserParent::SendCompositionEvent(event);
 }
 
 /**
  * During REQUEST_TO_COMMIT_COMPOSITION or REQUEST_TO_CANCEL_COMPOSITION,
  * widget usually sends a NS_COMPOSITION_CHANGE event to finalize or
  * clear the composition, respectively
@@ -2017,17 +2014,16 @@ TabParent::SendCompositionEvent(WidgetCo
  * Because the event will not reach content in time, we intercept it
  * here and pass the text as the EndIMEComposition return value
  */
 bool
 TabParent::SendCompositionChangeEvent(WidgetCompositionEvent& event)
 {
   if (mIMECompositionEnding) {
     mIMECompositionText = event.mData;
-    mIMEEventCountAfterEnding++;
     return true;
   }
 
   // We must be able to simulate the selection because
   // we might not receive selection updates in time
   if (!mIMEComposing) {
     mIMECompositionStart = std::min(mIMESelectionAnchor, mIMESelectionFocus);
   }
@@ -2108,31 +2104,28 @@ TabParent::GetRenderFrame()
   if (ManagedPRenderFrameParent().IsEmpty()) {
     return nullptr;
   }
   return static_cast<RenderFrameParent*>(ManagedPRenderFrameParent()[0]);
 }
 
 bool
 TabParent::RecvEndIMEComposition(const bool& aCancel,
-                                 bool* aNoCompositionEvent,
                                  nsString* aComposition)
 {
   nsCOMPtr<nsIWidget> widget = GetWidget();
   if (!widget)
     return true;
 
   mIMECompositionEnding = true;
-  mIMEEventCountAfterEnding = 0;
 
   widget->NotifyIME(IMENotification(aCancel ? REQUEST_TO_CANCEL_COMPOSITION :
                                               REQUEST_TO_COMMIT_COMPOSITION));
 
   mIMECompositionEnding = false;
-  *aNoCompositionEvent = !mIMEEventCountAfterEnding;
   *aComposition = mIMECompositionText;
   mIMECompositionText.Truncate(0);  
   return true;
 }
 
 bool
 TabParent::RecvGetInputContext(int32_t* aIMEEnabled,
                                int32_t* aIMEOpen,
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -190,17 +190,16 @@ public:
     virtual bool RecvNotifyIMEMouseButtonEvent(const widget::IMENotification& aEventMessage,
                                                bool* aConsumedByIME) MOZ_OVERRIDE;
     virtual bool RecvNotifyIMEEditorRect(const LayoutDeviceIntRect& aRect) MOZ_OVERRIDE;
     virtual bool RecvNotifyIMEPositionChange(
                    const LayoutDeviceIntRect& aEditorRect,
                    InfallibleTArray<LayoutDeviceIntRect>&& aCompositionRects,
                    const LayoutDeviceIntRect& aCaretRect) MOZ_OVERRIDE;
     virtual bool RecvEndIMEComposition(const bool& aCancel,
-                                       bool* aNoCompositionEvent,
                                        nsString* aComposition) MOZ_OVERRIDE;
     virtual bool RecvGetInputContext(int32_t* aIMEEnabled,
                                      int32_t* aIMEOpen,
                                      intptr_t* aNativeIMEContext) MOZ_OVERRIDE;
     virtual bool RecvSetInputContext(const int32_t& aIMEEnabled,
                                      const int32_t& aIMEOpen,
                                      const nsString& aType,
                                      const nsString& aInputmode,
@@ -415,17 +414,16 @@ protected:
     // IME
     static TabParent *mIMETabParent;
     nsString mIMECacheText;
     uint32_t mIMESelectionAnchor;
     uint32_t mIMESelectionFocus;
     mozilla::WritingMode mWritingMode;
     bool mIMEComposing;
     bool mIMECompositionEnding;
-    uint32_t mIMEEventCountAfterEnding;
     // Buffer to store composition text during ResetInputState
     // Compositions in almost all cases are small enough for nsAutoString
     nsAutoString mIMECompositionText;
     uint32_t mIMECompositionStart;
     uint32_t mIMESeqno;
 
     uint32_t mIMECompositionRectOffset;
     InfallibleTArray<LayoutDeviceIntRect> mIMECompositionRects;
--- a/widget/PuppetWidget.cpp
+++ b/widget/PuppetWidget.cpp
@@ -104,16 +104,17 @@ PuppetWidget::Create(nsIWidget        *a
 
   mBounds = aRect;
   mEnabled = true;
   mVisible = true;
 
   mDrawTarget = gfxPlatform::GetPlatform()->
     CreateOffscreenContentDrawTarget(IntSize(1, 1), SurfaceFormat::B8G8R8A8);
 
+  mIMEComposing = false;
   mNeedIMEStateInit = MightNeedIMEFocus(aInitData);
 
   PuppetWidget* parent = static_cast<PuppetWidget*>(aParent);
   if (parent) {
     parent->SetChild(this);
     mLayerManager = parent->GetLayerManager();
   }
   else {
@@ -299,16 +300,19 @@ PuppetWidget::DispatchEvent(WidgetGUIEve
     WidgetKeyboardEvent* keyEvent = event->AsKeyboardEvent();
     if (keyEvent) {
       mTabChild->RequestNativeKeyBindings(&autoCache, keyEvent);
     }
   }
 
   aStatus = nsEventStatus_eIgnore;
 
+  if (event->message == NS_COMPOSITION_START) {
+    mIMEComposing = true;
+  }
   uint32_t seqno = kLatestSeqno;
   switch (event->mClass) {
   case eCompositionEventClass:
     seqno = event->AsCompositionEvent()->mSeqno;
     break;
   case eSelectionEventClass:
     seqno = event->AsSelectionEvent()->mSeqno;
     break;
@@ -321,16 +325,21 @@ PuppetWidget::DispatchEvent(WidgetGUIEve
       return NS_OK;
     }
   }
 
   if (mAttachedWidgetListener) {
     aStatus = mAttachedWidgetListener->HandleEvent(event, mUseAttachedEvents);
   }
 
+  if (event->mClass == eCompositionEventClass &&
+      event->AsCompositionEvent()->CausesDOMCompositionEndEvent()) {
+    mIMEComposing = false;
+  }
+
   return NS_OK;
 }
 
 
 NS_IMETHODIMP_(bool)
 PuppetWidget::ExecuteNativeKeyBinding(NativeKeyBindingsType aType,
                                       const mozilla::WidgetKeyboardEvent& aEvent,
                                       DoCommandCallback aCallback,
@@ -388,31 +397,29 @@ PuppetWidget::GetLayerManager(PLayerTran
 nsresult
 PuppetWidget::IMEEndComposition(bool aCancel)
 {
 #ifndef MOZ_CROSS_PROCESS_IME
   return NS_OK;
 #endif
 
   nsEventStatus status;
-  bool noCompositionEvent = false;
   WidgetCompositionEvent compositionCommitEvent(true, NS_COMPOSITION_COMMIT,
                                                 this);
   InitEvent(compositionCommitEvent, nullptr);
   // SendEndIMEComposition is always called since ResetInputState
   // should always be called even if we aren't composing something.
   if (!mTabChild ||
-      !mTabChild->SendEndIMEComposition(aCancel, &noCompositionEvent,
+      !mTabChild->SendEndIMEComposition(aCancel,
                                         &compositionCommitEvent.mData)) {
     return NS_ERROR_FAILURE;
   }
 
-  if (noCompositionEvent) {
+  if (!mIMEComposing)
     return NS_OK;
-  }
 
   compositionCommitEvent.mSeqno = mIMELastReceivedSeqno;
   DispatchEvent(&compositionCommitEvent, status);
   return NS_OK;
 }
 
 nsresult
 PuppetWidget::NotifyIMEInternal(const IMENotification& aIMENotification)
--- a/widget/PuppetWidget.h
+++ b/widget/PuppetWidget.h
@@ -254,16 +254,17 @@ private:
   nsRefPtr<PuppetWidget> mChild;
   nsIntRegion mDirtyRegion;
   nsRevocableEventPtr<PaintTask> mPaintTask;
   // XXX/cjones: keeping this around until we teach LayerManager to do
   // retained-content-only transactions
   mozilla::RefPtr<DrawTarget> mDrawTarget;
   // IME
   nsIMEUpdatePreference mIMEPreferenceOfParent;
+  bool mIMEComposing;
   // Latest seqno received through events
   uint32_t mIMELastReceivedSeqno;
   // Chrome's seqno value when last blur occurred
   // arriving events with seqno up to this should be discarded
   // Note that if seqno overflows (~50 days at 1 ms increment rate),
   // events will be discarded until new focus/blur occurs
   uint32_t mIMELastBlurSeqno;
   bool mNeedIMEStateInit;