From 2307e2060e3b39e09d75fbe61e578ccb5ce99221 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Tue, 3 Jan 2012 22:52:20 -0800 Subject: [PATCH] Bug 709492 - Part 1: Add a paintingSuppressed getter to nsIDOMWindowUtils. r=bz --- dom/base/nsDOMWindowUtils.cpp | 16 ++++++++++++++++ dom/interfaces/base/nsIDOMWindowUtils.idl | 8 +++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 28275f3b055a..72f6a027e225 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -2039,3 +2039,19 @@ nsDOMWindowUtils::GetPCCountScriptContents(PRInt32 script, JSContext* cx, nsAStr 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 presShell; + docShell->GetPresShell(getter_AddRefs(presShell)); + NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE); + + *aPaintingSuppressed = presShell->IsPaintingSuppressed(); + return NS_OK; +} + diff --git a/dom/interfaces/base/nsIDOMWindowUtils.idl b/dom/interfaces/base/nsIDOMWindowUtils.idl index 0ab427c52f0b..1dba3ca2d980 100644 --- a/dom/interfaces/base/nsIDOMWindowUtils.idl +++ b/dom/interfaces/base/nsIDOMWindowUtils.idl @@ -69,7 +69,7 @@ interface nsIDOMBlob; interface nsIDOMFile; interface nsIFile; -[scriptable, uuid(9df58cf3-7094-4c8d-96f2-bebd765099fe)] +[scriptable, uuid(c1fa9c82-acf2-4b27-8ca7-7d1864e606af)] interface nsIDOMWindowUtils : nsISupports { /** @@ -981,4 +981,10 @@ interface nsIDOMWindowUtils : nsISupports { */ [implicit_jscontext] AString getPCCountScriptContents(in long script); + + /** + * Returns true if painting is suppressed for this window and false + * otherwise. + */ + readonly attribute boolean paintingSuppressed; };