From 78823780e7fd449566d3526e625d20ad6e69d374 Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Fri, 3 Jun 2016 14:22:25 +1200 Subject: [PATCH] Bug 1274962 - Part 2: Remove unnecessary optimization combining translations. r=mstange --- layout/base/nsDisplayList.cpp | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 9d50b0dfe8a4..bcc2b0f38fe4 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -5727,17 +5727,7 @@ nsDisplayTransform::GetResultingTransformMatrixInternal(const FrameTransformProp // This is a simplification of the following |else| block, the // simplification being possible because we don't need to apply // mToTransformOrigin between two transforms. - if ((aFlags & OFFSET_BY_ORIGIN) && - !hasPerspective) { - // We can fold the final translation by roundedOrigin into the first matrix - // basis change translation. This is more stable against variation due to - // insufficient floating point precision than reversing the translation - // afterwards. - result.PreTranslate(-aProperties.mToTransformOrigin); - result.PostTranslate(roundedOrigin + aProperties.mToTransformOrigin); - } else { - result.ChangeBasis(aProperties.mToTransformOrigin); - } + result.ChangeBasis(aProperties.mToTransformOrigin); } else { Point3D refBoxOffset(NSAppUnitsToFloatPixels(refBox.X(), aAppUnitsPerPixel), NSAppUnitsToFloatPixels(refBox.Y(), aAppUnitsPerPixel), @@ -5761,24 +5751,16 @@ nsDisplayTransform::GetResultingTransformMatrixInternal(const FrameTransformProp // Similar to the code in the |if| block above, but since we've accounted // for mToTransformOrigin so we don't include that. We also need to reapply // refBoxOffset. - if ((aFlags & OFFSET_BY_ORIGIN) && - !hasPerspective) { - result.PreTranslate(-refBoxOffset); - result.PostTranslate(roundedOrigin + refBoxOffset); - } else { - result.ChangeBasis(refBoxOffset); - } + result.ChangeBasis(refBoxOffset); } if (hasPerspective) { result = result * perspectiveMatrix; - - if (aFlags & OFFSET_BY_ORIGIN) { - result.PostTranslate(roundedOrigin); - } } - if (aFlags & BASIS_AT_ORIGIN) { + if (aFlags & OFFSET_BY_ORIGIN) { + result.PostTranslate(roundedOrigin); + } else if (aFlags & BASIS_AT_ORIGIN) { result.ChangeBasis(roundedOrigin); }