Bug 1115802 - Scrolling no longer working when tab mirroring from fennec. r=snorp, a=sledru
authorBrad Lassey <blassey@mozilla.com>
Wed, 31 Dec 2014 14:31:05 -0500
changeset 242838 f6d5f2303fea
parent 242837 a33308dd5af8
child 242839 ad2cfe2a92a5
push id4319
push userryanvm@gmail.com
push date2015-01-14 14:36 +0000
treeherdermozilla-beta@f6d5f2303fea [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp, sledru
bugs1115802
milestone36.0
Bug 1115802 - Scrolling no longer working when tab mirroring from fennec. r=snorp, a=sledru
dom/media/webrtc/MediaEngineTabVideoSource.cpp
--- a/dom/media/webrtc/MediaEngineTabVideoSource.cpp
+++ b/dom/media/webrtc/MediaEngineTabVideoSource.cpp
@@ -3,17 +3,16 @@
  * 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 "MediaEngineTabVideoSource.h"
 
 #include "mozilla/gfx/2D.h"
 #include "mozilla/RefPtr.h"
 #include "nsGlobalWindow.h"
-#include "nsDOMWindowUtils.h"
 #include "nsIDOMClientRect.h"
 #include "nsIDocShell.h"
 #include "nsIPresShell.h"
 #include "nsPresContext.h"
 #include "gfxContext.h"
 #include "gfx2DGlue.h"
 #include "ImageContainer.h"
 #include "Layers.h"
@@ -218,32 +217,19 @@ MediaEngineTabVideoSource::Draw() {
   nsresult rv;
 
   nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(mWindow);
 
   if (!win) {
     return;
   }
 
-  // take a screenshot, as wide as possible, proportional to the destination size
-  nsCOMPtr<nsIDOMWindowUtils> utils = do_GetInterface(win);
-  if (!utils) {
-    return;
-  }
-
-  nsCOMPtr<nsIDOMClientRect> rect;
-  rv = utils->GetRootBounds(getter_AddRefs(rect));
-  NS_ENSURE_SUCCESS_VOID(rv);
-  if (!rect) {
-    return;
-  }
-
-  float width, height;
-  rect->GetWidth(&width);
-  rect->GetHeight(&height);
+  int32_t width, height;
+  win->GetInnerWidth(&width);
+  win->GetInnerHeight(&height);
 
   if (width == 0 || height == 0) {
     return;
   }
 
   int32_t srcW;
   int32_t srcH;
 
@@ -262,17 +248,17 @@ MediaEngineTabVideoSource::Draw() {
     docshell->GetPresContext(getter_AddRefs(presContext));
   }
   if (!presContext) {
     return;
   }
 
   nscolor bgColor = NS_RGB(255, 255, 255);
   nsCOMPtr<nsIPresShell> presShell = presContext->PresShell();
-  uint32_t renderDocFlags = nsIPresShell::RENDER_DOCUMENT_RELATIVE;
+  uint32_t renderDocFlags = 0;
   if (!mScrollWithPage) {
     renderDocFlags |= nsIPresShell::RENDER_IGNORE_VIEWPORT_SCROLLING;
   }
   nsRect r(0, 0, nsPresContext::CSSPixelsToAppUnits((float)srcW),
            nsPresContext::CSSPixelsToAppUnits((float)srcH));
 
   gfxImageFormat format = gfxImageFormat::RGB24;
   uint32_t stride = gfxASurface::FormatStrideForWidth(format, size.width);