Bug 1253434 - Avoid trying to capture plugin windows that have a zero width or height and a positive value for the other dim. r=aklotz
authorJim Mathies <jmathies@mozilla.com>
Thu, 03 Mar 2016 17:23:32 -0600
changeset 324973 788f3c251d57e8964b1cdcb68163d2c4cb3a81fc
parent 324972 7dec4b377e6b789e357ed2326852a901c3281a95
child 324974 7f4e37c4268e03e0b5f2aa7eda3d91e9f925ce1b
push id1128
push userjlund@mozilla.com
push dateWed, 01 Jun 2016 01:31:59 +0000
treeherdermozilla-release@fe0d30de989d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaklotz
bugs1253434
milestone47.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 1253434 - Avoid trying to capture plugin windows that have a zero width or height and a positive value for the other dim. r=aklotz MozReview-Commit-ID: 8YZZsnqlkdX
dom/plugins/ipc/PluginInstanceParent.cpp
--- a/dom/plugins/ipc/PluginInstanceParent.cpp
+++ b/dom/plugins/ipc/PluginInstanceParent.cpp
@@ -1266,17 +1266,17 @@ PluginInstanceParent::UpdateScrollCaptur
         CAPTURE_LOG("no windowdc");
         aRequestNewCapture = true;
         return false;
     }
 
     RECT bounds = {0};
     ::GetWindowRect(mChildPluginHWND, &bounds);
     if ((bounds.left == bounds.right && bounds.top == bounds.bottom) ||
-        (!mWindowSize.width && !mWindowSize.height)) {
+        mWindowSize.IsEmpty()) {
         CAPTURE_LOG("empty bounds");
         // Lots of null window plugins in content, don't capture.
         return false;
     }
 
     // If we need to init mScrollCapture do so, also reset it if the size of the
     // plugin window changes.
     if (!mScrollCapture || mScrollCapture->GetSize() != mWindowSize) {
@@ -1292,17 +1292,17 @@ PluginInstanceParent::UpdateScrollCaptur
     int rgnType = ::GetWindowRgnBox(mPluginHWND, &clip);
     bool clipCorrect = !clip.left && !clip.top &&
                        clip.right == mWindowSize.width &&
                        clip.bottom == mWindowSize.height;
 
     bool isVisible = ::IsWindowVisible(mChildPluginHWND);
 
     CAPTURE_LOG("validcap=%d visible=%d region=%d clip=%d:%dx%dx%dx%d",
-                mValidFirstCapture, isVisible, rgnType, clipCorrect
+                mValidFirstCapture, isVisible, rgnType, clipCorrect,
                 clip.left, clip.top, clip.right, clip.bottom);
 
     // We have a good capture and can't update so keep using the existing
     // capture image. Otherwise fall through so we paint the fill color to
     // the layer.
     if (mValidFirstCapture && (!isVisible || !clipCorrect)) {
         return true;
     }
@@ -1321,16 +1321,21 @@ PluginInstanceParent::UpdateScrollCaptur
             CAPTURE_LOG("blt failure??");
             return false;
         }
         ::GdiFlush();
         mValidFirstCapture = true;
     }
 
     IntSize targetSize = mScrollCapture->GetSize();
+
+    if (targetSize.IsEmpty()) {
+        return false;
+    }
+
     RefPtr<gfx::DrawTarget> dt =
         gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(mScrollCapture,
                                                                targetSize);
 
     if (nativeScrollCapture) {
         // Copy the native capture image over to a remotable gfx surface.
         RefPtr<gfx::SourceSurface> sourceSurface =
             gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(nullptr,