author Seth Fowler <>
Thu, 21 Apr 2016 01:21:58 -0700
changeset 318033 69abdc731a9962cb1220facb41f26bef7087b486
parent 314220 2d171d75b7464583358fcfb7524617ad5dce6a6f
child 318035 bb3bf463c0ec5fae4dcb8469a1cd127d40ad8f59
permissions -rw-r--r--
Bug 1261554 (Part 1) - Prepare for implementing in-displayport visibility tracking. r=mstange

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at */

 * Declares visibility-related types. @Visibility is an enumeration of the
 * possible visibility states of a frame. @OnNonvisible is an enumeration that
 * allows callers to request a specific action when a frame transitions from
 * visible to nonvisible.

#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.

  // 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

  // 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.

  // 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.

// 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

// Requested actions when frames transition to the nonvisible state.
enum class OnNonvisible : uint8_t
  DISCARD_IMAGES  // Discard images associated with the frame.

} // namespace mozilla

#endif // mozilla_layout_generic_Visibility_h