2014-08-28 06:13:41 +04: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_LAYERMETRICSWRAPPER_H
|
|
|
|
#define GFX_LAYERMETRICSWRAPPER_H
|
|
|
|
|
|
|
|
#include "Layers.h"
|
2016-01-07 02:56:58 +03:00
|
|
|
#include "UnitTransforms.h"
|
2014-08-28 06:13:41 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A wrapper class around a target Layer with that allows user code to
|
|
|
|
* walk through the FrameMetrics objects on the layer the same way it
|
|
|
|
* would walk through a ContainerLayer hierarchy. Consider the following
|
|
|
|
* layer tree:
|
|
|
|
*
|
|
|
|
* +---+
|
|
|
|
* | A |
|
|
|
|
* +---+
|
|
|
|
* / | \
|
|
|
|
* / | \
|
|
|
|
* / | \
|
|
|
|
* +---+ +-----+ +---+
|
|
|
|
* | B | | C | | D |
|
|
|
|
* +---+ +-----+ +---+
|
|
|
|
* | FMn |
|
|
|
|
* | . |
|
|
|
|
* | . |
|
|
|
|
* | . |
|
|
|
|
* | FM1 |
|
|
|
|
* | FM0 |
|
|
|
|
* +-----+
|
|
|
|
* / \
|
|
|
|
* / \
|
|
|
|
* +---+ +---+
|
|
|
|
* | E | | F |
|
|
|
|
* +---+ +---+
|
|
|
|
*
|
|
|
|
* In this layer tree, there are six layers with A being the root and B,D,E,F
|
|
|
|
* being leaf nodes. Layer C is in the middle and has n+1 FrameMetrics, labelled
|
|
|
|
* FM0...FMn. FM0 is the FrameMetrics you get by calling c->GetFrameMetrics(0)
|
|
|
|
* and FMn is the FrameMetrics you can obtain by calling
|
2016-10-24 20:07:01 +03:00
|
|
|
* c->GetFrameMetrics(c->GetScrollMetadataCount() - 1). This layer tree is
|
2014-08-28 06:13:41 +04:00
|
|
|
* conceptually equivalent to this one below:
|
|
|
|
*
|
|
|
|
* +---+
|
|
|
|
* | A |
|
|
|
|
* +---+
|
|
|
|
* / | \
|
|
|
|
* / | \
|
|
|
|
* / | \
|
|
|
|
* +---+ +-----+ +---+
|
|
|
|
* | B | | Cn | | D |
|
|
|
|
* +---+ +-----+ +---+
|
|
|
|
* |
|
|
|
|
* .
|
|
|
|
* .
|
|
|
|
* .
|
|
|
|
* |
|
|
|
|
* +-----+
|
|
|
|
* | C1 |
|
|
|
|
* +-----+
|
|
|
|
* |
|
|
|
|
* +-----+
|
|
|
|
* | C0 |
|
|
|
|
* +-----+
|
|
|
|
* / \
|
|
|
|
* / \
|
|
|
|
* +---+ +---+
|
|
|
|
* | E | | F |
|
|
|
|
* +---+ +---+
|
|
|
|
*
|
|
|
|
* In this layer tree, the layer C has been expanded into a stack of container
|
|
|
|
* layers C1...Cn, where C1 has FrameMetrics FM1 and Cn has FrameMetrics Fn.
|
|
|
|
* Although in this example C (in the first layer tree) and C0 (in the second
|
|
|
|
* layer tree) are both ContainerLayers (because they have children), they
|
2014-09-26 21:06:08 +04:00
|
|
|
* do not have to be. They may just be PaintedLayers or ColorLayers, for example,
|
2014-08-28 06:13:41 +04:00
|
|
|
* which do not have any children. However, the type of C will always be the
|
|
|
|
* same as the type of C0.
|
|
|
|
*
|
|
|
|
* The LayerMetricsWrapper class allows client code to treat the first layer
|
|
|
|
* tree as though it were the second. That is, instead of client code having
|
|
|
|
* to iterate through the FrameMetrics objects directly, it can use a
|
|
|
|
* LayerMetricsWrapper to encapsulate that aspect of the layer tree and just
|
|
|
|
* walk the tree as if it were a stack of ContainerLayers.
|
|
|
|
*
|
|
|
|
* The functions on this class do different things depending on which
|
|
|
|
* simulated ContainerLayer is being wrapped. For example, if the
|
|
|
|
* LayerMetricsWrapper is pretending to be C0, the GetNextSibling() function
|
|
|
|
* will return null even though the underlying layer C does actually have
|
|
|
|
* a next sibling. The LayerMetricsWrapper pretending to be Cn will return
|
|
|
|
* D as the next sibling.
|
|
|
|
*
|
|
|
|
* Implementation notes:
|
|
|
|
*
|
|
|
|
* The AtTopLayer() and AtBottomLayer() functions in this class refer to
|
|
|
|
* Cn and C0 in the second layer tree above; that is, they are predicates
|
|
|
|
* to test if the LayerMetricsWrapper is simulating the topmost or bottommost
|
|
|
|
* layer, as those will have special behaviour.
|
|
|
|
*
|
|
|
|
* It is possible to wrap a nullptr in a LayerMetricsWrapper, in which case
|
|
|
|
* the IsValid() function will return false. This is required to allow
|
|
|
|
* LayerMetricsWrapper to be a MOZ_STACK_CLASS (desirable because it is used
|
|
|
|
* in loops and recursion).
|
|
|
|
*
|
|
|
|
* This class purposely does not expose the wrapped layer directly to avoid
|
|
|
|
* user code from accidentally calling functions directly on it. Instead
|
|
|
|
* any necessary functions should be wrapped in this class. It does expose
|
|
|
|
* the wrapped layer as a void* for printf purposes.
|
|
|
|
*
|
|
|
|
* The implementation may look like it special-cases mIndex == 0 and/or
|
2016-10-24 20:07:01 +03:00
|
|
|
* GetScrollMetadataCount() == 0. This is an artifact of the fact that both
|
|
|
|
* mIndex and GetScrollMetadataCount() are uint32_t and GetScrollMetadataCount()
|
2014-08-28 06:13:41 +04:00
|
|
|
* can return 0 but mIndex cannot store -1. This seems better than the
|
|
|
|
* alternative of making mIndex a int32_t that can store -1, but then having
|
|
|
|
* to cast to uint32_t all over the place.
|
|
|
|
*/
|
|
|
|
class MOZ_STACK_CLASS LayerMetricsWrapper {
|
|
|
|
public:
|
2014-08-28 06:13:41 +04:00
|
|
|
enum StartAt {
|
|
|
|
TOP,
|
|
|
|
BOTTOM,
|
|
|
|
};
|
|
|
|
|
2014-08-28 06:13:41 +04:00
|
|
|
LayerMetricsWrapper()
|
|
|
|
: mLayer(nullptr)
|
|
|
|
, mIndex(0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-08-28 06:13:41 +04:00
|
|
|
explicit LayerMetricsWrapper(Layer* aRoot, StartAt aStart = StartAt::TOP)
|
2014-08-28 06:13:41 +04:00
|
|
|
: mLayer(aRoot)
|
|
|
|
, mIndex(0)
|
|
|
|
{
|
|
|
|
if (!mLayer) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-08-28 06:13:41 +04:00
|
|
|
switch (aStart) {
|
|
|
|
case StartAt::TOP:
|
2016-03-29 02:14:52 +03:00
|
|
|
mIndex = mLayer->GetScrollMetadataCount();
|
2014-08-28 06:13:41 +04:00
|
|
|
if (mIndex > 0) {
|
|
|
|
mIndex--;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case StartAt::BOTTOM:
|
|
|
|
mIndex = 0;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
MOZ_ASSERT_UNREACHABLE("Unknown startAt value");
|
|
|
|
break;
|
2014-08-28 06:13:41 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
explicit LayerMetricsWrapper(Layer* aLayer, uint32_t aMetricsIndex)
|
|
|
|
: mLayer(aLayer)
|
|
|
|
, mIndex(aMetricsIndex)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mLayer);
|
2016-03-29 02:14:52 +03:00
|
|
|
MOZ_ASSERT(mIndex == 0 || mIndex < mLayer->GetScrollMetadataCount());
|
2014-08-28 06:13:41 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool IsValid() const
|
|
|
|
{
|
|
|
|
return mLayer != nullptr;
|
|
|
|
}
|
|
|
|
|
2016-07-14 01:07:52 +03:00
|
|
|
explicit operator bool() const
|
2014-08-28 06:13:41 +04:00
|
|
|
{
|
|
|
|
return IsValid();
|
|
|
|
}
|
|
|
|
|
2014-08-28 06:13:41 +04:00
|
|
|
LayerMetricsWrapper GetParent() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
|
|
|
|
if (!AtTopLayer()) {
|
|
|
|
return LayerMetricsWrapper(mLayer, mIndex + 1);
|
|
|
|
}
|
|
|
|
if (mLayer->GetParent()) {
|
|
|
|
return LayerMetricsWrapper(mLayer->GetParent(), StartAt::BOTTOM);
|
|
|
|
}
|
|
|
|
return LayerMetricsWrapper(nullptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
LayerMetricsWrapper GetFirstChild() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
|
|
|
|
if (!AtBottomLayer()) {
|
|
|
|
return LayerMetricsWrapper(mLayer, mIndex - 1);
|
|
|
|
}
|
|
|
|
return LayerMetricsWrapper(mLayer->GetFirstChild());
|
|
|
|
}
|
|
|
|
|
2014-08-28 06:13:41 +04:00
|
|
|
LayerMetricsWrapper GetLastChild() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
|
|
|
|
if (!AtBottomLayer()) {
|
|
|
|
return LayerMetricsWrapper(mLayer, mIndex - 1);
|
|
|
|
}
|
|
|
|
return LayerMetricsWrapper(mLayer->GetLastChild());
|
|
|
|
}
|
|
|
|
|
|
|
|
LayerMetricsWrapper GetPrevSibling() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
|
|
|
|
if (AtTopLayer()) {
|
|
|
|
return LayerMetricsWrapper(mLayer->GetPrevSibling());
|
|
|
|
}
|
|
|
|
return LayerMetricsWrapper(nullptr);
|
|
|
|
}
|
|
|
|
|
2014-08-28 06:13:41 +04:00
|
|
|
LayerMetricsWrapper GetNextSibling() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
|
|
|
|
if (AtTopLayer()) {
|
|
|
|
return LayerMetricsWrapper(mLayer->GetNextSibling());
|
|
|
|
}
|
|
|
|
return LayerMetricsWrapper(nullptr);
|
|
|
|
}
|
|
|
|
|
2016-03-29 02:14:52 +03:00
|
|
|
const ScrollMetadata& Metadata() const
|
2014-08-28 06:13:41 +04:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
|
2016-03-29 02:14:52 +03:00
|
|
|
if (mIndex >= mLayer->GetScrollMetadataCount()) {
|
2016-03-31 00:04:10 +03:00
|
|
|
return *ScrollMetadata::sNullMetadata;
|
2014-08-28 06:13:41 +04:00
|
|
|
}
|
2016-03-29 02:14:52 +03:00
|
|
|
return mLayer->GetScrollMetadata(mIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
const FrameMetrics& Metrics() const
|
|
|
|
{
|
|
|
|
return Metadata().GetMetrics();
|
2014-08-28 06:13:41 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
AsyncPanZoomController* GetApzc() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
|
2016-03-29 02:14:52 +03:00
|
|
|
if (mIndex >= mLayer->GetScrollMetadataCount()) {
|
2014-08-28 06:13:41 +04:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return mLayer->GetAsyncPanZoomController(mIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetApzc(AsyncPanZoomController* aApzc) const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
|
2016-03-29 02:14:52 +03:00
|
|
|
if (mLayer->GetScrollMetadataCount() == 0) {
|
2014-08-28 06:13:41 +04:00
|
|
|
MOZ_ASSERT(mIndex == 0);
|
|
|
|
MOZ_ASSERT(aApzc == nullptr);
|
|
|
|
return;
|
|
|
|
}
|
2016-03-29 02:14:52 +03:00
|
|
|
MOZ_ASSERT(mIndex < mLayer->GetScrollMetadataCount());
|
2014-08-28 06:13:41 +04:00
|
|
|
mLayer->SetAsyncPanZoomController(mIndex, aApzc);
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Name() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
|
|
|
|
if (AtBottomLayer()) {
|
|
|
|
return mLayer->Name();
|
|
|
|
}
|
|
|
|
return "DummyContainerLayer";
|
|
|
|
}
|
|
|
|
|
2014-08-28 06:13:41 +04:00
|
|
|
LayerManager* Manager() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
|
|
|
|
return mLayer->Manager();
|
|
|
|
}
|
|
|
|
|
2014-08-28 06:13:41 +04:00
|
|
|
gfx::Matrix4x4 GetTransform() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
|
|
|
|
if (AtBottomLayer()) {
|
|
|
|
return mLayer->GetTransform();
|
|
|
|
}
|
|
|
|
return gfx::Matrix4x4();
|
|
|
|
}
|
|
|
|
|
2016-01-07 02:56:58 +03:00
|
|
|
CSSTransformMatrix GetTransformTyped() const
|
|
|
|
{
|
|
|
|
return ViewAs<CSSTransformMatrix>(GetTransform());
|
|
|
|
}
|
|
|
|
|
2015-11-02 23:08:01 +03:00
|
|
|
bool TransformIsPerspective() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
|
|
|
|
// mLayer->GetTransformIsPerspective() tells us whether
|
|
|
|
// mLayer->GetTransform() is a perspective transform. Since
|
|
|
|
// mLayer->GetTransform() is only used at the bottom layer, we only
|
|
|
|
// need to check GetTransformIsPerspective() at the bottom layer too.
|
|
|
|
if (AtBottomLayer()) {
|
|
|
|
return mLayer->GetTransformIsPerspective();
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-11-14 15:40:14 +03:00
|
|
|
EventRegions GetEventRegions() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
|
|
|
|
if (AtBottomLayer()) {
|
|
|
|
return mLayer->GetEventRegions();
|
|
|
|
}
|
|
|
|
return EventRegions();
|
|
|
|
}
|
|
|
|
|
2017-05-24 22:47:14 +03:00
|
|
|
LayerIntRegion GetVisibleRegion() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
|
|
|
|
if (AtBottomLayer()) {
|
|
|
|
return mLayer->GetVisibleRegion();
|
|
|
|
}
|
|
|
|
|
|
|
|
return ViewAs<LayerPixel>(
|
|
|
|
TransformBy(mLayer->GetTransformTyped(), mLayer->GetVisibleRegion()),
|
|
|
|
PixelCastJustification::MovingDownToChildren);
|
|
|
|
}
|
|
|
|
|
2015-02-27 01:45:37 +03:00
|
|
|
bool HasTransformAnimation() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
|
|
|
|
if (AtBottomLayer()) {
|
|
|
|
return mLayer->HasTransformAnimation();
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-08-28 06:13:41 +04:00
|
|
|
RefLayer* AsRefLayer() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
|
|
|
|
if (AtBottomLayer()) {
|
|
|
|
return mLayer->AsRefLayer();
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2017-04-20 17:38:05 +03:00
|
|
|
Maybe<uint64_t> GetReferentId() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
|
|
|
|
if (AtBottomLayer()) {
|
|
|
|
return mLayer->AsRefLayer()
|
|
|
|
? Some(mLayer->AsRefLayer()->GetReferentId())
|
|
|
|
: Nothing();
|
|
|
|
}
|
|
|
|
return Nothing();
|
|
|
|
}
|
|
|
|
|
2016-04-21 01:38:25 +03:00
|
|
|
Maybe<ParentLayerIntRect> GetClipRect() const
|
2014-08-28 06:13:41 +04:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
|
2016-04-21 01:38:25 +03:00
|
|
|
Maybe<ParentLayerIntRect> result;
|
2015-04-12 05:03:00 +03:00
|
|
|
|
2016-05-05 00:30:26 +03:00
|
|
|
// The layer can have a clip rect and a scrolled clip, which are considered
|
|
|
|
// to apply only to the bottommost LayerMetricsWrapper.
|
|
|
|
// TODO: These actually apply in a different coordinate space than the
|
|
|
|
// scroll clip of the bottommost metrics, so we shouldn't be intersecting
|
|
|
|
// them with the scroll clip; bug 1269537 tracks fixing this.
|
2015-03-11 20:36:12 +03:00
|
|
|
if (AtBottomLayer()) {
|
2016-04-21 01:38:25 +03:00
|
|
|
result = mLayer->GetClipRect();
|
2016-05-05 00:30:26 +03:00
|
|
|
result = IntersectMaybeRects(result, mLayer->GetScrolledClipRect());
|
2015-03-11 20:36:12 +03:00
|
|
|
}
|
|
|
|
|
2016-04-21 01:38:25 +03:00
|
|
|
// The scroll metadata can have a clip rect as well.
|
|
|
|
result = IntersectMaybeRects(result, Metadata().GetClipRect());
|
|
|
|
|
|
|
|
return result;
|
2014-08-28 06:13:41 +04:00
|
|
|
}
|
|
|
|
|
2015-12-10 01:29:03 +03:00
|
|
|
float GetPresShellResolution() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
|
|
|
|
if (AtTopLayer() && mLayer->AsContainerLayer()) {
|
|
|
|
return mLayer->AsContainerLayer()->GetPresShellResolution();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1.0f;
|
|
|
|
}
|
|
|
|
|
2015-02-17 05:30:02 +03:00
|
|
|
EventRegionsOverride GetEventRegionsOverride() const
|
|
|
|
{
|
2015-02-11 00:28:07 +03:00
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
|
|
|
|
if (mLayer->AsContainerLayer()) {
|
2015-02-17 05:30:02 +03:00
|
|
|
return mLayer->AsContainerLayer()->GetEventRegionsOverride();
|
2015-02-11 00:28:07 +03:00
|
|
|
}
|
2015-02-17 05:30:02 +03:00
|
|
|
return EventRegionsOverride::NoOverride;
|
2015-02-11 00:28:07 +03:00
|
|
|
}
|
|
|
|
|
2017-05-04 03:25:09 +03:00
|
|
|
const ScrollThumbData& GetScrollThumbData() const
|
2015-09-28 21:44:36 +03:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
|
2017-05-04 03:25:09 +03:00
|
|
|
return mLayer->GetScrollThumbData();
|
2015-09-28 21:44:36 +03:00
|
|
|
}
|
|
|
|
|
2017-05-23 17:50:41 +03:00
|
|
|
uint64_t GetScrollbarAnimationId() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
// This function is only really needed for template-compatibility with
|
|
|
|
// WebRenderScrollDataWrapper. Although it will be called, the return
|
|
|
|
// value is not used.
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-09-28 21:44:36 +03:00
|
|
|
FrameMetrics::ViewID GetScrollbarTargetContainerId() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
|
|
|
|
return mLayer->GetScrollbarTargetContainerId();
|
|
|
|
}
|
|
|
|
|
2016-04-14 23:42:24 +03:00
|
|
|
bool IsScrollbarContainer() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
return mLayer->IsScrollbarContainer();
|
|
|
|
}
|
|
|
|
|
2016-05-12 00:28:04 +03:00
|
|
|
FrameMetrics::ViewID GetFixedPositionScrollContainerId() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
|
|
|
|
return mLayer->GetFixedPositionScrollContainerId();
|
|
|
|
}
|
|
|
|
|
2014-08-28 06:13:41 +04:00
|
|
|
// Expose an opaque pointer to the layer. Mostly used for printf
|
|
|
|
// purposes. This is not intended to be a general-purpose accessor
|
|
|
|
// for the underlying layer.
|
|
|
|
const void* GetLayer() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
|
|
|
|
return (void*)mLayer;
|
|
|
|
}
|
|
|
|
|
2014-08-28 06:13:41 +04:00
|
|
|
bool operator==(const LayerMetricsWrapper& aOther) const
|
|
|
|
{
|
|
|
|
return mLayer == aOther.mLayer
|
|
|
|
&& mIndex == aOther.mIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator!=(const LayerMetricsWrapper& aOther) const
|
|
|
|
{
|
|
|
|
return !(*this == aOther);
|
|
|
|
}
|
|
|
|
|
2014-08-28 06:13:41 +04:00
|
|
|
private:
|
|
|
|
bool AtBottomLayer() const
|
|
|
|
{
|
|
|
|
return mIndex == 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool AtTopLayer() const
|
|
|
|
{
|
2016-03-29 02:14:52 +03:00
|
|
|
return mLayer->GetScrollMetadataCount() == 0 || mIndex == mLayer->GetScrollMetadataCount() - 1;
|
2014-08-28 06:13:41 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Layer* mLayer;
|
|
|
|
uint32_t mIndex;
|
|
|
|
};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|
2014-08-28 06:13:41 +04:00
|
|
|
|
|
|
|
#endif /* GFX_LAYERMETRICSWRAPPER_H */
|