Bug 1267438 - Give layers an optional scrolled clip that is scrolled by all scroll frames associated with the layer. r=mstange

MozReview-Commit-ID: EGqVZuISSZQ

--HG--
extra : rebase_source : cf1e70734524cb740cb0cb64190d5a780d2b692f
extra : amend_source : b91d3f887a78da248950289fa8917db5fa62910b
extra : source : 54cb97cee6810ec56308d1f2f66e5b8fda02da3e
extra : histedit_source : dc982f0a16e8c2c042c260bc56252425cc6f76c4
This commit is contained in:
Botond Ballo 2016-04-29 17:32:53 -04:00
Родитель b6836691eb
Коммит 771407a83d
6 изменённых файлов: 33 добавлений и 0 удалений

Просмотреть файл

@ -725,6 +725,8 @@ private:
Maybe<size_t> mMaskLayerIndex;
};
typedef Maybe<LayerClip> MaybeLayerClip; // for passing over IPDL
/**
* Metadata about a scroll frame that's stored in the layer tree for use by
* the compositor (including APZ). This includes the scroll frame's FrameMetrics,

Просмотреть файл

@ -1100,6 +1100,8 @@ Layer::GetCombinedClipRect() const
{
Maybe<ParentLayerIntRect> clip = GetClipRect();
clip = IntersectMaybeRects(clip, GetScrolledClipRect());
for (size_t i = 0; i < mScrollMetadata.Length(); i++) {
clip = IntersectMaybeRects(clip, mScrollMetadata[i].GetClipRect());
}
@ -1902,6 +1904,9 @@ Layer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
if (mClipRect) {
AppendToString(aStream, *mClipRect, " [clip=", "]");
}
if (mScrolledClip) {
AppendToString(aStream, mScrolledClip->GetClipRect(), " [scrolled-clip=", "]");
}
if (1.0 != mPostXScale || 1.0 != mPostYScale) {
aStream << nsPrintfCString(" [postScale=%g, %g]", mPostXScale, mPostYScale).get();
}

Просмотреть файл

@ -1035,6 +1035,26 @@ public:
}
}
/**
* CONSTRUCTION PHASE ONLY
* Set an optional scrolled clip on the layer.
* The scrolled clip, if present, consists of a clip rect and an optional mask.
* This scrolled clip is always scrolled by all scroll frames associated with
* this layer. (By contrast, the scroll clips stored in ScrollMetadata are
* only scrolled by scroll frames above that ScrollMetadata, and the layer's
* mClipRect is always fixed to the layer contents (which may or may not be
* scrolled by some of the scroll frames associated with the layer, depending
* on whether the layer is fixed).)
*/
void SetScrolledClip(const Maybe<LayerClip>& aScrolledClip)
{
if (mScrolledClip != aScrolledClip) {
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) ScrolledClip", this));
mScrolledClip = aScrolledClip;
Mutated();
}
}
/**
* CONSTRUCTION PHASE ONLY
* Set a layer to mask this layer.
@ -1281,6 +1301,7 @@ public:
float GetOpacity() { return mOpacity; }
gfx::CompositionOp GetMixBlendMode() const { return mMixBlendMode; }
const Maybe<ParentLayerIntRect>& GetClipRect() const { return mClipRect; }
const Maybe<LayerClip>& GetScrolledClip() const { return mScrolledClip; }
uint32_t GetContentFlags() { return mContentFlags; }
const gfx::IntRect& GetLayerBounds() const { return mLayerBounds; }
const LayerIntRegion& GetVisibleRegion() const { return mVisibleRegion; }
@ -1850,6 +1871,7 @@ protected:
gfx::CompositionOp mMixBlendMode;
bool mForceIsolatedGroup;
Maybe<ParentLayerIntRect> mClipRect;
Maybe<LayerClip> mScrolledClip;
gfx::IntRect mTileSourceRect;
gfx::TiledIntRegion mInvalidRegion;
nsTArray<RefPtr<AsyncPanZoomController> > mApzcs;

Просмотреть файл

@ -343,6 +343,7 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
layer->SetContentFlags(common.contentFlags());
layer->SetOpacity(common.opacity());
layer->SetClipRect(common.useClipRect() ? Some(common.clipRect()) : Nothing());
layer->SetScrolledClip(common.scrolledClip());
layer->SetBaseTransform(common.transform().value());
layer->SetTransformIsPerspective(common.transformIsPerspective());
layer->SetPostScale(common.postXScale(), common.postYScale());

Просмотреть файл

@ -45,6 +45,7 @@ using struct mozilla::layers::ScrollMetadata from "FrameMetrics.h";
using mozilla::layers::FrameMetrics::ViewID from "FrameMetrics.h";
using struct mozilla::layers::FenceHandle from "mozilla/layers/FenceUtils.h";
using mozilla::layers::LayersBackend from "mozilla/layers/LayersTypes.h";
using mozilla::layers::MaybeLayerClip from "FrameMetrics.h";
namespace mozilla {
namespace layers {
@ -218,6 +219,7 @@ struct CommonLayerAttributes {
float opacity;
bool useClipRect;
ParentLayerIntRect clipRect;
MaybeLayerClip scrolledClip;
bool isFixedPosition;
uint64_t fixedPositionScrollContainerId;
LayerPoint fixedPositionAnchor;

Просмотреть файл

@ -828,6 +828,7 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
common.useClipRect() = !!mutant->GetClipRect();
common.clipRect() = (common.useClipRect() ?
*mutant->GetClipRect() : ParentLayerIntRect());
common.scrolledClip() = mutant->GetScrolledClip();
common.isFixedPosition() = mutant->GetIsFixedPosition();
if (mutant->GetIsFixedPosition()) {
common.fixedPositionScrollContainerId() = mutant->GetFixedPositionScrollContainerId();