зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1541705 - Introduce remote document rect. r=botond
The rect will be used for calculating the result of the composition of the remote display item on the compositor. Differential Revision: https://phabricator.services.mozilla.com/D44419 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
f869493a22
Коммит
5221523b46
|
@ -309,6 +309,13 @@ class MOZ_STACK_CLASS LayerMetricsWrapper final {
|
|||
PixelCastJustification::MovingDownToChildren);
|
||||
}
|
||||
|
||||
LayerIntRect GetRemoteDocumentRect() const {
|
||||
MOZ_ASSERT(IsValid());
|
||||
|
||||
return AsRefLayer() ? AsRefLayer()->GetRemoteDocumentRect()
|
||||
: LayerIntRect();
|
||||
}
|
||||
|
||||
bool HasTransformAnimation() const {
|
||||
MOZ_ASSERT(IsValid());
|
||||
|
||||
|
|
|
@ -1312,7 +1312,8 @@ void ContainerLayer::DidInsertChild(Layer* aLayer) {
|
|||
}
|
||||
|
||||
void RefLayer::FillSpecificAttributes(SpecificLayerAttributes& aAttrs) {
|
||||
aAttrs = RefLayerAttributes(GetReferentId(), mEventRegionsOverride);
|
||||
aAttrs = RefLayerAttributes(GetReferentId(), mEventRegionsOverride,
|
||||
mRemoteDocumentRect);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2675,6 +2675,22 @@ class RefLayer : public ContainerLayer {
|
|||
return mEventRegionsOverride;
|
||||
}
|
||||
|
||||
/**
|
||||
* CONSTRUCTION PHASE ONLY
|
||||
* Set remote subdocument iframe size.
|
||||
*/
|
||||
void SetRemoteDocumentRect(const LayerIntRect& aRemoteDocumentRect) {
|
||||
if (mRemoteDocumentRect.IsEqualEdges(aRemoteDocumentRect)) {
|
||||
return;
|
||||
}
|
||||
mRemoteDocumentRect = aRemoteDocumentRect;
|
||||
Mutated();
|
||||
}
|
||||
|
||||
const LayerIntRect& GetRemoteDocumentRect() const {
|
||||
return mRemoteDocumentRect;
|
||||
}
|
||||
|
||||
/**
|
||||
* DRAWING PHASE ONLY
|
||||
* |aLayer| is the same as the argument to ConnectReferentLayer().
|
||||
|
@ -2710,6 +2726,7 @@ class RefLayer : public ContainerLayer {
|
|||
// 0 is a special value that means "no ID".
|
||||
LayersId mId;
|
||||
EventRegionsOverride mEventRegionsOverride;
|
||||
LayerIntRect mRemoteDocumentRect;
|
||||
};
|
||||
|
||||
void SetAntialiasingFlags(Layer* aLayer, gfx::DrawTarget* aTarget);
|
||||
|
|
|
@ -969,14 +969,14 @@ HitTestingTreeNode* APZCTreeManager::PrepareNodeForLayer(
|
|||
// when those properties change.
|
||||
node = RecycleOrCreateNode(aProofOfTreeLock, aState, nullptr, aLayersId);
|
||||
AttachNodeToTree(node, aParent, aNextSibling);
|
||||
node->SetHitTestData(GetEventRegions(aLayer), aLayer.GetVisibleRegion(),
|
||||
aLayer.GetTransformTyped(),
|
||||
(!parentHasPerspective && aLayer.GetClipRect())
|
||||
? Some(ParentLayerIntRegion(*aLayer.GetClipRect()))
|
||||
: Nothing(),
|
||||
GetEventRegionsOverride(aParent, aLayer),
|
||||
aLayer.IsBackfaceHidden(),
|
||||
!!aLayer.IsAsyncZoomContainer());
|
||||
node->SetHitTestData(
|
||||
GetEventRegions(aLayer), aLayer.GetVisibleRegion(),
|
||||
aLayer.GetRemoteDocumentRect(), aLayer.GetTransformTyped(),
|
||||
(!parentHasPerspective && aLayer.GetClipRect())
|
||||
? Some(ParentLayerIntRegion(*aLayer.GetClipRect()))
|
||||
: Nothing(),
|
||||
GetEventRegionsOverride(aParent, aLayer), aLayer.IsBackfaceHidden(),
|
||||
!!aLayer.IsAsyncZoomContainer());
|
||||
node->SetScrollbarData(aLayer.GetScrollbarAnimationId(),
|
||||
aLayer.GetScrollbarData());
|
||||
node->SetFixedPosData(aLayer.GetFixedPositionScrollContainerId());
|
||||
|
@ -1095,11 +1095,11 @@ HitTestingTreeNode* APZCTreeManager::PrepareNodeForLayer(
|
|||
|
||||
Maybe<ParentLayerIntRegion> clipRegion =
|
||||
parentHasPerspective ? Nothing() : ComputeClipRegion(aLayer);
|
||||
node->SetHitTestData(GetEventRegions(aLayer), aLayer.GetVisibleRegion(),
|
||||
aLayer.GetTransformTyped(), clipRegion,
|
||||
GetEventRegionsOverride(aParent, aLayer),
|
||||
aLayer.IsBackfaceHidden(),
|
||||
!!aLayer.IsAsyncZoomContainer());
|
||||
node->SetHitTestData(
|
||||
GetEventRegions(aLayer), aLayer.GetVisibleRegion(),
|
||||
aLayer.GetRemoteDocumentRect(), aLayer.GetTransformTyped(), clipRegion,
|
||||
GetEventRegionsOverride(aParent, aLayer), aLayer.IsBackfaceHidden(),
|
||||
!!aLayer.IsAsyncZoomContainer());
|
||||
apzc->SetAncestorTransform(aAncestorTransform);
|
||||
|
||||
PrintAPZCInfo(aLayer, apzc);
|
||||
|
@ -1199,11 +1199,11 @@ HitTestingTreeNode* APZCTreeManager::PrepareNodeForLayer(
|
|||
|
||||
Maybe<ParentLayerIntRegion> clipRegion =
|
||||
parentHasPerspective ? Nothing() : ComputeClipRegion(aLayer);
|
||||
node->SetHitTestData(GetEventRegions(aLayer), aLayer.GetVisibleRegion(),
|
||||
aLayer.GetTransformTyped(), clipRegion,
|
||||
GetEventRegionsOverride(aParent, aLayer),
|
||||
aLayer.IsBackfaceHidden(),
|
||||
!!aLayer.IsAsyncZoomContainer());
|
||||
node->SetHitTestData(
|
||||
GetEventRegions(aLayer), aLayer.GetVisibleRegion(),
|
||||
aLayer.GetRemoteDocumentRect(), aLayer.GetTransformTyped(), clipRegion,
|
||||
GetEventRegionsOverride(aParent, aLayer), aLayer.IsBackfaceHidden(),
|
||||
!!aLayer.IsAsyncZoomContainer());
|
||||
}
|
||||
|
||||
// Note: if layer properties must be propagated to nodes, RecvUpdate in
|
||||
|
|
|
@ -208,12 +208,14 @@ LayersId HitTestingTreeNode::GetLayersId() const { return mLayersId; }
|
|||
|
||||
void HitTestingTreeNode::SetHitTestData(
|
||||
const EventRegions& aRegions, const LayerIntRegion& aVisibleRegion,
|
||||
const LayerIntRect& aRemoteDocumentRect,
|
||||
const CSSTransformMatrix& aTransform,
|
||||
const Maybe<ParentLayerIntRegion>& aClipRegion,
|
||||
const EventRegionsOverride& aOverride, bool aIsBackfaceHidden,
|
||||
bool aIsAsyncZoomContainer) {
|
||||
mEventRegions = aRegions;
|
||||
mVisibleRegion = aVisibleRegion;
|
||||
mRemoteDocumentRect = aRemoteDocumentRect;
|
||||
mTransform = aTransform;
|
||||
mClipRegion = aClipRegion;
|
||||
mOverride = aOverride;
|
||||
|
|
|
@ -103,6 +103,7 @@ class HitTestingTreeNode {
|
|||
|
||||
void SetHitTestData(const EventRegions& aRegions,
|
||||
const LayerIntRegion& aVisibleRegion,
|
||||
const LayerIntRect& aRemoteDocumentRect,
|
||||
const CSSTransformMatrix& aTransform,
|
||||
const Maybe<ParentLayerIntRegion>& aClipRegion,
|
||||
const EventRegionsOverride& aOverride,
|
||||
|
@ -189,6 +190,10 @@ class HitTestingTreeNode {
|
|||
|
||||
LayerIntRegion mVisibleRegion;
|
||||
|
||||
/* The rectangle of remote iframe on the corresponding layer coordinate.
|
||||
* It's empty if this node is not for remote iframe. */
|
||||
LayerIntRect mRemoteDocumentRect;
|
||||
|
||||
/* This is the transform from layer L. This does NOT include any async
|
||||
* transforms. */
|
||||
CSSTransformMatrix mTransform;
|
||||
|
|
|
@ -632,7 +632,9 @@ bool LayerTransactionParent::SetLayerAttributes(
|
|||
refLayer->SetReferentId(specific.get_RefLayerAttributes().id());
|
||||
refLayer->SetEventRegionsOverride(
|
||||
specific.get_RefLayerAttributes().eventRegionsOverride());
|
||||
UpdateHitTestingTree(layer, "event regions override changed");
|
||||
refLayer->SetRemoteDocumentRect(
|
||||
specific.get_RefLayerAttributes().remoteDocumentRect());
|
||||
UpdateHitTestingTree(layer, "ref layer attributes changed");
|
||||
break;
|
||||
}
|
||||
case Specific::TImageLayerAttributes: {
|
||||
|
|
|
@ -34,6 +34,7 @@ using mozilla::LayerPoint from "Units.h";
|
|||
using mozilla::LayerCoord from "Units.h";
|
||||
using mozilla::LayerSize from "Units.h";
|
||||
using mozilla::LayerRect from "Units.h";
|
||||
using mozilla::LayerIntRect from "Units.h";
|
||||
using mozilla::LayerIntRegion from "Units.h";
|
||||
using mozilla::ParentLayerIntRect from "Units.h";
|
||||
using mozilla::LayoutDeviceIntRect from "Units.h";
|
||||
|
@ -305,6 +306,7 @@ struct CanvasLayerAttributes { SamplingFilter samplingFilter; IntRect bounds;
|
|||
struct RefLayerAttributes {
|
||||
LayersId id;
|
||||
EventRegionsOverride eventRegionsOverride;
|
||||
LayerIntRect remoteDocumentRect;
|
||||
};
|
||||
struct ImageLayerAttributes { SamplingFilter samplingFilter; IntSize scaleToSize; ScaleMode scaleMode; };
|
||||
|
||||
|
|
|
@ -88,6 +88,12 @@ class WebRenderLayerScrollData final {
|
|||
mVisibleRegion = aRegion;
|
||||
}
|
||||
const LayerIntRegion& GetVisibleRegion() const { return mVisibleRegion; }
|
||||
void SetRemoteDocumentRect(const LayerIntRect& aRemoteDocumentRect) {
|
||||
mRemoteDocumentRect = aRemoteDocumentRect;
|
||||
}
|
||||
const LayerIntRect& GetRemoteDocumentRect() const {
|
||||
return mRemoteDocumentRect;
|
||||
}
|
||||
void SetReferentId(LayersId aReferentId) { mReferentId = Some(aReferentId); }
|
||||
Maybe<LayersId> GetReferentId() const { return mReferentId; }
|
||||
|
||||
|
@ -155,6 +161,7 @@ class WebRenderLayerScrollData final {
|
|||
gfx::Matrix4x4 mTransform;
|
||||
bool mTransformIsPerspective;
|
||||
LayerIntRegion mVisibleRegion;
|
||||
LayerIntRect mRemoteDocumentRect;
|
||||
Maybe<LayersId> mReferentId;
|
||||
Maybe<RenderRootBoundary> mReferentRenderRoot;
|
||||
Maybe<RenderRootBoundary> mBoundaryRoot;
|
||||
|
@ -271,6 +278,7 @@ struct ParamTraits<mozilla::layers::WebRenderLayerScrollData> {
|
|||
WriteParam(aMsg, aParam.mTransform);
|
||||
WriteParam(aMsg, aParam.mTransformIsPerspective);
|
||||
WriteParam(aMsg, aParam.mVisibleRegion);
|
||||
WriteParam(aMsg, aParam.mRemoteDocumentRect);
|
||||
WriteParam(aMsg, aParam.mReferentId);
|
||||
WriteParam(aMsg, aParam.mReferentRenderRoot);
|
||||
WriteParam(aMsg, aParam.mBoundaryRoot);
|
||||
|
@ -291,6 +299,7 @@ struct ParamTraits<mozilla::layers::WebRenderLayerScrollData> {
|
|||
ReadParam(aMsg, aIter, &aResult->mTransform) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mTransformIsPerspective) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mVisibleRegion) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mRemoteDocumentRect) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mReferentId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mReferentRenderRoot) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mBoundaryRoot) &&
|
||||
|
|
|
@ -299,6 +299,22 @@ class MOZ_STACK_CLASS WebRenderScrollDataWrapper final {
|
|||
PixelCastJustification::MovingDownToChildren);
|
||||
}
|
||||
|
||||
LayerIntRect GetRemoteDocumentRect() const {
|
||||
MOZ_ASSERT(IsValid());
|
||||
|
||||
if (mLayer->GetReferentId().isNothing()) {
|
||||
return LayerIntRect();
|
||||
}
|
||||
|
||||
if (AtBottomLayer()) {
|
||||
return mLayer->GetRemoteDocumentRect();
|
||||
}
|
||||
|
||||
return ViewAs<LayerPixel>(TransformBy(mLayer->GetTransformTyped(),
|
||||
mLayer->GetRemoteDocumentRect()),
|
||||
PixelCastJustification::MovingDownToChildren);
|
||||
}
|
||||
|
||||
Maybe<LayersId> GetReferentId() const {
|
||||
MOZ_ASSERT(IsValid());
|
||||
|
||||
|
|
|
@ -1376,6 +1376,14 @@ mozilla::LayerState nsDisplayRemote::GetLayerState(
|
|||
return mozilla::LayerState::LAYER_ACTIVE_FORCE;
|
||||
}
|
||||
|
||||
LayerIntRect GetFrameRect(const nsIFrame* aFrame) {
|
||||
LayoutDeviceRect rect = LayoutDeviceRect::FromAppUnits(
|
||||
aFrame->GetContentRectRelativeToSelf(),
|
||||
aFrame->PresContext()->AppUnitsPerDevPixel());
|
||||
return RoundedOut(rect * LayoutDeviceToLayerScale(
|
||||
aFrame->PresShell()->GetCumulativeResolution()));
|
||||
}
|
||||
|
||||
already_AddRefed<mozilla::layers::Layer> nsDisplayRemote::BuildLayer(
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aContainerParameters) {
|
||||
|
@ -1442,6 +1450,7 @@ already_AddRefed<mozilla::layers::Layer> nsDisplayRemote::BuildLayer(
|
|||
refLayer->SetBaseTransform(m);
|
||||
refLayer->SetEventRegionsOverride(mEventRegionsOverride);
|
||||
refLayer->SetReferentId(mLayersId);
|
||||
refLayer->SetRemoteDocumentRect(GetFrameRect(mFrame));
|
||||
|
||||
return layer.forget();
|
||||
}
|
||||
|
@ -1515,6 +1524,7 @@ bool nsDisplayRemote::UpdateScrollData(
|
|||
aLayerData->SetTransform(
|
||||
mozilla::gfx::Matrix4x4::Translation(mOffset.x, mOffset.y, 0.0));
|
||||
aLayerData->SetEventRegionsOverride(mEventRegionsOverride);
|
||||
aLayerData->SetRemoteDocumentRect(GetFrameRect(mFrame));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче