mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1214267 - Send the side to which fixed-pos items are attached so that we can move them in the compositor more correctly when the viewport size is changing. r=mattwoodrow
This commit is contained in:
parent
edc7736827
commit
a84470d0f5
@ -1148,6 +1148,11 @@ public:
|
||||
* compositing the layer tree with a transformation (such as when
|
||||
* asynchronously scrolling and zooming).
|
||||
*
|
||||
* - |aSides| is the set of sides to which the element is fixed relative to.
|
||||
* This is used if the viewport size is changed in the compositor and
|
||||
* fixed position items need to shift accordingly. This value is made up
|
||||
* combining appropriate values from mozilla::SideBits.
|
||||
*
|
||||
* - |aIsClipFixed| is true if this layer's clip rect and mask layer
|
||||
* should also remain fixed during async scrolling/animations.
|
||||
* This is the case for fixed position layers, but not for
|
||||
@ -1155,11 +1160,13 @@ public:
|
||||
*/
|
||||
void SetFixedPositionData(FrameMetrics::ViewID aScrollId,
|
||||
const LayerPoint& aAnchor,
|
||||
int32_t aSides,
|
||||
bool aIsClipFixed)
|
||||
{
|
||||
if (!mFixedPositionData ||
|
||||
mFixedPositionData->mScrollId != aScrollId ||
|
||||
mFixedPositionData->mAnchor != aAnchor ||
|
||||
mFixedPositionData->mSides != aSides ||
|
||||
mFixedPositionData->mIsClipFixed != aIsClipFixed) {
|
||||
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) FixedPositionData", this));
|
||||
if (!mFixedPositionData) {
|
||||
@ -1167,6 +1174,7 @@ public:
|
||||
}
|
||||
mFixedPositionData->mScrollId = aScrollId;
|
||||
mFixedPositionData->mAnchor = aAnchor;
|
||||
mFixedPositionData->mSides = aSides;
|
||||
mFixedPositionData->mIsClipFixed = aIsClipFixed;
|
||||
Mutated();
|
||||
}
|
||||
@ -1261,6 +1269,7 @@ public:
|
||||
bool GetIsStickyPosition() { return mStickyPositionData; }
|
||||
FrameMetrics::ViewID GetFixedPositionScrollContainerId() { return mFixedPositionData ? mFixedPositionData->mScrollId : FrameMetrics::NULL_SCROLL_ID; }
|
||||
LayerPoint GetFixedPositionAnchor() { return mFixedPositionData ? mFixedPositionData->mAnchor : LayerPoint(); }
|
||||
int32_t GetFixedPositionSides() { return mFixedPositionData ? mFixedPositionData->mSides : eSideBitsNone; }
|
||||
bool IsClipFixed() { return mFixedPositionData ? mFixedPositionData->mIsClipFixed : false; }
|
||||
FrameMetrics::ViewID GetStickyScrollContainerId() { return mStickyPositionData->mScrollId; }
|
||||
const LayerRect& GetStickyScrollRangeOuter() { return mStickyPositionData->mOuter; }
|
||||
@ -1790,6 +1799,7 @@ protected:
|
||||
struct FixedPositionData {
|
||||
FrameMetrics::ViewID mScrollId;
|
||||
LayerPoint mAnchor;
|
||||
int32_t mSides;
|
||||
bool mIsClipFixed;
|
||||
};
|
||||
UniquePtr<FixedPositionData> mFixedPositionData;
|
||||
|
@ -283,17 +283,21 @@ GetLayerFixedMarginsOffset(Layer* aLayer,
|
||||
// Because fixed layer margins are stored relative to the root scrollable
|
||||
// layer, we can just take the difference between these values.
|
||||
LayerPoint translation;
|
||||
const LayerPoint& anchor = aLayer->GetFixedPositionAnchor();
|
||||
int32_t sides = aLayer->GetFixedPositionSides();
|
||||
|
||||
if (anchor.x > 0) {
|
||||
if ((sides & eSideBitsLeftRight) == eSideBitsLeftRight) {
|
||||
translation.x += (aFixedLayerMargins.left - aFixedLayerMargins.right) / 2;
|
||||
} else if (sides & eSideBitsRight) {
|
||||
translation.x -= aFixedLayerMargins.right;
|
||||
} else {
|
||||
} else if (sides & eSideBitsLeft) {
|
||||
translation.x += aFixedLayerMargins.left;
|
||||
}
|
||||
|
||||
if (anchor.y > 0) {
|
||||
if ((sides & eSideBitsTopBottom) == eSideBitsTopBottom) {
|
||||
translation.y += (aFixedLayerMargins.top - aFixedLayerMargins.bottom) / 2;
|
||||
} else if (sides & eSideBitsBottom) {
|
||||
translation.y -= aFixedLayerMargins.bottom;
|
||||
} else {
|
||||
} else if (sides & eSideBitsTop) {
|
||||
translation.y += aFixedLayerMargins.top;
|
||||
}
|
||||
|
||||
|
@ -327,6 +327,7 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
|
||||
if (common.isFixedPosition()) {
|
||||
layer->SetFixedPositionData(common.fixedPositionScrollContainerId(),
|
||||
common.fixedPositionAnchor(),
|
||||
common.fixedPositionSides(),
|
||||
common.isClipFixed());
|
||||
}
|
||||
if (common.isStickyPosition()) {
|
||||
|
@ -217,6 +217,7 @@ struct CommonLayerAttributes {
|
||||
bool isFixedPosition;
|
||||
uint64_t fixedPositionScrollContainerId;
|
||||
LayerPoint fixedPositionAnchor;
|
||||
int32_t fixedPositionSides;
|
||||
bool isClipFixed;
|
||||
bool isStickyPosition;
|
||||
uint64_t stickyScrollContainerId;
|
||||
|
@ -1854,17 +1854,22 @@ nsLayoutUtils::SetFixedPositionLayerData(Layer* aLayer,
|
||||
// defaulting to top-left.
|
||||
LayerPoint anchor(anchorRect.x, anchorRect.y);
|
||||
|
||||
int32_t sides = eSideBitsNone;
|
||||
if (aFixedPosFrame != aViewportFrame) {
|
||||
const nsStylePosition* position = aFixedPosFrame->StylePosition();
|
||||
if (position->mOffset.GetRightUnit() != eStyleUnit_Auto) {
|
||||
sides |= eSideBitsRight;
|
||||
if (position->mOffset.GetLeftUnit() != eStyleUnit_Auto) {
|
||||
sides |= eSideBitsLeft;
|
||||
anchor.x = anchorRect.x + anchorRect.width / 2.f;
|
||||
} else {
|
||||
anchor.x = anchorRect.XMost();
|
||||
}
|
||||
}
|
||||
if (position->mOffset.GetBottomUnit() != eStyleUnit_Auto) {
|
||||
sides |= eSideBitsBottom;
|
||||
if (position->mOffset.GetTopUnit() != eStyleUnit_Auto) {
|
||||
sides |= eSideBitsTop;
|
||||
anchor.y = anchorRect.y + anchorRect.height / 2.f;
|
||||
} else {
|
||||
anchor.y = anchorRect.YMost();
|
||||
@ -1878,7 +1883,7 @@ nsLayoutUtils::SetFixedPositionLayerData(Layer* aLayer,
|
||||
id = FindOrCreateIDFor(content);
|
||||
}
|
||||
}
|
||||
aLayer->SetFixedPositionData(id, anchor, aIsClipFixed);
|
||||
aLayer->SetFixedPositionData(id, anchor, sides, aIsClipFixed);
|
||||
}
|
||||
|
||||
bool
|
||||
|
Loading…
Reference in New Issue
Block a user