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-31 07:17:45 +00:00
parent 61569917d1
commit 681aa6716a
5 changed files with 50 additions and 16 deletions

View File

@ -1301,6 +1301,16 @@ void WebRenderCommandBuilder::DoGroupingForDisplayList(
bool snapped; bool snapped;
nsRect groupBounds = aWrappingItem->GetBounds(aDisplayListBuilder, &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());
mClippedGroupBounds = Nothing();
}
DIGroup& group = groupData->mSubGroup; DIGroup& group = groupData->mSubGroup;
gfx::Size scale = aSc.GetInheritedScale(); gfx::Size scale = aSc.GetInheritedScale();
@ -1485,7 +1495,8 @@ bool WebRenderCommandBuilder::ShouldDumpDisplayList(
void WebRenderCommandBuilder::CreateWebRenderCommandsFromDisplayList( void WebRenderCommandBuilder::CreateWebRenderCommandsFromDisplayList(
nsDisplayList* aDisplayList, nsDisplayItem* aWrappingItem, nsDisplayList* aDisplayList, nsDisplayItem* aWrappingItem,
nsDisplayListBuilder* aDisplayListBuilder, const StackingContextHelper& aSc, nsDisplayListBuilder* aDisplayListBuilder, const StackingContextHelper& aSc,
wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources) { wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources,
nsDisplayItem* aOuterItem) {
if (mDoGrouping) { if (mDoGrouping) {
MOZ_RELEASE_ASSERT( MOZ_RELEASE_ASSERT(
aWrappingItem, aWrappingItem,
@ -1595,6 +1606,25 @@ void WebRenderCommandBuilder::CreateWebRenderCommandsFromDisplayList(
// animated geometry root, so we can combine subsequent items of that // animated geometry root, so we can combine subsequent items of that
// type into the same image. // type into the same image.
mContainsSVGGroup = mDoGrouping = true; 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"); GP("attempting to enter the grouping code\n");
} }

View File

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

View File

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

View File

@ -132,18 +132,18 @@ fuzzy-if(d2d,0-16,0-10) == img-content-outside-viewBox-1.html img-content-outsid
== img-widthAndHeight-meet-1.html img-widthAndHeight-meet-1-ref.html == img-widthAndHeight-meet-1.html img-widthAndHeight-meet-1-ref.html
== img-widthAndHeight-meet-2.html img-widthAndHeight-meet-2-ref.html == img-widthAndHeight-meet-2.html img-widthAndHeight-meet-2-ref.html
fuzzy-if(webrender,255-255,21-21) == img-widthAndHeight-slice-1.html img-widthAndHeight-slice-1-ref.html == img-widthAndHeight-slice-1.html img-widthAndHeight-slice-1-ref.html
fuzzy-if(webrender,255-255,12-12) == img-widthAndHeight-slice-2.html img-widthAndHeight-slice-2-ref.html == img-widthAndHeight-slice-2.html img-widthAndHeight-slice-2-ref.html
== img-height-meet-1.html img-height-meet-1-ref.html == img-height-meet-1.html img-height-meet-1-ref.html
== img-height-meet-2.html img-height-meet-2-ref.html == img-height-meet-2.html img-height-meet-2-ref.html
fuzzy-if(webrender,255-255,21-21) == img-height-slice-1.html img-height-slice-1-ref.html == img-height-slice-1.html img-height-slice-1-ref.html
fuzzy-if(webrender,255-255,12-12) == img-height-slice-2.html img-height-slice-2-ref.html == img-height-slice-2.html img-height-slice-2-ref.html
== img-width-meet-1.html img-width-meet-1-ref.html == img-width-meet-1.html img-width-meet-1-ref.html
== img-width-meet-2.html img-width-meet-2-ref.html == img-width-meet-2.html img-width-meet-2-ref.html
fuzzy-if(webrender,255-255,21-21) == img-width-slice-1.html img-width-slice-1-ref.html fuzzy-if(webrender,255-255,3-3) == img-width-slice-1.html img-width-slice-1-ref.html
fuzzy-if(webrender,255-255,12-12) == img-width-slice-2.html img-width-slice-2-ref.html == img-width-slice-2.html img-width-slice-2-ref.html
# Alternate version of "width & height both non-%-valued" tests, but now # Alternate version of "width & height both non-%-valued" tests, but now
# with no explicit viewBox, to trigger "synthesize-viewBox" behavior # with no explicit viewBox, to trigger "synthesize-viewBox" behavior
@ -154,10 +154,10 @@ fuzzy-if(webrender,255-255,12-12) == img-width-slice-2.html img-width-slice-2-r
# Alternate versions of "only one dimension is non-%-valued" tests, but now # Alternate versions of "only one dimension is non-%-valued" tests, but now
# with no explicit viewBox, to trigger "synthesize-viewBox" behavior # with no explicit viewBox, to trigger "synthesize-viewBox" behavior
fuzzy-if(webrender,255-255,20-40) == img-novb-height-meet-1.html img-novb-height-all-1-ref.html == img-novb-height-meet-1.html img-novb-height-all-1-ref.html
fuzzy-if(webrender,255-255,20-40) == img-novb-height-slice-1.html img-novb-height-all-1-ref.html == img-novb-height-slice-1.html img-novb-height-all-1-ref.html
fuzzy-if(skiaContent,0-255,0-10) fuzzy-if(webrender,255-255,20-20) == img-novb-width-meet-1.html img-novb-width-all-1-ref.html fuzzy-if(skiaContent,0-255,0-10) == img-novb-width-meet-1.html img-novb-width-all-1-ref.html
fuzzy-if(skiaContent,0-255,0-10) fuzzy-if(webrender,255-255,20-20) == img-novb-width-slice-1.html img-novb-width-all-1-ref.html fuzzy-if(skiaContent,0-255,0-10) == img-novb-width-slice-1.html img-novb-width-all-1-ref.html
# with with a fragmentIdentifier viewBox # with with a fragmentIdentifier viewBox
== img-fragment-1a.html img-fragment-1-ref.html == img-fragment-1a.html img-fragment-1-ref.html

View File

@ -3,7 +3,7 @@
fuzzy(0-111,0-1802) fuzzy-if(skiaContent,0-130,0-1000) == additive-1.svg additive-1-ref.svg # bug 981344, bug 1239766 fuzzy(0-111,0-1802) fuzzy-if(skiaContent,0-130,0-1000) == additive-1.svg additive-1-ref.svg # bug 981344, bug 1239766
== animate-width-1.svg lime.svg == animate-width-1.svg lime.svg
fuzzy-if(cocoaWidget,0-3,0-50) fuzzy-if(winWidget,0-15,0-30) fuzzy-if(gtkWidget,0-3,0-50) fuzzy-if(webrender,3-3,9-9) fuzzy-if(Android,0-16,0-1) == paced-1.svg paced-1-ref.svg # bug 981640, Bug 1293550 fuzzy-if(cocoaWidget,0-3,0-50) fuzzy-if(winWidget,0-15,0-30) fuzzy-if(gtkWidget,0-3,0-50) fuzzy-if(Android,0-16,0-1) == paced-1.svg paced-1-ref.svg # bug 981640, Bug 1293550
fuzzy-if(skiaContent,0-7,0-90) == rotate-angle-1.svg rotate-angle-ref.svg fuzzy-if(skiaContent,0-7,0-90) == rotate-angle-1.svg rotate-angle-ref.svg
fuzzy-if(skiaContent,0-7,0-90) == rotate-angle-2.svg rotate-angle-ref.svg fuzzy-if(skiaContent,0-7,0-90) == rotate-angle-2.svg rotate-angle-ref.svg
fuzzy-if(skiaContent,0-7,0-130) == rotate-angle-3.svg rotate-angle-ref.svg fuzzy-if(skiaContent,0-7,0-130) == rotate-angle-3.svg rotate-angle-ref.svg