Bug 1447874 - Introduce DOMWindowUtils.flushLayoutWithoutThrottledAnimations. r=birtles,kats
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Mon, 02 Apr 2018 10:35:44 +0900
changeset 411750 c3dc86c628f40d3ad6d6848346fc9721031ae732
parent 411749 16e014e079d7ec561e54bd97f83fd1ec9f4784a3
child 411751 4b4230db0bdce11b915a896b84ab99631c77aa82
push id33770
push usernerli@mozilla.com
push dateThu, 05 Apr 2018 10:01:08 +0000
treeherdermozilla-central@65e0fefdab51 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbirtles, kats
bugs1447874
milestone61.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 1447874 - Introduce DOMWindowUtils.flushLayoutWithoutThrottledAnimations. r=birtles,kats MozReview-Commit-ID: LNNCgl0QSML
dom/base/nsDOMWindowUtils.cpp
dom/interfaces/base/nsIDOMWindowUtils.idl
--- 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();
 
   /**