Bug 734668; reviewer's changes. r=Ms2ger,roc
authorNicholas Cameron <ncameron@mozilla.com>
Fri, 12 Oct 2012 22:42:53 +1300
changeset 110189 6dae073c5dffe57ff07fe344ccef317d984818b3
parent 110188 f5c8dabab38f6462b647e0f7cb7f2ecedb676c7d
child 110190 d2b6588287710cd2f664bf07f71775250bbcfd7c
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersMs2ger, roc
bugs734668
milestone19.0a1
Bug 734668; reviewer's changes. r=Ms2ger,roc
content/canvas/src/CanvasRenderingContext2D.cpp
content/canvas/src/CanvasRenderingContext2D.h
content/canvas/src/Makefile.in
dom/bindings/Bindings.conf
js/xpconnect/src/dom_quickstubs.qsconf
layout/build/nsLayoutModule.cpp
--- a/content/canvas/src/CanvasRenderingContext2D.cpp
+++ b/content/canvas/src/CanvasRenderingContext2D.cpp
@@ -117,20 +117,18 @@ namespace mgfx = mozilla::gfx;
   {0x9793f9e7, 0x9dc1, 0x4e9c, {0x81, 0xc8, 0xfc, 0xa7, 0x14, 0xf4, 0x30, 0x79}}
 
 nsresult
 NS_NewCanvasRenderingContext2D(nsIDOMCanvasRenderingContext2D** aResult)
 {
   Telemetry::Accumulate(Telemetry::CANVAS_2D_USED, 1);
   nsRefPtr<nsIDOMCanvasRenderingContext2D> ctx =
     new mozilla::dom::CanvasRenderingContext2D();
-  if (!ctx)
-    return NS_ERROR_OUT_OF_MEMORY;
-
-  *aResult = ctx.forget().get();
+
+  ctx.forget(aResult);
   return NS_OK;
 }
 
 namespace mozilla {
 namespace dom {
 
 static float kDefaultFontSize = 10.0;
 static NS_NAMED_LITERAL_STRING(kDefaultFontName, "sans-serif");
@@ -907,23 +905,27 @@ CanvasRenderingContext2D::ClearTarget()
   state->globalAlpha = 1.0;
 
   state->colorStyles[STYLE_FILL] = NS_RGB(0,0,0);
   state->colorStyles[STYLE_STROKE] = NS_RGB(0,0,0);
   state->shadowColor = NS_RGBA(0,0,0,0);
 }
 
 NS_IMETHODIMP
-CanvasRenderingContext2D::InitializeWithSurface(nsIDocShell *shell, gfxASurface *surface, int32_t width, int32_t height)
+CanvasRenderingContext2D::InitializeWithSurface(nsIDocShell *shell,
+                                                gfxASurface *surface,
+                                                int32_t width,
+                                                int32_t height)
 {
   mDocShell = shell;
   mThebesSurface = surface;
 
   SetDimensions(width, height);
-  mTarget = gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(surface, IntSize(width, height));
+  mTarget = gfxPlatform::GetPlatform()->
+    CreateDrawTargetForSurface(surface, IntSize(width, height));
   if (!mTarget) {
     EnsureErrorTarget();
     mTarget = sErrorTarget;
   }
 
   return NS_OK;
 }
 
@@ -1970,17 +1972,17 @@ CanvasRenderingContext2D::FillRect(doubl
 {
   if (!FloatValidate(x,y,w,h)) {
     return;
   }
 
   const ContextState &state = CurrentState();
 
   if (state.patternStyles[STYLE_FILL]) {
-    CanvasPattern::RepeatMode repeat = 
+    CanvasPattern::RepeatMode repeat =
       state.patternStyles[STYLE_FILL]->mRepeat;
     // In the FillRect case repeat modes are easy to deal with.
     bool limitx = repeat == CanvasPattern::NOREPEAT || repeat == CanvasPattern::REPEATY;
     bool limity = repeat == CanvasPattern::NOREPEAT || repeat == CanvasPattern::REPEATX;
 
     IntSize patternSize =
       state.patternStyles[STYLE_FILL]->mSurface->GetSize();
 
--- a/content/canvas/src/Makefile.in
+++ b/content/canvas/src/Makefile.in
@@ -20,23 +20,24 @@ EXPORTS = \
 	WebGLContext.h \
 	WebGLElementArrayCache.h \
 	WebGLExtensions.h \
 	$(NULL)
 
 EXPORTS_NAMESPACES = mozilla/dom
 
 EXPORTS_mozilla/dom = \
+	CanvasRenderingContext2D.h \
   ImageData.h \
   $(NULL)
 
 CPPSRCS	= \
 	CanvasImageCache.cpp \
+	CanvasRenderingContext2D.cpp \
 	CanvasUtils.cpp \
-	CanvasRenderingContext2D.cpp \
 	DocumentRendererParent.cpp \
 	DocumentRendererChild.cpp \
 	ImageData.cpp \
 	$(NULL)
 
 ifdef MOZ_WEBGL
 
 CPPSRCS += \
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -104,18 +104,16 @@ DOMInterfaces = {
     'headerFile': 'nsIDOMFile.h',
 },
 {
     'workers': True,
 }],
 
 'CanvasRenderingContext2D': [
 {
-    'nativeType': 'mozilla::dom::CanvasRenderingContext2D',
-    'headerFile': 'CanvasRenderingContext2D.h',
     'implicitJSContext': [
         'createImageData', 'getImageData', 'putImageData', 'strokeStyle',
         'fillStyle', 'mozDash'
     ],
     'resultNotAddRefed': [ 'canvas' ],
     'binaryNames': {
         'mozImageSmoothingEnabled': 'imageSmoothingEnabled',
         'mozFillRule': 'fillRule'
--- a/js/xpconnect/src/dom_quickstubs.qsconf
+++ b/js/xpconnect/src/dom_quickstubs.qsconf
@@ -957,24 +957,22 @@ customMethodCalls = {
     'nsIDOMWindow_GetOnmouseleave' : {
         'thisType' : 'nsIDOMWindow',
         'unwrapThisFailureFatal' : False
         },
     'nsIDOMWindow_SetOnmouseleave' : {
         'thisType' : 'nsIDOMWindow',
         'unwrapThisFailureFatal' : False
         },
-    
     'nsIDOMImageData_GetWidth': {
         'thisType': 'nsIDOMImageData',
         'code': 'uint32_t result = static_cast<mozilla::dom::ImageData*>(self)->GetWidth();',
         'canFail': False
         },
     'nsIDOMImageData_GetHeight': {
         'thisType': 'nsIDOMImageData',
         'code': 'uint32_t result = static_cast<mozilla::dom::ImageData*>(self)->GetHeight();',
         'canFail': False
         },
     'nsIDOMImageData_GetData': {
         'canFail': False
         }
     }
-
--- a/layout/build/nsLayoutModule.cpp
+++ b/layout/build/nsLayoutModule.cpp
@@ -711,17 +711,16 @@ NS_DEFINE_NAMED_CID(NS_CONTENTITERATOR_C
 NS_DEFINE_NAMED_CID(NS_PRECONTENTITERATOR_CID);
 NS_DEFINE_NAMED_CID(NS_SUBTREEITERATOR_CID);
 NS_DEFINE_NAMED_CID(NS_HTMLIMAGEELEMENT_CID);
 NS_DEFINE_NAMED_CID(NS_HTMLOPTIONELEMENT_CID);
 #ifdef MOZ_MEDIA
 NS_DEFINE_NAMED_CID(NS_HTMLAUDIOELEMENT_CID);
 #endif
 NS_DEFINE_NAMED_CID(NS_CANVASRENDERINGCONTEXT2D_CID);
-NS_DEFINE_NAMED_CID(NS_CANVASRENDERINGCONTEXT2DTHEBES_CID);
 NS_DEFINE_NAMED_CID(NS_CANVASRENDERINGCONTEXTWEBGL_CID);
 NS_DEFINE_NAMED_CID(NS_TEXT_ENCODER_CID);
 NS_DEFINE_NAMED_CID(NS_HTMLCOPY_TEXT_ENCODER_CID);
 NS_DEFINE_NAMED_CID(NS_XMLCONTENTSERIALIZER_CID);
 NS_DEFINE_NAMED_CID(NS_XHTMLCONTENTSERIALIZER_CID);
 NS_DEFINE_NAMED_CID(NS_HTMLCONTENTSERIALIZER_CID);
 NS_DEFINE_NAMED_CID(NS_PLAINTEXTSERIALIZER_CID);
 NS_DEFINE_NAMED_CID(NS_PARSERUTILS_CID);