Bug 1521644 - Add a layer property that indicates async zoom container layers. r=mattwoodrow
authorMarkus Stange <mstange@themasta.com>
Fri, 01 Feb 2019 18:29:11 +0000
changeset 456488 1da2f61f8c538eff6202ddac84ce9988e90ddafa
parent 456487 f66aef24ffe6b0fd914d9f5f5a78aa848c63bba9
child 456489 eca791db896743b462a82e3808d9f90efb7a2042
push id111656
push userdvarga@mozilla.com
push dateSat, 02 Feb 2019 09:51:54 +0000
treeherdermozilla-inbound@d8cebb3b46cf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1521644
milestone67.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 1521644 - Add a layer property that indicates async zoom container layers. r=mattwoodrow MozReview-Commit-ID: 6qkFXhRDFs Differential Revision: https://phabricator.services.mozilla.com/D17174
gfx/layers/LayerAttributes.h
gfx/layers/Layers.cpp
gfx/layers/Layers.h
--- a/gfx/layers/LayerAttributes.h
+++ b/gfx/layers/LayerAttributes.h
@@ -174,16 +174,24 @@ class SimpleLayerAttributes final {
   bool SetIsFixedPosition(bool aFixedPosition) {
     if (mIsFixedPosition == aFixedPosition) {
       return false;
     }
     mIsFixedPosition = aFixedPosition;
     return true;
   }
 
+  bool SetIsAsyncZoomContainer(const Maybe<FrameMetrics::ViewID>& aViewId) {
+    if (mIsAsyncZoomContainerForViewId == aViewId) {
+      return false;
+    }
+    mIsAsyncZoomContainerForViewId = aViewId;
+    return true;
+  }
+
   bool SetScrollbarData(const ScrollbarData& aScrollbarData) {
     if (mScrollbarData == aScrollbarData) {
       return false;
     }
     mScrollbarData = aScrollbarData;
     return true;
   }
 
@@ -287,16 +295,20 @@ class SimpleLayerAttributes final {
   float GetPostYScale() const { return mPostYScale; }
 
   uint32_t GetContentFlags() const { return mContentFlags; }
 
   float GetOpacity() const { return mOpacity; }
 
   bool IsFixedPosition() const { return mIsFixedPosition; }
 
+  Maybe<FrameMetrics::ViewID> IsAsyncZoomContainer() const {
+    return mIsAsyncZoomContainerForViewId;
+  }
+
   const ScrollbarData& GetScrollbarData() const { return mScrollbarData; }
 
   gfx::CompositionOp GetMixBlendMode() const { return mMixBlendMode; }
 
   bool GetForceIsolatedGroup() const { return mForceIsolatedGroup; }
 
   const gfx::Matrix4x4& GetTransform() const { return mTransform; }
 
@@ -336,30 +348,33 @@ class SimpleLayerAttributes final {
     return mTransform == aOther.mTransform &&
            mTransformIsPerspective == aOther.mTransformIsPerspective &&
            mScrolledClip == aOther.mScrolledClip &&
            mPostXScale == aOther.mPostXScale &&
            mPostYScale == aOther.mPostYScale &&
            mContentFlags == aOther.mContentFlags &&
            mOpacity == aOther.mOpacity &&
            mIsFixedPosition == aOther.mIsFixedPosition &&
+           mIsAsyncZoomContainerForViewId ==
+               aOther.mIsAsyncZoomContainerForViewId &&
            mScrollbarData == aOther.mScrollbarData &&
            mMixBlendMode == aOther.mMixBlendMode &&
            mForceIsolatedGroup == aOther.mForceIsolatedGroup;
   }
 
  private:
   gfx::Matrix4x4 mTransform;
   bool mTransformIsPerspective;
   Maybe<LayerClip> mScrolledClip;
   float mPostXScale;
   float mPostYScale;
   uint32_t mContentFlags;
   float mOpacity;
   bool mIsFixedPosition;
+  Maybe<FrameMetrics::ViewID> mIsAsyncZoomContainerForViewId;
   ScrollbarData mScrollbarData;
   gfx::CompositionOp mMixBlendMode;
   bool mForceIsolatedGroup;
 
   struct FixedPositionData {
     ScrollableLayerGuid::ViewID mScrollId;
     LayerPoint mAnchor;
     int32_t mSides;
--- a/gfx/layers/Layers.cpp
+++ b/gfx/layers/Layers.cpp
@@ -1713,16 +1713,21 @@ void Layer::PrintInfo(std::stringstream&
     aStream << " [extend3DContext]";
   }
   if (Combines3DTransformWithAncestors()) {
     aStream << " [combines3DTransformWithAncestors]";
   }
   if (Is3DContextLeaf()) {
     aStream << " [is3DContextLeaf]";
   }
+  if (Maybe<FrameMetrics::ViewID> viewId = IsAsyncZoomContainer()) {
+    aStream << nsPrintfCString(" [asyncZoomContainer scrollId=%" PRIu64 "]",
+                               *viewId)
+                   .get();
+  }
   if (IsScrollbarContainer()) {
     aStream << " [scrollbar]";
   }
   if (GetScrollbarData().IsThumb()) {
     if (Maybe<ScrollDirection> thumbDirection = GetScrollbarData().mDirection) {
       if (*thumbDirection == ScrollDirection::eVertical) {
         aStream << nsPrintfCString(" [vscrollbar=%" PRIu64 "]",
                                    GetScrollbarData().mTargetViewId)
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -1211,16 +1211,24 @@ class Layer {
   void SetIsFixedPosition(bool aFixedPosition) {
     if (mSimpleAttrs.SetIsFixedPosition(aFixedPosition)) {
       MOZ_LAYERS_LOG_IF_SHADOWABLE(
           this, ("Layer::Mutated(%p) IsFixedPosition", this));
       MutatedSimple();
     }
   }
 
+  void SetIsAsyncZoomContainer(const Maybe<FrameMetrics::ViewID>& aViewId) {
+    if (mSimpleAttrs.SetIsAsyncZoomContainer(aViewId)) {
+      MOZ_LAYERS_LOG_IF_SHADOWABLE(
+          this, ("Layer::Mutated(%p) IsAsyncZoomContainer", this));
+      MutatedSimple();
+    }
+  }
+
   /**
    * CONSTRUCTION PHASE ONLY
    * This flag is true when the transform on the layer is a perspective
    * transform. The compositor treats perspective transforms specially
    * for async scrolling purposes.
    */
   void SetTransformIsPerspective(bool aTransformIsPerspective) {
     if (mSimpleAttrs.SetTransformIsPerspective(aTransformIsPerspective)) {
@@ -1354,16 +1362,19 @@ class Layer {
   const CSSTransformMatrix GetTransformTyped() const;
   const gfx::Matrix4x4& GetBaseTransform() const {
     return mSimpleAttrs.GetTransform();
   }
   // Note: these are virtual because ContainerLayerComposite overrides them.
   virtual float GetPostXScale() const { return mSimpleAttrs.GetPostXScale(); }
   virtual float GetPostYScale() const { return mSimpleAttrs.GetPostYScale(); }
   bool GetIsFixedPosition() { return mSimpleAttrs.IsFixedPosition(); }
+  Maybe<FrameMetrics::ViewID> IsAsyncZoomContainer() {
+    return mSimpleAttrs.IsAsyncZoomContainer();
+  }
   bool GetTransformIsPerspective() const {
     return mSimpleAttrs.GetTransformIsPerspective();
   }
   bool GetIsStickyPosition() { return mSimpleAttrs.IsStickyPosition(); }
   ScrollableLayerGuid::ViewID GetFixedPositionScrollContainerId() {
     return mSimpleAttrs.GetFixedPositionScrollContainerId();
   }
   LayerPoint GetFixedPositionAnchor() {