Bug 602787 part.2 Don't implement nsIWidgetListener in its header file r=roc
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 22 Oct 2013 22:27:34 +0900
changeset 166502 64a6e6020d05c4eab0d85926b8617e9b0dbf5c64
parent 166501 2607bb7e0a303363e318e21007e358f887a46926
child 166503 b122fa9825ee5446fc2aea919771d9f83a951920
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs602787
milestone27.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 602787 part.2 Don't implement nsIWidgetListener in its header file r=roc
view/public/nsView.h
widget/nsIWidgetListener.h
widget/xpwidgets/moz.build
widget/xpwidgets/nsIWidgetListener.cpp
xpfe/appshell/src/nsAppShellService.cpp
xpfe/appshell/src/nsChromeTreeOwner.cpp
xpfe/appshell/src/nsContentTreeOwner.cpp
xpfe/appshell/src/nsWebShellWindow.cpp
xpfe/appshell/src/nsWebShellWindow.h
xpfe/appshell/src/nsXULWindow.h
--- a/view/public/nsView.h
+++ b/view/public/nsView.h
@@ -6,16 +6,17 @@
 #ifndef nsView_h__
 #define nsView_h__
 
 #include "nsCoord.h"
 #include "nsRect.h"
 #include "nsPoint.h"
 #include "nsRegion.h"
 #include "nsCRT.h"
+#include "nsWidgetInitData.h" // for nsWindowType
 #include "nsIWidgetListener.h"
 #include "mozilla/EventForwards.h"
 
 class nsViewManager;
 class nsIWidget;
 class nsIFrame;
 
 // Enumerated type to indicate the visibility of a layer.
--- a/widget/nsIWidgetListener.h
+++ b/widget/nsIWidgetListener.h
@@ -1,22 +1,24 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsIWidgetListener_h__
 #define nsIWidgetListener_h__
 
-#include "nscore.h"
-#include "nsIXULWindow.h"
-#include "nsRegion.h"
-#include "mozilla/BasicEvents.h"
+#include <stdint.h>
+
+#include "mozilla/EventForwards.h"
 
 class nsView;
+class nsIntRegion;
 class nsIPresShell;
+class nsIWidget;
+class nsIXULWindow;
 
 /**
  * sizemode is an adjunct to widget size
  */
 enum nsSizeMode
 {
   nsSizeMode_Normal = 0,
   nsSizeMode_Minimized,
@@ -38,107 +40,106 @@ class nsIWidgetListener
 {
 public:
 
   /**
    * If this listener is for an nsIXULWindow, return it. If this is null, then
    * this is likely a listener for a view, which can be determined using
    * GetView. If both methods return null, this will be an nsWebBrowser.
    */
-  virtual nsIXULWindow* GetXULWindow() { return nullptr; }
+  virtual nsIXULWindow* GetXULWindow();
 
   /**
    * If this listener is for an nsView, return it.
    */
-  virtual nsView* GetView() { return nullptr; }
+  virtual nsView* GetView();
 
   /**
    * Return the presshell for this widget listener.
    */
-  virtual nsIPresShell* GetPresShell() { return nullptr; }
+  virtual nsIPresShell* GetPresShell();
 
   /**
    * Called when a window is moved to location (x, y). Returns true if the
    * notification was handled. Coordinates are outer window screen coordinates.
    */
-  virtual bool WindowMoved(nsIWidget* aWidget, int32_t aX, int32_t aY) { return false; }
+  virtual bool WindowMoved(nsIWidget* aWidget, int32_t aX, int32_t aY);
 
   /**
    * Called when a window is resized to (width, height). Returns true if the
    * notification was handled. Coordinates are outer window screen coordinates.
    */
-  virtual bool WindowResized(nsIWidget* aWidget, int32_t aWidth, int32_t aHeight) { return false; }
+  virtual bool WindowResized(nsIWidget* aWidget,
+                             int32_t aWidth, int32_t aHeight);
 
   /**
    * Called when the size mode (minimized, maximized, fullscreen) is changed.
    */
-  virtual void SizeModeChanged(nsSizeMode sizeMode) { }
+  virtual void SizeModeChanged(nsSizeMode aSizeMode);
 
   /**
    * Called when the z-order of the window is changed. Returns true if the
    * notification was handled. aPlacement indicates the new z order. If
    * placement is nsWindowZRelative, then aRequestBelow should be the
    * window to place below. On return, aActualBelow will be set to the
    * window actually behind. This generally only applies to Windows.
    */
-  virtual bool ZLevelChanged(bool aImmediate, nsWindowZ *aPlacement,
-                             nsIWidget* aRequestBelow, nsIWidget** aActualBelow) { return false; }
+  virtual bool ZLevelChanged(bool aImmediate, nsWindowZ* aPlacement,
+                             nsIWidget* aRequestBelow,
+                             nsIWidget** aActualBelow);
 
   /**
    * Called when the window is activated and focused.
    */
-  virtual void WindowActivated() { }
+  virtual void WindowActivated();
 
   /**
    * Called when the window is deactivated and no longer focused.
    */
-  virtual void WindowDeactivated() { }
+  virtual void WindowDeactivated();
 
   /**
    * Called when the show/hide toolbar button on the Mac titlebar is pressed.
    */
-  virtual void OSToolbarButtonPressed() { }
+  virtual void OSToolbarButtonPressed();
 
   /**
    * Called when a request is made to close the window. Returns true if the
    * notification was handled. Returns true if the notification was handled.
    */
-  virtual bool RequestWindowClose(nsIWidget* aWidget) { return false; }
+  virtual bool RequestWindowClose(nsIWidget* aWidget);
 
   /*
    * Indicate that a paint is about to occur on this window. This is called
    * at a time when it's OK to change the geometry of this widget or of
    * other widgets. Must be called before every call to PaintWindow.
    */
-  virtual void WillPaintWindow(nsIWidget* aWidget) { }
+  virtual void WillPaintWindow(nsIWidget* aWidget);
 
   /**
    * Paint the specified region of the window. Returns true if the
    * notification was handled.
    * This is called at a time when it is not OK to change the geometry of
    * this widget or of other widgets.
    */
-  virtual bool PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion) { return false; }
+  virtual bool PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion);
 
   /**
    * Indicates that a paint occurred.
    * This is called at a time when it is OK to change the geometry of
    * this widget or of other widgets.
    * Must be called after every call to PaintWindow.
    */
-  virtual void DidPaintWindow() { }
+  virtual void DidPaintWindow();
 
   /**
    * Request that layout schedules a repaint on the next refresh driver tick.
    */
-  virtual void RequestRepaint() { }
+  virtual void RequestRepaint();
 
   /**
    * Handle an event.
    */
   virtual nsEventStatus HandleEvent(mozilla::WidgetGUIEvent* aEvent,
-                                    bool aUseAttachedEvents)
-  {
-    return nsEventStatus_eIgnore;
-  }
+                                    bool aUseAttachedEvents);
 };
 
 #endif
--- a/widget/xpwidgets/moz.build
+++ b/widget/xpwidgets/moz.build
@@ -24,16 +24,17 @@ CPP_SOURCES += [
     'nsBaseDragService.cpp',
     'nsBaseScreen.cpp',
     'nsBaseWidget.cpp',
     'nsClipboardHelper.cpp',
     'nsClipboardPrivacyHandler.cpp',
     'nsFilePickerProxy.cpp',
     'nsHTMLFormatConverter.cpp',
     'nsIdleService.cpp',
+    'nsIWidgetListener.cpp',
     'nsPrimitiveHelpers.cpp',
     'nsPrintOptionsImpl.cpp',
     'nsPrintSession.cpp',
     'nsPrintSettingsImpl.cpp',
     'nsTransferable.cpp',
     'nsXPLookAndFeel.cpp',
 ]
 
new file mode 100644
--- /dev/null
+++ b/widget/xpwidgets/nsIWidgetListener.cpp
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsIWidgetListener.h"
+
+#include "nsRegion.h"
+#include "nsView.h"
+#include "nsIPresShell.h"
+#include "nsIWidget.h"
+#include "nsIXULWindow.h"
+
+#include "mozilla/BasicEvents.h"
+
+using namespace mozilla;
+
+nsIXULWindow*
+nsIWidgetListener::GetXULWindow()
+{
+  return nullptr;
+}
+
+nsView*
+nsIWidgetListener::GetView()
+{
+  return nullptr;
+}
+
+nsIPresShell*
+nsIWidgetListener::GetPresShell()
+{
+  return nullptr;
+}
+
+bool
+nsIWidgetListener::WindowMoved(nsIWidget* aWidget,
+                               int32_t aX,
+                               int32_t aY)
+{
+  return false;
+}
+
+bool
+nsIWidgetListener::WindowResized(nsIWidget* aWidget,
+                                 int32_t aWidth,
+                                 int32_t aHeight)
+{
+  return false;
+}
+
+void
+nsIWidgetListener::SizeModeChanged(nsSizeMode aSizeMode)
+{
+}
+
+bool
+nsIWidgetListener::ZLevelChanged(bool aImmediate,
+                                 nsWindowZ* aPlacement,
+                                 nsIWidget* aRequestBelow,
+                                 nsIWidget** aActualBelow)
+{
+  return false;
+}
+
+void
+nsIWidgetListener::WindowActivated()
+{
+}
+
+void
+nsIWidgetListener::WindowDeactivated()
+{
+}
+
+void
+nsIWidgetListener::OSToolbarButtonPressed()
+{
+}
+
+bool
+nsIWidgetListener::RequestWindowClose(nsIWidget* aWidget)
+{
+  return false;
+}
+
+void
+nsIWidgetListener::WillPaintWindow(nsIWidget* aWidget)
+{
+}
+
+bool
+nsIWidgetListener::PaintWindow(nsIWidget* aWidget,
+                               nsIntRegion aRegion)
+{
+  return false;
+}
+
+void
+nsIWidgetListener::DidPaintWindow()
+{
+}
+
+void
+nsIWidgetListener::RequestRepaint()
+{
+}
+
+nsEventStatus
+nsIWidgetListener::HandleEvent(WidgetGUIEvent* aEvent,
+                               bool aUseAttachedEvents)
+{
+  return nsEventStatus_eIgnore;
+}
--- a/xpfe/appshell/src/nsAppShellService.cpp
+++ b/xpfe/appshell/src/nsAppShellService.cpp
@@ -18,17 +18,19 @@
 #include "nsPIWindowWatcher.h"
 #include "nsIDOMWindow.h"
 #include "nsPIDOMWindow.h"
 #include "nsWebShellWindow.h"
 
 #include "nsCRT.h"
 #include "prprf.h"
 
+#include "nsWidgetInitData.h"
 #include "nsWidgetsCID.h"
+#include "nsIWidget.h"
 #include "nsIRequestObserver.h"
 
 /* For implementing GetHiddenWindowAndJSContext */
 #include "nsIScriptGlobalObject.h"
 #include "nsIScriptContext.h"
 #include "jsapi.h"
 
 #include "nsAppShellService.h"
--- a/xpfe/appshell/src/nsChromeTreeOwner.cpp
+++ b/xpfe/appshell/src/nsChromeTreeOwner.cpp
@@ -14,16 +14,17 @@
 #include "nsIServiceManager.h"
 #include "nsIDocShellTreeItem.h"
 
 // Interfaces needed to include
 #include "nsIPrompt.h"
 #include "nsIAuthPrompt.h"
 #include "nsIBrowserDOMWindow.h"
 #include "nsIWebProgress.h"
+#include "nsIWidget.h"
 #include "nsIWindowMediator.h"
 #include "nsIDOMChromeWindow.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMXULElement.h"
 #include "nsIXULBrowserWindow.h"
 #include "mozilla/dom/Element.h"
--- a/xpfe/appshell/src/nsContentTreeOwner.cpp
+++ b/xpfe/appshell/src/nsContentTreeOwner.cpp
@@ -29,16 +29,17 @@
 #include "nsIXULBrowserWindow.h"
 #include "nsIPrincipal.h"
 #include "nsIURIFixup.h"
 #include "nsCDefaultURIFixup.h"
 #include "nsIWebNavigation.h"
 #include "nsDocShellCID.h"
 #include "nsIExternalURLHandlerService.h"
 #include "nsIMIMEInfo.h"
+#include "nsIWidget.h"
 #include "mozilla/BrowserElementParent.h"
 
 #include "nsIDOMDocument.h"
 #include "nsIScriptObjectPrincipal.h"
 #include "nsIURI.h"
 #include "nsIDocument.h"
 #if defined(XP_MACOSX)
 #include "nsThreadUtils.h"
--- a/xpfe/appshell/src/nsWebShellWindow.cpp
+++ b/xpfe/appshell/src/nsWebShellWindow.cpp
@@ -21,16 +21,17 @@
 
 #include "nsEscape.h"
 #include "nsPIDOMWindow.h"
 #include "nsIWebNavigation.h"
 #include "nsIWindowWatcher.h"
 
 #include "nsIDOMXULElement.h"
 
+#include "nsWidgetInitData.h"
 #include "nsWidgetsCID.h"
 #include "nsIWidget.h"
 #include "nsIWidgetListener.h"
 
 #include "nsIDOMCharacterData.h"
 #include "nsIDOMNodeList.h"
 
 #include "nsITimer.h"
--- a/xpfe/appshell/src/nsWebShellWindow.h
+++ b/xpfe/appshell/src/nsWebShellWindow.h
@@ -11,16 +11,18 @@
 #include "nsITimer.h"
 #include "nsCOMPtr.h"
 #include "nsXULWindow.h"
 #include "nsIWidgetListener.h"
 
 /* Forward declarations.... */
 class nsIURI;
 
+struct nsWidgetInitData;
+
 namespace mozilla {
 class WebShellWindowTimerCallback;
 } // namespace mozilla
 
 class nsWebShellWindow : public nsXULWindow,
                          public nsIWebProgressListener,
                          public nsIWidgetListener
 {
--- a/xpfe/appshell/src/nsXULWindow.h
+++ b/xpfe/appshell/src/nsXULWindow.h
@@ -12,16 +12,17 @@
 #include "nsContentTreeOwner.h"
 
 // Helper classes
 #include "nsCOMPtr.h"
 #include "nsTArray.h"
 #include "nsString.h"
 #include "nsWeakReference.h"
 #include "nsCOMArray.h"
+#include "nsRect.h"
 
 // Interfaces needed
 #include "nsIBaseWindow.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIDOMWindow.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"