Bug 929021. Skip calling GetFrameBoundsForTransform when we don't need it. r=heycam
☠☠ backed out by b71812b077de ☠ ☠
authorRobert O'Callahan <robert@ocallahan.org>
Tue, 22 Oct 2013 11:09:46 +0200
changeset 166622 a61d898ea4facb179c6ba93820acbbbb0b1885a8
parent 166621 7a457cfcaa9ad94ff64dd9fa5df52e94b622c806
child 166623 bcf1282f3f4b6698f35eb6d1a48463d49f330278
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs929021
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 929021. Skip calling GetFrameBoundsForTransform when we don't need it. r=heycam
layout/base/nsDisplayList.cpp
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -3912,18 +3912,25 @@ nsDisplayTransform::GetDeltaToMozTransfo
   NS_PRECONDITION(aFrame->IsTransformed(),
                   "Shouldn't get a delta for an untransformed frame!");
 
   /* For both of the coordinates, if the value of -moz-transform is a
    * percentage, it's relative to the size of the frame.  Otherwise, if it's
    * a distance, it's already computed for us!
    */
   const nsStyleDisplay* display = aFrame->StyleDisplay();
-  nsRect boundingRect = (aBoundsOverride ? *aBoundsOverride :
-                         nsDisplayTransform::GetFrameBoundsForTransform(aFrame));
+  nsRect boundingRect;
+  if (aBoundsOverride) {
+    boundingRect = *aBoundsOverride;
+  } else if (display->mTransformOrigin[0].GetUnit() != eStyleUnit_Coord ||
+             display->mTransformOrigin[1].GetUnit() != eStyleUnit_Coord) {
+    // GetFrameBoundsForTransform is expensive for SVG frames and we don't need
+    // it if the origin is coords (which it is by default for SVG).
+    boundingRect = nsDisplayTransform::GetFrameBoundsForTransform(aFrame);
+  }
 
   /* Allows us to access named variables by index. */
   float coords[2];
   nscoord boundingOffsets[2] = {boundingRect.x, boundingRect.y};
   nscoord boundingDimensions[2] = {boundingRect.width, boundingRect.height};
   nscoord frameOffsets[2] = {aFrame->GetPosition().x, aFrame->GetPosition().y};
 
   for (uint8_t index = 0; index < 2; ++index) {