Backed out changeset e5b859d66536 (bug 1386553) for Windows bustage at layers/StackingContextHelper.h(50). r=backout on a CLOSED TREE

This commit is contained in:
Sebastian Hengst 2017-08-03 09:57:53 +02:00
parent 2caa31713d
commit a1ff1e3d1d
3 changed files with 75 additions and 67 deletions

View File

@ -7,7 +7,6 @@
#include "mozilla/layers/WebRenderLayer.h" #include "mozilla/layers/WebRenderLayer.h"
#include "UnitTransforms.h" #include "UnitTransforms.h"
#include "nsDisplayList.h"
namespace mozilla { namespace mozilla {
namespace layers { namespace layers {
@ -18,6 +17,33 @@ StackingContextHelper::StackingContextHelper()
// mOrigin remains at 0,0 // 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<wr::WrFilterOp>& 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, StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParentSC,
wr::DisplayListBuilder& aBuilder, wr::DisplayListBuilder& aBuilder,
WebRenderLayer* aLayer, WebRenderLayer* aLayer,
@ -62,47 +88,6 @@ StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParen
mOrigin = aLayer->Bounds().TopLeft(); mOrigin = aLayer->Bounds().TopLeft();
} }
StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParentSC,
wr::DisplayListBuilder& aBuilder,
nsDisplayListBuilder* aDisplayListBuilder,
nsDisplayItem* aItem,
nsDisplayList* aDisplayList,
gfx::Matrix4x4Typed<LayerPixel, LayerPixel>* aBoundTransform,
uint64_t aAnimationsId,
float* aOpacityPtr,
gfx::Matrix4x4* aTransformPtr,
const nsTArray<wr::WrFilterOp>& 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<LayerPixel>(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() StackingContextHelper::~StackingContextHelper()
{ {
if (mBuilder) { if (mBuilder) {

View File

@ -12,10 +12,6 @@
#include "mozilla/webrender/WebRenderTypes.h" #include "mozilla/webrender/WebRenderTypes.h"
#include "Units.h" #include "Units.h"
class nsDisplayBuilder;
class nsDisplayItem;
class nsDisplayList;
namespace mozilla { namespace mozilla {
namespace layers { namespace layers {
@ -49,10 +45,8 @@ public:
// The constructor for layers-free mode. // The constructor for layers-free mode.
StackingContextHelper(const StackingContextHelper& aParentSC, StackingContextHelper(const StackingContextHelper& aParentSC,
wr::DisplayListBuilder& aBuilder, wr::DisplayListBuilder& aBuilder,
nsDisplayListBuilder* aDisplayListBuilder, LayerRect aBoundForSC,
nsDisplayItem* aItem, LayerPoint aOrigin,
nsDisplayList* aDisplayList,
gfx::Matrix4x4Typed<LayerPixel, LayerPixel>* aBoundTransform,
uint64_t aAnimationsId, uint64_t aAnimationsId,
float* aOpacityPtr, float* aOpacityPtr,
gfx::Matrix4x4* aTransformPtr, gfx::Matrix4x4* aTransformPtr,

View File

@ -6118,6 +6118,13 @@ nsDisplayOpacity::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuil
mozilla::layers::WebRenderLayerManager* aManager, mozilla::layers::WebRenderLayerManager* aManager,
nsDisplayListBuilder* aDisplayListBuilder) nsDisplayListBuilder* aDisplayListBuilder)
{ {
nsRect itemBounds = mList.GetClippedBoundsWithRespectToASR(aDisplayListBuilder, mActiveScrolledRoot);
nsRect childrenVisible = GetVisibleRectForChildren();
nsRect visibleRect = itemBounds.Intersect(childrenVisible);
float appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
LayerRect bounds = ViewAs<LayerPixel>(LayoutDeviceRect::FromAppUnits(visibleRect, appUnitsPerDevPixel),
PixelCastJustification::WebRenderHasUnitResolution);
LayerPoint origin = bounds.TopLeft();
float* opacityForSC = &mOpacity; float* opacityForSC = &mOpacity;
RefPtr<WebRenderAnimationData> animationData = aManager->CreateOrRecycleWebRenderUserData<WebRenderAnimationData>(this); RefPtr<WebRenderAnimationData> animationData = aManager->CreateOrRecycleWebRenderUserData<WebRenderAnimationData>(this);
@ -6142,10 +6149,8 @@ nsDisplayOpacity::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuil
nsTArray<mozilla::wr::WrFilterOp> filters; nsTArray<mozilla::wr::WrFilterOp> filters;
StackingContextHelper sc(aSc, StackingContextHelper sc(aSc,
aBuilder, aBuilder,
aDisplayListBuilder, bounds,
this, origin,
&mList,
nullptr,
animationsId, animationsId,
opacityForSC, opacityForSC,
nullptr, nullptr,
@ -6198,9 +6203,16 @@ nsDisplayBlendMode::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBu
mozilla::layers::WebRenderLayerManager* aManager, mozilla::layers::WebRenderLayerManager* aManager,
nsDisplayListBuilder* aDisplayListBuilder) nsDisplayListBuilder* aDisplayListBuilder)
{ {
nsRect itemBounds = mList.GetClippedBoundsWithRespectToASR(aDisplayListBuilder, mActiveScrolledRoot);
nsRect childrenVisible = GetVisibleRectForChildren();
nsRect visibleRect = itemBounds.Intersect(childrenVisible);
float appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
LayerRect bounds = ViewAs<LayerPixel>(LayoutDeviceRect::FromAppUnits(visibleRect, appUnitsPerDevPixel),
PixelCastJustification::WebRenderHasUnitResolution);
LayerPoint origin = bounds.TopLeft();
nsTArray<mozilla::wr::WrFilterOp> filters; nsTArray<mozilla::wr::WrFilterOp> filters;
StackingContextHelper sc(aSc, aBuilder, aDisplayListBuilder, this, StackingContextHelper sc(aSc, aBuilder, bounds, origin, 0, nullptr, nullptr,
&mList, nullptr, 0, nullptr, nullptr,
filters, nsCSSRendering::GetGFXBlendMode(mBlendMode)); filters, nsCSSRendering::GetGFXBlendMode(mBlendMode));
return nsDisplayWrapList::CreateWebRenderCommands(aBuilder, sc, aParentCommands, return nsDisplayWrapList::CreateWebRenderCommands(aBuilder, sc, aParentCommands,
@ -6324,8 +6336,15 @@ nsDisplayBlendContainer::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder
mozilla::layers::WebRenderLayerManager* aManager, mozilla::layers::WebRenderLayerManager* aManager,
nsDisplayListBuilder* aDisplayListBuilder) nsDisplayListBuilder* aDisplayListBuilder)
{ {
StackingContextHelper sc(aSc, aBuilder, aDisplayListBuilder, this, nsRect itemBounds = mList.GetClippedBoundsWithRespectToASR(aDisplayListBuilder, mActiveScrolledRoot);
&mList, nullptr, 0, nullptr, nullptr); nsRect childrenVisible = GetVisibleRectForChildren();
nsRect visibleRect = itemBounds.Intersect(childrenVisible);
float appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
LayerRect bounds = ViewAs<LayerPixel>(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, return nsDisplayWrapList::CreateWebRenderCommands(aBuilder, sc, aParentCommands,
aManager, aDisplayListBuilder); aManager, aDisplayListBuilder);
@ -7772,6 +7791,23 @@ nsDisplayTransform::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBu
transformForSC = nullptr; 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<LayerPixel>(LayoutDeviceRect::FromAppUnits(visibleRect, appUnitsPerDevPixel),
PixelCastJustification::WebRenderHasUnitResolution);
LayerPoint origin = bounds.TopLeft();
gfx::Matrix4x4Typed<LayerPixel, LayerPixel> boundTransform = ViewAs< gfx::Matrix4x4Typed<LayerPixel, LayerPixel> >(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<WebRenderAnimationData> animationData = aManager->CreateOrRecycleWebRenderUserData<WebRenderAnimationData>(this); RefPtr<WebRenderAnimationData> animationData = aManager->CreateOrRecycleWebRenderUserData<WebRenderAnimationData>(this);
AnimationInfo& animationInfo = animationData->GetAnimationInfo(); AnimationInfo& animationInfo = animationData->GetAnimationInfo();
@ -7799,18 +7835,11 @@ nsDisplayTransform::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBu
aManager->WrBridge()->AddWebRenderParentCommand(anim); aManager->WrBridge()->AddWebRenderParentCommand(anim);
} }
gfx::Matrix4x4Typed<LayerPixel, LayerPixel> boundTransform = ViewAs< gfx::Matrix4x4Typed<LayerPixel, LayerPixel> >(newTransformMatrix);
boundTransform._41 = 0.0f;
boundTransform._42 = 0.0f;
boundTransform._43 = 0.0f;
nsTArray<mozilla::wr::WrFilterOp> filters; nsTArray<mozilla::wr::WrFilterOp> filters;
StackingContextHelper sc(aSc, StackingContextHelper sc(aSc,
aBuilder, aBuilder,
aDisplayListBuilder, bounds,
this, origin,
mStoredList.GetChildren(),
&boundTransform,
animationsId, animationsId,
nullptr, nullptr,
transformForSC, transformForSC,