Bug 1144619 - Variable 'nextX' is created in the wrong scope. r=dbaron
authorStéphane SCHMIDELY <stephanichous@hotmail.fr>
Thu, 19 Mar 2015 21:00:03 +0100
changeset 263603 a77ec216cb3e6c3cd05956240c023446a99c48b1
parent 263602 f19216bba031c57b063433cbb8f8524b43c8b21f
child 263604 f3988f82aefcca4eb63824a7eef19dc092903beb
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1144619
milestone39.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 1144619 - Variable 'nextX' is created in the wrong scope. r=dbaron
layout/xul/nsSprocketLayout.cpp
--- a/layout/xul/nsSprocketLayout.cpp
+++ b/layout/xul/nsSprocketLayout.cpp
@@ -288,19 +288,16 @@ nsSprocketLayout::Layout(nsIFrame* aBox,
     // Handle box packing.
     HandleBoxPack(aBox, frameState, x, y, originalClientRect, clientRect);
 
     // Now that packing is taken care of we set up a few additional
     // tracking variables.
     origX = x;
     origY = y;
 
-    nscoord nextX = x;
-    nscoord nextY = y;
-
     // Now we iterate over our box children and our box size lists in 
     // parallel.  For each child, we look at its sizes and figure out
     // where to place it.
     nsComputedBoxSize* childComputedBoxSize = computedBoxSizes;
     nsBoxSize* childBoxSize                 = boxSizes;
 
     nsIFrame* child = nsBox::GetChildBox(aBox);
 
@@ -349,19 +346,16 @@ nsSprocketLayout::Layout(nsIFrame* aBox,
           x -= (childBoxSize->right);
       } else {
         if (frameState & NS_STATE_IS_DIRECTION_NORMAL)
           y += (childBoxSize->left);
         else
           y -= (childBoxSize->right);
       }
 
-      nextX = x;
-      nextY = y;
-
       // Now we build a child rect.
       nscoord rectX = x;
       nscoord rectY = y;
       if (!(frameState & NS_STATE_IS_DIRECTION_NORMAL)) {
         if (frameState & NS_STATE_IS_HORIZONTAL)
           rectX -= width;
         else
           rectY -= height;
@@ -378,16 +372,19 @@ nsSprocketLayout::Layout(nsIFrame* aBox,
       if (childRect.width > clientRect.width)
         clientRect.width = childRect.width;
 
       if (childRect.height > clientRect.height)
         clientRect.height = childRect.height;
     
       // Either |nextX| or |nextY| is updated by this function call, according
       // to our axis.
+      nscoord nextX = x;
+      nscoord nextY = y;
+
       ComputeChildsNextPosition(aBox, x, y, nextX, nextY, childRect);
 
       // Now we further update our nextX/Y along our axis.
       // We also set childRect.y/x along the opposite axis appropriately for a
       // stretch alignment.  (Non-stretch alignment is handled below.)
       if (frameState & NS_STATE_IS_HORIZONTAL) {
         if (frameState & NS_STATE_IS_DIRECTION_NORMAL)
           nextX += (childBoxSize->right);