Bug 1273250 - Set a layer clip rather than a scroll clip for fixed background layers if the clip moves with the layer. r=mstange
This patch also removes the earlier workaround added in
bug 1272525.
MozReview-Commit-ID: HR2wF2BGsKl
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -3871,18 +3871,21 @@ ContainerState::ProcessDisplayItems(nsDi
scrollClip = scrollClip->mParent) {
if (scrollClip->mClip) {
clip.IntersectWith(*scrollClip->mClip);
}
}
item->SetClip(mBuilder, clip);
}
- bool shouldFixToViewport = !(*animatedGeometryRoot)->GetParent() &&
- item->ShouldFixToViewport(mBuilder);
+ bool clipMovesWithLayer = (animatedGeometryRoot == animatedGeometryRootForClip);
+
+ bool shouldFixToViewport = !clipMovesWithLayer &&
+ !(*animatedGeometryRoot)->GetParent() &&
+ item->ShouldFixToViewport(mBuilder);
// For items that are fixed to the viewport, remove their clip at the
// display item level because additional areas could be brought into
// view by async scrolling. Save the clip so we can set it on the layer
// instead later.
DisplayItemClip fixedToViewportClip = DisplayItemClip::NoClip();
if (shouldFixToViewport) {
fixedToViewportClip = item->GetClip();
@@ -4111,17 +4114,17 @@ ContainerState::ProcessDisplayItems(nsDi
ownLayer->SetClipRect(Nothing());
ownLayer->SetScrolledClip(Nothing());
if (layerClip.HasClip()) {
// For layers fixed to the viewport, the clip becomes part of the
// layer's scrolled clip. However, BasicLayerManager doesn't support
// scrolled clips, and doesn't care about the distinction anyways
// (it only matters for async scrolling), so only set a scrolled clip
// if we have a widget layer manager.
- if (shouldFixToViewport && mManager->IsWidgetLayerManager()) {
+ if (shouldFixToViewport) {
LayerClip scrolledClip;
scrolledClip.SetClipRect(layerClipRect);
if (layerClip.IsRectClippedByRoundedCorner(itemContent)) {
scrolledClip.SetMaskLayerIndex(
SetupMaskLayerForScrolledClip(ownLayer.get(), layerClip));
}
ownLayer->SetScrolledClip(Some(scrolledClip));
} else {