Bug 814149. Fix GetCanvas. r=bz
authorNicholas Cameron <ncameron@mozilla.com>
Thu, 22 Nov 2012 10:55:36 +1300
changeset 113938 abfc7d944d591b6d4effdee5efa7b8b4ab566676
parent 113937 2fe6082b7361d6ad15e5195610e841cc8a98e3fa
child 113939 c4e31e87a072661019b41630c30e3642828435d0
push id18463
push userncameron@mozilla.com
push dateWed, 21 Nov 2012 21:56:57 +0000
treeherdermozilla-inbound@c4e31e87a072 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs814149
milestone20.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 814149. Fix GetCanvas. r=bz
content/canvas/src/CanvasRenderingContext2D.h
content/html/content/public/nsHTMLCanvasElement.h
content/html/content/src/nsHTMLCanvasElement.cpp
--- a/content/canvas/src/CanvasRenderingContext2D.h
+++ b/content/canvas/src/CanvasRenderingContext2D.h
@@ -138,17 +138,18 @@ public:
   CanvasRenderingContext2D();
   virtual ~CanvasRenderingContext2D();
 
   virtual JSObject* WrapObject(JSContext *cx, JSObject *scope,
                                bool *triedToWrap);
 
   nsHTMLCanvasElement* GetCanvas() const
   {
-    return mCanvasElement;
+    // corresponds to changes to the old bindings made in bug 745025
+    return mCanvasElement->GetOriginalCanvas();
   }
 
   void Save();
   void Restore();
   void Scale(double x, double y, mozilla::ErrorResult& error);
   void Rotate(double angle, mozilla::ErrorResult& error);
   void Translate(double x, double y, mozilla::ErrorResult& error);
   void Transform(double m11, double m12, double m21, double m22, double dx,
--- a/content/html/content/public/nsHTMLCanvasElement.h
+++ b/content/html/content/public/nsHTMLCanvasElement.h
@@ -168,17 +168,17 @@ protected:
   nsresult MozGetAsFileImpl(const nsAString& aName,
                             const nsAString& aType,
                             nsIDOMFile** aResult);
   nsresult GetContextHelper(const nsAString& aContextId,
                             nsICanvasRenderingContextInternal **aContext);
   void CallPrintCallback();
 
   nsString mCurrentContextId;
-  nsCOMPtr<nsIDOMHTMLCanvasElement> mOriginalCanvas;
+  nsRefPtr<nsHTMLCanvasElement> mOriginalCanvas;
   nsCOMPtr<nsIPrintCallback> mPrintCallback;
   nsCOMPtr<nsICanvasRenderingContextInternal> mCurrentContext;
   nsCOMPtr<nsHTMLCanvasPrintState> mPrintState;
   
 public:
   // Record whether this canvas should be write-only or not.
   // We set this when script paints an image from a different origin.
   // We also transitively set it when script paints a canvas which
@@ -188,17 +188,17 @@ public:
   bool IsPrintCallbackDone();
 
   void HandlePrintCallback(nsPresContext::nsPresContextType aType);
 
   nsresult DispatchPrintCallback(nsITimerCallback* aCallback);
 
   void ResetPrintCallback();
 
-  nsIDOMHTMLCanvasElement* GetOriginalCanvas();
+  nsHTMLCanvasElement* GetOriginalCanvas();
 };
 
 inline nsISupports*
 GetISupports(nsHTMLCanvasElement* p)
 {
   return static_cast<mozilla::dom::Element*>(p);
 }
 
--- a/content/html/content/src/nsHTMLCanvasElement.cpp
+++ b/content/html/content/src/nsHTMLCanvasElement.cpp
@@ -302,17 +302,17 @@ nsHTMLCanvasElement::IsPrintCallbackDone
 {
   if (mPrintState == nullptr) {
     return true;
   }
 
   return mPrintState->mIsDone;
 }
 
-nsIDOMHTMLCanvasElement*
+nsHTMLCanvasElement*
 nsHTMLCanvasElement::GetOriginalCanvas()
 {
   return mOriginalCanvas ? mOriginalCanvas.get() : this;
 }
 
 nsresult
 nsHTMLCanvasElement::CopyInnerTo(Element* aDest)
 {