Bug 1234485 - Part 1. Add ActiveLayerTracker::IsMaskPositionAnimated. draft
authorcku <cku@mozilla.com>
Tue, 18 Oct 2016 17:45:14 +0800
changeset 426555 43550c353a02324af12852664dba6de1bb4ca295
parent 426420 dc89484d4b45abf442162e5ea2dd46f9de40197d
child 426556 3d7b935fa0a7626c3fae933dc407a676b09be342
push id32740
push userbmo:cku@mozilla.com
push dateTue, 18 Oct 2016 18:13:24 +0000
bugs1234485
milestone52.0a1
Bug 1234485 - Part 1. Add ActiveLayerTracker::IsMaskPositionAnimated. MozReview-Commit-ID: kAX0SKiyaY
layout/base/ActiveLayerTracker.cpp
layout/base/ActiveLayerTracker.h
--- a/layout/base/ActiveLayerTracker.cpp
+++ b/layout/base/ActiveLayerTracker.cpp
@@ -540,16 +540,24 @@ ActiveLayerTracker::IsContentActive(nsIF
 ActiveLayerTracker::SetCurrentScrollHandlerFrame(nsIFrame* aFrame)
 {
   if (!gLayerActivityTracker) {
     gLayerActivityTracker = new LayerActivityTracker();
   }
   gLayerActivityTracker->mCurrentScrollHandlerFrame = aFrame;
 }
 
+/* static */ bool
+ActiveLayerTracker::IsMaskPositionAnimated(nsDisplayListBuilder* aBuilder,
+                                                 nsIFrame* aFrame)
+{
+  return IsStyleAnimated(aBuilder, aFrame, eCSSProperty_mask_position_x) ||
+         IsStyleAnimated(aBuilder, aFrame, eCSSProperty_mask_position_y);
+}
+
 /* static */ void
 ActiveLayerTracker::Shutdown()
 {
   delete gLayerActivityTracker;
   gLayerActivityTracker = nullptr;
 }
 
 } // namespace mozilla
--- a/layout/base/ActiveLayerTracker.h
+++ b/layout/base/ActiveLayerTracker.h
@@ -129,13 +129,20 @@ public:
   static bool IsContentActive(nsIFrame* aFrame);
 
   /**
    * Called before and after a scroll event handler is executed, with the
    * scrollframe or nullptr, respectively. This acts as a hint to treat
    * inline style changes during the handler differently.
    */
   static void SetCurrentScrollHandlerFrame(nsIFrame* aFrame);
+
+  /**
+   * Return true if aFrame's mask-position-x or mask-position-y
+   * property is animated.
+   */
+  static bool IsMaskPositionAnimated(nsDisplayListBuilder* aBuilder,
+                                     nsIFrame* aFrame);
 };
 
 } // namespace mozilla
 
 #endif /* ACTIVELAYERTRACKER_H_ */