mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 23:35:34 +00:00
Bug 1214151 - If a sticky element does not consume all of the un-adjustment for an async transform, allow a descendant fixed or sticky element to consume it. r=mstange
MozReview-Commit-ID: HHGjs4GZGNX --HG-- extra : rebase_source : 9e31e1135e7be90006529ce205d575b2dcd67c27
This commit is contained in:
parent
da66438e7c
commit
be99d4ba83
@ -508,6 +508,11 @@ AsyncCompositionManager::AlignFixedAndStickyLayers(Layer* aTransformedSubtreeRoo
|
||||
ParentLayerPoint translation = TransformBy(localTransformTyped, transformedAnchor)
|
||||
- TransformBy(localTransformTyped, anchor);
|
||||
|
||||
// A fixed layer will "consume" (be unadjusted by) the entire translation
|
||||
// calculated above. A sticky layer may consume all, part, or none of it,
|
||||
// depending on where we are relative to its sticky scroll range.
|
||||
bool translationConsumed = true;
|
||||
|
||||
if (layer->GetIsStickyPosition()) {
|
||||
// For sticky positioned layers, the difference between the two rectangles
|
||||
// defines a pair of translation intervals in each dimension through which
|
||||
@ -519,10 +524,14 @@ AsyncCompositionManager::AlignFixedAndStickyLayers(Layer* aTransformedSubtreeRoo
|
||||
|
||||
// TODO: There's a unit mismatch here, as |translation| is in ParentLayer
|
||||
// space while |stickyOuter| and |stickyInner| are in Layer space.
|
||||
ParentLayerPoint originalTranslation = translation;
|
||||
translation.y = IntervalOverlap(translation.y, stickyOuter.y, stickyOuter.YMost()) -
|
||||
IntervalOverlap(translation.y, stickyInner.y, stickyInner.YMost());
|
||||
translation.x = IntervalOverlap(translation.x, stickyOuter.x, stickyOuter.XMost()) -
|
||||
IntervalOverlap(translation.x, stickyInner.x, stickyInner.XMost());
|
||||
if (translation != originalTranslation) {
|
||||
translationConsumed = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Finally, apply the translation to the layer transform. Note that in cases
|
||||
@ -533,7 +542,13 @@ AsyncCompositionManager::AlignFixedAndStickyLayers(Layer* aTransformedSubtreeRoo
|
||||
TranslateShadowLayer(layer, ThebesPoint(translation.ToUnknownPoint()),
|
||||
true, aClipPartsCache);
|
||||
|
||||
return TraversalFlag::Skip;
|
||||
// If we didn't consume the entire translation, continue the traversal
|
||||
// to allow a descendant fixed or sticky layer to consume the rest.
|
||||
// TODO: We curently don't handle the case where we consume part but not
|
||||
// all of the translation correctly. In such a case,
|
||||
// |a[Previous|Current]TransformForRoot| would need to be adjusted
|
||||
// to reflect only the unconsumed part of the translation.
|
||||
return translationConsumed ? TraversalFlag::Skip : TraversalFlag::Continue;
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user