diff --git a/gfx/thebes/gfxContext.cpp b/gfx/thebes/gfxContext.cpp index 0ee0b3ebc1e..071c452672d 100644 --- a/gfx/thebes/gfxContext.cpp +++ b/gfx/thebes/gfxContext.cpp @@ -31,6 +31,8 @@ using namespace mozilla; using namespace mozilla::gfx; +UserDataKey gfxContext::sDontUseAsSourceKey; + /* This class lives on the stack and allows gfxContext users to easily, and * performantly get a gfx::Pattern to use for drawing in their current context. */ @@ -1614,8 +1616,9 @@ gfxContext::PushGroupAndCopyBackground(gfxContentType content) gfxRect clipRect = GetRoundOutDeviceClipExtents(this); clipExtents = IntRect(clipRect.x, clipRect.y, clipRect.width, clipRect.height); } - if (mDT->GetFormat() == FORMAT_B8G8R8X8 || - mDT->GetOpaqueRect().Contains(clipExtents)) { + if ((mDT->GetFormat() == FORMAT_B8G8R8X8 || + mDT->GetOpaqueRect().Contains(clipExtents)) && + !mDT->GetUserData(&sDontUseAsSourceKey)) { DrawTarget *oldDT = mDT; RefPtr source = mDT->Snapshot(); Point oldDeviceOffset = CurrentState().deviceOffset; diff --git a/gfx/thebes/gfxContext.h b/gfx/thebes/gfxContext.h index 9c097433222..a589095f27e 100644 --- a/gfx/thebes/gfxContext.h +++ b/gfx/thebes/gfxContext.h @@ -708,6 +708,8 @@ public: void CopyAsDataURL(); #endif + static mozilla::gfx::UserDataKey sDontUseAsSourceKey; + private: friend class GeneralPattern; friend struct GlyphBufferAzure; diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index 2aa9faed9ed..fe54054bc9f 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -3377,12 +3377,14 @@ NSEvent* gLastDragMouseDownEvent = nil; gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(targetSurface, gfx::IntSize(backingSize.width, backingSize.height)); + dt->AddUserData(&gfxContext::sDontUseAsSourceKey, dt, nullptr); targetContext = new gfxContext(dt); } else if (gfxPlatform::GetPlatform()->SupportsAzureContentForType(gfx::BACKEND_COREGRAPHICS)) { RefPtr dt = gfx::Factory::CreateDrawTargetForCairoCGContext(aContext, gfx::IntSize(backingSize.width, backingSize.height)); + dt->AddUserData(&gfxContext::sDontUseAsSourceKey, dt, nullptr); targetContext = new gfxContext(dt); } else { targetContext = new gfxContext(targetSurface);