Represent scroll timeline information in the Layers API draft
authorBotond Ballo <botond@mozilla.com>
Wed, 03 Aug 2016 19:57:44 -0400
changeset 397399 bd628ac0f500eb33789dbc175c1923882dcda32a
parent 397398 eccc15e6ea7692f8c4b8f35d322edb8541309442
child 397400 e9648de4147bc68a92ca241764cb4639c53f9dd0
push id25288
push userbballo@mozilla.com
push dateFri, 05 Aug 2016 19:41:51 +0000
milestone50.0a1
Represent scroll timeline information in the Layers API MozReview-Commit-ID: C3BgVuu3ce8
gfx/ipc/GfxMessageUtils.h
gfx/layers/ipc/LayersMessages.ipdlh
--- a/gfx/ipc/GfxMessageUtils.h
+++ b/gfx/ipc/GfxMessageUtils.h
@@ -12,16 +12,17 @@
 #include "ImageTypes.h"
 #include "RegionBuilder.h"
 #include "base/process_util.h"
 #include "chrome/common/ipc_message_utils.h"
 #include "gfxPoint.h"
 #include "gfxRect.h"
 #include "gfxTypes.h"
 #include "ipc/IPCMessageUtils.h"
+#include "mozilla/dom/ScrollTimelineBinding.h"  // for mozilla::dom::ScrollDirection
 #include "mozilla/gfx/Matrix.h"
 #include "mozilla/layers/AsyncDragMetrics.h"
 #include "mozilla/layers/CompositorTypes.h"
 #include "mozilla/layers/GeckoContentController.h"
 #include "mozilla/layers/LayersTypes.h"
 #include "nsRect.h"
 #include "nsRegion.h"
 
@@ -1226,11 +1227,19 @@ struct ParamTraits<mozilla::layers::Asyn
             ReadParam(aMsg, aIter, &aResult->mPresShellId) &&
             ReadParam(aMsg, aIter, &aResult->mDragStartSequenceNumber) &&
             ReadParam(aMsg, aIter, &aResult->mScrollbarDragOffset) &&
             ReadParam(aMsg, aIter, &aResult->mScrollTrack) &&
             ReadParam(aMsg, aIter, &aResult->mDirection));
   }
 };
 
+template <>
+struct ParamTraits<mozilla::dom::ScrollDirection>
+  : public ContiguousEnumSerializer<
+             mozilla::dom::ScrollDirection,
+             mozilla::dom::ScrollDirection::Vertical,
+             mozilla::dom::ScrollDirection::EndGuard_>
+{};
+
 } /* namespace IPC */
 
 #endif /* __GFXMESSAGEUTILS_H__ */
--- a/gfx/layers/ipc/LayersMessages.ipdlh
+++ b/gfx/layers/ipc/LayersMessages.ipdlh
@@ -32,16 +32,17 @@ using nsCSSProperty from "nsCSSProperty.
 using mozilla::dom::ScreenOrientationInternal from "mozilla/dom/ScreenOrientation.h";
 using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h";
 using mozilla::LayerMargin from "Units.h";
 using mozilla::LayerPoint from "Units.h";
 using mozilla::LayerRect from "Units.h";
 using mozilla::LayerIntRegion from "Units.h";
 using mozilla::ParentLayerIntRect from "Units.h";
 using mozilla::LayoutDeviceIntRect from "Units.h";
+using mozilla::dom::ScrollDirection from "mozilla/dom/ScrollTimelineBinding.h";
 using mozilla::layers::ScaleMode from "mozilla/layers/LayersTypes.h";
 using mozilla::layers::EventRegions from "mozilla/layers/LayersTypes.h";
 using mozilla::layers::EventRegionsOverride from "mozilla/layers/LayersTypes.h";
 using mozilla::layers::DiagnosticTypes from "mozilla/layers/CompositorTypes.h";
 using struct mozilla::layers::ScrollMetadata from "FrameMetrics.h";
 using mozilla::layers::FrameMetrics::ViewID from "FrameMetrics.h";
 using struct mozilla::layers::FenceHandle from "mozilla/layers/FenceUtils.h";
 using mozilla::layers::LayersBackend from "mozilla/layers/LayersTypes.h";
@@ -172,16 +173,27 @@ struct TransformData {
   int32_t appUnitsPerDevPixel;
 };
 
 union AnimationData {
   null_t;
   TransformData;
 };
 
+struct ScrollTimelineInfo {
+  ScrollDirection direction;
+  ViewID scrollFrame;
+  TimeDuration timeRange;
+};
+
+union MaybeScrollTimelineInfo {
+  null_t;
+  ScrollTimelineInfo;
+};
+
 struct Animation {
   // Unlike in nsAnimationManager, this start time is at the end of the
   // delay.  If the delay is changed dynamically, the layer's data will
   // be updated.
   TimeStamp startTime;
   // The value of the animation's current time at the moment it was created.
   // For animations that are waiting to start, their startTime will be null.
   // Once the animation is ready to start, we calculate an appropriate value
@@ -199,16 +211,19 @@ struct Animation {
   float iterationStart;
   // This uses the NS_STYLE_ANIMATION_DIRECTION_* constants.
   int32_t direction;
   nsCSSProperty property;
   AnimationData data;
   float playbackRate;
   // This is used in the transformed progress calculation.
   TimingFunction easingFunction;
+  // If this is present, the animation is driven by a ScrollTimeline, and
+  // this structure contains information about that timeline.
+  MaybeScrollTimelineInfo scrollTimelineInfo;
 };
 
 // Change a layer's attributes
 struct CommonLayerAttributes {
   IntRect layerBounds;
   LayerIntRegion visibleRegion;
   EventRegions eventRegions;
   TransformMatrix transform;