bug 1115802 - Scrolling no longer working when tab mirroring from fennec r=snorp
authorBrad Lassey <blassey@mozilla.com>
Wed, 31 Dec 2014 14:31:05 -0500
changeset 247678 7f82e95ceb0571889d9db76513c4a19aab63e2ba
parent 247677 d5a6e28f71322f7f40a90021787f16f3a70ff4d2
child 247679 c21ef02bbde9f0d5049da90d0046a87c91d15f26
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1115802
milestone37.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 1115802 - Scrolling no longer working when tab mirroring from fennec r=snorp
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);