2012-07-30 17:42:26 -07:00
|
|
|
/* -*- 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 http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef GFX_FRAMEMETRICS_H
|
|
|
|
#define GFX_FRAMEMETRICS_H
|
|
|
|
|
2013-08-11 16:17:23 -07:00
|
|
|
#include <stdint.h> // for uint32_t, uint64_t
|
|
|
|
#include "Units.h" // for CSSRect, CSSPixel, etc
|
|
|
|
#include "mozilla/gfx/BasePoint.h" // for BasePoint
|
|
|
|
#include "mozilla/gfx/Rect.h" // for RoundedIn
|
|
|
|
#include "mozilla/gfx/ScaleFactor.h" // for ScaleFactor
|
2012-07-30 17:42:26 -07:00
|
|
|
|
2014-01-21 09:33:52 -08:00
|
|
|
namespace IPC {
|
|
|
|
template <typename T> struct ParamTraits;
|
|
|
|
} // namespace IPC
|
|
|
|
|
2012-07-30 17:42:26 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2013-09-05 15:26:59 -07:00
|
|
|
// The layer coordinates of the parent layer. Like the layer coordinates
|
|
|
|
// of the current layer (LayerPixel) but doesn't include the current layer's
|
|
|
|
// resolution.
|
|
|
|
struct ParentLayerPixel {};
|
|
|
|
|
|
|
|
typedef gfx::ScaleFactor<LayoutDevicePixel, ParentLayerPixel> LayoutDeviceToParentLayerScale;
|
|
|
|
typedef gfx::ScaleFactor<ParentLayerPixel, LayerPixel> ParentLayerToLayerScale;
|
|
|
|
|
|
|
|
typedef gfx::ScaleFactor<ParentLayerPixel, ScreenPixel> ParentLayerToScreenScale;
|
|
|
|
|
2012-07-30 17:42:26 -07:00
|
|
|
/**
|
|
|
|
* The viewport and displayport metrics for the painted frame at the
|
|
|
|
* time of a layer-tree transaction. These metrics are especially
|
|
|
|
* useful for shadow layers, because the metrics values are updated
|
|
|
|
* atomically with new pixels.
|
|
|
|
*/
|
2013-05-29 14:59:24 -07:00
|
|
|
struct FrameMetrics {
|
2014-01-21 09:33:52 -08:00
|
|
|
friend struct IPC::ParamTraits<mozilla::layers::FrameMetrics>;
|
2012-07-30 17:42:26 -07:00
|
|
|
public:
|
|
|
|
// We use IDs to identify frames across processes.
|
2012-08-22 08:56:38 -07:00
|
|
|
typedef uint64_t ViewID;
|
2012-07-30 17:42:26 -07:00
|
|
|
static const ViewID NULL_SCROLL_ID; // This container layer does not scroll.
|
2013-11-22 11:45:50 -08:00
|
|
|
static const ViewID START_SCROLL_ID = 2; // This is the ID that scrolling subframes
|
2012-07-30 17:42:26 -07:00
|
|
|
// will begin at.
|
|
|
|
|
|
|
|
FrameMetrics()
|
2012-09-28 19:16:34 -07:00
|
|
|
: mCompositionBounds(0, 0, 0, 0)
|
|
|
|
, mDisplayPort(0, 0, 0, 0)
|
2012-11-21 14:34:18 -08:00
|
|
|
, mCriticalDisplayPort(0, 0, 0, 0)
|
2012-09-28 19:16:34 -07:00
|
|
|
, mViewport(0, 0, 0, 0)
|
|
|
|
, mScrollOffset(0, 0)
|
2012-07-30 17:42:26 -07:00
|
|
|
, mScrollId(NULL_SCROLL_ID)
|
2012-09-28 19:16:34 -07:00
|
|
|
, mScrollableRect(0, 0, 0, 0)
|
2013-06-21 14:03:56 -07:00
|
|
|
, mResolution(1)
|
2013-09-05 15:26:59 -07:00
|
|
|
, mCumulativeResolution(1)
|
2013-06-21 14:03:56 -07:00
|
|
|
, mZoom(1)
|
2012-09-28 19:16:34 -07:00
|
|
|
, mDevPixelsPerCSSPixel(1)
|
2013-05-23 18:43:36 -07:00
|
|
|
, mPresShellId(-1)
|
2014-01-21 09:33:52 -08:00
|
|
|
, mMayHaveTouchListeners(false)
|
2013-11-08 16:07:00 -08:00
|
|
|
, mIsRoot(false)
|
2013-09-23 12:09:48 -07:00
|
|
|
, mHasScrollgrab(false)
|
2014-01-21 09:33:52 -08:00
|
|
|
, mDisableScrollingX(false)
|
|
|
|
, mDisableScrollingY(false)
|
2014-02-05 14:43:20 -08:00
|
|
|
, mUpdateScrollOffset(false)
|
|
|
|
, mScrollGeneration(0)
|
2012-07-30 17:42:26 -07:00
|
|
|
{}
|
|
|
|
|
|
|
|
// Default copy ctor and operator= are fine
|
|
|
|
|
|
|
|
bool operator==(const FrameMetrics& aOther) const
|
|
|
|
{
|
2012-10-03 16:51:38 -07:00
|
|
|
return mCompositionBounds.IsEqualEdges(aOther.mCompositionBounds) &&
|
|
|
|
mDisplayPort.IsEqualEdges(aOther.mDisplayPort) &&
|
2012-11-21 14:34:18 -08:00
|
|
|
mCriticalDisplayPort.IsEqualEdges(aOther.mCriticalDisplayPort) &&
|
2012-10-03 16:51:38 -07:00
|
|
|
mViewport.IsEqualEdges(aOther.mViewport) &&
|
|
|
|
mScrollOffset == aOther.mScrollOffset &&
|
|
|
|
mScrollId == aOther.mScrollId &&
|
|
|
|
mScrollableRect.IsEqualEdges(aOther.mScrollableRect) &&
|
|
|
|
mResolution == aOther.mResolution &&
|
2013-09-05 15:26:59 -07:00
|
|
|
mCumulativeResolution == aOther.mCumulativeResolution &&
|
2012-10-03 16:51:38 -07:00
|
|
|
mDevPixelsPerCSSPixel == aOther.mDevPixelsPerCSSPixel &&
|
2013-05-23 18:43:36 -07:00
|
|
|
mMayHaveTouchListeners == aOther.mMayHaveTouchListeners &&
|
2013-11-08 16:07:00 -08:00
|
|
|
mPresShellId == aOther.mPresShellId &&
|
2013-12-16 09:04:45 -08:00
|
|
|
mIsRoot == aOther.mIsRoot &&
|
2014-01-21 09:33:52 -08:00
|
|
|
mHasScrollgrab == aOther.mHasScrollgrab &&
|
|
|
|
mDisableScrollingX == aOther.mDisableScrollingX &&
|
|
|
|
mDisableScrollingY == aOther.mDisableScrollingY &&
|
2013-12-16 09:04:45 -08:00
|
|
|
mUpdateScrollOffset == aOther.mUpdateScrollOffset;
|
2012-07-30 17:42:26 -07:00
|
|
|
}
|
|
|
|
bool operator!=(const FrameMetrics& aOther) const
|
|
|
|
{
|
|
|
|
return !operator==(aOther);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsDefault() const
|
|
|
|
{
|
2013-05-23 18:43:36 -07:00
|
|
|
FrameMetrics def;
|
|
|
|
|
|
|
|
def.mPresShellId = mPresShellId;
|
|
|
|
return (def == *this);
|
2012-07-30 17:42:26 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
bool IsRootScrollable() const
|
|
|
|
{
|
2013-11-08 16:07:00 -08:00
|
|
|
return mIsRoot;
|
2012-07-30 17:42:26 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
bool IsScrollable() const
|
|
|
|
{
|
|
|
|
return mScrollId != NULL_SCROLL_ID;
|
|
|
|
}
|
|
|
|
|
2013-06-21 14:03:56 -07:00
|
|
|
CSSToLayerScale LayersPixelsPerCSSPixel() const
|
2012-09-28 19:16:34 -07:00
|
|
|
{
|
2013-09-05 15:26:59 -07:00
|
|
|
return mCumulativeResolution * mDevPixelsPerCSSPixel;
|
2012-09-28 19:16:34 -07:00
|
|
|
}
|
|
|
|
|
2013-06-21 14:03:56 -07:00
|
|
|
LayerPoint GetScrollOffsetInLayerPixels() const
|
2012-09-28 19:16:34 -07:00
|
|
|
{
|
2013-06-21 14:03:56 -07:00
|
|
|
return mScrollOffset * LayersPixelsPerCSSPixel();
|
2012-09-28 19:16:34 -07:00
|
|
|
}
|
|
|
|
|
2013-09-05 15:26:59 -07:00
|
|
|
LayoutDeviceToParentLayerScale GetParentResolution() const
|
|
|
|
{
|
|
|
|
return mCumulativeResolution / mResolution;
|
|
|
|
}
|
|
|
|
|
2013-12-13 09:23:47 -08:00
|
|
|
// Ensure the scrollableRect is at least as big as the compositionBounds
|
|
|
|
// because the scrollableRect can be smaller if the content is not large
|
|
|
|
// and the scrollableRect hasn't been updated yet.
|
|
|
|
// We move the scrollableRect up because we don't know if we can move it
|
|
|
|
// down. i.e. we know that scrollableRect can go back as far as zero.
|
|
|
|
// but we don't know how much further ahead it can go.
|
|
|
|
CSSRect GetExpandedScrollableRect() const
|
|
|
|
{
|
|
|
|
CSSRect scrollableRect = mScrollableRect;
|
2013-12-18 06:13:52 -08:00
|
|
|
CSSRect compBounds = CalculateCompositedRectInCssPixels();
|
|
|
|
if (scrollableRect.width < compBounds.width) {
|
2013-12-13 09:23:47 -08:00
|
|
|
scrollableRect.x = std::max(0.f,
|
2013-12-18 06:13:52 -08:00
|
|
|
scrollableRect.x - (compBounds.width - scrollableRect.width));
|
|
|
|
scrollableRect.width = compBounds.width;
|
2013-12-13 09:23:47 -08:00
|
|
|
}
|
|
|
|
|
2013-12-18 06:13:52 -08:00
|
|
|
if (scrollableRect.height < compBounds.height) {
|
2013-12-13 09:23:47 -08:00
|
|
|
scrollableRect.y = std::max(0.f,
|
2013-12-18 06:13:52 -08:00
|
|
|
scrollableRect.y - (compBounds.height - scrollableRect.height));
|
|
|
|
scrollableRect.height = compBounds.height;
|
2013-12-13 09:23:47 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
return scrollableRect;
|
|
|
|
}
|
|
|
|
|
2013-06-26 06:53:51 -07:00
|
|
|
/**
|
|
|
|
* Return the scale factor needed to fit the viewport
|
|
|
|
* into its composition bounds.
|
|
|
|
*/
|
|
|
|
CSSToScreenScale CalculateIntrinsicScale() const
|
|
|
|
{
|
|
|
|
return CSSToScreenScale(float(mCompositionBounds.width) / float(mViewport.width));
|
|
|
|
}
|
|
|
|
|
2013-06-26 06:54:49 -07:00
|
|
|
CSSRect CalculateCompositedRectInCssPixels() const
|
|
|
|
{
|
2013-08-26 06:50:30 -07:00
|
|
|
return CSSRect(gfx::RoundedIn(mCompositionBounds / mZoom));
|
2013-06-26 06:54:49 -07:00
|
|
|
}
|
|
|
|
|
2012-09-28 19:16:34 -07:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// The following metrics are all in widget space/device pixels.
|
|
|
|
//
|
|
|
|
|
2013-10-08 14:13:11 -07:00
|
|
|
// This is the area within the widget that we're compositing to. It is relative
|
|
|
|
// to the layer tree origin.
|
2012-09-28 19:16:34 -07:00
|
|
|
//
|
|
|
|
// This is useful because, on mobile, the viewport and composition dimensions
|
|
|
|
// are not always the same. In this case, we calculate the displayport using
|
|
|
|
// an area bigger than the region we're compositing to. If we used the
|
|
|
|
// viewport dimensions to calculate the displayport, we'd run into situations
|
|
|
|
// where we're prerendering the wrong regions and the content may be clipped,
|
2013-10-08 14:13:11 -07:00
|
|
|
// or too much of it prerendered. If the composition dimensions are the same as the
|
|
|
|
// viewport dimensions, there is no need for this and we can just use the viewport
|
2012-09-28 19:16:34 -07:00
|
|
|
// instead.
|
|
|
|
//
|
2013-10-08 14:13:11 -07:00
|
|
|
// This value is valid for nested scrollable layers as well, and is still
|
2013-11-08 08:23:47 -08:00
|
|
|
// relative to the layer tree origin. This value is provided by Gecko at
|
|
|
|
// layout/paint time.
|
2013-06-14 13:11:29 -07:00
|
|
|
ScreenIntRect mCompositionBounds;
|
2012-09-28 19:16:34 -07:00
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// The following metrics are all in CSS pixels. They are not in any uniform
|
|
|
|
// space, so each is explained separately.
|
|
|
|
//
|
|
|
|
|
|
|
|
// The area of a frame's contents that has been painted, relative to the
|
|
|
|
// viewport. It is in the same coordinate space as |mViewport|. For example,
|
|
|
|
// if it is at 0,0, then it's at the same place at the viewport, which is at
|
|
|
|
// the top-left in the layer, and at the same place as the scroll offset of
|
|
|
|
// the document.
|
|
|
|
//
|
|
|
|
// Note that this is structured in such a way that it doesn't depend on the
|
|
|
|
// method layout uses to scroll content.
|
|
|
|
//
|
|
|
|
// May be larger or smaller than |mScrollableRect|.
|
|
|
|
//
|
|
|
|
// To pre-render a margin of 100 CSS pixels around the window,
|
|
|
|
// { x = -100, y = - 100,
|
2013-07-03 06:04:10 -07:00
|
|
|
// width = window.innerWidth + 200, height = window.innerHeight + 200 }
|
2012-09-28 19:16:34 -07:00
|
|
|
//
|
|
|
|
// This is only valid on the root layer. Nested iframes do not have a
|
|
|
|
// displayport set on them. See bug 775452.
|
2013-06-10 06:05:42 -07:00
|
|
|
CSSRect mDisplayPort;
|
2012-09-28 19:16:34 -07:00
|
|
|
|
2012-11-21 14:34:18 -08:00
|
|
|
// If non-empty, the area of a frame's contents that is considered critical
|
|
|
|
// to paint. Area outside of this area (i.e. area inside mDisplayPort, but
|
|
|
|
// outside of mCriticalDisplayPort) is considered low-priority, and may be
|
|
|
|
// painted with lower precision, or not painted at all.
|
|
|
|
//
|
|
|
|
// The same restrictions for mDisplayPort apply here.
|
2013-06-10 06:05:42 -07:00
|
|
|
CSSRect mCriticalDisplayPort;
|
2012-11-21 14:34:18 -08:00
|
|
|
|
2012-09-28 19:16:34 -07:00
|
|
|
// The CSS viewport, which is the dimensions we're using to constrain the
|
|
|
|
// <html> element of this frame, relative to the top-left of the layer. Note
|
|
|
|
// that its offset is structured in such a way that it doesn't depend on the
|
|
|
|
// method layout uses to scroll content.
|
|
|
|
//
|
|
|
|
// This is mainly useful on the root layer, however nested iframes can have
|
|
|
|
// their own viewport, which will just be the size of the window of the
|
|
|
|
// iframe. For layers that don't correspond to a document, this metric is
|
|
|
|
// meaningless and invalid.
|
2013-06-10 06:05:43 -07:00
|
|
|
CSSRect mViewport;
|
2012-09-28 19:16:34 -07:00
|
|
|
|
|
|
|
// The position of the top-left of the CSS viewport, relative to the document
|
|
|
|
// (or the document relative to the viewport, if that helps understand it).
|
|
|
|
//
|
|
|
|
// Thus it is relative to the document. It is in the same coordinate space as
|
|
|
|
// |mScrollableRect|, but a different coordinate space than |mViewport| and
|
|
|
|
// |mDisplayPort|.
|
|
|
|
//
|
|
|
|
// It is required that the rect:
|
|
|
|
// { x = mScrollOffset.x, y = mScrollOffset.y,
|
2013-06-21 14:03:56 -07:00
|
|
|
// width = mCompositionBounds.x / mResolution.scale,
|
|
|
|
// height = mCompositionBounds.y / mResolution.scale }
|
2012-09-28 19:16:34 -07:00
|
|
|
// Be within |mScrollableRect|.
|
|
|
|
//
|
|
|
|
// This is valid for any layer, but is always relative to this frame and
|
|
|
|
// not any parents, regardless of parent transforms.
|
2013-06-10 06:05:43 -07:00
|
|
|
CSSPoint mScrollOffset;
|
2012-09-28 19:16:34 -07:00
|
|
|
|
2013-11-08 16:07:00 -08:00
|
|
|
// A unique ID assigned to each scrollable frame.
|
2012-07-30 17:42:26 -07:00
|
|
|
ViewID mScrollId;
|
|
|
|
|
2012-09-28 19:16:34 -07:00
|
|
|
// The scrollable bounds of a frame. This is determined by reflow.
|
2013-08-21 04:46:05 -07:00
|
|
|
// Ordinarily the x and y will be 0 and the width and height will be the
|
|
|
|
// size of the element being scrolled. However for RTL pages or elements
|
|
|
|
// the x value may be negative.
|
2012-09-28 19:16:34 -07:00
|
|
|
//
|
|
|
|
// This is relative to the document. It is in the same coordinate space as
|
|
|
|
// |mScrollOffset|, but a different coordinate space than |mViewport| and
|
|
|
|
// |mDisplayPort|. Note also that this coordinate system is understood by
|
|
|
|
// window.scrollTo().
|
|
|
|
//
|
|
|
|
// This is valid on any layer unless it has no content.
|
2013-06-10 06:05:43 -07:00
|
|
|
CSSRect mScrollableRect;
|
2012-07-30 17:42:26 -07:00
|
|
|
|
2012-09-28 19:16:38 -07:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// The following metrics are dimensionless.
|
|
|
|
//
|
|
|
|
|
2013-11-08 08:23:46 -08:00
|
|
|
// The incremental resolution that the current frame has been painted at
|
|
|
|
// relative to the parent frame's resolution. This information is provided
|
|
|
|
// by Gecko at layout/paint time.
|
2013-09-05 15:26:59 -07:00
|
|
|
ParentLayerToLayerScale mResolution;
|
|
|
|
|
|
|
|
// The cumulative resolution that the current frame has been painted at.
|
|
|
|
// This is the product of our mResolution and the mResolutions of our parent frames.
|
2013-11-08 08:23:46 -08:00
|
|
|
// This information is provided by Gecko at layout/paint time.
|
2013-09-05 15:26:59 -07:00
|
|
|
LayoutDeviceToLayerScale mCumulativeResolution;
|
2012-08-21 21:37:06 -07:00
|
|
|
|
2013-08-26 06:50:30 -07:00
|
|
|
// The "user zoom". Content is painted by gecko at mResolution * mDevPixelsPerCSSPixel,
|
|
|
|
// but will be drawn to the screen at mZoom. In the steady state, the
|
|
|
|
// two will be the same, but during an async zoom action the two may
|
2013-11-08 08:23:46 -08:00
|
|
|
// diverge. This information is initialized in Gecko but updated in the APZC.
|
2013-08-26 06:50:30 -07:00
|
|
|
CSSToScreenScale mZoom;
|
2012-09-28 19:16:38 -07:00
|
|
|
|
2012-09-28 19:16:34 -07:00
|
|
|
// The conversion factor between CSS pixels and device pixels for this frame.
|
|
|
|
// This can vary based on a variety of things, such as reflowing-zoom. The
|
|
|
|
// conversion factor for device pixels to layers pixels is just the
|
|
|
|
// resolution.
|
2013-06-21 14:03:56 -07:00
|
|
|
CSSToLayoutDeviceScale mDevPixelsPerCSSPixel;
|
2012-09-28 19:16:34 -07:00
|
|
|
|
2014-01-21 09:33:52 -08:00
|
|
|
uint32_t mPresShellId;
|
|
|
|
|
2012-08-21 21:37:06 -07:00
|
|
|
// Whether or not this frame may have touch listeners.
|
|
|
|
bool mMayHaveTouchListeners;
|
2013-05-23 18:43:36 -07:00
|
|
|
|
2013-11-08 16:07:00 -08:00
|
|
|
// Whether or not this is the root scroll frame for the root content document.
|
|
|
|
bool mIsRoot;
|
2013-09-23 12:09:48 -07:00
|
|
|
|
|
|
|
// Whether or not this frame is for an element marked 'scrollgrab'.
|
|
|
|
bool mHasScrollgrab;
|
2013-12-16 09:04:45 -08:00
|
|
|
|
2014-01-21 09:33:52 -08:00
|
|
|
public:
|
|
|
|
bool GetDisableScrollingX() const
|
|
|
|
{
|
|
|
|
return mDisableScrollingX;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetDisableScrollingX(bool aDisableScrollingX)
|
|
|
|
{
|
|
|
|
mDisableScrollingX = aDisableScrollingX;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GetDisableScrollingY() const
|
|
|
|
{
|
|
|
|
return mDisableScrollingY;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetDisableScrollingY(bool aDisableScrollingY)
|
|
|
|
{
|
|
|
|
mDisableScrollingY = aDisableScrollingY;
|
|
|
|
}
|
|
|
|
|
2014-02-05 14:43:20 -08:00
|
|
|
void SetScrollOffsetUpdated(uint32_t aScrollGeneration)
|
|
|
|
{
|
|
|
|
mUpdateScrollOffset = true;
|
|
|
|
mScrollGeneration = aScrollGeneration;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GetScrollOffsetUpdated() const
|
|
|
|
{
|
|
|
|
return mUpdateScrollOffset;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t GetScrollGeneration() const
|
|
|
|
{
|
|
|
|
return mScrollGeneration;
|
|
|
|
}
|
|
|
|
|
2014-01-21 09:33:52 -08:00
|
|
|
private:
|
|
|
|
// New fields from now on should be made private and old fields should
|
|
|
|
// be refactored to be private.
|
|
|
|
|
|
|
|
// Allow disabling scrolling in individual axis to support
|
|
|
|
// |overflow: hidden|.
|
|
|
|
bool mDisableScrollingX;
|
|
|
|
bool mDisableScrollingY;
|
2014-02-05 14:43:20 -08:00
|
|
|
|
|
|
|
// Whether mScrollOffset was updated by something other than the APZ code, and
|
|
|
|
// if the APZC receiving this metrics should update its local copy.
|
|
|
|
bool mUpdateScrollOffset;
|
|
|
|
// The scroll generation counter used to acknowledge the scroll offset update.
|
|
|
|
uint32_t mScrollGeneration;
|
2012-07-30 17:42:26 -07:00
|
|
|
};
|
|
|
|
|
2013-11-13 10:20:31 -08:00
|
|
|
/**
|
|
|
|
* This class allows us to uniquely identify a scrollable layer. The
|
|
|
|
* mLayersId identifies the layer tree (corresponding to a child process
|
|
|
|
* and/or tab) that the scrollable layer belongs to. The mPresShellId
|
|
|
|
* is a temporal identifier (corresponding to the document loaded that
|
|
|
|
* contains the scrollable layer, which may change over time). The
|
|
|
|
* mScrollId corresponds to the actual frame that is scrollable.
|
|
|
|
*/
|
|
|
|
struct ScrollableLayerGuid {
|
|
|
|
uint64_t mLayersId;
|
|
|
|
uint32_t mPresShellId;
|
|
|
|
FrameMetrics::ViewID mScrollId;
|
|
|
|
|
|
|
|
ScrollableLayerGuid()
|
|
|
|
: mLayersId(0)
|
|
|
|
, mPresShellId(0)
|
|
|
|
, mScrollId(0)
|
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(ScrollableLayerGuid);
|
|
|
|
}
|
|
|
|
|
|
|
|
ScrollableLayerGuid(uint64_t aLayersId, uint32_t aPresShellId,
|
|
|
|
FrameMetrics::ViewID aScrollId)
|
|
|
|
: mLayersId(aLayersId)
|
|
|
|
, mPresShellId(aPresShellId)
|
|
|
|
, mScrollId(aScrollId)
|
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(ScrollableLayerGuid);
|
|
|
|
}
|
|
|
|
|
|
|
|
ScrollableLayerGuid(uint64_t aLayersId, const FrameMetrics& aMetrics)
|
|
|
|
: mLayersId(aLayersId)
|
|
|
|
, mPresShellId(aMetrics.mPresShellId)
|
|
|
|
, mScrollId(aMetrics.mScrollId)
|
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(ScrollableLayerGuid);
|
|
|
|
}
|
|
|
|
|
|
|
|
~ScrollableLayerGuid()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(ScrollableLayerGuid);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator==(const ScrollableLayerGuid& other) const
|
|
|
|
{
|
|
|
|
return mLayersId == other.mLayersId
|
|
|
|
&& mPresShellId == other.mPresShellId
|
|
|
|
&& mScrollId == other.mScrollId;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator!=(const ScrollableLayerGuid& other) const
|
|
|
|
{
|
|
|
|
return !(*this == other);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-01-06 10:26:44 -08:00
|
|
|
struct ZoomConstraints {
|
|
|
|
bool mAllowZoom;
|
2014-02-24 16:22:45 -08:00
|
|
|
bool mAllowDoubleTapZoom;
|
2014-01-06 10:26:44 -08:00
|
|
|
CSSToScreenScale mMinZoom;
|
|
|
|
CSSToScreenScale mMaxZoom;
|
|
|
|
|
|
|
|
ZoomConstraints()
|
|
|
|
: mAllowZoom(true)
|
2014-02-24 16:22:45 -08:00
|
|
|
, mAllowDoubleTapZoom(true)
|
2014-01-06 10:26:44 -08:00
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(ZoomConstraints);
|
|
|
|
}
|
|
|
|
|
|
|
|
ZoomConstraints(bool aAllowZoom,
|
2014-02-24 16:22:45 -08:00
|
|
|
bool aAllowDoubleTapZoom,
|
2014-01-06 10:26:44 -08:00
|
|
|
const CSSToScreenScale& aMinZoom,
|
|
|
|
const CSSToScreenScale& aMaxZoom)
|
|
|
|
: mAllowZoom(aAllowZoom)
|
2014-02-24 16:22:45 -08:00
|
|
|
, mAllowDoubleTapZoom(aAllowDoubleTapZoom)
|
2014-01-06 10:26:44 -08:00
|
|
|
, mMinZoom(aMinZoom)
|
|
|
|
, mMaxZoom(aMaxZoom)
|
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(ZoomConstraints);
|
|
|
|
}
|
|
|
|
|
|
|
|
~ZoomConstraints()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(ZoomConstraints);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator==(const ZoomConstraints& other) const
|
|
|
|
{
|
|
|
|
return mAllowZoom == other.mAllowZoom
|
2014-02-24 16:22:45 -08:00
|
|
|
&& mAllowDoubleTapZoom == other.mAllowDoubleTapZoom
|
2014-01-06 10:26:44 -08:00
|
|
|
&& mMinZoom == other.mMinZoom
|
|
|
|
&& mMaxZoom == other.mMaxZoom;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator!=(const ZoomConstraints& other) const
|
|
|
|
{
|
|
|
|
return !(*this == other);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-07-30 17:42:26 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* GFX_FRAMEMETRICS_H */
|