mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Back out bug 1148582 for static analysis bustage.
This commit is contained in:
parent
0ead6b379a
commit
375ab11d1c
@ -733,7 +733,6 @@ struct ParamTraits<mozilla::layers::FrameMetrics>
|
||||
WriteParam(aMsg, aParam.GetPageScrollAmount());
|
||||
WriteParam(aMsg, aParam.AllowVerticalScrollWithWheel());
|
||||
WriteParam(aMsg, aParam.mClipRect);
|
||||
WriteParam(aMsg, aParam.mMaskLayerIndex);
|
||||
WriteParam(aMsg, aParam.mIsLayersIdRoot);
|
||||
WriteParam(aMsg, aParam.mUsesContainerScrolling);
|
||||
WriteParam(aMsg, aParam.GetContentDescription());
|
||||
@ -779,7 +778,6 @@ struct ParamTraits<mozilla::layers::FrameMetrics>
|
||||
ReadParam(aMsg, aIter, &aResult->mPageScrollAmount) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mAllowVerticalScrollWithWheel) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mClipRect) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mMaskLayerIndex) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mIsLayersIdRoot) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mUsesContainerScrolling) &&
|
||||
ReadContentDescription(aMsg, aIter, aResult));
|
||||
|
@ -104,7 +104,6 @@ public:
|
||||
mPageScrollAmount == aOther.mPageScrollAmount &&
|
||||
mAllowVerticalScrollWithWheel == aOther.mAllowVerticalScrollWithWheel &&
|
||||
mClipRect == aOther.mClipRect &&
|
||||
mMaskLayerIndex == aOther.mMaskLayerIndex &&
|
||||
mIsLayersIdRoot == aOther.mIsLayersIdRoot &&
|
||||
mUsesContainerScrolling == aOther.mUsesContainerScrolling;
|
||||
}
|
||||
@ -526,13 +525,6 @@ public:
|
||||
return mClipRect.ref();
|
||||
}
|
||||
|
||||
void SetMaskLayerIndex(const Maybe<size_t>& aIndex) {
|
||||
mMaskLayerIndex = aIndex;
|
||||
}
|
||||
const Maybe<size_t>& GetMaskLayerIndex() const {
|
||||
return mMaskLayerIndex;
|
||||
}
|
||||
|
||||
void SetIsLayersIdRoot(bool aValue) {
|
||||
mIsLayersIdRoot = aValue;
|
||||
}
|
||||
@ -722,11 +714,6 @@ private:
|
||||
// The clip rect to use when compositing a layer with this FrameMetrics.
|
||||
Maybe<ParentLayerIntRect> mClipRect;
|
||||
|
||||
// An extra clip mask layer to use when compositing a layer with this
|
||||
// FrameMetrics. This is an index into the MetricsMaskLayers array on
|
||||
// the Layer.
|
||||
Maybe<size_t> mMaskLayerIndex;
|
||||
|
||||
// Whether these framemetrics are for the root scroll frame (root element if
|
||||
// we don't have a root scroll frame) for its layers id.
|
||||
bool mIsLayersIdRoot;
|
||||
|
@ -57,7 +57,7 @@ void ImageLayer::ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSu
|
||||
mEffectiveTransformForBuffer = mEffectiveTransform;
|
||||
}
|
||||
|
||||
ComputeEffectiveTransformForMaskLayers(aTransformToSurface);
|
||||
ComputeEffectiveTransformForMaskLayer(aTransformToSurface);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -83,10 +83,6 @@ NotifySubdocumentInvalidationRecursive(Layer* aLayer, NotifySubDocInvalidationFu
|
||||
if (aLayer->GetMaskLayer()) {
|
||||
NotifySubdocumentInvalidationRecursive(aLayer->GetMaskLayer(), aCallback);
|
||||
}
|
||||
for (size_t i = 0; i < aLayer->GetAncestorMaskLayerCount(); i++) {
|
||||
Layer* maskLayer = aLayer->GetAncestorMaskLayerAt(i);
|
||||
NotifySubdocumentInvalidationRecursive(maskLayer, aCallback);
|
||||
}
|
||||
|
||||
if (!container) {
|
||||
return;
|
||||
@ -115,10 +111,6 @@ struct LayerPropertiesBase : public LayerProperties
|
||||
if (aLayer->GetMaskLayer()) {
|
||||
mMaskLayer = CloneLayerTreePropertiesInternal(aLayer->GetMaskLayer(), true);
|
||||
}
|
||||
for (size_t i = 0; i < aLayer->GetAncestorMaskLayerCount(); i++) {
|
||||
Layer* maskLayer = aLayer->GetAncestorMaskLayerAt(i);
|
||||
mAncestorMaskLayers.AppendElement(CloneLayerTreePropertiesInternal(maskLayer, true));
|
||||
}
|
||||
if (mUseClipRect) {
|
||||
mClipRect = *aLayer->GetClipRect();
|
||||
}
|
||||
@ -147,22 +139,10 @@ struct LayerPropertiesBase : public LayerProperties
|
||||
bool transformChanged = !mTransform.FuzzyEqualsMultiplicative(mLayer->GetLocalTransform()) ||
|
||||
mLayer->GetPostXScale() != mPostXScale ||
|
||||
mLayer->GetPostYScale() != mPostYScale;
|
||||
Layer* otherMask = mLayer->GetMaskLayer();
|
||||
const Maybe<ParentLayerIntRect>& otherClip = mLayer->GetClipRect();
|
||||
nsIntRegion result;
|
||||
|
||||
bool ancestorMaskChanged = mAncestorMaskLayers.Length() != mLayer->GetAncestorMaskLayerCount();
|
||||
if (!ancestorMaskChanged) {
|
||||
for (size_t i = 0; i < mAncestorMaskLayers.Length(); i++) {
|
||||
if (mLayer->GetAncestorMaskLayerAt(i) != mAncestorMaskLayers[i]->mLayer) {
|
||||
ancestorMaskChanged = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Layer* otherMask = mLayer->GetMaskLayer();
|
||||
if ((mMaskLayer ? mMaskLayer->mLayer : nullptr) != otherMask ||
|
||||
ancestorMaskChanged ||
|
||||
(mUseClipRect != !!otherClip) ||
|
||||
mLayer->GetLocalOpacity() != mOpacity ||
|
||||
transformChanged)
|
||||
@ -182,15 +162,6 @@ struct LayerPropertiesBase : public LayerProperties
|
||||
mTransform);
|
||||
}
|
||||
|
||||
for (size_t i = 0;
|
||||
i < std::min(mAncestorMaskLayers.Length(), mLayer->GetAncestorMaskLayerCount());
|
||||
i++)
|
||||
{
|
||||
AddTransformedRegion(result,
|
||||
mAncestorMaskLayers[i]->ComputeChange(aCallback, aGeometryChanged),
|
||||
mTransform);
|
||||
}
|
||||
|
||||
if (mUseClipRect && otherClip) {
|
||||
if (!mClipRect.IsEqualInterior(*otherClip)) {
|
||||
aGeometryChanged = true;
|
||||
@ -222,7 +193,6 @@ struct LayerPropertiesBase : public LayerProperties
|
||||
|
||||
nsRefPtr<Layer> mLayer;
|
||||
UniquePtr<LayerPropertiesBase> mMaskLayer;
|
||||
nsTArray<UniquePtr<LayerPropertiesBase>> mAncestorMaskLayers;
|
||||
nsIntRegion mVisibleRegion;
|
||||
nsIntRegion mInvalidRegion;
|
||||
Matrix4x4 mTransform;
|
||||
@ -473,9 +443,6 @@ LayerProperties::ClearInvalidations(Layer *aLayer)
|
||||
if (aLayer->GetMaskLayer()) {
|
||||
ClearInvalidations(aLayer->GetMaskLayer());
|
||||
}
|
||||
for (size_t i = 0; i < aLayer->GetAncestorMaskLayerCount(); i++) {
|
||||
ClearInvalidations(aLayer->GetAncestorMaskLayerAt(i));
|
||||
}
|
||||
|
||||
ContainerLayer* container = aLayer->AsContainerLayer();
|
||||
if (!container) {
|
||||
|
@ -857,31 +857,21 @@ Layer::DeprecatedGetEffectiveMixBlendMode()
|
||||
}
|
||||
|
||||
void
|
||||
Layer::ComputeEffectiveTransformForMaskLayers(const gfx::Matrix4x4& aTransformToSurface)
|
||||
Layer::ComputeEffectiveTransformForMaskLayer(const Matrix4x4& aTransformToSurface)
|
||||
{
|
||||
if (GetMaskLayer()) {
|
||||
ComputeEffectiveTransformForMaskLayer(GetMaskLayer(), aTransformToSurface);
|
||||
}
|
||||
for (size_t i = 0; i < GetAncestorMaskLayerCount(); i++) {
|
||||
Layer* maskLayer = GetAncestorMaskLayerAt(i);
|
||||
ComputeEffectiveTransformForMaskLayer(maskLayer, aTransformToSurface);
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
Layer::ComputeEffectiveTransformForMaskLayer(Layer* aMaskLayer, const gfx::Matrix4x4& aTransformToSurface)
|
||||
{
|
||||
aMaskLayer->mEffectiveTransform = aTransformToSurface;
|
||||
if (mMaskLayer) {
|
||||
mMaskLayer->mEffectiveTransform = aTransformToSurface;
|
||||
|
||||
#ifdef DEBUG
|
||||
bool maskIs2D = aMaskLayer->GetTransform().CanDraw2D();
|
||||
NS_ASSERTION(maskIs2D, "How did we end up with a 3D transform here?!");
|
||||
bool maskIs2D = mMaskLayer->GetTransform().CanDraw2D();
|
||||
NS_ASSERTION(maskIs2D, "How did we end up with a 3D transform here?!");
|
||||
#endif
|
||||
// The mask layer can have an async transform applied to it in some
|
||||
// situations, so be sure to use its GetLocalTransform() rather than
|
||||
// its GetTransform().
|
||||
aMaskLayer->mEffectiveTransform = aMaskLayer->GetLocalTransform() *
|
||||
aMaskLayer->mEffectiveTransform;
|
||||
// The mask layer can have an async transform applied to it in some
|
||||
// situations, so be sure to use its GetLocalTransform() rather than
|
||||
// its GetTransform().
|
||||
mMaskLayer->mEffectiveTransform = mMaskLayer->GetLocalTransform() *
|
||||
mMaskLayer->mEffectiveTransform;
|
||||
}
|
||||
}
|
||||
|
||||
RenderTargetRect
|
||||
@ -1200,7 +1190,7 @@ ContainerLayer::DefaultComputeEffectiveTransforms(const Matrix4x4& aTransformToS
|
||||
mEffectiveTransform = SnapTransformTranslation(idealTransform, &residual);
|
||||
|
||||
bool useIntermediateSurface;
|
||||
if (HasMaskLayers() ||
|
||||
if (GetMaskLayer() ||
|
||||
GetForceIsolatedGroup()) {
|
||||
useIntermediateSurface = true;
|
||||
#ifdef MOZ_DUMP_PAINTING
|
||||
@ -1229,7 +1219,7 @@ ContainerLayer::DefaultComputeEffectiveTransforms(const Matrix4x4& aTransformToS
|
||||
* Nor for a child with a mask layer.
|
||||
*/
|
||||
if ((clipRect && !clipRect->IsEmpty() && !child->GetVisibleRegion().IsEmpty()) ||
|
||||
child->HasMaskLayers()) {
|
||||
child->GetMaskLayer()) {
|
||||
useIntermediateSurface = true;
|
||||
break;
|
||||
}
|
||||
@ -1246,9 +1236,9 @@ ContainerLayer::DefaultComputeEffectiveTransforms(const Matrix4x4& aTransformToS
|
||||
}
|
||||
|
||||
if (idealTransform.CanDraw2D()) {
|
||||
ComputeEffectiveTransformForMaskLayers(aTransformToSurface);
|
||||
ComputeEffectiveTransformForMaskLayer(aTransformToSurface);
|
||||
} else {
|
||||
ComputeEffectiveTransformForMaskLayers(Matrix4x4());
|
||||
ComputeEffectiveTransformForMaskLayer(Matrix4x4());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1531,13 +1521,6 @@ Layer::Dump(std::stringstream& aStream, const char* aPrefix, bool aDumpHtml)
|
||||
mask->Dump(aStream, pfx.get(), aDumpHtml);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < GetAncestorMaskLayerCount(); i++) {
|
||||
aStream << nsPrintfCString("%s Ancestor mask layer %d:\n", aPrefix, uint32_t(i)).get();
|
||||
nsAutoCString pfx(aPrefix);
|
||||
pfx += " ";
|
||||
GetAncestorMaskLayerAt(i)->Dump(aStream, pfx.get(), aDumpHtml);
|
||||
}
|
||||
|
||||
#ifdef MOZ_DUMP_PAINTING
|
||||
for (size_t i = 0; i < mExtraDumpInfo.Length(); i++) {
|
||||
const nsCString& str = mExtraDumpInfo[i];
|
||||
|
@ -1058,18 +1058,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* CONSTRUCTION PHASE ONLY
|
||||
* Add a FrameMetrics-associated mask layer.
|
||||
*/
|
||||
void SetAncestorMaskLayers(const nsTArray<nsRefPtr<Layer>>& aLayers) {
|
||||
if (aLayers != mAncestorMaskLayers) {
|
||||
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) AncestorMaskLayers", this));
|
||||
mAncestorMaskLayers = aLayers;
|
||||
Mutated();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* CONSTRUCTION PHASE ONLY
|
||||
* Tell this layer what its transform should be. The transformation
|
||||
@ -1283,19 +1271,6 @@ public:
|
||||
bool IsScrollbarContainer() { return mIsScrollbarContainer; }
|
||||
Layer* GetMaskLayer() const { return mMaskLayer; }
|
||||
|
||||
// Ancestor mask layers are associated with FrameMetrics, but for simplicity
|
||||
// in maintaining the layer tree structure we attach them to the layer.
|
||||
size_t GetAncestorMaskLayerCount() const {
|
||||
return mAncestorMaskLayers.Length();
|
||||
}
|
||||
Layer* GetAncestorMaskLayerAt(size_t aIndex) const {
|
||||
return mAncestorMaskLayers.ElementAt(aIndex);
|
||||
}
|
||||
|
||||
bool HasMaskLayers() const {
|
||||
return GetMaskLayer() || mAncestorMaskLayers.Length() > 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the combined clip rect of the Layer clip and all clips on FrameMetrics.
|
||||
* This is intended for use in Layout. The compositor needs to apply async
|
||||
@ -1514,11 +1489,9 @@ public:
|
||||
virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) = 0;
|
||||
|
||||
/**
|
||||
* Computes the effective transform for mask layers, if this layer has any.
|
||||
* computes the effective transform for a mask layer, if this layer has one
|
||||
*/
|
||||
void ComputeEffectiveTransformForMaskLayers(const gfx::Matrix4x4& aTransformToSurface);
|
||||
static void ComputeEffectiveTransformForMaskLayer(Layer* aMaskLayer,
|
||||
const gfx::Matrix4x4& aTransformToSurface);
|
||||
void ComputeEffectiveTransformForMaskLayer(const gfx::Matrix4x4& aTransformToSurface);
|
||||
|
||||
/**
|
||||
* Calculate the scissor rect required when rendering this layer.
|
||||
@ -1722,7 +1695,6 @@ protected:
|
||||
Layer* mPrevSibling;
|
||||
void* mImplData;
|
||||
nsRefPtr<Layer> mMaskLayer;
|
||||
nsTArray<nsRefPtr<Layer>> mAncestorMaskLayers;
|
||||
gfx::UserData mUserData;
|
||||
gfx::IntRect mLayerBounds;
|
||||
nsIntRegion mVisibleRegion;
|
||||
@ -1834,7 +1806,7 @@ public:
|
||||
"Residual translation out of range");
|
||||
mValidRegion.SetEmpty();
|
||||
}
|
||||
ComputeEffectiveTransformForMaskLayers(aTransformToSurface);
|
||||
ComputeEffectiveTransformForMaskLayer(aTransformToSurface);
|
||||
}
|
||||
|
||||
LayerManager::PaintedLayerCreationHint GetCreationHint() const { return mCreationHint; }
|
||||
@ -2145,7 +2117,7 @@ public:
|
||||
{
|
||||
gfx::Matrix4x4 idealTransform = GetLocalTransform() * aTransformToSurface;
|
||||
mEffectiveTransform = SnapTransformTranslation(idealTransform, nullptr);
|
||||
ComputeEffectiveTransformForMaskLayers(aTransformToSurface);
|
||||
ComputeEffectiveTransformForMaskLayer(aTransformToSurface);
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -2297,7 +2269,7 @@ public:
|
||||
SnapTransform(GetLocalTransform(), gfxRect(0, 0, mBounds.width, mBounds.height),
|
||||
nullptr)*
|
||||
SnapTransformTranslation(aTransformToSurface, nullptr);
|
||||
ComputeEffectiveTransformForMaskLayers(aTransformToSurface);
|
||||
ComputeEffectiveTransformForMaskLayer(aTransformToSurface);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -73,11 +73,9 @@ FindBackgroundLayer(ReadbackLayer* aLayer, nsIntPoint* aOffset)
|
||||
return nullptr;
|
||||
|
||||
if (l->GetEffectiveOpacity() != 1.0 ||
|
||||
l->HasMaskLayers() ||
|
||||
l->GetMaskLayer() ||
|
||||
!(l->GetContentFlags() & Layer::CONTENT_OPAQUE))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// cliprects are post-transform
|
||||
const Maybe<ParentLayerIntRect>& clipRect = l->GetEffectiveClipRect();
|
||||
|
@ -2917,7 +2917,6 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri
|
||||
mFrameMetrics.SetLineScrollAmount(aLayerMetrics.GetLineScrollAmount());
|
||||
mFrameMetrics.SetPageScrollAmount(aLayerMetrics.GetPageScrollAmount());
|
||||
mFrameMetrics.SetClipRect(aLayerMetrics.GetClipRect());
|
||||
mFrameMetrics.SetMaskLayerIndex(aLayerMetrics.GetMaskLayerIndex());
|
||||
mFrameMetrics.SetIsLayersIdRoot(aLayerMetrics.IsLayersIdRoot());
|
||||
mFrameMetrics.SetUsesContainerScrolling(aLayerMetrics.UsesContainerScrolling());
|
||||
|
||||
|
@ -44,7 +44,7 @@ BasicContainerLayer::ComputeEffectiveTransforms(const Matrix4x4& aTransformToSur
|
||||
if (!idealTransform.CanDraw2D()) {
|
||||
mEffectiveTransform = idealTransform;
|
||||
ComputeEffectiveTransformsForChildren(Matrix4x4());
|
||||
ComputeEffectiveTransformForMaskLayers(Matrix4x4());
|
||||
ComputeEffectiveTransformForMaskLayer(Matrix4x4());
|
||||
mUseIntermediateSurface = true;
|
||||
return;
|
||||
}
|
||||
@ -54,7 +54,7 @@ BasicContainerLayer::ComputeEffectiveTransforms(const Matrix4x4& aTransformToSur
|
||||
// need to apply any compensation using the residual from SnapTransformTranslation.
|
||||
ComputeEffectiveTransformsForChildren(idealTransform);
|
||||
|
||||
ComputeEffectiveTransformForMaskLayers(aTransformToSurface);
|
||||
ComputeEffectiveTransformForMaskLayer(aTransformToSurface);
|
||||
|
||||
Layer* child = GetFirstChild();
|
||||
bool hasSingleBlendingChild = false;
|
||||
|
@ -86,7 +86,7 @@ public:
|
||||
mResidualTranslation = gfxPoint(0,0);
|
||||
mValidRegion.SetEmpty();
|
||||
}
|
||||
ComputeEffectiveTransformForMaskLayers(aTransformToSurface);
|
||||
ComputeEffectiveTransformForMaskLayer(aTransformToSurface);
|
||||
return;
|
||||
}
|
||||
PaintedLayer::ComputeEffectiveTransforms(aTransformToSurface);
|
||||
|
@ -133,7 +133,9 @@ ClientCanvasLayer::RenderLayer()
|
||||
PROFILER_LABEL("ClientCanvasLayer", "RenderLayer",
|
||||
js::ProfileEntry::Category::GRAPHICS);
|
||||
|
||||
RenderMaskLayers(this);
|
||||
if (GetMaskLayer()) {
|
||||
ToClientLayer(GetMaskLayer())->RenderLayer();
|
||||
}
|
||||
|
||||
if (!IsDirty()) {
|
||||
return;
|
||||
|
@ -43,7 +43,9 @@ public:
|
||||
|
||||
virtual void RenderLayer()
|
||||
{
|
||||
RenderMaskLayers(this);
|
||||
if (GetMaskLayer()) {
|
||||
ToClientLayer(GetMaskLayer())->RenderLayer();
|
||||
}
|
||||
}
|
||||
|
||||
virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
|
||||
|
@ -47,7 +47,9 @@ protected:
|
||||
public:
|
||||
virtual void RenderLayer() override
|
||||
{
|
||||
RenderMaskLayers(this);
|
||||
if (GetMaskLayer()) {
|
||||
ToClientLayer(GetMaskLayer())->RenderLayer();
|
||||
}
|
||||
|
||||
DefaultComputeSupportsComponentAlphaChildren();
|
||||
|
||||
|
@ -126,7 +126,9 @@ protected:
|
||||
void
|
||||
ClientImageLayer::RenderLayer()
|
||||
{
|
||||
RenderMaskLayers(this);
|
||||
if (GetMaskLayer()) {
|
||||
ToClientLayer(GetMaskLayer())->RenderLayer();
|
||||
}
|
||||
|
||||
if (!mContainer) {
|
||||
return;
|
||||
|
@ -390,16 +390,6 @@ public:
|
||||
{
|
||||
return static_cast<ClientLayer*>(aLayer->ImplData());
|
||||
}
|
||||
|
||||
template <typename LayerType>
|
||||
static inline void RenderMaskLayers(LayerType* aLayer) {
|
||||
if (aLayer->GetMaskLayer()) {
|
||||
ToClientLayer(aLayer->GetMaskLayer())->RenderLayer();
|
||||
}
|
||||
for (size_t i = 0; i < aLayer->GetAncestorMaskLayerCount(); i++) {
|
||||
ToClientLayer(aLayer->GetAncestorMaskLayerAt(i))->RenderLayer();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Create a shadow layer (PLayerChild) for aLayer, if we're forwarding
|
||||
|
@ -117,7 +117,9 @@ ClientPaintedLayer::PaintThebes()
|
||||
void
|
||||
ClientPaintedLayer::RenderLayerWithReadback(ReadbackProcessor *aReadback)
|
||||
{
|
||||
RenderMaskLayers(this);
|
||||
if (GetMaskLayer()) {
|
||||
ToClientLayer(GetMaskLayer())->RenderLayer();
|
||||
}
|
||||
|
||||
if (!mContentClient) {
|
||||
mContentClient = ContentClient::CreateContentClient(ClientManager()->AsShadowForwarder());
|
||||
|
@ -443,8 +443,10 @@ ClientTiledPaintedLayer::RenderLayer()
|
||||
}
|
||||
|
||||
if (!ClientManager()->IsRepeatTransaction()) {
|
||||
// Only paint the mask layers on the first transaction.
|
||||
RenderMaskLayers(this);
|
||||
// Only paint the mask layer on the first transaction.
|
||||
if (GetMaskLayer()) {
|
||||
ToClientLayer(GetMaskLayer())->RenderLayer();
|
||||
}
|
||||
|
||||
// For more complex cases we need to calculate a bunch of metrics before we
|
||||
// can do the paint.
|
||||
|
@ -614,18 +614,6 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer)
|
||||
// The final clip for the layer is the intersection of these clips.
|
||||
Maybe<ParentLayerIntRect> asyncClip = aLayer->GetClipRect();
|
||||
|
||||
// The transform of a mask layer is relative to the masked layer's parent
|
||||
// layer. So whenever we apply an async transform to a layer, we need to
|
||||
// apply that same transform to the layer's own mask layer.
|
||||
// A layer can also have "ancestor" mask layers for any rounded clips from
|
||||
// its ancestor scroll frames. A scroll frame mask layer only needs to be
|
||||
// async transformed for async scrolls of this scroll frame's ancestor
|
||||
// scroll frames, not for async scrolls of this scroll frame itself.
|
||||
// In the loop below, we iterate over scroll frames from inside to outside.
|
||||
// At each iteration, this array contains the layer's ancestor mask layers
|
||||
// of all scroll frames inside the current one.
|
||||
nsTArray<Layer*> ancestorMaskLayers;
|
||||
|
||||
for (uint32_t i = 0; i < aLayer->GetFrameMetricsCount(); i++) {
|
||||
AsyncPanZoomController* controller = aLayer->GetAsyncPanZoomController(i);
|
||||
if (!controller) {
|
||||
@ -688,21 +676,6 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer)
|
||||
}
|
||||
}
|
||||
|
||||
// Do the same for the ancestor mask layers: ancestorMaskLayers contains
|
||||
// the ancestor mask layers for scroll frames *inside* the current scroll
|
||||
// frame, so these are the ones we need to shift by our async transform.
|
||||
for (Layer* ancestorMaskLayer : ancestorMaskLayers) {
|
||||
SetShadowTransform(ancestorMaskLayer,
|
||||
ancestorMaskLayer->GetLocalTransform() * asyncTransform);
|
||||
}
|
||||
|
||||
// Append the ancestor mask layer for this scroll frame to ancestorMaskLayers.
|
||||
if (metrics.GetMaskLayerIndex()) {
|
||||
size_t maskLayerIndex = metrics.GetMaskLayerIndex().value();
|
||||
Layer* ancestorMaskLayer = aLayer->GetAncestorMaskLayerAt(maskLayerIndex);
|
||||
ancestorMaskLayers.AppendElement(ancestorMaskLayer);
|
||||
}
|
||||
|
||||
combinedAsyncTransformWithoutOverscroll *= asyncTransformWithoutOverscroll;
|
||||
combinedAsyncTransform *= asyncTransform;
|
||||
}
|
||||
@ -719,12 +692,6 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer)
|
||||
SetShadowTransform(aLayer,
|
||||
aLayer->GetLocalTransform() * AdjustForClip(combinedAsyncTransform, aLayer));
|
||||
|
||||
// Do the same for the layer's own mask layer, if it has one.
|
||||
if (Layer* maskLayer = aLayer->GetMaskLayer()) {
|
||||
SetShadowTransform(maskLayer,
|
||||
maskLayer->GetLocalTransform() * combinedAsyncTransform);
|
||||
}
|
||||
|
||||
const FrameMetrics& bottom = LayerMetricsWrapper::BottommostScrollableMetrics(aLayer);
|
||||
MOZ_ASSERT(bottom.IsScrollable()); // must be true because hasAsyncTransform is true
|
||||
|
||||
|
@ -95,15 +95,17 @@ CanvasLayerComposite::RenderLayer(const IntRect& aClipRect)
|
||||
}
|
||||
#endif
|
||||
|
||||
RenderWithAllMasks(this, mCompositor, aClipRect,
|
||||
[&](EffectChain& effectChain, const Rect& clipRect) {
|
||||
mCompositableHost->Composite(effectChain,
|
||||
GetEffectiveOpacity(),
|
||||
GetEffectiveTransform(),
|
||||
GetEffectFilter(),
|
||||
clipRect);
|
||||
});
|
||||
EffectChain effectChain(this);
|
||||
AddBlendModeEffect(effectChain);
|
||||
|
||||
LayerManagerComposite::AutoAddMaskEffect autoMaskEffect(mMaskLayer, effectChain);
|
||||
gfx::Rect clipRect(aClipRect.x, aClipRect.y, aClipRect.width, aClipRect.height);
|
||||
|
||||
mCompositableHost->Composite(effectChain,
|
||||
GetEffectiveOpacity(),
|
||||
GetEffectiveTransform(),
|
||||
GetEffectFilter(),
|
||||
clipRect);
|
||||
mCompositableHost->BumpFlashCounter();
|
||||
}
|
||||
|
||||
|
@ -21,17 +21,28 @@ namespace layers {
|
||||
void
|
||||
ColorLayerComposite::RenderLayer(const gfx::IntRect& aClipRect)
|
||||
{
|
||||
gfx::Rect rect(GetBounds());
|
||||
EffectChain effects(this);
|
||||
|
||||
GenEffectChain(effects);
|
||||
|
||||
gfx::IntRect boundRect = GetBounds();
|
||||
|
||||
LayerManagerComposite::AutoAddMaskEffect autoMaskEffect(GetMaskLayer(),
|
||||
effects);
|
||||
|
||||
gfx::Rect rect(boundRect.x, boundRect.y,
|
||||
boundRect.width, boundRect.height);
|
||||
gfx::Rect clipRect(aClipRect.x, aClipRect.y,
|
||||
aClipRect.width, aClipRect.height);
|
||||
|
||||
float opacity = GetEffectiveOpacity();
|
||||
|
||||
AddBlendModeEffect(effects);
|
||||
|
||||
const gfx::Matrix4x4& transform = GetEffectiveTransform();
|
||||
|
||||
RenderWithAllMasks(this, mCompositor, aClipRect,
|
||||
[&](EffectChain& effectChain, const Rect& clipRect) {
|
||||
GenEffectChain(effectChain);
|
||||
mCompositor->DrawQuad(rect, clipRect, effectChain, GetEffectiveOpacity(), transform);
|
||||
});
|
||||
|
||||
mCompositor->DrawQuad(rect, clipRect, effects, opacity, transform);
|
||||
mCompositor->DrawDiagnostics(DiagnosticFlags::COLOR,
|
||||
rect, Rect(aClipRect),
|
||||
rect, clipRect,
|
||||
transform);
|
||||
}
|
||||
|
||||
|
@ -513,24 +513,34 @@ ContainerRender(ContainerT* aContainer,
|
||||
return;
|
||||
}
|
||||
|
||||
gfx::Rect visibleRect(aContainer->GetEffectiveVisibleRegion().GetBounds());
|
||||
Compositor* compositor = aManager->GetCompositor();
|
||||
float opacity = aContainer->GetEffectiveOpacity();
|
||||
|
||||
gfx::IntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds();
|
||||
#ifdef MOZ_DUMP_PAINTING
|
||||
if (gfxUtils::sDumpPainting) {
|
||||
RefPtr<gfx::DataSourceSurface> surf = surface->Dump(compositor);
|
||||
RefPtr<gfx::DataSourceSurface> surf = surface->Dump(aManager->GetCompositor());
|
||||
if (surf) {
|
||||
WriteSnapshotToDumpFile(aContainer, surf);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
RenderWithAllMasks(aContainer, compositor, aClipRect,
|
||||
[&](EffectChain& effectChain, const Rect& clipRect) {
|
||||
effectChain.mPrimaryEffect = new EffectRenderTarget(surface);
|
||||
compositor->DrawQuad(visibleRect, clipRect, effectChain,
|
||||
aContainer->GetEffectiveOpacity(),
|
||||
aContainer->GetEffectiveTransform());
|
||||
});
|
||||
EffectChain effectChain(aContainer);
|
||||
LayerManagerComposite::AutoAddMaskEffect autoMaskEffect(aContainer->GetMaskLayer(),
|
||||
effectChain,
|
||||
!aContainer->GetTransform().CanDraw2D());
|
||||
if (autoMaskEffect.Failed()) {
|
||||
NS_WARNING("Failed to apply a mask effect.");
|
||||
return;
|
||||
}
|
||||
|
||||
aContainer->AddBlendModeEffect(effectChain);
|
||||
effectChain.mPrimaryEffect = new EffectRenderTarget(surface);
|
||||
|
||||
gfx::Rect rect(visibleRect.x, visibleRect.y, visibleRect.width, visibleRect.height);
|
||||
gfx::Rect clipRect(aClipRect.x, aClipRect.y, aClipRect.width, aClipRect.height);
|
||||
aManager->GetCompositor()->DrawQuad(rect, clipRect, effectChain, opacity,
|
||||
aContainer->GetEffectiveTransform());
|
||||
} else {
|
||||
RenderLayers(aContainer, aManager, RenderTargetPixel::FromUntyped(aClipRect));
|
||||
}
|
||||
|
@ -95,15 +95,17 @@ ImageLayerComposite::RenderLayer(const IntRect& aClipRect)
|
||||
|
||||
mCompositor->MakeCurrent();
|
||||
|
||||
RenderWithAllMasks(this, mCompositor, aClipRect,
|
||||
[&](EffectChain& effectChain, const Rect& clipRect) {
|
||||
mImageHost->SetCompositor(mCompositor);
|
||||
mImageHost->Composite(effectChain,
|
||||
GetEffectiveOpacity(),
|
||||
GetEffectiveTransformForBuffer(),
|
||||
GetEffectFilter(),
|
||||
clipRect);
|
||||
});
|
||||
EffectChain effectChain(this);
|
||||
LayerManagerComposite::AutoAddMaskEffect autoMaskEffect(mMaskLayer, effectChain);
|
||||
AddBlendModeEffect(effectChain);
|
||||
|
||||
gfx::Rect clipRect(aClipRect.x, aClipRect.y, aClipRect.width, aClipRect.height);
|
||||
mImageHost->SetCompositor(mCompositor);
|
||||
mImageHost->Composite(effectChain,
|
||||
GetEffectiveOpacity(),
|
||||
GetEffectiveTransformForBuffer(),
|
||||
GetEffectFilter(),
|
||||
clipRect);
|
||||
mImageHost->BumpFlashCounter();
|
||||
}
|
||||
|
||||
@ -141,7 +143,7 @@ ImageLayerComposite::ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransform
|
||||
mEffectiveTransformForBuffer = mEffectiveTransform;
|
||||
}
|
||||
|
||||
ComputeEffectiveTransformForMaskLayers(aTransformToSurface);
|
||||
ComputeEffectiveTransformForMaskLayer(aTransformToSurface);
|
||||
}
|
||||
|
||||
CompositableHost*
|
||||
|
@ -234,7 +234,7 @@ LayerManagerComposite::ApplyOcclusionCulling(Layer* aLayer, nsIntRegion& aOpaque
|
||||
// If we have a simple transform, then we can add our opaque area into
|
||||
// aOpaqueRegion.
|
||||
if (isTranslation &&
|
||||
!aLayer->HasMaskLayers() &&
|
||||
!aLayer->GetMaskLayer() &&
|
||||
aLayer->GetLocalOpacity() == 1.0f) {
|
||||
if (aLayer->GetContentFlags() & Layer::CONTENT_OPAQUE) {
|
||||
localOpaque.Or(localOpaque, composite->GetFullyRenderedRegion());
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "mozilla/gfx/Rect.h" // for Rect
|
||||
#include "mozilla/gfx/Types.h" // for SurfaceFormat
|
||||
#include "mozilla/layers/CompositorTypes.h"
|
||||
#include "mozilla/layers/Effects.h" // for EffectChain
|
||||
#include "mozilla/layers/LayersTypes.h" // for LayersBackend, etc
|
||||
#include "mozilla/Maybe.h" // for Maybe
|
||||
#include "mozilla/RefPtr.h"
|
||||
@ -458,138 +457,6 @@ protected:
|
||||
gfx::IntRect mClearRect;
|
||||
};
|
||||
|
||||
// Render aLayer using aCompositor and apply all mask layers of aLayer: The
|
||||
// layer's own mask layer (aLayer->GetMaskLayer()), and any ancestor mask
|
||||
// layers.
|
||||
// If more than one mask layer needs to be applied, we use intermediate surfaces
|
||||
// (CompositingRenderTargets) for rendering, applying one mask layer at a time.
|
||||
// Callers need to provide a callback function aRenderCallback that does the
|
||||
// actual rendering of the source. It needs to have the following form:
|
||||
// void (EffectChain& effectChain, const Rect& clipRect)
|
||||
// aRenderCallback is called exactly once, inside this function, unless aLayer's
|
||||
// visible region is completely clipped out (in that case, aRenderCallback won't
|
||||
// be called at all).
|
||||
// This function calls aLayer->AsLayerComposite()->AddBlendModeEffect for the
|
||||
// final rendering pass.
|
||||
//
|
||||
// (This function should really live in LayerManagerComposite.cpp, but we
|
||||
// need to use templates for passing lambdas until bug 1164522 is resolved.)
|
||||
template<typename RenderCallbackType>
|
||||
void
|
||||
RenderWithAllMasks(Layer* aLayer, Compositor* aCompositor,
|
||||
const gfx::IntRect& aClipRect,
|
||||
RenderCallbackType aRenderCallback)
|
||||
{
|
||||
Layer* firstMask = nullptr;
|
||||
size_t maskLayerCount = 0;
|
||||
size_t nextAncestorMaskLayer = 0;
|
||||
|
||||
size_t ancestorMaskLayerCount = aLayer->GetAncestorMaskLayerCount();
|
||||
if (Layer* ownMask = aLayer->GetMaskLayer()) {
|
||||
firstMask = ownMask;
|
||||
maskLayerCount = ancestorMaskLayerCount + 1;
|
||||
nextAncestorMaskLayer = 0;
|
||||
} else if (ancestorMaskLayerCount > 0) {
|
||||
firstMask = aLayer->GetAncestorMaskLayerAt(0);
|
||||
maskLayerCount = ancestorMaskLayerCount;
|
||||
nextAncestorMaskLayer = 1;
|
||||
} else {
|
||||
// no mask layers at all
|
||||
}
|
||||
|
||||
bool firstMaskIs3D = false;
|
||||
if (ContainerLayer* container = aLayer->AsContainerLayer()) {
|
||||
firstMaskIs3D = !container->GetTransform().CanDraw2D();
|
||||
}
|
||||
|
||||
if (maskLayerCount <= 1) {
|
||||
// This is the common case. Render in one pass and return.
|
||||
EffectChain effectChain(aLayer);
|
||||
LayerManagerComposite::AutoAddMaskEffect
|
||||
autoMaskEffect(firstMask, effectChain, firstMaskIs3D);
|
||||
aLayer->AsLayerComposite()->AddBlendModeEffect(effectChain);
|
||||
aRenderCallback(effectChain, gfx::Rect(aClipRect));
|
||||
return;
|
||||
}
|
||||
|
||||
// We have multiple mask layers.
|
||||
// We split our list of mask layers into three parts:
|
||||
// (1) The first mask
|
||||
// (2) The list of intermediate masks (every mask except first and last)
|
||||
// (3) The final mask.
|
||||
// Part (2) can be empty.
|
||||
// For parts (1) and (2) we need to allocate intermediate surfaces to render
|
||||
// into. The final mask gets rendered into the original render target.
|
||||
|
||||
// Calculate the size of the intermediate surfaces.
|
||||
gfx::Rect visibleRect(aLayer->GetEffectiveVisibleRegion().GetBounds());
|
||||
gfx::Matrix4x4 transform = aLayer->GetEffectiveTransform();
|
||||
// TODO: Use RenderTargetIntRect and TransformTo<...> here
|
||||
gfx::IntRect surfaceRect =
|
||||
RoundedOut(transform.TransformBounds(visibleRect)).Intersect(aClipRect);
|
||||
if (surfaceRect.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<CompositingRenderTarget> originalTarget =
|
||||
aCompositor->GetCurrentRenderTarget();
|
||||
|
||||
RefPtr<CompositingRenderTarget> firstTarget =
|
||||
aCompositor->CreateRenderTarget(surfaceRect, INIT_MODE_CLEAR);
|
||||
if (!firstTarget) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Render the source while applying the first mask.
|
||||
aCompositor->SetRenderTarget(firstTarget);
|
||||
{
|
||||
EffectChain firstEffectChain(aLayer);
|
||||
LayerManagerComposite::AutoAddMaskEffect
|
||||
firstMaskEffect(firstMask, firstEffectChain, firstMaskIs3D);
|
||||
aRenderCallback(firstEffectChain, gfx::Rect(aClipRect - surfaceRect.TopLeft()));
|
||||
// firstTarget now contains the transformed source with the first mask and
|
||||
// opacity already applied.
|
||||
}
|
||||
|
||||
// Apply the intermediate masks.
|
||||
gfx::Rect intermediateClip(surfaceRect - surfaceRect.TopLeft());
|
||||
RefPtr<CompositingRenderTarget> previousTarget = firstTarget;
|
||||
for (size_t i = nextAncestorMaskLayer; i < ancestorMaskLayerCount - 1; i++) {
|
||||
Layer* intermediateMask = aLayer->GetAncestorMaskLayerAt(i);
|
||||
RefPtr<CompositingRenderTarget> intermediateTarget =
|
||||
aCompositor->CreateRenderTarget(surfaceRect, INIT_MODE_CLEAR);
|
||||
if (!intermediateTarget) {
|
||||
break;
|
||||
}
|
||||
aCompositor->SetRenderTarget(intermediateTarget);
|
||||
EffectChain intermediateEffectChain(aLayer);
|
||||
LayerManagerComposite::AutoAddMaskEffect
|
||||
intermediateMaskEffect(intermediateMask, intermediateEffectChain);
|
||||
if (intermediateMaskEffect.Failed()) {
|
||||
continue;
|
||||
}
|
||||
intermediateEffectChain.mPrimaryEffect = new EffectRenderTarget(previousTarget);
|
||||
aCompositor->DrawQuad(gfx::Rect(surfaceRect), intermediateClip,
|
||||
intermediateEffectChain, 1.0, gfx::Matrix4x4());
|
||||
previousTarget = intermediateTarget;
|
||||
}
|
||||
|
||||
aCompositor->SetRenderTarget(originalTarget);
|
||||
|
||||
// Apply the final mask, rendering into originalTarget.
|
||||
EffectChain finalEffectChain(aLayer);
|
||||
finalEffectChain.mPrimaryEffect = new EffectRenderTarget(previousTarget);
|
||||
Layer* finalMask = aLayer->GetAncestorMaskLayerAt(ancestorMaskLayerCount - 1);
|
||||
|
||||
// The blend mode needs to be applied in this final step, because this is
|
||||
// where we're blending with the actual background (which is in originalTarget).
|
||||
aLayer->AsLayerComposite()->AddBlendModeEffect(finalEffectChain);
|
||||
LayerManagerComposite::AutoAddMaskEffect autoMaskEffect(finalMask, finalEffectChain);
|
||||
if (!autoMaskEffect.Failed()) {
|
||||
aCompositor->DrawQuad(gfx::Rect(surfaceRect), gfx::Rect(aClipRect),
|
||||
finalEffectChain, 1.0, gfx::Matrix4x4());
|
||||
}
|
||||
}
|
||||
|
||||
} /* layers */
|
||||
} /* mozilla */
|
||||
|
@ -119,13 +119,12 @@ PaintedLayerComposite::RenderLayer(const gfx::IntRect& aClipRect)
|
||||
PROFILER_LABEL("PaintedLayerComposite", "RenderLayer",
|
||||
js::ProfileEntry::Category::GRAPHICS);
|
||||
|
||||
Compositor* compositor = mCompositeManager->GetCompositor();
|
||||
|
||||
MOZ_ASSERT(mBuffer->GetCompositor() == compositor &&
|
||||
MOZ_ASSERT(mBuffer->GetCompositor() == mCompositeManager->GetCompositor() &&
|
||||
mBuffer->GetLayer() == this,
|
||||
"buffer is corrupted");
|
||||
|
||||
const nsIntRegion& visibleRegion = GetEffectiveVisibleRegion();
|
||||
gfx::Rect clipRect(aClipRect.x, aClipRect.y, aClipRect.width, aClipRect.height);
|
||||
|
||||
#ifdef MOZ_DUMP_PAINTING
|
||||
if (gfxUtils::sDumpPainting) {
|
||||
@ -136,22 +135,21 @@ PaintedLayerComposite::RenderLayer(const gfx::IntRect& aClipRect)
|
||||
}
|
||||
#endif
|
||||
|
||||
EffectChain effectChain(this);
|
||||
LayerManagerComposite::AutoAddMaskEffect autoMaskEffect(mMaskLayer, effectChain);
|
||||
AddBlendModeEffect(effectChain);
|
||||
|
||||
RenderWithAllMasks(this, compositor, aClipRect,
|
||||
[&](EffectChain& effectChain, const Rect& clipRect) {
|
||||
mBuffer->SetPaintWillResample(MayResample());
|
||||
|
||||
mBuffer->Composite(effectChain,
|
||||
GetEffectiveOpacity(),
|
||||
GetEffectiveTransform(),
|
||||
GetEffectFilter(),
|
||||
clipRect,
|
||||
&visibleRegion);
|
||||
});
|
||||
mBuffer->SetPaintWillResample(MayResample());
|
||||
|
||||
mBuffer->Composite(effectChain,
|
||||
GetEffectiveOpacity(),
|
||||
GetEffectiveTransform(),
|
||||
GetEffectFilter(),
|
||||
clipRect,
|
||||
&visibleRegion);
|
||||
mBuffer->BumpFlashCounter();
|
||||
|
||||
compositor->MakeCurrent();
|
||||
mCompositeManager->GetCompositor()->MakeCurrent();
|
||||
}
|
||||
|
||||
CompositableHost*
|
||||
|
@ -1071,9 +1071,6 @@ CompositorParent::SetShadowProperties(Layer* aLayer)
|
||||
if (Layer* maskLayer = aLayer->GetMaskLayer()) {
|
||||
SetShadowProperties(maskLayer);
|
||||
}
|
||||
for (size_t i = 0; i < aLayer->GetAncestorMaskLayerCount(); i++) {
|
||||
SetShadowProperties(aLayer->GetAncestorMaskLayerAt(i));
|
||||
}
|
||||
|
||||
// FIXME: Bug 717688 -- Do these updates in LayerTransactionParent::RecvUpdate.
|
||||
LayerComposite* layerComposite = aLayer->AsLayerComposite();
|
||||
|
@ -352,13 +352,6 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
|
||||
layer->SetInvalidRegion(common.invalidRegion());
|
||||
layer->SetFrameMetrics(common.metrics());
|
||||
|
||||
nsTArray<nsRefPtr<Layer>> maskLayers;
|
||||
for (size_t i = 0; i < common.ancestorMaskLayersParent().Length(); i++) {
|
||||
Layer* maskLayer = cast(common.ancestorMaskLayersParent().ElementAt(i))->AsLayer();
|
||||
maskLayers.AppendElement(maskLayer);
|
||||
}
|
||||
layer->SetAncestorMaskLayers(maskLayers);
|
||||
|
||||
typedef SpecificLayerAttributes Specific;
|
||||
const SpecificLayerAttributes& specific = attrs.specific();
|
||||
switch (specific.type()) {
|
||||
|
@ -225,7 +225,6 @@ struct CommonLayerAttributes {
|
||||
int8_t mixBlendMode;
|
||||
bool forceIsolatedGroup;
|
||||
nullable PLayer maskLayer;
|
||||
PLayer[] ancestorMaskLayers;
|
||||
// Animated colors will only honored for ColorLayers.
|
||||
Animation[] animations;
|
||||
nsIntRegion invalidRegion;
|
||||
|
@ -607,10 +607,6 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
|
||||
common.animations() = mutant->GetAnimations();
|
||||
common.invalidRegion() = mutant->GetInvalidRegion();
|
||||
common.metrics() = mutant->GetAllFrameMetrics();
|
||||
for (size_t i = 0; i < mutant->GetAncestorMaskLayerCount(); i++) {
|
||||
auto layer = Shadow(mutant->GetAncestorMaskLayerAt(i)->AsShadowableLayer());
|
||||
common.ancestorMaskLayersChild().AppendElement(layer);
|
||||
}
|
||||
attrs.specific() = null_t();
|
||||
mutant->FillSpecificAttributes(attrs.specific());
|
||||
|
||||
|
@ -1088,14 +1088,8 @@ protected:
|
||||
* Grab a recyclable ImageLayer for use as a mask layer for aLayer (that is a
|
||||
* mask layer which has been used for aLayer before), or create one if such
|
||||
* a layer doesn't exist.
|
||||
*
|
||||
* Since mask layers can exist either on the layer directly, or as a side-
|
||||
* attachment to FrameMetrics (for ancestor scrollframe clips), we key the
|
||||
* recycle operation on both the originating layer and the mask layer's
|
||||
* index in the layer, if any.
|
||||
*/
|
||||
struct MaskLayerKey;
|
||||
already_AddRefed<ImageLayer> CreateOrRecycleMaskImageLayerFor(const MaskLayerKey& aKey);
|
||||
already_AddRefed<ImageLayer> CreateOrRecycleMaskImageLayerFor(Layer* aLayer);
|
||||
/**
|
||||
* Grabs all PaintedLayers and ColorLayers from the ContainerLayer and makes them
|
||||
* available for recycling.
|
||||
@ -1197,12 +1191,6 @@ protected:
|
||||
const nsIntRegion& aLayerVisibleRegion,
|
||||
uint32_t aRoundedRectClipCount = UINT32_MAX);
|
||||
|
||||
already_AddRefed<Layer> CreateMaskLayer(
|
||||
Layer *aLayer, const DisplayItemClip& aClip,
|
||||
const nsIntRegion& aLayerVisibleRegion,
|
||||
const Maybe<size_t>& aForAncestorMaskLayer,
|
||||
uint32_t aRoundedRectClipCount = UINT32_MAX);
|
||||
|
||||
bool ChooseAnimatedGeometryRoot(const nsDisplayList& aList,
|
||||
const nsIFrame **aAnimatedGeometryRoot);
|
||||
|
||||
@ -1235,33 +1223,11 @@ protected:
|
||||
typedef nsAutoTArray<NewLayerEntry,1> AutoLayersArray;
|
||||
AutoLayersArray mNewChildLayers;
|
||||
nsTHashtable<nsRefPtrHashKey<PaintedLayer>> mPaintedLayersAvailableForRecycling;
|
||||
nsDataHashtable<nsPtrHashKey<Layer>, nsRefPtr<ImageLayer> >
|
||||
mRecycledMaskImageLayers;
|
||||
nscoord mAppUnitsPerDevPixel;
|
||||
bool mSnappingEnabled;
|
||||
bool mFlattenToSingleLayer;
|
||||
|
||||
struct MaskLayerKey {
|
||||
MaskLayerKey() : mLayer(nullptr) {}
|
||||
MaskLayerKey(Layer* aLayer, const Maybe<size_t>& aAncestorIndex)
|
||||
: mLayer(aLayer),
|
||||
mAncestorIndex(aAncestorIndex)
|
||||
{}
|
||||
|
||||
PLDHashNumber Hash() const {
|
||||
// Hash the layer and add the layer index to the hash.
|
||||
return (NS_PTR_TO_UINT32(mLayer) >> 2)
|
||||
+ (mAncestorIndex ? (*mAncestorIndex + 1) : 0);
|
||||
}
|
||||
bool operator ==(const MaskLayerKey& aOther) const {
|
||||
return mLayer == aOther.mLayer &&
|
||||
mAncestorIndex == aOther.mAncestorIndex;
|
||||
}
|
||||
|
||||
Layer* mLayer;
|
||||
Maybe<size_t> mAncestorIndex;
|
||||
};
|
||||
|
||||
nsDataHashtable<nsGenericHashKey<MaskLayerKey>, nsRefPtr<ImageLayer>>
|
||||
mRecycledMaskImageLayers;
|
||||
};
|
||||
|
||||
class PaintedDisplayItemLayerUserData : public LayerUserData
|
||||
@ -1961,12 +1927,12 @@ ContainerState::CreateOrRecycleImageLayer(PaintedLayer *aPainted)
|
||||
}
|
||||
|
||||
already_AddRefed<ImageLayer>
|
||||
ContainerState::CreateOrRecycleMaskImageLayerFor(const MaskLayerKey& aKey)
|
||||
ContainerState::CreateOrRecycleMaskImageLayerFor(Layer* aLayer)
|
||||
{
|
||||
nsRefPtr<ImageLayer> result = mRecycledMaskImageLayers.Get(aKey);
|
||||
nsRefPtr<ImageLayer> result = mRecycledMaskImageLayers.Get(aLayer);
|
||||
if (result) {
|
||||
mRecycledMaskImageLayers.Remove(aKey);
|
||||
aKey.mLayer->ClearExtraDumpInfo();
|
||||
mRecycledMaskImageLayers.Remove(aLayer);
|
||||
aLayer->ClearExtraDumpInfo();
|
||||
// XXX if we use clip on mask layers, null it out here
|
||||
} else {
|
||||
// Create a new layer
|
||||
@ -4354,14 +4320,7 @@ ContainerState::CollectOldLayers()
|
||||
if (Layer* maskLayer = layer->GetMaskLayer()) {
|
||||
NS_ASSERTION(maskLayer->GetType() == Layer::TYPE_IMAGE,
|
||||
"Could not recycle mask layer, unsupported layer type.");
|
||||
mRecycledMaskImageLayers.Put(MaskLayerKey(layer, Nothing()), static_cast<ImageLayer*>(maskLayer));
|
||||
}
|
||||
for (size_t i = 0; i < layer->GetAncestorMaskLayerCount(); i++) {
|
||||
Layer* maskLayer = layer->GetAncestorMaskLayerAt(i);
|
||||
|
||||
NS_ASSERTION(maskLayer->GetType() == Layer::TYPE_IMAGE,
|
||||
"Could not recycle mask layer, unsupported layer type.");
|
||||
mRecycledMaskImageLayers.Put(MaskLayerKey(layer, Some(i)), static_cast<ImageLayer*>(maskLayer));
|
||||
mRecycledMaskImageLayers.Put(layer, static_cast<ImageLayer*>(maskLayer));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4399,16 +4358,9 @@ ContainerState::SetupScrollingMetadata(NewLayerEntry* aEntry)
|
||||
nsAutoTArray<FrameMetrics,2> metricsArray;
|
||||
if (aEntry->mBaseFrameMetrics) {
|
||||
metricsArray.AppendElement(*aEntry->mBaseFrameMetrics);
|
||||
|
||||
// The base FrameMetrics was not computed by the nsIScrollableframe, so it
|
||||
// should not have a mask layer.
|
||||
MOZ_ASSERT(!aEntry->mBaseFrameMetrics->GetMaskLayerIndex());
|
||||
}
|
||||
uint32_t baseLength = metricsArray.Length();
|
||||
|
||||
// Any extra mask layers we need to attach to FrameMetrics.
|
||||
nsTArray<nsRefPtr<Layer>> maskLayers;
|
||||
|
||||
nsIFrame* fParent;
|
||||
for (const nsIFrame* f = aEntry->mAnimatedGeometryRoot;
|
||||
f != mContainerAnimatedGeometryRoot;
|
||||
@ -4433,38 +4385,11 @@ ContainerState::SetupScrollingMetadata(NewLayerEntry* aEntry)
|
||||
continue;
|
||||
}
|
||||
|
||||
Maybe<FrameMetricsAndClip> info =
|
||||
scrollFrame->ComputeFrameMetrics(aEntry->mLayer, mContainerReferenceFrame, mParameters);
|
||||
if (!info) {
|
||||
continue;
|
||||
}
|
||||
|
||||
FrameMetrics& metrics = info->metrics;
|
||||
const DisplayItemClip* clip = info->clip;
|
||||
|
||||
if (clip &&
|
||||
clip->HasClip() &&
|
||||
clip->GetRoundedRectCount() > 0)
|
||||
{
|
||||
// The clip in between this scrollframe and its ancestor scrollframe
|
||||
// requires a mask layer. Since this mask layer should not move with
|
||||
// the APZC associated with this FrameMetrics, we attach the mask
|
||||
// layer as an additional, separate clip.
|
||||
Maybe<size_t> nextIndex = Some(maskLayers.Length());
|
||||
nsRefPtr<Layer> maskLayer =
|
||||
CreateMaskLayer(aEntry->mLayer, *clip, aEntry->mVisibleRegion, nextIndex, clip->GetRoundedRectCount());
|
||||
if (maskLayer) {
|
||||
metrics.SetMaskLayerIndex(nextIndex);
|
||||
maskLayers.AppendElement(maskLayer);
|
||||
}
|
||||
}
|
||||
|
||||
metricsArray.AppendElement(metrics);
|
||||
scrollFrame->ComputeFrameMetrics(aEntry->mLayer, mContainerReferenceFrame,
|
||||
mParameters, &metricsArray);
|
||||
}
|
||||
|
||||
// Watch out for FrameMetrics copies in profiles
|
||||
aEntry->mLayer->SetFrameMetrics(metricsArray);
|
||||
aEntry->mLayer->SetAncestorMaskLayers(maskLayers);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -5712,28 +5637,8 @@ ContainerState::SetupMaskLayer(Layer *aLayer,
|
||||
return;
|
||||
}
|
||||
|
||||
nsRefPtr<Layer> maskLayer =
|
||||
CreateMaskLayer(aLayer, aClip, aLayerVisibleRegion, Nothing(), aRoundedRectClipCount);
|
||||
|
||||
if (!maskLayer) {
|
||||
SetClipCount(paintedData, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
aLayer->SetMaskLayer(maskLayer);
|
||||
SetClipCount(paintedData, aRoundedRectClipCount);
|
||||
}
|
||||
|
||||
already_AddRefed<Layer>
|
||||
ContainerState::CreateMaskLayer(Layer *aLayer,
|
||||
const DisplayItemClip& aClip,
|
||||
const nsIntRegion& aLayerVisibleRegion,
|
||||
const Maybe<size_t>& aForAncestorMaskLayer,
|
||||
uint32_t aRoundedRectClipCount)
|
||||
{
|
||||
// check if we can re-use the mask layer
|
||||
MaskLayerKey recycleKey(aLayer, aForAncestorMaskLayer);
|
||||
nsRefPtr<ImageLayer> maskLayer = CreateOrRecycleMaskImageLayerFor(recycleKey);
|
||||
nsRefPtr<ImageLayer> maskLayer = CreateOrRecycleMaskImageLayerFor(aLayer);
|
||||
MaskLayerUserData* userData = GetMaskLayerUserData(maskLayer);
|
||||
|
||||
MaskLayerUserData newData;
|
||||
@ -5744,7 +5649,9 @@ ContainerState::CreateMaskLayer(Layer *aLayer,
|
||||
newData.mAppUnitsPerDevPixel = mContainerFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
|
||||
if (*userData == newData) {
|
||||
return maskLayer.forget();
|
||||
aLayer->SetMaskLayer(maskLayer);
|
||||
SetClipCount(paintedData, aRoundedRectClipCount);
|
||||
return;
|
||||
}
|
||||
|
||||
// calculate a more precise bounding rect
|
||||
@ -5797,7 +5704,8 @@ ContainerState::CreateMaskLayer(Layer *aLayer,
|
||||
// fail if we can't get the right surface
|
||||
if (!dt) {
|
||||
NS_WARNING("Could not create DrawTarget for mask layer.");
|
||||
return nullptr;
|
||||
SetClipCount(paintedData, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
nsRefPtr<gfxContext> context = new gfxContext(dt);
|
||||
@ -5842,7 +5750,9 @@ ContainerState::CreateMaskLayer(Layer *aLayer,
|
||||
userData->mRoundedClipRects.SwapElements(newData.mRoundedClipRects);
|
||||
userData->mImageKey = lookupKey;
|
||||
|
||||
return maskLayer.forget();
|
||||
aLayer->SetMaskLayer(maskLayer);
|
||||
SetClipCount(paintedData, aRoundedRectClipCount);
|
||||
return;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -2942,18 +2942,6 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
? nsLayoutUtils::FindOrCreateIDFor(mScrolledFrame->GetContent())
|
||||
: aBuilder->GetCurrentScrollParentId());
|
||||
DisplayListClipState::AutoSaveRestore clipState(aBuilder);
|
||||
if (!mIsRoot || !usingDisplayport) {
|
||||
nsRect clip = mScrollPort + aBuilder->ToReferenceFrame(mOuter);
|
||||
nscoord radii[8];
|
||||
bool haveRadii = mOuter->GetPaddingBoxBorderRadii(radii);
|
||||
// Our override of GetBorderRadii ensures we never have a radius at
|
||||
// the corners where we have a scrollbar.
|
||||
if (mClipAllDescendants) {
|
||||
clipState.ClipContentDescendants(clip, haveRadii ? radii : nullptr);
|
||||
} else {
|
||||
clipState.ClipContainingBlockDescendants(clip, haveRadii ? radii : nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
if (usingDisplayport) {
|
||||
// Capture the clip state of the parent scroll frame. This will be saved
|
||||
@ -2974,6 +2962,17 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
// the entire displayport, but it lets the compositor know to
|
||||
// clip to the scroll port after compositing.
|
||||
clipState.Clear();
|
||||
} else {
|
||||
nsRect clip = mScrollPort + aBuilder->ToReferenceFrame(mOuter);
|
||||
nscoord radii[8];
|
||||
bool haveRadii = mOuter->GetPaddingBoxBorderRadii(radii);
|
||||
// Our override of GetBorderRadii ensures we never have a radius at
|
||||
// the corners where we have a scrollbar.
|
||||
if (mClipAllDescendants) {
|
||||
clipState.ClipContentDescendants(clip, haveRadii ? radii : nullptr);
|
||||
} else {
|
||||
clipState.ClipContainingBlockDescendants(clip, haveRadii ? radii : nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
aBuilder->StoreDirtyRectForScrolledContents(mOuter, dirtyRect);
|
||||
@ -3053,13 +3052,14 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
scrolledContent.MoveTo(aLists);
|
||||
}
|
||||
|
||||
Maybe<FrameMetricsAndClip>
|
||||
void
|
||||
ScrollFrameHelper::ComputeFrameMetrics(Layer* aLayer,
|
||||
nsIFrame* aContainerReferenceFrame,
|
||||
const ContainerLayerParameters& aParameters) const
|
||||
const ContainerLayerParameters& aParameters,
|
||||
nsTArray<FrameMetrics>* aOutput) const
|
||||
{
|
||||
if (!mShouldBuildScrollableLayer || mIsScrollableLayerInRootContainer) {
|
||||
return Nothing();
|
||||
return;
|
||||
}
|
||||
|
||||
bool needsParentLayerClip = true;
|
||||
@ -3117,21 +3117,17 @@ ScrollFrameHelper::ComputeFrameMetrics(Layer* aLayer,
|
||||
}
|
||||
|
||||
// Return early, since if we don't use APZ we don't need FrameMetrics.
|
||||
return Nothing();
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mScrolledFrame->GetContent());
|
||||
|
||||
FrameMetricsAndClip result;
|
||||
|
||||
nsRect scrollport = mScrollPort + toReferenceFrame;
|
||||
result.metrics = nsLayoutUtils::ComputeFrameMetrics(
|
||||
mScrolledFrame, mOuter, mOuter->GetContent(),
|
||||
aContainerReferenceFrame, aLayer, mScrollParentID,
|
||||
scrollport, parentLayerClip, isRootContent, aParameters);
|
||||
result.clip = mAncestorClip;
|
||||
|
||||
return Some(result);
|
||||
*aOutput->AppendElement() =
|
||||
nsLayoutUtils::ComputeFrameMetrics(
|
||||
mScrolledFrame, mOuter, mOuter->GetContent(),
|
||||
aContainerReferenceFrame, aLayer, mScrollParentID,
|
||||
scrollport, parentLayerClip, isRootContent, aParameters);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -377,9 +377,9 @@ public:
|
||||
}
|
||||
}
|
||||
bool WantAsyncScroll() const;
|
||||
Maybe<FrameMetricsAndClip> ComputeFrameMetrics(
|
||||
Layer* aLayer, nsIFrame* aContainerReferenceFrame,
|
||||
const ContainerLayerParameters& aParameters) const;
|
||||
void ComputeFrameMetrics(Layer* aLayer, nsIFrame* aContainerReferenceFrame,
|
||||
const ContainerLayerParameters& aParameters,
|
||||
nsTArray<FrameMetrics>* aOutput) const;
|
||||
|
||||
// nsIScrollbarMediator
|
||||
void ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
@ -834,11 +834,11 @@ public:
|
||||
virtual bool WantAsyncScroll() const override {
|
||||
return mHelper.WantAsyncScroll();
|
||||
}
|
||||
virtual mozilla::Maybe<mozilla::FrameMetricsAndClip> ComputeFrameMetrics(
|
||||
Layer* aLayer, nsIFrame* aContainerReferenceFrame,
|
||||
const ContainerLayerParameters& aParameters) const override
|
||||
{
|
||||
return mHelper.ComputeFrameMetrics(aLayer, aContainerReferenceFrame, aParameters);
|
||||
virtual void ComputeFrameMetrics(Layer* aLayer, nsIFrame* aContainerReferenceFrame,
|
||||
const ContainerLayerParameters& aParameters,
|
||||
nsTArray<FrameMetrics>* aOutput) const override {
|
||||
mHelper.ComputeFrameMetrics(aLayer, aContainerReferenceFrame,
|
||||
aParameters, aOutput);
|
||||
}
|
||||
virtual bool IsIgnoringViewportClipping() const override {
|
||||
return mHelper.IsIgnoringViewportClipping();
|
||||
@ -1229,11 +1229,11 @@ public:
|
||||
virtual bool WantAsyncScroll() const override {
|
||||
return mHelper.WantAsyncScroll();
|
||||
}
|
||||
virtual mozilla::Maybe<mozilla::FrameMetricsAndClip> ComputeFrameMetrics(
|
||||
Layer* aLayer, nsIFrame* aContainerReferenceFrame,
|
||||
const ContainerLayerParameters& aParameters) const override
|
||||
{
|
||||
return mHelper.ComputeFrameMetrics(aLayer, aContainerReferenceFrame, aParameters);
|
||||
virtual void ComputeFrameMetrics(Layer* aLayer, nsIFrame* aContainerReferenceFrame,
|
||||
const ContainerLayerParameters& aParameters,
|
||||
nsTArray<FrameMetrics>* aOutput) const override {
|
||||
mHelper.ComputeFrameMetrics(aLayer, aContainerReferenceFrame,
|
||||
aParameters, aOutput);
|
||||
}
|
||||
virtual bool IsIgnoringViewportClipping() const override {
|
||||
return mHelper.IsIgnoringViewportClipping();
|
||||
|
@ -32,18 +32,10 @@ class nsDisplayListBuilder;
|
||||
|
||||
namespace mozilla {
|
||||
struct ContainerLayerParameters;
|
||||
class DisplayItemClip;
|
||||
namespace layers {
|
||||
class Layer;
|
||||
}
|
||||
|
||||
struct FrameMetricsAndClip
|
||||
{
|
||||
layers::FrameMetrics metrics;
|
||||
const DisplayItemClip* clip;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface for frames that are scrollable. This interface exposes
|
||||
@ -423,10 +415,10 @@ public:
|
||||
* aLayer's animated geometry root is this frame. If there needs to be a
|
||||
* FrameMetrics contributed by this frame, append it to aOutput.
|
||||
*/
|
||||
virtual mozilla::Maybe<mozilla::FrameMetricsAndClip> ComputeFrameMetrics(
|
||||
mozilla::layers::Layer* aLayer,
|
||||
nsIFrame* aContainerReferenceFrame,
|
||||
const ContainerLayerParameters& aParameters) const = 0;
|
||||
virtual void ComputeFrameMetrics(mozilla::layers::Layer* aLayer,
|
||||
nsIFrame* aContainerReferenceFrame,
|
||||
const ContainerLayerParameters& aParameters,
|
||||
nsTArray<FrameMetrics>* aOutput) const = 0;
|
||||
|
||||
/**
|
||||
* If this scroll frame is ignoring viewporting clipping
|
||||
|
Loading…
Reference in New Issue
Block a user