Bug 997014 - Part 6: Remove duplicate code for retreiving a snapshot from a canvas in CanvasRenderingContext2D. r=roc
☠☠ backed out by cf6ccdc2e849 ☠ ☠
authorMatt Woodrow <mwoodrow@mozilla.com>
Thu, 17 Apr 2014 17:32:41 +1200
changeset 178952 6ba917df6b413f2b56d2f2bb42b0107e3315641d
parent 178951 8681fc7a918b146128ce41581464acb70d0d9a6b
child 178953 cf6ccdc2e849e6718b95d355f5f33034c4b39b9f
push id42403
push usermwoodrow@mozilla.com
push dateThu, 17 Apr 2014 05:33:32 +0000
treeherdermozilla-inbound@6ba917df6b41 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs997014
milestone31.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 997014 - Part 6: Remove duplicate code for retreiving a snapshot from a canvas in CanvasRenderingContext2D. r=roc
content/canvas/src/CanvasRenderingContext2D.cpp
--- a/content/canvas/src/CanvasRenderingContext2D.cpp
+++ b/content/canvas/src/CanvasRenderingContext2D.cpp
@@ -3211,43 +3211,16 @@ CanvasRenderingContext2D::DrawImage(cons
   gfxIntSize imgSize;
 
   Element* element;
 
   EnsureTarget();
   if (image.IsHTMLCanvasElement()) {
     HTMLCanvasElement* canvas = &image.GetAsHTMLCanvasElement();
     element = canvas;
-    nsIntSize size = canvas->GetSize();
-    if (size.width == 0 || size.height == 0) {
-      error.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
-      return;
-    }
-
-    // Special case for Canvas, which could be an Azure canvas!
-    nsICanvasRenderingContextInternal *srcCanvas = canvas->GetContextAtIndex(0);
-    if (srcCanvas == this) {
-      // Self-copy.
-      srcSurf = mTarget->Snapshot();
-      imgSize = gfxIntSize(mWidth, mHeight);
-    } else if (srcCanvas) {
-      // This might not be an Azure canvas!
-      srcSurf = srcCanvas->GetSurfaceSnapshot();
-
-      if (srcSurf) {
-        if (mCanvasElement) {
-          // Do security check here.
-          CanvasUtils::DoDrawImageSecurityCheck(mCanvasElement,
-                                                element->NodePrincipal(),
-                                                canvas->IsWriteOnly(),
-                                                false);
-        }
-        imgSize = gfxIntSize(srcSurf->GetSize().width, srcSurf->GetSize().height);
-      }
-    }
   } else {
     if (image.IsHTMLImageElement()) {
       HTMLImageElement* img = &image.GetAsHTMLImageElement();
       element = img;
     } else {
       HTMLVideoElement* video = &image.GetAsHTMLVideoElement();
       element = video;
     }