Bug 709492 - Part 1: Add a paintingSuppressed getter to nsIDOMWindowUtils. r=bz a=akeybl
authorPatrick Walton <pwalton@mozilla.com>
Tue, 03 Jan 2012 22:52:20 -0800
changeset 84955 6a9aea623834b47fc6c186fb4f5e9ba9b799c2c5
parent 84954 61031c834e126508d1ecd257ccc29a16f632b0fd
child 84956 7503b8f043b849bcdd86e790e44461958b05e59f
push id519
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 00:38:35 +0000
treeherdermozilla-beta@788ea1ef610b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, akeybl
bugs709492
milestone11.0a2
Bug 709492 - Part 1: Add a paintingSuppressed getter to nsIDOMWindowUtils. r=bz a=akeybl
dom/base/nsDOMWindowUtils.cpp
dom/interfaces/base/nsIDOMWindowUtils.idl
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -2078,8 +2078,24 @@ nsDOMWindowUtils::GetPCCountScriptConten
 
   nsDependentJSString str;
   if (!str.init(cx, text))
     return NS_ERROR_FAILURE;
 
   result = str;
   return NS_OK;
 }
+
+NS_IMETHODIMP
+nsDOMWindowUtils::GetPaintingSuppressed(bool *aPaintingSuppressed)
+{
+  NS_ENSURE_TRUE(mWindow, NS_ERROR_FAILURE);
+  nsIDocShell *docShell = mWindow->GetDocShell();
+  NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
+
+  nsCOMPtr<nsIPresShell> presShell;
+  docShell->GetPresShell(getter_AddRefs(presShell));
+  NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
+
+  *aPaintingSuppressed = presShell->IsPaintingSuppressed();
+  return NS_OK;
+}
+
--- a/dom/interfaces/base/nsIDOMWindowUtils.idl
+++ b/dom/interfaces/base/nsIDOMWindowUtils.idl
@@ -64,17 +64,17 @@ interface nsIDOMHTMLCanvasElement;
 interface nsIDOMEvent;
 interface nsITransferable;
 interface nsIQueryContentEventResult;
 interface nsIDOMWindow;
 interface nsIDOMBlob;
 interface nsIDOMFile;
 interface nsIFile;
 
-[scriptable, uuid(3af3c5ce-6f2a-47e7-acd0-555ed576fa82)]
+[scriptable, uuid(c1fa9c82-acf2-4b27-8ca7-7d1864e606af)]
 interface nsIDOMWindowUtils : nsISupports {
 
   /**
    * Image animation mode of the window. When this attribute's value
    * is changed, the implementation should set all images in the window
    * to the given value. That is, when set to kDontAnimMode, all images
    * will stop animating. The attribute's value must be one of the
    * animationMode values from imgIContainer.
@@ -970,9 +970,15 @@ interface nsIDOMWindowUtils : nsISupport
   AString getPCCountScriptSummary(in long script);
 
   /**
    * Get a JSON string with full information about a profiled script,
    * including the decompilation of the script and placement of decompiled
    * operations within it, and PC counts for each operation.
    */
   AString getPCCountScriptContents(in long script);
+
+  /**
+   * Returns true if painting is suppressed for this window and false
+   * otherwise.
+   */
+  readonly attribute boolean paintingSuppressed;
 };