Bug 1743955 - Remove SimpleLayerAttributes. r=gfx-reviewers,lsalzman

Differential Revision: https://phabricator.services.mozilla.com/D132656
This commit is contained in:
Jeff Muizelaar 2021-12-02 14:37:20 +00:00
Родитель a5f65e1e44
Коммит faac529575
2 изменённых файлов: 0 добавлений и 307 удалений

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

@ -131,265 +131,6 @@ struct ScrollbarData {
}
};
/**
* Infrequently changing layer attributes.
*/
class SimpleLayerAttributes final {
friend struct IPC::ParamTraits<mozilla::layers::SimpleLayerAttributes>;
public:
SimpleLayerAttributes()
: mTransformIsPerspective(false),
mPostXScale(1.0f),
mPostYScale(1.0f),
mContentFlags(0),
mOpacity(1.0f),
mIsFixedPosition(false),
mMixBlendMode(gfx::CompositionOp::OP_OVER),
mForceIsolatedGroup(false) {}
/**
* Setters.
* All set methods return true if values changed, false otherwise.
*/
bool SetPostScale(float aXScale, float aYScale) {
if (mPostXScale == aXScale && mPostYScale == aYScale) {
return false;
}
mPostXScale = aXScale;
mPostYScale = aYScale;
return true;
}
bool SetContentFlags(uint32_t aFlags) {
if (aFlags == mContentFlags) {
return false;
}
mContentFlags = aFlags;
return true;
}
bool SetOpacity(float aOpacity) {
if (aOpacity == mOpacity) {
return false;
}
mOpacity = aOpacity;
return true;
}
bool SetIsFixedPosition(bool aFixedPosition) {
if (mIsFixedPosition == aFixedPosition) {
return false;
}
mIsFixedPosition = aFixedPosition;
return true;
}
bool SetAsyncZoomContainerId(const Maybe<FrameMetrics::ViewID>& aViewId) {
if (mAsyncZoomContainerId == aViewId) {
return false;
}
mAsyncZoomContainerId = aViewId;
return true;
}
bool SetScrollbarData(const ScrollbarData& aScrollbarData) {
if (mScrollbarData == aScrollbarData) {
return false;
}
mScrollbarData = aScrollbarData;
return true;
}
bool SetMixBlendMode(gfx::CompositionOp aMixBlendMode) {
if (mMixBlendMode == aMixBlendMode) {
return false;
}
mMixBlendMode = aMixBlendMode;
return true;
}
bool SetForceIsolatedGroup(bool aForceIsolatedGroup) {
if (mForceIsolatedGroup == aForceIsolatedGroup) {
return false;
}
mForceIsolatedGroup = aForceIsolatedGroup;
return true;
}
bool SetTransform(const gfx::Matrix4x4& aMatrix) {
if (mTransform == aMatrix) {
return false;
}
mTransform = aMatrix;
return true;
}
bool SetTransformIsPerspective(bool aIsPerspective) {
if (mTransformIsPerspective == aIsPerspective) {
return false;
}
mTransformIsPerspective = aIsPerspective;
return true;
}
bool SetFixedPositionData(ScrollableLayerGuid::ViewID aTargetViewId,
const LayerPoint& aAnchor, SideBits aSides) {
if (mFixedPositionData && mFixedPositionData->mScrollId == aTargetViewId &&
mFixedPositionData->mAnchor == aAnchor &&
mFixedPositionData->mSides == aSides) {
return false;
}
if (!mFixedPositionData) {
mFixedPositionData.emplace();
}
mFixedPositionData->mScrollId = aTargetViewId;
mFixedPositionData->mAnchor = aAnchor;
mFixedPositionData->mSides = aSides;
return true;
}
bool SetStickyPositionData(ScrollableLayerGuid::ViewID aScrollId,
LayerRectAbsolute aOuter,
LayerRectAbsolute aInner) {
if (mStickyPositionData &&
mStickyPositionData->mOuter.IsEqualEdges(aOuter) &&
mStickyPositionData->mInner.IsEqualEdges(aInner)) {
return false;
}
if (!mStickyPositionData) {
mStickyPositionData.emplace();
}
mStickyPositionData->mScrollId = aScrollId;
mStickyPositionData->mOuter = aOuter;
mStickyPositionData->mInner = aInner;
return true;
}
/**
* This returns true if scrolling info is equivalent for the purposes of
* APZ hit testing.
*/
bool HitTestingInfoIsEqual(const SimpleLayerAttributes& aOther) const {
if (mScrollbarData != aOther.mScrollbarData) {
return false;
}
if (GetFixedPositionScrollContainerId() !=
aOther.GetFixedPositionScrollContainerId()) {
return false;
}
if (mTransform != aOther.mTransform) {
return false;
}
return true;
}
/**
* Getters.
*/
float GetPostXScale() const { return mPostXScale; }
float GetPostYScale() const { return mPostYScale; }
uint32_t GetContentFlags() const { return mContentFlags; }
float GetOpacity() const { return mOpacity; }
bool IsFixedPosition() const { return mIsFixedPosition; }
Maybe<FrameMetrics::ViewID> GetAsyncZoomContainerId() const {
return mAsyncZoomContainerId;
}
const ScrollbarData& GetScrollbarData() const { return mScrollbarData; }
gfx::CompositionOp GetMixBlendMode() const { return mMixBlendMode; }
bool GetForceIsolatedGroup() const { return mForceIsolatedGroup; }
const gfx::Matrix4x4& GetTransform() const { return mTransform; }
bool GetTransformIsPerspective() const { return mTransformIsPerspective; }
ScrollableLayerGuid::ViewID GetFixedPositionScrollContainerId() const {
return (mIsFixedPosition && mFixedPositionData)
? mFixedPositionData->mScrollId
: ScrollableLayerGuid::NULL_SCROLL_ID;
}
LayerPoint GetFixedPositionAnchor() const {
return mFixedPositionData ? mFixedPositionData->mAnchor : LayerPoint();
}
SideBits GetFixedPositionSides() const {
return mFixedPositionData ? mFixedPositionData->mSides : SideBits::eNone;
}
bool IsStickyPosition() const { return !!mStickyPositionData; }
ScrollableLayerGuid::ViewID GetStickyScrollContainerId() const {
return mStickyPositionData->mScrollId;
}
const LayerRectAbsolute& GetStickyScrollRangeOuter() const {
return mStickyPositionData->mOuter;
}
const LayerRectAbsolute& GetStickyScrollRangeInner() const {
return mStickyPositionData->mInner;
}
bool operator==(const SimpleLayerAttributes& aOther) const {
return mTransform == aOther.mTransform &&
mTransformIsPerspective == aOther.mTransformIsPerspective &&
mPostXScale == aOther.mPostXScale &&
mPostYScale == aOther.mPostYScale &&
mContentFlags == aOther.mContentFlags &&
mOpacity == aOther.mOpacity &&
mIsFixedPosition == aOther.mIsFixedPosition &&
mAsyncZoomContainerId == aOther.mAsyncZoomContainerId &&
mScrollbarData == aOther.mScrollbarData &&
mMixBlendMode == aOther.mMixBlendMode &&
mForceIsolatedGroup == aOther.mForceIsolatedGroup;
}
private:
gfx::Matrix4x4 mTransform;
bool mTransformIsPerspective;
float mPostXScale;
float mPostYScale;
uint32_t mContentFlags;
float mOpacity;
bool mIsFixedPosition;
Maybe<FrameMetrics::ViewID> mAsyncZoomContainerId;
ScrollbarData mScrollbarData;
gfx::CompositionOp mMixBlendMode;
bool mForceIsolatedGroup;
struct FixedPositionData {
ScrollableLayerGuid::ViewID mScrollId;
LayerPoint mAnchor;
SideBits mSides;
};
Maybe<FixedPositionData> mFixedPositionData;
friend struct IPC::ParamTraits<
mozilla::layers::SimpleLayerAttributes::FixedPositionData>;
struct StickyPositionData {
ScrollableLayerGuid::ViewID mScrollId;
LayerRectAbsolute mOuter;
LayerRectAbsolute mInner;
};
Maybe<StickyPositionData> mStickyPositionData;
friend struct IPC::ParamTraits<
mozilla::layers::SimpleLayerAttributes::StickyPositionData>;
// Make sure to add new members to operator== and the ParamTraits template
// instantiation.
};
} // namespace layers
} // namespace mozilla

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

@ -876,54 +876,6 @@ struct ParamTraits<mozilla::layers::ScrollbarData> {
}
};
template <>
struct ParamTraits<mozilla::layers::SimpleLayerAttributes::FixedPositionData>
: public PlainOldDataSerializer<
mozilla::layers::SimpleLayerAttributes::FixedPositionData> {};
template <>
struct ParamTraits<mozilla::layers::SimpleLayerAttributes::StickyPositionData>
: public PlainOldDataSerializer<
mozilla::layers::SimpleLayerAttributes::StickyPositionData> {};
template <>
struct ParamTraits<mozilla::layers::SimpleLayerAttributes> {
typedef mozilla::layers::SimpleLayerAttributes paramType;
static void Write(Message* aMsg, const paramType& aParam) {
WriteParam(aMsg, aParam.mTransform);
WriteParam(aMsg, aParam.mTransformIsPerspective);
WriteParam(aMsg, aParam.mPostXScale);
WriteParam(aMsg, aParam.mPostYScale);
WriteParam(aMsg, aParam.mContentFlags);
WriteParam(aMsg, aParam.mOpacity);
WriteParam(aMsg, aParam.mIsFixedPosition);
WriteParam(aMsg, aParam.mAsyncZoomContainerId);
WriteParam(aMsg, aParam.mScrollbarData);
WriteParam(aMsg, aParam.mMixBlendMode);
WriteParam(aMsg, aParam.mForceIsolatedGroup);
WriteParam(aMsg, aParam.mFixedPositionData);
WriteParam(aMsg, aParam.mStickyPositionData);
}
static bool Read(const Message* aMsg, PickleIterator* aIter,
paramType* aResult) {
return ReadParam(aMsg, aIter, &aResult->mTransform) &&
ReadParam(aMsg, aIter, &aResult->mTransformIsPerspective) &&
ReadParam(aMsg, aIter, &aResult->mPostXScale) &&
ReadParam(aMsg, aIter, &aResult->mPostYScale) &&
ReadParam(aMsg, aIter, &aResult->mContentFlags) &&
ReadParam(aMsg, aIter, &aResult->mOpacity) &&
ReadParam(aMsg, aIter, &aResult->mIsFixedPosition) &&
ReadParam(aMsg, aIter, &aResult->mAsyncZoomContainerId) &&
ReadParam(aMsg, aIter, &aResult->mScrollbarData) &&
ReadParam(aMsg, aIter, &aResult->mMixBlendMode) &&
ReadParam(aMsg, aIter, &aResult->mForceIsolatedGroup) &&
ReadParam(aMsg, aIter, &aResult->mFixedPositionData) &&
ReadParam(aMsg, aIter, &aResult->mStickyPositionData);
}
};
template <>
struct ParamTraits<mozilla::layers::CompositionPayloadType>
: public ContiguousEnumSerializerInclusive<