Bug 1599795 - Change the remote document rect to size in gfx. r=emilio

What we really needed in the first place was the size not the rect.

Differential Revision: https://phabricator.services.mozilla.com/D62215

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Hiroyuki Ikezoe 2020-02-11 03:57:14 +00:00
Родитель c3615f343f
Коммит d4fa8f4fad
11 изменённых файлов: 47 добавлений и 41 удалений

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

@ -309,11 +309,11 @@ class MOZ_STACK_CLASS LayerMetricsWrapper final {
PixelCastJustification::MovingDownToChildren);
}
LayerIntRect GetRemoteDocumentRect() const {
LayerIntSize GetRemoteDocumentSize() const {
MOZ_ASSERT(IsValid());
return AsRefLayer() ? AsRefLayer()->GetRemoteDocumentRect()
: LayerIntRect();
return AsRefLayer() ? AsRefLayer()->GetRemoteDocumentSize()
: LayerIntSize();
}
bool HasTransformAnimation() const {

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

@ -1303,7 +1303,7 @@ void ContainerLayer::DidInsertChild(Layer* aLayer) {
void RefLayer::FillSpecificAttributes(SpecificLayerAttributes& aAttrs) {
aAttrs = RefLayerAttributes(GetReferentId(), mEventRegionsOverride,
mRemoteDocumentRect);
mRemoteDocumentSize);
}
/**

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

@ -2683,16 +2683,16 @@ class RefLayer : public ContainerLayer {
* CONSTRUCTION PHASE ONLY
* Set remote subdocument iframe size.
*/
void SetRemoteDocumentRect(const LayerIntRect& aRemoteDocumentRect) {
if (mRemoteDocumentRect.IsEqualEdges(aRemoteDocumentRect)) {
void SetRemoteDocumentSize(const LayerIntSize& aRemoteDocumentSize) {
if (mRemoteDocumentSize == aRemoteDocumentSize) {
return;
}
mRemoteDocumentRect = aRemoteDocumentRect;
mRemoteDocumentSize = aRemoteDocumentSize;
Mutated();
}
const LayerIntRect& GetRemoteDocumentRect() const {
return mRemoteDocumentRect;
const LayerIntSize& GetRemoteDocumentSize() const {
return mRemoteDocumentSize;
}
/**
@ -2730,7 +2730,9 @@ class RefLayer : public ContainerLayer {
// 0 is a special value that means "no ID".
LayersId mId;
EventRegionsOverride mEventRegionsOverride;
LayerIntRect mRemoteDocumentRect;
// The remote documents only need their size because their origin is always
// (0, 0).
LayerIntSize mRemoteDocumentSize;
};
void SetAntialiasingFlags(Layer* aLayer, gfx::DrawTarget* aTarget);

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

@ -1013,7 +1013,7 @@ void SetHitTestData(HitTestingTreeNode* aNode, HitTestingTreeNode* aParent,
const Maybe<ParentLayerIntRegion>& aClipRegion) {
aNode->SetHitTestData(
GetEventRegions(aLayer), aLayer.GetVisibleRegion(),
aLayer.GetRemoteDocumentRect(), aLayer.GetTransformTyped(), aClipRegion,
aLayer.GetRemoteDocumentSize(), aLayer.GetTransformTyped(), aClipRegion,
GetEventRegionsOverride(aParent, aLayer), aLayer.IsBackfaceHidden(),
!!aLayer.IsAsyncZoomContainer());
}

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

@ -239,14 +239,14 @@ LayersId HitTestingTreeNode::GetLayersId() const { return mLayersId; }
void HitTestingTreeNode::SetHitTestData(
const EventRegions& aRegions, const LayerIntRegion& aVisibleRegion,
const LayerIntRect& aRemoteDocumentRect,
const LayerIntSize& aRemoteDocumentSize,
const CSSTransformMatrix& aTransform,
const Maybe<ParentLayerIntRegion>& aClipRegion,
const EventRegionsOverride& aOverride, bool aIsBackfaceHidden,
bool aIsAsyncZoomContainer) {
mEventRegions = aRegions;
mVisibleRegion = aVisibleRegion;
mRemoteDocumentRect = aRemoteDocumentRect;
mRemoteDocumentSize = aRemoteDocumentSize;
mTransform = aTransform;
mClipRegion = aClipRegion;
mOverride = aOverride;
@ -376,8 +376,9 @@ const LayerIntRegion& HitTestingTreeNode::GetVisibleRegion() const {
}
ScreenRect HitTestingTreeNode::GetRemoteDocumentScreenRect() const {
ScreenRect result =
TransformBy(GetTransformToGecko(), IntRectToRect(mRemoteDocumentRect));
ScreenRect result = TransformBy(
GetTransformToGecko(),
IntRectToRect(LayerIntRect(LayerIntPoint(), mRemoteDocumentSize)));
for (const HitTestingTreeNode* node = this; node; node = node->GetParent()) {
if (!node->GetApzc()) {

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

@ -103,7 +103,7 @@ class HitTestingTreeNode {
void SetHitTestData(const EventRegions& aRegions,
const LayerIntRegion& aVisibleRegion,
const LayerIntRect& aRemoteDocumentRect,
const LayerIntSize& aRemoteDocumentSize,
const CSSTransformMatrix& aTransform,
const Maybe<ParentLayerIntRegion>& aClipRegion,
const EventRegionsOverride& aOverride,
@ -216,9 +216,9 @@ class HitTestingTreeNode {
LayerIntRegion mVisibleRegion;
/* The rectangle of remote iframe on the corresponding layer coordinate.
/* The size of remote iframe on the corresponding layer coordinate.
* It's empty if this node is not for remote iframe. */
LayerIntRect mRemoteDocumentRect;
LayerIntSize mRemoteDocumentSize;
/* This is the transform from layer L. This does NOT include any async
* transforms. */

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

@ -628,8 +628,8 @@ bool LayerTransactionParent::SetLayerAttributes(
refLayer->SetReferentId(specific.get_RefLayerAttributes().id());
refLayer->SetEventRegionsOverride(
specific.get_RefLayerAttributes().eventRegionsOverride());
refLayer->SetRemoteDocumentRect(
specific.get_RefLayerAttributes().remoteDocumentRect());
refLayer->SetRemoteDocumentSize(
specific.get_RefLayerAttributes().remoteDocumentSize());
UpdateHitTestingTree(layer, "ref layer attributes changed");
break;
}

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

@ -37,7 +37,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::LayerIntSize from "Units.h";
using mozilla::LayerIntRegion from "Units.h";
using mozilla::ParentLayerIntRect from "Units.h";
using mozilla::LayoutDeviceIntRect from "Units.h";
@ -277,7 +277,7 @@ struct CanvasLayerAttributes { SamplingFilter samplingFilter; IntRect bounds;
struct RefLayerAttributes {
LayersId id;
EventRegionsOverride eventRegionsOverride;
LayerIntRect remoteDocumentRect;
LayerIntSize remoteDocumentSize;
};
struct ImageLayerAttributes { SamplingFilter samplingFilter; IntSize scaleToSize; ScaleMode scaleMode; };

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

@ -88,11 +88,11 @@ class WebRenderLayerScrollData final {
mVisibleRegion = aRegion;
}
const LayerIntRegion& GetVisibleRegion() const { return mVisibleRegion; }
void SetRemoteDocumentRect(const LayerIntRect& aRemoteDocumentRect) {
mRemoteDocumentRect = aRemoteDocumentRect;
void SetRemoteDocumentSize(const LayerIntSize& aRemoteDocumentSize) {
mRemoteDocumentSize = aRemoteDocumentSize;
}
const LayerIntRect& GetRemoteDocumentRect() const {
return mRemoteDocumentRect;
const LayerIntSize& GetRemoteDocumentSize() const {
return mRemoteDocumentSize;
}
void SetReferentId(LayersId aReferentId) { mReferentId = Some(aReferentId); }
Maybe<LayersId> GetReferentId() const { return mReferentId; }
@ -173,7 +173,9 @@ class WebRenderLayerScrollData final {
gfx::Matrix4x4 mTransform;
bool mTransformIsPerspective;
LayerIntRegion mVisibleRegion;
LayerIntRect mRemoteDocumentRect;
// The remote documents only need their size because their origin is always
// (0, 0).
LayerIntSize mRemoteDocumentSize;
Maybe<LayersId> mReferentId;
Maybe<RenderRootBoundary> mReferentRenderRoot;
Maybe<RenderRootBoundary> mBoundaryRoot;
@ -292,7 +294,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.mRemoteDocumentSize);
WriteParam(aMsg, aParam.mReferentId);
WriteParam(aMsg, aParam.mReferentRenderRoot);
WriteParam(aMsg, aParam.mBoundaryRoot);
@ -315,7 +317,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->mRemoteDocumentSize) &&
ReadParam(aMsg, aIter, &aResult->mReferentId) &&
ReadParam(aMsg, aIter, &aResult->mReferentRenderRoot) &&
ReadParam(aMsg, aIter, &aResult->mBoundaryRoot) &&

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

@ -299,19 +299,18 @@ class MOZ_STACK_CLASS WebRenderScrollDataWrapper final {
PixelCastJustification::MovingDownToChildren);
}
LayerIntRect GetRemoteDocumentRect() const {
LayerIntSize GetRemoteDocumentSize() const {
MOZ_ASSERT(IsValid());
if (mLayer->GetReferentId().isNothing()) {
return LayerIntRect();
return LayerIntSize();
}
if (AtBottomLayer()) {
return mLayer->GetRemoteDocumentRect();
return mLayer->GetRemoteDocumentSize();
}
return ViewAs<LayerPixel>(TransformBy(mLayer->GetTransformTyped(),
mLayer->GetRemoteDocumentRect()),
return ViewAs<LayerPixel>(mLayer->GetRemoteDocumentSize(),
PixelCastJustification::MovingDownToChildren);
}

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

@ -1311,12 +1311,14 @@ mozilla::LayerState nsDisplayRemote::GetLayerState(
return mozilla::LayerState::LAYER_ACTIVE_FORCE;
}
LayerIntRect GetFrameRect(const nsIFrame* aFrame) {
LayoutDeviceRect rect = LayoutDeviceRect::FromAppUnits(
aFrame->GetContentRectRelativeToSelf(),
LayerIntSize GetFrameSize(const nsIFrame* aFrame) {
LayoutDeviceSize size = LayoutDeviceRect::FromAppUnits(
aFrame->GetContentRectRelativeToSelf().Size(),
aFrame->PresContext()->AppUnitsPerDevPixel());
return RoundedOut(rect * LayoutDeviceToLayerScale(
aFrame->PresShell()->GetCumulativeResolution()));
float cumulativeResolution = aFrame->PresShell()->GetCumulativeResolution();
return LayerIntSize::Round(size.width * cumulativeResolution,
size.height * cumulativeResolution);
}
already_AddRefed<mozilla::layers::Layer> nsDisplayRemote::BuildLayer(
@ -1388,7 +1390,7 @@ already_AddRefed<mozilla::layers::Layer> nsDisplayRemote::BuildLayer(
refLayer->SetBaseTransform(m);
refLayer->SetEventRegionsOverride(mEventRegionsOverride);
refLayer->SetReferentId(mLayersId);
refLayer->SetRemoteDocumentRect(GetFrameRect(mFrame));
refLayer->SetRemoteDocumentSize(GetFrameSize(mFrame));
return layer.forget();
}
@ -1466,7 +1468,7 @@ bool nsDisplayRemote::UpdateScrollData(
aLayerData->SetTransform(
mozilla::gfx::Matrix4x4::Translation(mOffset.x, mOffset.y, 0.0));
aLayerData->SetEventRegionsOverride(mEventRegionsOverride);
aLayerData->SetRemoteDocumentRect(GetFrameRect(mFrame));
aLayerData->SetRemoteDocumentSize(GetFrameSize(mFrame));
}
return true;
}