Bug 1447874 - Introduce DOMWindowUtils.flushLayoutWithoutThrottledAnimations. r?birtles,kats
MozReview-Commit-ID: LNNCgl0QSML
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -1722,16 +1722,28 @@ nsDOMWindowUtils::NeedsFlush(int32_t aFl
return NS_ERROR_INVALID_ARG;
}
*aResult = presShell->NeedFlush(flushType);
return NS_OK;
}
NS_IMETHODIMP
+nsDOMWindowUtils::FlushLayoutWithoutThrottledAnimations()
+{
+ nsCOMPtr<nsIDocument> doc = GetDocument();
+ if (doc) {
+ doc->FlushPendingNotifications(
+ ChangesToFlush(FlushType::Layout, false /* flush animations */));
+ }
+
+ return NS_OK;
+}
+
+NS_IMETHODIMP
nsDOMWindowUtils::GetRootBounds(nsISupports** aResult)
{
nsIDocument* doc = GetDocument();
NS_ENSURE_STATE(doc);
nsRect bounds(0, 0, 0, 0);
nsIPresShell* presShell = doc->GetShell();
if (presShell) {
--- a/dom/interfaces/base/nsIDOMWindowUtils.idl
+++ b/dom/interfaces/base/nsIDOMWindowUtils.idl
@@ -852,16 +852,22 @@ interface nsIDOMWindowUtils : nsISupport
const long FLUSH_DISPLAY = 2;
/**
* Returns true if a flush of the given type is needed.
*/
bool needsFlush(in long aFlushtype);
/**
+ * Flush pending layout-type notification without flushing throttled
+ * animations.
+ */
+ void flushLayoutWithoutThrottledAnimations();
+
+ /**
* Returns the bounds of the window's currently loaded document. This will
* generally be (0, 0, pageWidth, pageHeight) but in some cases (e.g. RTL
* documents) may have a negative left value.
* The returned object is a DOMRect (bug 1444991 may remove this walkaround).
*/
nsISupports getRootBounds();
/**