Bug 929021. Skip calling GetFrameBoundsForTransform when we don't need it. r=heycam
☠☠ backed out by efe4b4053304 ☠ ☠
authorRobert O'Callahan <robert@ocallahan.org>
Tue, 22 Oct 2013 11:09:46 +0200
changeset 165741 75ee2a0bc5d39593c5b594174efe4eff348cc798
parent 165740 ce20f4b16d56b245848981ec472a1033bed7e82c
child 165742 19f91220e648dc367ae64a14a6b873c5b909e5fa
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [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) {