Bug 1324591 - Disable partial pre-render for frames in position:sticky subtree. r=botond
☠☠ backed out by 65326426c5ec ☠ ☠
authorHiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
Sun, 05 Jul 2020 02:21:09 +0000
changeset 538820 75966ee1fe658b1767d7459256175c0662d14c25
parent 538819 d6a01c6bc40efca63c4a9bd8f2eca1bfbb9a9619
child 538821 290c0c7b98645cc4db2ced1ae06b68e6e23688e4
push id37570
push usernbeleuzu@mozilla.com
push dateSun, 05 Jul 2020 09:53:45 +0000
treeherdermozilla-central@75966ee1fe65 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1324591
milestone80.0a1
first release with
nightly linux32
75966ee1fe65 / 80.0a1 / 20200705095345 / files
nightly linux64
75966ee1fe65 / 80.0a1 / 20200705095345 / files
nightly mac
75966ee1fe65 / 80.0a1 / 20200705095345 / files
nightly win32
75966ee1fe65 / 80.0a1 / 20200705095345 / files
nightly win64
75966ee1fe65 / 80.0a1 / 20200705095345 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1324591 - Disable partial pre-render for frames in position:sticky subtree. r=botond Differential Revision: https://phabricator.services.mozilla.com/D77774
layout/painting/nsDisplayList.cpp
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -7643,16 +7643,32 @@ bool nsDisplayTransform::CanUseAsyncAnim
   return mPrerenderDecision != PrerenderDecision::No;
 }
 
 bool nsDisplayBackgroundColor::CanUseAsyncAnimations(
     nsDisplayListBuilder* aBuilder) {
   return StaticPrefs::gfx_omta_background_color();
 }
 
+static bool IsInStickyPositionedSubtree(const nsIFrame* aFrame) {
+  for (const nsIFrame* frame = aFrame; frame;
+       frame = nsLayoutUtils::GetCrossDocParentFrame(frame)) {
+    if (frame->IsStickyPositioned()) {
+      return true;
+    }
+  }
+  return false;
+}
+
+static bool ShouldUsePartialPrerender(const nsIFrame* aFrame) {
+  return StaticPrefs::layout_animation_prerender_partial() &&
+         // Bug 1642547: Support partial prerender for position:sticky elements.
+         !IsInStickyPositionedSubtree(aFrame);
+}
+
 /* static */
 auto nsDisplayTransform::ShouldPrerenderTransformedContent(
     nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsRect* aDirtyRect)
     -> PrerenderInfo {
   PrerenderInfo result;
   // If we are in a preserve-3d tree, and we've disallowed async animations, we
   // return No prerender decision directly.
   if ((aFrame->Extend3DContext() ||
@@ -7755,17 +7771,17 @@ auto nsDisplayTransform::ShouldPrerender
   uint64_t maxLimitArea = uint64_t(maxSize.width) * maxSize.height;
   uint64_t frameArea = uint64_t(frameSize.width) * frameSize.height;
   if (frameArea <= maxLimitArea && frameSize <= absoluteLimit) {
     *aDirtyRect = overflow;
     result.mDecision = PrerenderDecision::Full;
     return result;
   }
 
-  if (StaticPrefs::layout_animation_prerender_partial()) {
+  if (ShouldUsePartialPrerender(aFrame)) {
     *aDirtyRect = nsLayoutUtils::ComputePartialPrerenderArea(
         aFrame, untransformedDirtyRect, overflow, maxSize);
     result.mDecision = PrerenderDecision::Partial;
     return result;
   }
 
   if (frameArea > maxLimitArea) {
     uint64_t appUnitsPerPixel = AppUnitsPerCSSPixel();