зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1372603 - Move the clip rect for async images outside the iframe item. r=jrmuizel,sotaro
The async images codepath is a bit different in that it pushes an iframe item to the WR display list and updates it asynchronously. However in this case it still makes sense to push the layer's local clip outside the iframe, and just populate the iframe with the image and not worry about clips inside the iframe. As mentioned in part 1 of this patchset, this will be needed to properly handle async scrolling. This patch makes the necessary changes to push the clip outside the iframe and simplifies what happens in WebRenderCompositableHolder to generate the display list for the iframe itself. MozReview-Commit-ID: DeZElH4p4rc --HG-- extra : rebase_source : 3f3458a6c2607b8290dc2174a248f3d7bd33a3a9
This commit is contained in:
Родитель
4b9fbd6d4d
Коммит
60385dfbe4
|
@ -51,8 +51,6 @@ struct OpUpdateAsyncImagePipeline {
|
|||
LayerRect scBounds;
|
||||
Matrix4x4 scTransform;
|
||||
MaybeIntSize scaleToSize;
|
||||
MaybeLayerRect clipRect;
|
||||
MaybeImageMask mask;
|
||||
WrImageRendering filter;
|
||||
WrMixBlendMode mixBlendMode;
|
||||
};
|
||||
|
|
|
@ -501,8 +501,6 @@ WebRenderBridgeParent::ProcessWebRenderCommands(const gfx::IntSize &aSize,
|
|||
op.scBounds(),
|
||||
op.scTransform(),
|
||||
op.scaleToSize(),
|
||||
op.clipRect(),
|
||||
op.mask(),
|
||||
op.filter(),
|
||||
op.mixBlendMode());
|
||||
break;
|
||||
|
|
|
@ -130,8 +130,6 @@ WebRenderCompositableHolder::UpdateAsyncImagePipeline(const wr::PipelineId& aPip
|
|||
const LayerRect& aScBounds,
|
||||
const gfx::Matrix4x4& aScTransform,
|
||||
const gfx::MaybeIntSize& aScaleToSize,
|
||||
const MaybeLayerRect& aClipRect,
|
||||
const MaybeImageMask& aMask,
|
||||
const WrImageRendering& aFilter,
|
||||
const WrMixBlendMode& aMixBlendMode)
|
||||
{
|
||||
|
@ -148,8 +146,6 @@ WebRenderCompositableHolder::UpdateAsyncImagePipeline(const wr::PipelineId& aPip
|
|||
holder->mScBounds = aScBounds;
|
||||
holder->mScTransform = aScTransform;
|
||||
holder->mScaleToSize = aScaleToSize;
|
||||
holder->mClipRect = aClipRect;
|
||||
holder->mMask = aMask;
|
||||
holder->mFilter = aFilter;
|
||||
holder->mMixBlendMode = aMixBlendMode;
|
||||
}
|
||||
|
@ -282,10 +278,8 @@ WebRenderCompositableHolder::ApplyAsyncImages(wr::WebRenderAPI* aApi)
|
|||
if (holder->mScaleToSize.isSome()) {
|
||||
rect = LayerRect(0, 0, holder->mScaleToSize.value().width, holder->mScaleToSize.value().height);
|
||||
}
|
||||
LayerRect clipRect = holder->mClipRect.valueOr(rect);
|
||||
WrClipRegionToken clip = builder.PushClipRegion(
|
||||
wr::ToWrRect(clipRect),
|
||||
holder->mMask.ptrOr(nullptr));
|
||||
wr::ToWrRect(rect), nullptr);
|
||||
|
||||
if (useExternalImage) {
|
||||
MOZ_ASSERT(holder->mCurrentTexture->AsWebRenderTextureHost());
|
||||
|
|
|
@ -75,8 +75,6 @@ public:
|
|||
const LayerRect& aScBounds,
|
||||
const gfx::Matrix4x4& aScTransform,
|
||||
const gfx::MaybeIntSize& aScaleToSize,
|
||||
const MaybeLayerRect& aClipRect,
|
||||
const MaybeImageMask& aMask,
|
||||
const WrImageRendering& aFilter,
|
||||
const WrMixBlendMode& aMixBlendMode);
|
||||
void ApplyAsyncImages(wr::WebRenderAPI* aApi);
|
||||
|
@ -119,8 +117,6 @@ private:
|
|||
LayerRect mScBounds;
|
||||
gfx::Matrix4x4 mScTransform;
|
||||
gfx::MaybeIntSize mScaleToSize;
|
||||
MaybeLayerRect mClipRect;
|
||||
MaybeImageMask mMask;
|
||||
WrImageRendering mFilter;
|
||||
WrMixBlendMode mMixBlendMode;
|
||||
RefPtr<WebRenderImageHost> mImageHost;
|
||||
|
|
|
@ -142,26 +142,26 @@ WebRenderImageLayer::RenderLayer(wr::DisplayListBuilder& aBuilder,
|
|||
MOZ_ASSERT(mExternalImageId.isNothing());
|
||||
|
||||
// Push IFrame for async image pipeline.
|
||||
// XXX Remove this once partial display list update is supported.
|
||||
|
||||
ScrollingLayersHelper scroller(this, aBuilder, aSc);
|
||||
|
||||
ParentLayerRect bounds = GetLocalTransformTyped().TransformBounds(Bounds());
|
||||
|
||||
// As with WebRenderTextLayer, because we don't push a stacking context for
|
||||
// this async image pipeline, WR doesn't know about the transform on this layer.
|
||||
// Therefore we need to apply that transform to the bounds before we pass it on to WR.
|
||||
// The conversion from ParentLayerPixel to LayerPixel below is a result of
|
||||
// changing the reference layer from "this layer" to the "the layer that
|
||||
// created aSc".
|
||||
// We don't push a stacking context for this async image pipeline here.
|
||||
// Instead, we do it inside the iframe that hosts the image. As a result,
|
||||
// a bunch of the calculations normally done as part of that stacking
|
||||
// context need to be done manually and pushed over to the parent side,
|
||||
// where it will be done when we build the display list for the iframe.
|
||||
// That happens in WebRenderCompositableHolder.
|
||||
|
||||
LayerRect rect = ViewAs<LayerPixel>(bounds,
|
||||
PixelCastJustification::MovingDownToChildren);
|
||||
DumpLayerInfo("Image Layer async", rect);
|
||||
|
||||
// XXX Remove IFrame for async image pipeline when partial display list update is supported.
|
||||
WrClipRegionToken clipRegion = aBuilder.PushClipRegion(aSc.ToRelativeWrRect(rect));
|
||||
aBuilder.PushIFrame(aSc.ToRelativeWrRect(rect), clipRegion, mPipelineId.ref());
|
||||
|
||||
// Prepare data that are necessary for async image pipelin.
|
||||
// They are used within WebRenderCompositableHolder
|
||||
|
||||
gfx::Matrix4x4 scTransform = GetTransform();
|
||||
// Translate is applied as part of PushIFrame()
|
||||
scTransform.PostTranslate(-rect.x, -rect.y, 0);
|
||||
|
@ -179,15 +179,10 @@ WebRenderImageLayer::RenderLayer(wr::DisplayListBuilder& aBuilder,
|
|||
wr::ImageRendering filter = wr::ToImageRendering(mSamplingFilter);
|
||||
wr::MixBlendMode mixBlendMode = wr::ToWrMixBlendMode(GetMixBlendMode());
|
||||
|
||||
StackingContextHelper sc(aSc, aBuilder, this);
|
||||
Maybe<WrImageMask> mask = BuildWrMaskLayer(aSc, &sc);
|
||||
|
||||
WrBridge()->AddWebRenderParentCommand(OpUpdateAsyncImagePipeline(mPipelineId.value(),
|
||||
scBounds,
|
||||
scTransform,
|
||||
scaleToSize,
|
||||
ClipRect(),
|
||||
mask,
|
||||
filter,
|
||||
mixBlendMode));
|
||||
return;
|
||||
|
|
Загрузка…
Ссылка в новой задаче