Bug 1494408 - Clip groups to the transform clip to avoid bounds changes. r=jrmuizel

Differential Revision: https://phabricator.services.mozilla.com/D17983

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Matt Woodrow 2019-01-30 19:32:07 +00:00
Родитель 3ae3119574
Коммит 9da66b0f20
3 изменённых файлов: 38 добавлений и 5 удалений

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

@ -1301,6 +1301,15 @@ void WebRenderCommandBuilder::DoGroupingForDisplayList(
bool snapped;
nsRect groupBounds = aWrappingItem->GetBounds(aDisplayListBuilder, &snapped);
// We don't want to restrict the size of the blob to the building rect of the
// display item, since that will change when we scroll and trigger a resize
// invalidation of the blob (will be fixed by blob recoordination).
// Instead we retrieve the bounds of the overflow clip on the <svg> and use
// that to restrict our size and prevent invisible content from affecting
// our bounds.
if (mClippedGroupBounds) {
groupBounds = groupBounds.Intersect(mClippedGroupBounds.value());
}
DIGroup& group = groupData->mSubGroup;
gfx::Size scale = aSc.GetInheritedScale();
@ -1485,7 +1494,8 @@ bool WebRenderCommandBuilder::ShouldDumpDisplayList(
void WebRenderCommandBuilder::CreateWebRenderCommandsFromDisplayList(
nsDisplayList* aDisplayList, nsDisplayItem* aWrappingItem,
nsDisplayListBuilder* aDisplayListBuilder, const StackingContextHelper& aSc,
wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources) {
wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources,
nsDisplayItem* aOuterItem) {
if (mDoGrouping) {
MOZ_RELEASE_ASSERT(
aWrappingItem,
@ -1595,6 +1605,25 @@ void WebRenderCommandBuilder::CreateWebRenderCommandsFromDisplayList(
// animated geometry root, so we can combine subsequent items of that
// type into the same image.
mContainsSVGGroup = mDoGrouping = true;
if (aOuterItem &&
aOuterItem->GetType() == DisplayItemType::TYPE_TRANSFORM) {
// Inline <svg> should always have an overflow clip, but it gets put
// outside the nsDisplayTransform we create for scaling the svg
// viewport. Converting the clip into inner coordinates lets us
// restrict the size of the blob images and prevents unnecessary
// resizes.
nsDisplayTransform* transform =
static_cast<nsDisplayTransform*>(aOuterItem);
nsRect clippedBounds =
transform->GetClippedBounds(aDisplayListBuilder);
nsRect innerClippedBounds;
DebugOnly<bool> result = transform->UntransformRect(
aDisplayListBuilder, clippedBounds, &innerClippedBounds);
MOZ_ASSERT(result);
mClippedGroupBounds = Some(innerClippedBounds);
}
GP("attempting to enter the grouping code\n");
}

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

@ -92,10 +92,11 @@ class WebRenderCommandBuilder {
nsDisplayListBuilder* aDisplayListBuilder);
void CreateWebRenderCommandsFromDisplayList(
nsDisplayList* aDisplayList, nsDisplayItem* aOuterItem,
nsDisplayList* aDisplayList, nsDisplayItem* aWrappingItem,
nsDisplayListBuilder* aDisplayListBuilder,
const StackingContextHelper& aSc, wr::DisplayListBuilder& aBuilder,
wr::IpcResourceUpdateQueue& aResources);
wr::IpcResourceUpdateQueue& aResources,
nsDisplayItem* aOuterItem = nullptr);
// aWrappingItem has to be non-null.
void DoGroupingForDisplayList(nsDisplayList* aDisplayList,
@ -201,6 +202,7 @@ class WebRenderCommandBuilder {
// Whether consecutive inactive display items should be grouped into one
// blob image.
bool mDoGrouping;
Maybe<nsRect> mClippedGroupBounds;
// True if we're currently within an opacity:0 container, and only
// plugin and hit test items should be considered.

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

@ -7893,8 +7893,10 @@ bool nsDisplayTransform::CreateWebRenderCommands(
params,
LayoutDeviceRect(position, LayoutDeviceSize()));
return mStoredList.CreateWebRenderCommands(aBuilder, aResources, sc, aManager,
aDisplayListBuilder);
aManager->CommandBuilder().CreateWebRenderCommandsFromDisplayList(
mStoredList.GetChildren(), &mStoredList, aDisplayListBuilder, sc,
aBuilder, aResources, this);
return true;
}
bool nsDisplayTransform::UpdateScrollData(