Bug 1166436 part.6 mContentCache should store editor rect and TabParent should use it r=m_kato
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 05 Jun 2015 18:28:19 +0900
changeset 278129 cc5d3ee81d5132225e66dc35f0efa800f050ad33
parent 278128 a33f46c01ae80a8d3182919a4c6d25403f76880e
child 278130 73f252ed199632ba8d3e8557b6baaed6be18db42
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersm_kato
bugs1166436
milestone41.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 1166436 part.6 mContentCache should store editor rect and TabParent should use it r=m_kato
dom/ipc/TabParent.cpp
dom/ipc/TabParent.h
widget/ContentCache.h
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -2002,27 +2002,27 @@ TabParent::RecvNotifyIMEMouseButtonEvent
   nsresult rv = widget->NotifyIME(aIMENotification);
   *aConsumedByIME = rv == NS_SUCCESS_EVENT_CONSUMED;
   return true;
 }
 
 bool
 TabParent::RecvNotifyIMEEditorRect(const LayoutDeviceIntRect& aRect)
 {
-  mIMEEditorRect = aRect;
+  mContentCache.SetEditorRect(aRect);
   return true;
 }
 
 bool
 TabParent::RecvNotifyIMEPositionChange(
              const LayoutDeviceIntRect& aEditorRect,
              InfallibleTArray<LayoutDeviceIntRect>&& aCompositionRects,
              const LayoutDeviceIntRect& aCaretRect)
 {
-  mIMEEditorRect = aEditorRect;
+  mContentCache.SetEditorRect(aEditorRect);
   mContentCache.UpdateTextRectArray(aCompositionRects);
   mContentCache.UpdateCaretRect(aCaretRect);
 
   nsCOMPtr<nsIWidget> widget = GetWidget();
   if (!widget) {
     return true;
   }
 
@@ -2278,17 +2278,18 @@ TabParent::HandleQueryContentEvent(Widge
 
       aEvent.mReply.mOffset = aEvent.mInput.mOffset;
       aEvent.mReply.mRect -= GetChildProcessOffset();
       aEvent.mSucceeded = true;
     }
     break;
   case NS_QUERY_EDITOR_RECT:
     {
-      aEvent.mReply.mRect = mIMEEditorRect - GetChildProcessOffset();
+      aEvent.mReply.mRect =
+        mContentCache.GetEditorRect() - GetChildProcessOffset();
       aEvent.mSucceeded = true;
     }
     break;
   }
   return true;
 }
 
 bool
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -473,18 +473,16 @@ protected:
                                   BrowserConfiguration& aConfiguration);
 
     void SetHasContentOpener(bool aHasContentOpener);
 
     // IME
     static TabParent *mIMETabParent;
     ContentCache mContentCache;
 
-    LayoutDeviceIntRect mIMEEditorRect;
-
     nsIntRect mRect;
     ScreenIntSize mDimensions;
     ScreenOrientation mOrientation;
     float mDPI;
     CSSToLayoutDeviceScale mDefaultScale;
     bool mUpdatedDimensions;
     LayoutDeviceIntPoint mChromeOffset;
 
--- a/widget/ContentCache.h
+++ b/widget/ContentCache.h
@@ -101,16 +101,22 @@ public:
   bool UpdateCaretRect(const LayoutDeviceIntRect& aCaretRect)
   {
     return InitCaretRect(mCaret.mOffset, aCaretRect);
   }
   bool InitCaretRect(uint32_t aOffset, const LayoutDeviceIntRect& aCaretRect);
   uint32_t CaretOffset() const { return mCaret.mOffset; }
   bool GetCaretRect(uint32_t aOffset, LayoutDeviceIntRect& aCaretRect) const;
 
+  void SetEditorRect(const LayoutDeviceIntRect& aEditorRect)
+  {
+    mEditorRect = aEditorRect;
+  }
+  const LayoutDeviceIntRect& GetEditorRect() const { return mEditorRect; }
+
 private:
   // Whole text in the target
   nsString mText;
   // This is commit string which is caused by our request.
   nsString mCommitStringByRequest;
   // Start offset of the composition string.
   uint32_t mCompositionStart;
   // Count of composition events during requesting commit or cancel the
@@ -193,15 +199,17 @@ private:
         return false;
       }
       return InRange(aOffset) && aOffset + aLength <= EndOffset();
     }
     LayoutDeviceIntRect GetRect(uint32_t aOffset) const;
     LayoutDeviceIntRect GetUnionRect(uint32_t aOffset, uint32_t aLength) const;
   } mTextRectArray;
 
+  LayoutDeviceIntRect mEditorRect;
+
   bool mIsComposing;
   bool mRequestedToCommitOrCancelComposition;
 };
 
 } // namespace mozilla
 
 #endif // mozilla_ContentCache_h