From a1ff1e3d1dde0f0a5cb946fdfe9542367e681cea Mon Sep 17 00:00:00 2001 From: Sebastian Hengst Date: Thu, 3 Aug 2017 09:57:53 +0200 Subject: [PATCH] Backed out changeset e5b859d66536 (bug 1386553) for Windows bustage at layers/StackingContextHelper.h(50). r=backout on a CLOSED TREE --- gfx/layers/wr/StackingContextHelper.cpp | 69 ++++++++++--------------- gfx/layers/wr/StackingContextHelper.h | 10 +--- layout/painting/nsDisplayList.cpp | 63 ++++++++++++++++------ 3 files changed, 75 insertions(+), 67 deletions(-) diff --git a/gfx/layers/wr/StackingContextHelper.cpp b/gfx/layers/wr/StackingContextHelper.cpp index ba081680bd7e..4d8589972680 100644 --- a/gfx/layers/wr/StackingContextHelper.cpp +++ b/gfx/layers/wr/StackingContextHelper.cpp @@ -7,7 +7,6 @@ #include "mozilla/layers/WebRenderLayer.h" #include "UnitTransforms.h" -#include "nsDisplayList.h" namespace mozilla { namespace layers { @@ -18,6 +17,33 @@ StackingContextHelper::StackingContextHelper() // mOrigin remains at 0,0 } +StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParentSC, + wr::DisplayListBuilder& aBuilder, + LayerRect aBoundForSC, + LayerPoint aOrigin, + uint64_t aAnimationsId, + float* aOpacityPtr, + gfx::Matrix4x4* aTransformPtr, + const nsTArray& aFilters, + const gfx::CompositionOp& aMixBlendMode) + : mBuilder(&aBuilder) +{ + wr::LayoutRect scBounds = aParentSC.ToRelativeLayoutRect(aBoundForSC); + if (aTransformPtr) { + mTransform = *aTransformPtr; + } + + mBuilder->PushStackingContext(scBounds, + aAnimationsId, + aOpacityPtr, + aTransformPtr, + wr::TransformStyle::Flat, + wr::ToMixBlendMode(aMixBlendMode), + aFilters); + + mOrigin = aOrigin; +} + StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParentSC, wr::DisplayListBuilder& aBuilder, WebRenderLayer* aLayer, @@ -62,47 +88,6 @@ StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParen mOrigin = aLayer->Bounds().TopLeft(); } -StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParentSC, - wr::DisplayListBuilder& aBuilder, - nsDisplayListBuilder* aDisplayListBuilder, - nsDisplayItem* aItem, - nsDisplayList* aDisplayList, - gfx::Matrix4x4Typed* aBoundTransform, - uint64_t aAnimationsId, - float* aOpacityPtr, - gfx::Matrix4x4* aTransformPtr, - const nsTArray& aFilters, - const gfx::CompositionOp& aMixBlendMode) - : mBuilder(&aBuilder) -{ - nsRect itemBounds = aDisplayList->GetClippedBoundsWithRespectToASR(aDisplayListBuilder, aItem->GetActiveScrolledRoot()); - nsRect childrenVisible = aItem->GetVisibleRectForChildren(); - nsRect visibleRect = itemBounds.Intersect(childrenVisible); - float appUnitsPerDevPixel = aItem->Frame()->PresContext()->AppUnitsPerDevPixel(); - LayerRect bounds = ViewAs(LayoutDeviceRect::FromAppUnits(visibleRect, appUnitsPerDevPixel), - PixelCastJustification::WebRenderHasUnitResolution); - - // WR will only apply the 'translate' of the transform, so we need to do the scale/rotation manually. - if (aBoundTransform && !aBoundTransform->IsIdentity()) { - bounds.MoveTo(aBoundTransform->TransformPoint(bounds.TopLeft())); - } - - wr::LayoutRect scBounds = aParentSC.ToRelativeLayoutRect(bounds); - if (aTransformPtr) { - mTransform = *aTransformPtr; - } - - mBuilder->PushStackingContext(scBounds, - aAnimationsId, - aOpacityPtr, - aTransformPtr, - wr::TransformStyle::Flat, - wr::ToMixBlendMode(aMixBlendMode), - aFilters); - - mOrigin = bounds.TopLeft(); -} - StackingContextHelper::~StackingContextHelper() { if (mBuilder) { diff --git a/gfx/layers/wr/StackingContextHelper.h b/gfx/layers/wr/StackingContextHelper.h index 8dfc4f844b6c..83e77f4756df 100644 --- a/gfx/layers/wr/StackingContextHelper.h +++ b/gfx/layers/wr/StackingContextHelper.h @@ -12,10 +12,6 @@ #include "mozilla/webrender/WebRenderTypes.h" #include "Units.h" -class nsDisplayBuilder; -class nsDisplayItem; -class nsDisplayList; - namespace mozilla { namespace layers { @@ -49,10 +45,8 @@ public: // The constructor for layers-free mode. StackingContextHelper(const StackingContextHelper& aParentSC, wr::DisplayListBuilder& aBuilder, - nsDisplayListBuilder* aDisplayListBuilder, - nsDisplayItem* aItem, - nsDisplayList* aDisplayList, - gfx::Matrix4x4Typed* aBoundTransform, + LayerRect aBoundForSC, + LayerPoint aOrigin, uint64_t aAnimationsId, float* aOpacityPtr, gfx::Matrix4x4* aTransformPtr, diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index 60f7e605e5de..0f15dacf59ae 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -6118,6 +6118,13 @@ nsDisplayOpacity::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuil mozilla::layers::WebRenderLayerManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { + nsRect itemBounds = mList.GetClippedBoundsWithRespectToASR(aDisplayListBuilder, mActiveScrolledRoot); + nsRect childrenVisible = GetVisibleRectForChildren(); + nsRect visibleRect = itemBounds.Intersect(childrenVisible); + float appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel(); + LayerRect bounds = ViewAs(LayoutDeviceRect::FromAppUnits(visibleRect, appUnitsPerDevPixel), + PixelCastJustification::WebRenderHasUnitResolution); + LayerPoint origin = bounds.TopLeft(); float* opacityForSC = &mOpacity; RefPtr animationData = aManager->CreateOrRecycleWebRenderUserData(this); @@ -6142,10 +6149,8 @@ nsDisplayOpacity::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuil nsTArray filters; StackingContextHelper sc(aSc, aBuilder, - aDisplayListBuilder, - this, - &mList, - nullptr, + bounds, + origin, animationsId, opacityForSC, nullptr, @@ -6198,9 +6203,16 @@ nsDisplayBlendMode::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBu mozilla::layers::WebRenderLayerManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { + nsRect itemBounds = mList.GetClippedBoundsWithRespectToASR(aDisplayListBuilder, mActiveScrolledRoot); + nsRect childrenVisible = GetVisibleRectForChildren(); + nsRect visibleRect = itemBounds.Intersect(childrenVisible); + float appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel(); + LayerRect bounds = ViewAs(LayoutDeviceRect::FromAppUnits(visibleRect, appUnitsPerDevPixel), + PixelCastJustification::WebRenderHasUnitResolution); + LayerPoint origin = bounds.TopLeft(); + nsTArray filters; - StackingContextHelper sc(aSc, aBuilder, aDisplayListBuilder, this, - &mList, nullptr, 0, nullptr, nullptr, + StackingContextHelper sc(aSc, aBuilder, bounds, origin, 0, nullptr, nullptr, filters, nsCSSRendering::GetGFXBlendMode(mBlendMode)); return nsDisplayWrapList::CreateWebRenderCommands(aBuilder, sc, aParentCommands, @@ -6324,8 +6336,15 @@ nsDisplayBlendContainer::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder mozilla::layers::WebRenderLayerManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { - StackingContextHelper sc(aSc, aBuilder, aDisplayListBuilder, this, - &mList, nullptr, 0, nullptr, nullptr); + nsRect itemBounds = mList.GetClippedBoundsWithRespectToASR(aDisplayListBuilder, mActiveScrolledRoot); + nsRect childrenVisible = GetVisibleRectForChildren(); + nsRect visibleRect = itemBounds.Intersect(childrenVisible); + float appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel(); + LayerRect bounds = ViewAs(LayoutDeviceRect::FromAppUnits(visibleRect, appUnitsPerDevPixel), + PixelCastJustification::WebRenderHasUnitResolution); + LayerPoint origin = bounds.TopLeft(); + + StackingContextHelper sc(aSc, aBuilder, bounds, origin, 0, nullptr, nullptr); return nsDisplayWrapList::CreateWebRenderCommands(aBuilder, sc, aParentCommands, aManager, aDisplayListBuilder); @@ -7772,6 +7791,23 @@ nsDisplayTransform::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBu transformForSC = nullptr; } + nsRect itemBounds = mStoredList.GetChildren()->GetClippedBoundsWithRespectToASR(aDisplayListBuilder, mActiveScrolledRoot); + nsRect childrenVisible = GetVisibleRectForChildren(); + nsRect visibleRect = itemBounds.Intersect(childrenVisible); + float appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel(); + LayerRect bounds = ViewAs(LayoutDeviceRect::FromAppUnits(visibleRect, appUnitsPerDevPixel), + PixelCastJustification::WebRenderHasUnitResolution); + LayerPoint origin = bounds.TopLeft(); + + gfx::Matrix4x4Typed boundTransform = ViewAs< gfx::Matrix4x4Typed >(newTransformMatrix); + boundTransform._41 = 0.0f; + boundTransform._42 = 0.0f; + boundTransform._43 = 0.0f; + if (!boundTransform.IsIdentity()) { + // WR will only apply the 'translate' of the transform, so we need to do the scale/rotation manually. + bounds.MoveTo(boundTransform.TransformPoint(bounds.TopLeft())); + } + RefPtr animationData = aManager->CreateOrRecycleWebRenderUserData(this); AnimationInfo& animationInfo = animationData->GetAnimationInfo(); @@ -7799,18 +7835,11 @@ nsDisplayTransform::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBu aManager->WrBridge()->AddWebRenderParentCommand(anim); } - gfx::Matrix4x4Typed boundTransform = ViewAs< gfx::Matrix4x4Typed >(newTransformMatrix); - boundTransform._41 = 0.0f; - boundTransform._42 = 0.0f; - boundTransform._43 = 0.0f; - nsTArray filters; StackingContextHelper sc(aSc, aBuilder, - aDisplayListBuilder, - this, - mStoredList.GetChildren(), - &boundTransform, + bounds, + origin, animationsId, nullptr, transformForSC,