Bug 1395501 - Part1. Store inherited scale in stacking context. r=jrmuizel,kats

MozReview-Commit-ID: 6LsTJa05uFV
This commit is contained in:
Ethan Lin 2017-09-29 12:09:51 +08:00
Родитель e628cf64e9
Коммит 2902b1bde2
3 изменённых файлов: 17 добавлений и 5 удалений

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

@ -14,6 +14,7 @@ namespace layers {
StackingContextHelper::StackingContextHelper()
: mBuilder(nullptr)
, mScale(1.0f, 1.0f)
{
// mOrigin remains at 0,0
}
@ -24,6 +25,7 @@ StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParen
const Maybe<gfx::Matrix4x4>& aTransform,
const nsTArray<wr::WrFilterOp>& aFilters)
: mBuilder(&aBuilder)
, mScale(1.0f, 1.0f)
{
wr::LayoutRect scBounds = aParentSC.ToRelativeLayoutRect(aLayer->BoundsForStackingContext());
Layer* layer = aLayer->GetLayer();
@ -48,6 +50,7 @@ StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParen
gfx::Matrix4x4* aTransformPtr,
const nsTArray<wr::WrFilterOp>& aFilters)
: mBuilder(&aBuilder)
, mScale(1.0f, 1.0f)
{
wr::LayoutRect scBounds = aParentSC.ToRelativeLayoutRect(aLayer->BoundsForStackingContext());
if (aTransformPtr) {
@ -71,7 +74,7 @@ StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParen
nsDisplayListBuilder* aDisplayListBuilder,
nsDisplayItem* aItem,
nsDisplayList* aDisplayList,
gfx::Matrix4x4Typed<LayerPixel, LayerPixel>* aBoundTransform,
const gfx::Matrix4x4* aBoundTransform,
uint64_t aAnimationsId,
float* aOpacityPtr,
gfx::Matrix4x4* aTransformPtr,
@ -80,12 +83,19 @@ StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParen
const gfx::CompositionOp& aMixBlendMode,
bool aBackfaceVisible)
: mBuilder(&aBuilder)
, mScale(1.0f, 1.0f)
{
bool is2d = !aTransformPtr || (aTransformPtr->Is2D() && !aPerspectivePtr);
if (aTransformPtr) {
mTransform = *aTransformPtr;
}
// Compute scale for fallback rendering.
gfx::Matrix transform2d;
if (aBoundTransform && aBoundTransform->CanDraw2D(&transform2d)) {
mScale = transform2d.ScaleFactors(true) * aParentSC.mScale;
}
mBuilder->PushStackingContext(wr::LayoutRect(),
aAnimationsId,
aOpacityPtr,

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

@ -52,7 +52,7 @@ public:
nsDisplayListBuilder* aDisplayListBuilder,
nsDisplayItem* aItem,
nsDisplayList* aDisplayList,
gfx::Matrix4x4Typed<LayerPixel, LayerPixel>* aBoundTransform,
const gfx::Matrix4x4* aBoundTransform,
uint64_t aAnimationsId,
float* aOpacityPtr,
gfx::Matrix4x4* aTransformPtr,
@ -86,12 +86,16 @@ public:
// Same but for points
wr::LayoutPoint ToRelativeLayoutPoint(const LayerPoint& aPoint) const;
// Export the inherited scale
gfx::Size GetInheritedScale() const { return mScale; }
bool IsBackfaceVisible() const { return mTransform.IsBackfaceVisible(); }
private:
wr::DisplayListBuilder* mBuilder;
LayerPoint mOrigin;
gfx::Matrix4x4 mTransform;
gfx::Size mScale;
};
} // namespace layers

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

@ -8063,15 +8063,13 @@ nsDisplayTransform::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBu
animationsId = 0;
}
gfx::Matrix4x4Typed<LayerPixel, LayerPixel> boundTransform = ViewAs<gfx::Matrix4x4Typed<LayerPixel, LayerPixel>>(newTransformMatrix);
nsTArray<mozilla::wr::WrFilterOp> filters;
StackingContextHelper sc(aSc,
aBuilder,
aDisplayListBuilder,
this,
mStoredList.GetChildren(),
&boundTransform,
&newTransformMatrix,
animationsId,
nullptr,
transformForSC,