Bug 1419868 - Fix some inconsistent naming r?mystor draft
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 22 Nov 2017 14:21:37 -0500
changeset 702137 88d2e0bacf06c63eb65beaf442e5634d15d685ce
parent 702136 8697764fdb68ae0865469da5dfda1cfc3a448d24
child 741377 47699d29c32cfe52a4ddcff343730a9970fa5376
push id90389
push userkgupta@mozilla.com
push dateWed, 22 Nov 2017 19:22:39 +0000
reviewersmystor
bugs1419868
milestone59.0a1
Bug 1419868 - Fix some inconsistent naming r?mystor The property in question is the offset from the content process to the chrome process, but it gets called various things for historical reasons. Let's be consistent and just call it the chrome offset everywhere. Also, in some places this was needlessly getting turned into a nsIntPoint via ToUnknownPoint(), only to be turned back into a LayoutDeviceIntPoint at all the use sites. So this patch also updates some function signatures to avoid the needless conversion. No functional changes. MozReview-Commit-ID: AuhEUfa64Uj
dom/ipc/DOMTypes.ipdlh
dom/ipc/TabChild.cpp
dom/ipc/TabChild.h
dom/plugins/base/nsPluginInstanceOwner.cpp
layout/generic/nsPluginFrame.cpp
widget/PuppetWidget.cpp
widget/PuppetWidget.h
--- a/dom/ipc/DOMTypes.ipdlh
+++ b/dom/ipc/DOMTypes.ipdlh
@@ -91,17 +91,17 @@ struct ScreenDetails {
 };
 
 struct DimensionInfo
 {
   CSSRect rect;
   CSSSize size;
   ScreenOrientationInternal orientation;
   LayoutDeviceIntPoint clientOffset;
-  LayoutDeviceIntPoint chromeDisp;
+  LayoutDeviceIntPoint chromeOffset;
 };
 
 struct FrameScriptInfo
 {
   nsString url;
   bool runInGlobalScope;
 };
 
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -1315,17 +1315,17 @@ mozilla::ipc::IPCResult
 TabChild::RecvUpdateDimensions(const DimensionInfo& aDimensionInfo)
 {
     if (!mRemoteFrame) {
         return IPC_OK();
     }
 
     mUnscaledOuterRect = aDimensionInfo.rect();
     mClientOffset = aDimensionInfo.clientOffset();
-    mChromeDisp = aDimensionInfo.chromeDisp();
+    mChromeOffset = aDimensionInfo.chromeOffset();
 
     mOrientation = aDimensionInfo.orientation();
     SetUnscaledInnerSize(aDimensionInfo.size());
     if (!mHasValidInnerSize &&
         aDimensionInfo.size().width != 0 &&
         aDimensionInfo.size().height != 0) {
       mHasValidInnerSize = true;
     }
@@ -1335,18 +1335,18 @@ TabChild::RecvUpdateDimensions(const Dim
 
     // Set the size on the document viewer before we update the widget and
     // trigger a reflow. Otherwise the MobileViewportManager reads the stale
     // size from the content viewer when it computes a new CSS viewport.
     nsCOMPtr<nsIBaseWindow> baseWin = do_QueryInterface(WebNavigation());
     baseWin->SetPositionAndSize(0, 0, screenSize.width, screenSize.height,
                                 nsIBaseWindow::eRepaint);
 
-    mPuppetWidget->Resize(screenRect.x + mClientOffset.x + mChromeDisp.x,
-                          screenRect.y + mClientOffset.y + mChromeDisp.y,
+    mPuppetWidget->Resize(screenRect.x + mClientOffset.x + mChromeOffset.x,
+                          screenRect.y + mClientOffset.y + mChromeOffset.y,
                           screenSize.width, screenSize.height, true);
 
     return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 TabChild::RecvSizeModeChanged(const nsSizeMode& aSizeMode)
 {
@@ -3390,18 +3390,18 @@ TabChild::RecvUIResolutionChanged(const 
     if (presContext) {
       presContext->UIResolutionChangedSync();
     }
   }
 
   ScreenIntSize screenSize = GetInnerSize();
   if (mHasValidInnerSize && oldScreenSize != screenSize) {
     ScreenIntRect screenRect = GetOuterRect();
-    mPuppetWidget->Resize(screenRect.x + mClientOffset.x + mChromeDisp.x,
-                          screenRect.y + mClientOffset.y + mChromeDisp.y,
+    mPuppetWidget->Resize(screenRect.x + mClientOffset.x + mChromeOffset.x,
+                          screenRect.y + mClientOffset.y + mChromeOffset.y,
                           screenSize.width, screenSize.height, true);
 
     nsCOMPtr<nsIBaseWindow> baseWin = do_QueryInterface(WebNavigation());
     baseWin->SetPositionAndSize(0, 0, screenSize.width, screenSize.height,
                                 nsIBaseWindow::eRepaint);
   }
 
   return IPC_OK();
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -671,17 +671,17 @@ public:
 
   virtual PPaymentRequestChild*
   AllocPPaymentRequestChild() override;
 
   virtual bool
   DeallocPPaymentRequestChild(PPaymentRequestChild* aActor) override;
 
   LayoutDeviceIntPoint GetClientOffset() const { return mClientOffset; }
-  LayoutDeviceIntPoint GetChromeDisplacement() const { return mChromeDisp; };
+  LayoutDeviceIntPoint GetChromeOffset() const { return mChromeOffset; };
 
   bool IPCOpen() const { return mIPCOpen; }
 
   bool ParentIsActive() const
   {
     return mParentIsActive;
   }
 
@@ -926,17 +926,17 @@ private:
   bool mIgnoreKeyPressEvent;
   RefPtr<APZEventState> mAPZEventState;
   SetAllowedTouchBehaviorCallback mSetAllowedTouchBehaviorCallback;
   bool mHasValidInnerSize;
   bool mDestroyed;
   // Position of client area relative to the outer window
   LayoutDeviceIntPoint mClientOffset;
   // Position of tab, relative to parent widget (typically the window)
-  LayoutDeviceIntPoint mChromeDisp;
+  LayoutDeviceIntPoint mChromeOffset;
   TabId mUniqueId;
 
   // Holds the compositor options for the compositor rendering this tab,
   // once we find out which compositor that is.
   Maybe<mozilla::layers::CompositorOptions> mCompositorOptions;
 
   friend class ContentChild;
 
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -991,25 +991,23 @@ NPBool nsPluginInstanceOwner::ConvertPoi
     presContext->DeviceContext()->AppUnitsPerDevPixelAtUnitFullZoom());
 
   PuppetWidget *puppetWidget = static_cast<PuppetWidget*>(widget);
   PuppetWidget *rootWidget = static_cast<PuppetWidget*>(widget->GetTopLevelWidget());
   if (!rootWidget) {
     return false;
   }
   CSSIntPoint chromeSize = CSSIntPoint::Truncate(
-    LayoutDeviceIntPoint::FromUnknownPoint(rootWidget->GetChromeDimensions()) /
-    scaleFactor);
+    rootWidget->GetChromeOffset() / scaleFactor);
   nsIntSize intScreenDims = rootWidget->GetScreenDimensions();
   CSSIntSize screenDims = CSSIntSize::Truncate(
     LayoutDeviceIntSize::FromUnknownSize(intScreenDims) / scaleFactor);
   int32_t screenH = screenDims.height;
   CSSIntPoint windowPosition = CSSIntPoint::Truncate(
-    LayoutDeviceIntPoint::FromUnknownPoint(rootWidget->GetWindowPosition()) /
-    scaleFactor);
+    rootWidget->GetWindowPosition() / scaleFactor);
 
   // Window size is tab size + chrome size.
   LayoutDeviceIntRect tabContentBounds = puppetWidget->GetBounds();
   tabContentBounds.ScaleInverseRoundOut(scaleFactor.scale);
   int32_t windowH = tabContentBounds.height + int(chromeSize.y);
 
   CSSIntPoint pluginPosition = pluginFrame->GetScreenRect().TopLeft();
 
--- a/layout/generic/nsPluginFrame.cpp
+++ b/layout/generic/nsPluginFrame.cpp
@@ -787,17 +787,17 @@ mozilla::LayoutDeviceIntPoint
 nsPluginFrame::GetRemoteTabChromeOffset()
 {
   LayoutDeviceIntPoint offset;
   if (XRE_IsContentProcess()) {
     if (nsPIDOMWindowOuter* window = GetContent()->OwnerDoc()->GetWindow()) {
       if (nsCOMPtr<nsPIDOMWindowOuter> topWindow = window->GetTop()) {
         dom::TabChild* tc = dom::TabChild::GetFrom(topWindow);
         if (tc) {
-          offset += tc->GetChromeDisplacement();
+          offset += tc->GetChromeOffset();
         }
       }
     }
   }
   return offset;
 }
 
 nsIntPoint
--- a/widget/PuppetWidget.cpp
+++ b/widget/PuppetWidget.cpp
@@ -1207,36 +1207,36 @@ PuppetWidget::SetNativeData(uint32_t aDa
     }
     break;
   default:
     NS_WARNING("SetNativeData called with unsupported data type.");
   }
 }
 #endif
 
-nsIntPoint
-PuppetWidget::GetChromeDimensions()
+LayoutDeviceIntPoint
+PuppetWidget::GetChromeOffset()
 {
   if (!GetOwningTabChild()) {
     NS_WARNING("PuppetWidget without Tab does not have chrome information.");
-    return nsIntPoint();
+    return LayoutDeviceIntPoint();
   }
-  return GetOwningTabChild()->GetChromeDisplacement().ToUnknownPoint();
+  return GetOwningTabChild()->GetChromeOffset();
 }
 
-nsIntPoint
+LayoutDeviceIntPoint
 PuppetWidget::GetWindowPosition()
 {
   if (!GetOwningTabChild()) {
-    return nsIntPoint();
+    return LayoutDeviceIntPoint();
   }
 
   int32_t winX, winY, winW, winH;
-  NS_ENSURE_SUCCESS(GetOwningTabChild()->GetDimensions(0, &winX, &winY, &winW, &winH), nsIntPoint());
-  return nsIntPoint(winX, winY) + GetOwningTabChild()->GetClientOffset().ToUnknownPoint();
+  NS_ENSURE_SUCCESS(GetOwningTabChild()->GetDimensions(0, &winX, &winY, &winW, &winH), LayoutDeviceIntPoint());
+  return LayoutDeviceIntPoint(winX, winY) + GetOwningTabChild()->GetClientOffset();
 }
 
 LayoutDeviceIntRect
 PuppetWidget::GetScreenBounds()
 {
   return LayoutDeviceIntRect(WidgetToScreenOffset(), mBounds.Size());
 }
 
--- a/widget/PuppetWidget.h
+++ b/widget/PuppetWidget.h
@@ -135,17 +135,17 @@ public:
   void SetNativeData(uint32_t aDataType, uintptr_t aVal) override;
 #endif
 
   // PuppetWidgets don't have any concept of titles.
   virtual nsresult SetTitle(const nsAString& aTitle) override
   { return NS_ERROR_UNEXPECTED; }
 
   virtual LayoutDeviceIntPoint WidgetToScreenOffset() override
-  { return LayoutDeviceIntPoint::FromUnknownPoint(GetWindowPosition() + GetChromeDimensions()); }
+  { return GetWindowPosition() + GetChromeOffset(); }
 
   int32_t RoundsWidgetCoordinatesTo() override;
 
   void InitEvent(WidgetGUIEvent& aEvent,
                  LayoutDeviceIntPoint* aPoint = nullptr);
 
   virtual nsresult DispatchEvent(WidgetGUIEvent* aEvent,
                                  nsEventStatus& aStatus) override;
@@ -230,21 +230,21 @@ public:
   {
     mDPI = aDpi;
     mRounding = aRounding;
     mDefaultScale = aScale;
   }
 
   nsIntSize GetScreenDimensions();
 
-  // Get the size of the chrome of the window that this tab belongs to.
-  nsIntPoint GetChromeDimensions();
+  // Get the offset to the chrome of the window that this tab belongs to.
+  LayoutDeviceIntPoint GetChromeOffset();
 
   // Get the screen position of the application window.
-  nsIntPoint GetWindowPosition();
+  LayoutDeviceIntPoint GetWindowPosition();
 
   virtual LayoutDeviceIntRect GetScreenBounds() override;
 
   virtual MOZ_MUST_USE nsresult
   StartPluginIME(const mozilla::WidgetKeyboardEvent& aKeyboardEvent,
                  int32_t aPanelX, int32_t aPanelY,
                  nsString& aCommitted) override;