diff --git a/gfx/2d/Matrix.h b/gfx/2d/Matrix.h index 70138084a1a7..b036989da141 100644 --- a/gfx/2d/Matrix.h +++ b/gfx/2d/Matrix.h @@ -1269,24 +1269,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 f554caa7af80..81ed9f263b65 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 78b0b0dc60fd..e95141d08b53 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -4996,15 +4996,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, @@ -5050,13 +5041,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 && @@ -5146,7 +5136,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 e65c8340564c..d83e5c1da69c 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 97ad149cda5a..000000000000 --- a/layout/reftests/invalidation/fractional-transform-1.html +++ /dev/null @@ -1,40 +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 b10e45b9dfe8..000000000000 --- a/layout/reftests/invalidation/fractional-transform-2.html +++ /dev/null @@ -1,36 +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 c56134920ee9..000000000000 --- a/layout/reftests/invalidation/fractional-transform-3.html +++ /dev/null @@ -1,36 +0,0 @@ - - - -Scrolling shouldn't invalidate the square. - - - - - - - - - - - - - - diff --git a/layout/reftests/invalidation/reftest.list b/layout/reftests/invalidation/reftest.list index 3c69ac4d5703..47e796996462 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 279363842cf2..abe261d5ca8b 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;