--- a/layout/generic/Visibility.h+++ b/layout/generic/Visibility.h@@ -13,45 +13,31 @@ #ifndef mozilla_layout_generic_Visibility_h #define mozilla_layout_generic_Visibility_h namespace mozilla { // Visibility states for frames. enum class Visibility : uint8_t {- // We're not tracking visibility for this frame.+ // Indicates that we're not tracking visibility for this frame. UNTRACKED,- // This frame is nonvisible - i.e., it was not within the displayport as of- // the last paint (in which case it'd be IN_DISPLAYPORT) and our heuristics- // aren't telling us that it may become visible soon (in which case it'd be- // MAY_BECOME_VISIBLE).- NONVISIBLE,-- // This frame is nonvisible now, but our heuristics tell us it may become- // visible soon. These heuristics are updated on a relatively slow timer, so a- // frame being marked MAY_BECOME_VISIBLE does not imply any particular- // relationship between the frame and the displayport.- MAY_BECOME_VISIBLE,+ // Indicates that the frame is probably nonvisible. Visible frames *may* be+ // APPROXIMATELY_NONVISIBLE because approximate visibility is not updated+ // synchronously. Some truly nonvisible frames may be marked+ // APPROXIMATELY_VISIBLE instead if our heuristics lead us to think they may+ // be visible soon.+ APPROXIMATELY_NONVISIBLE,- // This frame was within the displayport as of the last paint. That doesn't- // necessarily mean that the frame is visible - it may still lie outside the- // viewport - but it does mean that the user may scroll the frame into view- // asynchronously at any time (due to APZ), so for most purposes such a frame- // should be treated as truly visible.- IN_DISPLAYPORT-};--// The subset of the states in @Visibility which have a per-frame counter. This-// is used in the implementation of visibility tracking.-enum class VisibilityCounter : uint8_t-{- MAY_BECOME_VISIBLE,- IN_DISPLAYPORT+ // Indicates that the frame is either visible now or is likely to be visible+ // soon according to our heuristics. As with APPROXIMATELY_NONVISIBLE, it's+ // important to note that approximately visibility is not updated+ // synchronously, so this information may be out of date.+ APPROXIMATELY_VISIBLE }; // Requested actions when frames transition to the nonvisible state. enum class OnNonvisible : uint8_t { DISCARD_IMAGES // Discard images associated with the frame. };

--- a/layout/generic/nsIFrame.h+++ b/layout/generic/nsIFrame.h@@ -419,17 +419,16 @@ class nsIFrame : public nsQueryFrame { public: template <typename T> using Maybe = mozilla::Maybe<T>; using Nothing = mozilla::Nothing; using OnNonvisible = mozilla::OnNonvisible; template<typename T=void> using PropertyDescriptor = const mozilla::FramePropertyDescriptor<T>*; using Visibility = mozilla::Visibility;- using VisibilityCounter = mozilla::VisibilityCounter; typedef mozilla::FrameProperties FrameProperties; typedef mozilla::layers::Layer Layer; typedef mozilla::layout::FrameChildList ChildList; typedef mozilla::layout::FrameChildListID ChildListID; typedef mozilla::layout::FrameChildListIDs ChildListIDs; typedef mozilla::layout::FrameChildListIterator ChildListIterator; typedef mozilla::layout::FrameChildListArrayIterator ChildListArrayIterator;@@ -1107,44 +1106,29 @@ public: { return bool(GetStateBits() & NS_FRAME_VISIBILITY_IS_TRACKED); } /// @return the visibility state of this frame. See the Visibility enum /// for the possible return values and their meanings. Visibility GetVisibility() const;- /// @return true if this frame is either in the displayport now or may- /// become visible soon.- bool IsVisibleOrMayBecomeVisibleSoon() const- {- Visibility visibility = GetVisibility();- return visibility == Visibility::MAY_BECOME_VISIBLE ||- visibility == Visibility::IN_DISPLAYPORT;- }- /// Update the visibility state of this frame synchronously. /// XXX(seth): Avoid using this method; we should be relying on the refresh /// driver for visibility updates. This method, which replaces /// nsLayoutUtils::UpdateApproximateFrameVisibility(), exists purely as a /// temporary measure to avoid changing behavior during the transition from /// the old image visibility code. void UpdateVisibilitySynchronously();- struct VisibilityState- {- unsigned int mApproximateCounter : 16;- unsigned int mInDisplayPortCounter : 16;- };-- // A frame property which stores the visibility state of this frame, which- // consists of a VisibilityState value that stores counters for each type of- // visibility we track. When the visibility of this frame is not being- // tracked, this property is absent.- NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(VisibilityStateProperty, VisibilityState);+ // A frame property which stores the visibility state of this frame. Right+ // now that consists of an approximate visibility counter represented as a+ // uint32_t. When the visibility of this frame is not being tracked, this+ // property is absent.+ NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(VisibilityStateProperty, uint32_t); protected: /** * Subclasses can call this method to enable visibility tracking for this frame. * * If visibility tracking was previously disabled, this will schedule an * update an asynchronous update of visibility.@@ -1179,39 +1163,31 @@ protected: public: /////////////////////////////////////////////////////////////////////////////// // Internal implementation for the approximate frame visibility API. /////////////////////////////////////////////////////////////////////////////// /**- * We track the visibility of frames using counters; if any of the counters- * are non-zero, then the frame is considered visible. Using counters allows- * us to account for situations where the frame may be visible in more than- * one place (for example, via -moz-element), and it simplifies the+ * We track the approximate visibility of frames using a counter; if it's+ * non-zero, then the frame is considered visible. Using a counter allows us+ * to account for situations where the frame may be visible in more than one+ * place (for example, via -moz-element), and it simplifies the * implementation of our approximate visibility tracking algorithms. *- * There are two visibility counters for each frame: the approximate counter- * (which is based on our heuristics for which frames may become visible- * "soon"), and the in-displayport counter (which records if the frame was- * within the displayport at the last paint).- *- *- * @param aCounter Which counter to increment or decrement. * @param aNonvisibleAction A requested action if the frame has become * nonvisible. If Nothing(), no action is * requested. If DISCARD_IMAGES is specified, the * frame is requested to ask any images it's * associated with to discard their surfaces if * possible. */- void DecVisibilityCount(VisibilityCounter aCounter,- Maybe<OnNonvisible> aNonvisibleAction = Nothing());- void IncVisibilityCount(VisibilityCounter aCounter);+ void DecApproximateVisibleCount(Maybe<OnNonvisible> aNonvisibleAction = Nothing());+ void IncApproximateVisibleCount(); /** * Get the specified child list. * * @param aListID identifies the requested child list. * @return the child list. If the requested list is unsupported by this * frame type, an empty list will be returned.