mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 856932 - Fix async scrolling of auto-positioned fixed position elements. r=nrc
Layers representing auto-positioned fixed position elements should not be offset by the fixed layer margins.
This commit is contained in:
parent
54272cbda0
commit
1f8698bb32
@ -859,6 +859,9 @@ public:
|
|||||||
* will be mirrored here. This allows for asynchronous animation of the
|
* will be mirrored here. This allows for asynchronous animation of the
|
||||||
* margins by reconciling the difference between this value and a value that
|
* margins by reconciling the difference between this value and a value that
|
||||||
* is updated more frequently.
|
* is updated more frequently.
|
||||||
|
* If the left or top margins are negative, it means that the elements this
|
||||||
|
* layer represents are auto-positioned, and so fixed position margins should
|
||||||
|
* not have an effect on the corresponding axis.
|
||||||
*/
|
*/
|
||||||
void SetFixedPositionMargins(const gfx::Margin& aMargins)
|
void SetFixedPositionMargins(const gfx::Margin& aMargins)
|
||||||
{
|
{
|
||||||
|
@ -642,17 +642,24 @@ CompositorParent::TransformFixedLayers(Layer* aLayer,
|
|||||||
// aFixedLayerMargins are the margins we expect to be at at the current
|
// aFixedLayerMargins are the margins we expect to be at at the current
|
||||||
// time, obtained via SyncViewportInfo, and fixedMargins are the margins
|
// time, obtained via SyncViewportInfo, and fixedMargins are the margins
|
||||||
// that were used during layout.
|
// that were used during layout.
|
||||||
|
// If top/left of fixedMargins are negative, that indicates that this layer
|
||||||
|
// represents auto-positioned elements, and should not be affected by
|
||||||
|
// fixed margins at all.
|
||||||
const gfx::Margin& fixedMargins = aLayer->GetFixedPositionMargins();
|
const gfx::Margin& fixedMargins = aLayer->GetFixedPositionMargins();
|
||||||
if (anchor.x > 0) {
|
if (fixedMargins.left >= 0) {
|
||||||
translation.x -= aFixedLayerMargins.right - fixedMargins.right;
|
if (anchor.x > 0) {
|
||||||
} else {
|
translation.x -= aFixedLayerMargins.right - fixedMargins.right;
|
||||||
translation.x += aFixedLayerMargins.left - fixedMargins.left;
|
} else {
|
||||||
|
translation.x += aFixedLayerMargins.left - fixedMargins.left;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (anchor.y > 0) {
|
if (fixedMargins.top >= 0) {
|
||||||
translation.y -= aFixedLayerMargins.bottom - fixedMargins.bottom;
|
if (anchor.y > 0) {
|
||||||
} else {
|
translation.y -= aFixedLayerMargins.bottom - fixedMargins.bottom;
|
||||||
translation.y += aFixedLayerMargins.top - fixedMargins.top;
|
} else {
|
||||||
|
translation.y += aFixedLayerMargins.top - fixedMargins.top;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The transform already takes the resolution scale into account. Since we
|
// The transform already takes the resolution scale into account. Since we
|
||||||
|
@ -2961,6 +2961,19 @@ nsDisplayFixedPosition::BuildLayer(nsDisplayListBuilder* aBuilder,
|
|||||||
aContainerParameters.mYScale,
|
aContainerParameters.mYScale,
|
||||||
NSAppUnitsToFloatPixels(fixedMargins.left, factor) *
|
NSAppUnitsToFloatPixels(fixedMargins.left, factor) *
|
||||||
aContainerParameters.mXScale);
|
aContainerParameters.mXScale);
|
||||||
|
|
||||||
|
// If the frame is auto-positioned on either axis, set the top/left layer
|
||||||
|
// margins to -1, to indicate to the compositor that this layer is
|
||||||
|
// unaffected by fixed margins.
|
||||||
|
if (position->mOffset.GetLeftUnit() == eStyleUnit_Auto &&
|
||||||
|
position->mOffset.GetRightUnit() == eStyleUnit_Auto) {
|
||||||
|
fixedLayerMargins.left = -1;
|
||||||
|
}
|
||||||
|
if (position->mOffset.GetTopUnit() == eStyleUnit_Auto &&
|
||||||
|
position->mOffset.GetBottomUnit() == eStyleUnit_Auto) {
|
||||||
|
fixedLayerMargins.top = -1;
|
||||||
|
}
|
||||||
|
|
||||||
layer->SetFixedPositionMargins(fixedLayerMargins);
|
layer->SetFixedPositionMargins(fixedLayerMargins);
|
||||||
|
|
||||||
return layer.forget();
|
return layer.forget();
|
||||||
|
Loading…
Reference in New Issue
Block a user