Bug 1019888 - Log canvas background color when dumping display items. r=tn
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 03 Jun 2014 16:21:39 -0400
changeset 205668 a0b699f4fddd4053ba38d01413f608c8ca9a16a3
parent 205667 828b5db62ed085700089bd7199b8fcb33c0da534
child 205669 d06bf90cb6ed1802f712fec16a6a085647c7c3dd
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstn
bugs1019888
milestone32.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 1019888 - Log canvas background color when dumping display items. r=tn
layout/generic/nsCanvasFrame.cpp
layout/generic/nsCanvasFrame.h
--- a/layout/generic/nsCanvasFrame.cpp
+++ b/layout/generic/nsCanvasFrame.cpp
@@ -13,16 +13,17 @@
 #include "nsRenderingContext.h"
 #include "nsGkAtoms.h"
 #include "nsPresShell.h"
 #include "nsIPresShell.h"
 #include "nsDisplayList.h"
 #include "nsCSSFrameConstructor.h"
 #include "nsFrameManager.h"
 #include "gfxPlatform.h"
+#include "nsPrintfCString.h"
 // for touchcaret
 #include "nsContentList.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsContentUtils.h"
 #include "nsStyleSet.h"
 // for focus
 #include "nsIScrollableFrame.h"
 #ifdef DEBUG_CANVAS_FOCUS
@@ -203,16 +204,26 @@ nsDisplayCanvasBackgroundColor::Paint(ns
   nsPoint offset = ToReferenceFrame();
   nsRect bgClipRect = frame->CanvasArea() + offset;
   if (NS_GET_A(mColor) > 0) {
     aCtx->SetColor(mColor);
     aCtx->FillRect(bgClipRect);
   }
 }
 
+#ifdef MOZ_DUMP_PAINTING
+void
+nsDisplayCanvasBackgroundColor::WriteDebugInfo(nsACString& aTo)
+{
+  aTo += nsPrintfCString(" (rgba %d,%d,%d,%d)",
+          NS_GET_R(mColor), NS_GET_G(mColor),
+          NS_GET_B(mColor), NS_GET_A(mColor));
+}
+#endif
+
 static void BlitSurface(gfxContext* aDest, const gfxRect& aRect, gfxASurface* aSource)
 {
   aDest->Translate(gfxPoint(aRect.x, aRect.y));
   aDest->SetSource(aSource);
   aDest->NewPath();
   aDest->Rectangle(gfxRect(0, 0, aRect.width, aRect.height));
   aDest->Fill();
   aDest->Translate(-gfxPoint(aRect.x, aRect.y));
--- a/layout/generic/nsCanvasFrame.h
+++ b/layout/generic/nsCanvasFrame.h
@@ -190,16 +190,19 @@ public:
                      nsRenderingContext* aCtx) MOZ_OVERRIDE;
 
   void SetExtraBackgroundColor(nscolor aColor)
   {
     mColor = aColor;
   }
 
   NS_DISPLAY_DECL_NAME("CanvasBackgroundColor", TYPE_CANVAS_BACKGROUND_COLOR)
+#ifdef MOZ_DUMP_PAINTING
+  virtual void WriteDebugInfo(nsACString& aTo) MOZ_OVERRIDE;
+#endif
 
 private:
   nscolor mColor;
 };
 
 class nsDisplayCanvasBackgroundImage : public nsDisplayBackgroundImage {
 public:
   nsDisplayCanvasBackgroundImage(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,