Bug 1291457 - Add an nsIWidget API so that layout can declare a widget as being an arrow panel. draft
authorMarkus Stange <mstange@themasta.com>
Tue, 02 Aug 2016 16:30:02 -0400
changeset 395776 ca3c88de268845bb4d1fc47ff186cbe4f5e52123
parent 395775 23cb515d4b12144549b3a05bfe36337eb08959fd
child 395777 d9a03f20423fc20774d6d3de7458426326211c8f
push id24844
push usermstange@themasta.com
push dateTue, 02 Aug 2016 21:27:11 +0000
bugs1291457
milestone51.0a1
Bug 1291457 - Add an nsIWidget API so that layout can declare a widget as being an arrow panel. MozReview-Commit-ID: 6PUYXDo2qsk
widget/cocoa/nsCocoaWindow.h
widget/cocoa/nsCocoaWindow.mm
widget/nsIWidget.h
--- a/widget/cocoa/nsCocoaWindow.h
+++ b/widget/cocoa/nsCocoaWindow.h
@@ -256,16 +256,17 @@ public:
     NS_IMETHOD              ConstrainPosition(bool aAllowSlop,
                                               int32_t *aX, int32_t *aY) override;
     virtual void            SetSizeConstraints(const SizeConstraints& aConstraints) override;
     NS_IMETHOD              Move(double aX, double aY) override;
     NS_IMETHOD              PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
                                         nsIWidget *aWidget, bool aActivate) override;
     NS_IMETHOD              SetSizeMode(nsSizeMode aMode) override;
     NS_IMETHOD              HideWindowChrome(bool aShouldHide) override;
+    virtual void            SetIsArrowPanel(bool aIsArrowPanel, const LayoutDeviceIntPoint& aArrowTip) override;
 
     void EnteredFullScreen(bool aFullScreen, bool aNativeMode = true);
     virtual bool PrepareForFullscreenTransition(nsISupports** aData) override;
     virtual void PerformFullscreenTransition(FullscreenTransitionStage aStage,
                                              uint16_t aDuration,
                                              nsISupports* aData,
                                              nsIRunnable* aCallback) override;
     NS_IMETHOD MakeFullScreen(
--- a/widget/cocoa/nsCocoaWindow.mm
+++ b/widget/cocoa/nsCocoaWindow.mm
@@ -2273,16 +2273,22 @@ void nsCocoaWindow::SetDrawsInTitlebar(b
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   if (mWindow)
     [mWindow setDrawsContentsIntoWindowFrame:aState];
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
+void nsCocoaWindow::SetIsArrowPanel(bool aIsArrowPanel, const LayoutDeviceIntPoint& aArrowTip)
+{
+  NSPoint arrowTip = nsCocoaUtils::DevPixelsToCocoaPoints(aArrowTip, BackingScaleFactor());
+  [mWindow setIsArrowPanel:aIsArrowPanel pointingTo:arrowTip];
+}
+
 NS_IMETHODIMP nsCocoaWindow::SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
                                                         uint32_t aNativeMessage,
                                                         uint32_t aModifierFlags,
                                                         nsIObserver* aObserver)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   AutoObserverNotifier notifier(aObserver, "mouseevent");
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -1943,16 +1943,18 @@ public:
      * determine how widget coordinates will be rounded.
      */
     virtual int32_t RoundsWidgetCoordinatesTo() { return 1; }
 
     virtual void UpdateZoomConstraints(const uint32_t& aPresShellId,
                                        const FrameMetrics::ViewID& aViewId,
                                        const mozilla::Maybe<ZoomConstraints>& aConstraints) {};
 
+    virtual void SetIsArrowPanel(bool aIsArrowPanel, const LayoutDeviceIntPoint& aArrowTip) {}
+
     /**
      * GetTextEventDispatcher() returns TextEventDispatcher belonging to the
      * widget.  Note that this never returns nullptr.
      */
     NS_IMETHOD_(TextEventDispatcher*) GetTextEventDispatcher() = 0;
 
     /**
      * GetNativeTextEventDispatcherListener() returns a