diff --git a/gfx/2d/Matrix.h b/gfx/2d/Matrix.h index b9c2c02f415..5813a6185dd 100644 --- a/gfx/2d/Matrix.h +++ b/gfx/2d/Matrix.h @@ -1251,24 +1251,6 @@ public: return *this; } - // Nudge the 3D components to integer so that this matrix will become 2D if - // it's very close to already being 2D. - // This doesn't change the _41 and _42 components. - Matrix4x4Typed &NudgeTo2D() - { - NudgeToInteger(&_13); - NudgeToInteger(&_14); - NudgeToInteger(&_23); - NudgeToInteger(&_24); - NudgeToInteger(&_31); - NudgeToInteger(&_32); - NudgeToInteger(&_33); - NudgeToInteger(&_34); - NudgeToInteger(&_43); - NudgeToInteger(&_44); - return *this; - } - Point4D TransposedVector(int aIndex) const { MOZ_ASSERT(aIndex >= 0 && aIndex <= 3, "Invalid matrix array index"); diff --git a/gfx/layers/LayerTreeInvalidation.cpp b/gfx/layers/LayerTreeInvalidation.cpp index f554caa7af8..81ed9f263b6 100644 --- a/gfx/layers/LayerTreeInvalidation.cpp +++ b/gfx/layers/LayerTreeInvalidation.cpp @@ -171,7 +171,7 @@ struct LayerPropertiesBase : public LayerProperties nsIntRegion ComputeChange(NotifySubDocInvalidationFunc aCallback, bool& aGeometryChanged) { - bool transformChanged = !mTransform.FuzzyEqualsMultiplicative(GetTransformForInvalidation(mLayer)) || + bool transformChanged = !mTransform.FuzzyEqual(GetTransformForInvalidation(mLayer)) || mLayer->GetPostXScale() != mPostXScale || mLayer->GetPostYScale() != mPostYScale; const Maybe& otherClip = mLayer->GetEffectiveClipRect(); diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index 718f3ddbe31..b8a1a982c0b 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -4979,15 +4979,6 @@ static inline gfxSize RoundToFloatPrecision(const gfxSize& aSize) return gfxSize(float(aSize.width), float(aSize.height)); } -static inline gfxSize NudgedToIntegerSize(const gfxSize& aSize) -{ - float width = aSize.width; - float height = aSize.height; - gfx::NudgeToInteger(&width); - gfx::NudgeToInteger(&height); - return gfxSize(width, height); -} - static void RestrictScaleToMaxLayerSize(gfxSize& aScale, const nsRect& aVisibleRect, nsIFrame* aContainerFrame, @@ -5033,13 +5024,12 @@ ChooseScaleAndSetTransform(FrameLayerBuilder* aLayerBuilder, if (aTransform) { // aTransform is applied first, then the scale is applied to the result transform = (*aTransform)*transform; - // Set relevant 3d matrix entries that are close to integers to be those - // exact integers. This protects against floating-point inaccuracies - // causing problems in the CanDraw2D / Is2D checks below. - // We don't nudge all matrix components here. In particular, we don't want to - // nudge the X/Y translation components, because those include the scroll - // offset, and we don't want scrolling to affect whether we nudge or not. - transform.NudgeTo2D(); + // Set any matrix entries close to integers to be those exact integers. + // This protects against floating-point inaccuracies causing problems + // in the checks below. + // We use the fixed epsilon version here because we don't want the nudging + // to depend on the scroll position. + transform.NudgeToIntegersFixedEpsilon(); } Matrix transform2d; if (aContainerFrame && @@ -5129,7 +5119,7 @@ ChooseScaleAndSetTransform(FrameLayerBuilder* aLayerBuilder, scale.height = gfxUtils::ClampToScaleFactor(scale.height); } } else { - scale = NudgedToIntegerSize(scale); + // XXX Do we need to move nearly-integer values to integers here? } } // If the scale factors are too small, just use 1.0. The content is being diff --git a/layout/reftests/backgrounds/vector/empty/reftest.list b/layout/reftests/backgrounds/vector/empty/reftest.list index e65c8340564..d83e5c1da69 100644 --- a/layout/reftests/backgrounds/vector/empty/reftest.list +++ b/layout/reftests/backgrounds/vector/empty/reftest.list @@ -3,10 +3,11 @@ == wide--contain--height.html ref-wide-empty.html == wide--contain--width.html ref-wide-empty.html -== tall--cover--height.html ref-tall-lime.html -== tall--cover--width.html ref-tall-lime.html -== wide--cover--height.html ref-wide-lime.html -== wide--cover--width.html ref-wide-lime.html +# These tests fail because of integer overflow; see bug 894555. +fails == tall--cover--height.html ref-tall-lime.html +fails == tall--cover--width.html ref-tall-lime.html +fails == wide--cover--height.html ref-wide-lime.html +fails == wide--cover--width.html ref-wide-lime.html == zero-height-ratio-contain.html ref-tall-empty.html == zero-height-ratio-cover.html ref-tall-empty.html diff --git a/layout/reftests/invalidation/fractional-transform-1.html b/layout/reftests/invalidation/fractional-transform-1.html deleted file mode 100644 index 778621bcbce..00000000000 --- a/layout/reftests/invalidation/fractional-transform-1.html +++ /dev/null @@ -1,36 +0,0 @@ - - - -Scrolling shouldn't invalidate either rect. - - - - - - - - - - - - - - - - - - diff --git a/layout/reftests/invalidation/fractional-transform-2.html b/layout/reftests/invalidation/fractional-transform-2.html deleted file mode 100644 index 9e47164ae32..00000000000 --- a/layout/reftests/invalidation/fractional-transform-2.html +++ /dev/null @@ -1,32 +0,0 @@ - - - -Scrolling shouldn't invalidate the square. - - - - - - - - - - - - - - diff --git a/layout/reftests/invalidation/fractional-transform-3.html b/layout/reftests/invalidation/fractional-transform-3.html deleted file mode 100644 index ebd89a66d69..00000000000 --- a/layout/reftests/invalidation/fractional-transform-3.html +++ /dev/null @@ -1,32 +0,0 @@ - - - -Scrolling shouldn't invalidate the square. - - - - - - - - - - - - - - diff --git a/layout/reftests/invalidation/reftest.list b/layout/reftests/invalidation/reftest.list index 3c69ac4d570..47e79699646 100644 --- a/layout/reftests/invalidation/reftest.list +++ b/layout/reftests/invalidation/reftest.list @@ -68,9 +68,6 @@ pref(layers.single-tile.enabled,false) != paintedlayer-recycling-3.html about:bl fuzzy-if(gtkWidget,2,4) fuzzy-if(asyncPan,2,3955) fuzzy-if(OSX,179,30) fuzzy-if(skiaContent,16,3230) == image-scrolling-zoom-1.html image-scrolling-zoom-1-ref.html != image-scrolling-zoom-1-ref.html image-scrolling-zoom-1-notref.html pref(layers.single-tile.enabled,false) != fast-scrolling.html about:blank -!= fractional-transform-1.html about:blank -!= fractional-transform-2.html about:blank -!= fractional-transform-3.html about:blank == background-position-1.html background-position-1-ref.html == zero-opacity-animation.html about:blank == zero-opacity-text.html about:blank diff --git a/mfbt/FloatingPoint.h b/mfbt/FloatingPoint.h index 279363842cf..abe261d5ca8 100644 --- a/mfbt/FloatingPoint.h +++ b/mfbt/FloatingPoint.h @@ -401,13 +401,6 @@ FuzzyEqualsMultiplicative(T aValue1, T aValue2, T aEpsilon = detail::FuzzyEqualsEpsilon::value()) { static_assert(IsFloatingPoint::value, "floating point type required"); - - // Short-circuit the common case in order to avoid the expensive operations - // below. - if (aValue1 == aValue2) { - return true; - } - // can't use std::min because of bug 965340 T smaller = Abs(aValue1) < Abs(aValue2) ? Abs(aValue1) : Abs(aValue2); return Abs(aValue1 - aValue2) <= aEpsilon * smaller;