Bug 1095754 - Add nsPluginFrame support for e10s specific plugin configuration data. r=roc
authorJim Mathies <jmathies@mozilla.com>
Thu, 29 Jan 2015 13:41:55 -0600
changeset 226587 f1bac083d4ba88de34a314aff54c77ac95794e50
parent 226586 49ad0d06ab60e83d292d62fcc433c4e46bf82359
child 226588 674f5f49d0d8ed7395a76e2c339cf80e87aeb708
push id28200
push userkwierso@gmail.com
push dateThu, 29 Jan 2015 23:01:46 +0000
treeherdermozilla-central@4380ed39de3a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1095754
milestone38.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 1095754 - Add nsPluginFrame support for e10s specific plugin configuration data. r=roc
layout/generic/nsPluginFrame.cpp
layout/generic/nsPluginFrame.h
widget/nsIWidget.h
--- a/layout/generic/nsPluginFrame.cpp
+++ b/layout/generic/nsPluginFrame.cpp
@@ -82,16 +82,18 @@ using mozilla::DefaultXDisplay;
 #include <winuser.h>
 #endif
 
 #ifdef MOZ_WIDGET_ANDROID
 #include "AndroidBridge.h"
 #include "GLContext.h"
 #endif
 
+#include "mozilla/dom/TabChild.h"
+
 #ifdef CreateEvent // Thank you MS.
 #undef CreateEvent
 #endif
 
 #ifdef PR_LOGGING 
 static PRLogModuleInfo *
 GetObjectFrameLog()
 {
@@ -390,16 +392,44 @@ nsPluginFrame::GetMinISize(nsRenderingCo
 
 /* virtual */ nscoord
 nsPluginFrame::GetPrefISize(nsRenderingContext *aRenderingContext)
 {
   return nsPluginFrame::GetMinISize(aRenderingContext);
 }
 
 void
+nsPluginFrame::GetWidgetConfiguration(nsTArray<nsIWidget::Configuration>* aConfigurations)
+{
+  if (!mWidget) {
+    return;
+  }
+
+  if (!mWidget->GetParent()) {
+    // Plugin widgets should not be toplevel except when they're out of the
+    // document, in which case the plugin should not be registered for
+    // geometry updates and this should not be called. But apparently we
+    // have bugs where mWidget sometimes is toplevel here. Bail out.
+    NS_ERROR("Plugin widgets registered for geometry updates should not be toplevel");
+    return;
+  }
+
+  nsIWidget::Configuration* configuration = aConfigurations->AppendElement();
+  configuration->mChild = mWidget;
+  configuration->mBounds = mNextConfigurationBounds;
+  configuration->mClipRegion = mNextConfigurationClipRegion;
+#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
+  if (XRE_GetProcessType() == GeckoProcessType_Content) {
+    configuration->mWindowID = (uintptr_t)mWidget->GetNativeData(NS_NATIVE_PLUGIN_PORT);
+    configuration->mVisible = mWidget->IsVisible();
+  }
+#endif // defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
+}
+
+void
 nsPluginFrame::GetDesiredSize(nsPresContext* aPresContext,
                               const nsHTMLReflowState& aReflowState,
                               nsHTMLReflowMetrics& aMetrics)
 {
   // By default, we have no area
   aMetrics.ClearSize();
 
   if (IsHidden(false)) {
--- a/layout/generic/nsPluginFrame.h
+++ b/layout/generic/nsPluginFrame.h
@@ -116,33 +116,17 @@ public:
   void SetEmptyWidgetConfiguration()
   {
     mNextConfigurationBounds = nsIntRect(0,0,0,0);
     mNextConfigurationClipRegion.Clear();
   }
   /**
    * Append the desired widget configuration to aConfigurations.
    */
-  void GetWidgetConfiguration(nsTArray<nsIWidget::Configuration>* aConfigurations)
-  {
-    if (mWidget) {
-      if (!mWidget->GetParent()) {
-        // Plugin widgets should not be toplevel except when they're out of the
-        // document, in which case the plugin should not be registered for
-        // geometry updates and this should not be called. But apparently we
-        // have bugs where mWidget sometimes is toplevel here. Bail out.
-        NS_ERROR("Plugin widgets registered for geometry updates should not be toplevel");
-        return;
-      }
-      nsIWidget::Configuration* configuration = aConfigurations->AppendElement();
-      configuration->mChild = mWidget;
-      configuration->mBounds = mNextConfigurationBounds;
-      configuration->mClipRegion = mNextConfigurationClipRegion;
-    }
-  }
+  void GetWidgetConfiguration(nsTArray<nsIWidget::Configuration>* aConfigurations);
 
   nsIntRect GetWidgetlessClipRect() {
     return RegionFromArray(mNextConfigurationClipRegion).GetBounds();
   }
 
   /**
    * Called after all widget position/size/clip regions have been changed
    * (even if there isn't a widget for this plugin).
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -1358,16 +1358,18 @@ class nsIWidget : public nsISupports {
     virtual nsTransparencyMode GetTransparencyMode() = 0;
 
     /**
      * This represents a command to set the bounds and clip region of
      * a child widget.
      */
     struct Configuration {
         nsIWidget* mChild;
+        uintptr_t mWindowID; // e10s specific, the unique plugin port id
+        bool mVisible; // e10s specific, widget visibility
         nsIntRect mBounds;
         nsTArray<nsIntRect> mClipRegion;
     };
 
     /**
      * Sets the clip region of each mChild (which must actually be a child
      * of this widget) to the union of the pixel rects given in
      * mClipRegion, all relative to the top-left of the child