Bug 1382682 - Collect scroll metadata for scrollinfo layers as well. r?mstange draft
authorKartikaya Gupta <kgupta@mozilla.com>
Fri, 21 Jul 2017 08:34:11 -0400
changeset 613033 c982667f60c020686c10b0daed52f8e5237fafce
parent 613032 4ffbfeec83e61c5e7af2ae4b7ae5bcbf62dddf4e
child 638590 e5c08f2884191aa9c2b1a8b78113b77d75e32e86
push id69701
push userkgupta@mozilla.com
push dateFri, 21 Jul 2017 12:34:29 +0000
reviewersmstange
bugs1382682
milestone56.0a1
Bug 1382682 - Collect scroll metadata for scrollinfo layers as well. r?mstange MozReview-Commit-ID: JdHExWIpet9
gfx/layers/wr/WebRenderLayerManager.cpp
--- a/gfx/layers/wr/WebRenderLayerManager.cpp
+++ b/gfx/layers/wr/WebRenderLayerManager.cpp
@@ -251,16 +251,31 @@ WebRenderLayerManager::CreateWebRenderCo
           // information into the WR display list directly.
           Maybe<ScrollMetadata> metadata = asr->mScrollableFrame->ComputeScrollMetadata(
               nullptr, item->ReferenceFrame(),
               ContainerLayerParameters(), nullptr);
           MOZ_ASSERT(metadata);
           mScrollMetadata[id] = *metadata;
         }
       }
+      if (itemType == nsDisplayItem::TYPE_SCROLL_INFO_LAYER) {
+        // we should only really get one scroll info layer per scroll id, so
+        // it's not worth trying to get the ViewID and checking to see if we
+        // already have it in mScrollMetadata before doing the work of computing
+        // the metadata.
+        nsDisplayScrollInfoLayer* info = static_cast<nsDisplayScrollInfoLayer*>(item);
+        UniquePtr<ScrollMetadata> metadata = info->ComputeScrollMetadata(
+            nullptr, ContainerLayerParameters());
+        MOZ_ASSERT(metadata);
+        MOZ_ASSERT(metadata->GetMetrics().IsScrollInfoLayer());
+        FrameMetrics::ViewID id = metadata->GetMetrics().GetScrollId();
+        if (mScrollMetadata.find(id) == mScrollMetadata.end()) {
+          mScrollMetadata[id] = *metadata;
+        }
+      }
     }
 
     if (!item->CreateWebRenderCommands(aBuilder, aSc, mParentCommands, this,
                                        aDisplayListBuilder)) {
       PushItemAsImage(item, aBuilder, aSc, aDisplayListBuilder);
     }
   }
   aDisplayList->AppendToTop(&savedItems);