Backed out changeset 22d7763100aa (bug 1391499) for build bustage on Windows at gfx/layers/wr/StackingContextHelper.cpp(105): 'Size': undeclared identifier. r=backout

This commit is contained in:
Sebastian Hengst 2017-08-28 12:28:55 +02:00
Родитель ebac958b65
Коммит 80cced1397
2 изменённых файлов: 7 добавлений и 56 удалений

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

@ -14,8 +14,6 @@ namespace layers {
StackingContextHelper::StackingContextHelper() StackingContextHelper::StackingContextHelper()
: mBuilder(nullptr) : mBuilder(nullptr)
, mXScale(1.0f)
, mYScale(1.0f)
{ {
// mOrigin remains at 0,0 // mOrigin remains at 0,0
} }
@ -26,8 +24,6 @@ StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParen
const Maybe<gfx::Matrix4x4>& aTransform, const Maybe<gfx::Matrix4x4>& aTransform,
const nsTArray<wr::WrFilterOp>& aFilters) const nsTArray<wr::WrFilterOp>& aFilters)
: mBuilder(&aBuilder) : mBuilder(&aBuilder)
, mXScale(1.0f)
, mYScale(1.0f)
{ {
wr::LayoutRect scBounds = aParentSC.ToRelativeLayoutRect(aLayer->BoundsForStackingContext()); wr::LayoutRect scBounds = aParentSC.ToRelativeLayoutRect(aLayer->BoundsForStackingContext());
Layer* layer = aLayer->GetLayer(); Layer* layer = aLayer->GetLayer();
@ -51,8 +47,6 @@ StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParen
gfx::Matrix4x4* aTransformPtr, gfx::Matrix4x4* aTransformPtr,
const nsTArray<wr::WrFilterOp>& aFilters) const nsTArray<wr::WrFilterOp>& aFilters)
: mBuilder(&aBuilder) : mBuilder(&aBuilder)
, mXScale(1.0f)
, mYScale(1.0f)
{ {
wr::LayoutRect scBounds = aParentSC.ToRelativeLayoutRect(aLayer->BoundsForStackingContext()); wr::LayoutRect scBounds = aParentSC.ToRelativeLayoutRect(aLayer->BoundsForStackingContext());
if (aTransformPtr) { if (aTransformPtr) {
@ -83,38 +77,13 @@ StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParen
const nsTArray<wr::WrFilterOp>& aFilters, const nsTArray<wr::WrFilterOp>& aFilters,
const gfx::CompositionOp& aMixBlendMode) const gfx::CompositionOp& aMixBlendMode)
: mBuilder(&aBuilder) : mBuilder(&aBuilder)
, mXScale(1.0f)
, mYScale(1.0f)
{ {
nsRect visibleRect; nsRect visibleRect;
if (aTransformPtr) {
mTransform = *aTransformPtr;
}
bool is2d = !aTransformPtr || (aTransformPtr->Is2D() && !aPerspectivePtr); bool is2d = !aTransformPtr || (aTransformPtr->Is2D() && !aPerspectivePtr);
if (is2d) { if (is2d) {
nsRect itemBounds = aDisplayList->GetClippedBoundsWithRespectToASR(aDisplayListBuilder, aItem->GetActiveScrolledRoot()); nsRect itemBounds = aDisplayList->GetClippedBoundsWithRespectToASR(aDisplayListBuilder, aItem->GetActiveScrolledRoot());
nsRect childrenVisible = aItem->GetVisibleRectForChildren(); nsRect childrenVisible = aItem->GetVisibleRectForChildren();
visibleRect = itemBounds.Intersect(childrenVisible); visibleRect = itemBounds.Intersect(childrenVisible);
// Apply the inherited scale from parent
mTransform.PostScale(aParentSC.mXScale, aParentSC.mYScale, 1.0);
mTransform.NudgeToIntegersFixedEpsilon();
Size scale = mTransform.As2D().ScaleFactors(true);
// Restore the scale to default if the scale is too small
if (FuzzyEqualsAdditive(scale.width, 0.0f) ||
FuzzyEqualsAdditive(scale.height, 0.0f)) {
scale = Size(1.0f, 1.0f);
}
mTransform.PreScale(1.0f/scale.width, 1.0f/scale.height, 1.0);
// Store the inherited scale if has
this->mXScale = scale.width;
this->mYScale = scale.height;
} else { } else {
visibleRect = aDisplayList->GetBounds(aDisplayListBuilder); visibleRect = aDisplayList->GetBounds(aDisplayListBuilder);
// The position of bounds are calculated by transform and perspective matrix in 3d case. reset it to (0, 0) // The position of bounds are calculated by transform and perspective matrix in 3d case. reset it to (0, 0)
@ -130,11 +99,14 @@ StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParen
} }
wr::LayoutRect scBounds = aParentSC.ToRelativeLayoutRect(bounds); wr::LayoutRect scBounds = aParentSC.ToRelativeLayoutRect(bounds);
if (aTransformPtr) {
mTransform = *aTransformPtr;
}
mBuilder->PushStackingContext(scBounds, mBuilder->PushStackingContext(scBounds,
aAnimationsId, aAnimationsId,
aOpacityPtr, aOpacityPtr,
aTransformPtr ? &mTransform : aTransformPtr, aTransformPtr,
is2d ? wr::TransformStyle::Flat : wr::TransformStyle::Preserve3D, is2d ? wr::TransformStyle::Flat : wr::TransformStyle::Preserve3D,
aPerspectivePtr, aPerspectivePtr,
wr::ToMixBlendMode(aMixBlendMode), wr::ToMixBlendMode(aMixBlendMode),
@ -153,25 +125,13 @@ StackingContextHelper::~StackingContextHelper()
wr::LayoutRect wr::LayoutRect
StackingContextHelper::ToRelativeLayoutRect(const LayerRect& aRect) const StackingContextHelper::ToRelativeLayoutRect(const LayerRect& aRect) const
{ {
// Multiply by the scale inherited from ancestors if exits return wr::ToLayoutRect(aRect - mOrigin);
LayerRect aMaybeScaledRect = aRect;
if (mXScale != 1.0f || mYScale != 1.0f) {
aMaybeScaledRect.Scale(mXScale, mYScale);
}
return wr::ToLayoutRect(aMaybeScaledRect - mOrigin);
} }
wr::LayoutRect wr::LayoutRect
StackingContextHelper::ToRelativeLayoutRect(const LayoutDeviceRect& aRect) const StackingContextHelper::ToRelativeLayoutRect(const LayoutDeviceRect& aRect) const
{ {
// Multiply by the scale inherited from ancestors if exits return wr::ToLayoutRect(ViewAs<LayerPixel>(aRect, PixelCastJustification::WebRenderHasUnitResolution) - mOrigin);
LayoutDeviceRect aMaybeScaledRect = aRect;
if (mXScale != 1.0f || mYScale != 1.0f) {
aMaybeScaledRect.Scale(mXScale, mYScale);
}
return wr::ToLayoutRect(ViewAs<LayerPixel>(aMaybeScaledRect, PixelCastJustification::WebRenderHasUnitResolution) - mOrigin);
} }
wr::LayoutPoint wr::LayoutPoint
@ -183,13 +143,7 @@ StackingContextHelper::ToRelativeLayoutPoint(const LayerPoint& aPoint) const
wr::LayoutRect wr::LayoutRect
StackingContextHelper::ToRelativeLayoutRectRounded(const LayoutDeviceRect& aRect) const StackingContextHelper::ToRelativeLayoutRectRounded(const LayoutDeviceRect& aRect) const
{ {
// Multiply by the scale inherited from ancestors if exits return wr::ToLayoutRect(RoundedToInt(ViewAs<LayerPixel>(aRect, PixelCastJustification::WebRenderHasUnitResolution) - mOrigin));
LayoutDeviceRect aMaybeScaledRect = aRect;
if (mXScale != 1.0f || mYScale != 1.0f) {
aMaybeScaledRect.Scale(mXScale, mYScale);
}
return wr::ToLayoutRect(RoundedToInt(ViewAs<LayerPixel>(aMaybeScaledRect, PixelCastJustification::WebRenderHasUnitResolution) - mOrigin));
} }
} // namespace layers } // namespace layers

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

@ -89,9 +89,6 @@ private:
wr::DisplayListBuilder* mBuilder; wr::DisplayListBuilder* mBuilder;
LayerPoint mOrigin; LayerPoint mOrigin;
gfx::Matrix4x4 mTransform; gfx::Matrix4x4 mTransform;
float mXScale;
float mYScale;
}; };
} // namespace layers } // namespace layers