From c91003698de0b2ce5371b43dca1e3524a0e55b44 Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Wed, 17 Oct 2012 10:30:37 +1300 Subject: [PATCH] Bug 750417 - Remove Redraw calls from nsSprocketLayout. r=roc --- layout/xul/base/src/nsSprocketLayout.cpp | 20 +++----------------- layout/xul/base/src/nsSprocketLayout.h | 3 +-- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/layout/xul/base/src/nsSprocketLayout.cpp b/layout/xul/base/src/nsSprocketLayout.cpp index 65b64a5357d3..66deea55d776 100644 --- a/layout/xul/base/src/nsSprocketLayout.cpp +++ b/layout/xul/base/src/nsSprocketLayout.cpp @@ -251,7 +251,6 @@ nsSprocketLayout::Layout(nsIFrame* aBox, nsBoxLayoutState& aState) } // With the sizes computed, now it's time to lay out our children. - bool needsRedraw = false; bool finished; nscoord passes = 0; @@ -472,15 +471,8 @@ nsSprocketLayout::Layout(nsIFrame* aBox, nsBoxLayoutState& aState) // set it again child->SetBounds(aState, childRect); - - // Since the child changed size, we know a redraw is probably going to be required. - needsRedraw = true; } - // if something moved then we might need to redraw - if (oldRect.x != childRect.x || oldRect.y != childRect.y) - needsRedraw = true; - // If we already determined that layout was required or if our size has changed, then // we make sure to call layout on the child, since its children may need to be shifted // around as a result of the size change. @@ -632,13 +624,9 @@ nsSprocketLayout::Layout(nsIFrame* aBox, nsBoxLayoutState& aState) // Perform out-of-axis alignment for non-stretch alignments if (!(frameState & NS_STATE_AUTO_STRETCH)) { - AlignChildren(aBox, aState, &needsRedraw); + AlignChildren(aBox, aState); } - - // Now do our redraw. - if (needsRedraw) - aBox->Redraw(aState); - + // That's it! If you made it this far without having a nervous breakdown, // congratulations! Go get yourself a beer. return NS_OK; @@ -919,8 +907,7 @@ nsSprocketLayout::ComputeChildsNextPosition(nsIFrame* aBox, void nsSprocketLayout::AlignChildren(nsIFrame* aBox, - nsBoxLayoutState& aState, - bool* aNeedsRedraw) + nsBoxLayoutState& aState) { nsFrameState frameState = 0; GetFrameState(aBox, frameState); @@ -1005,7 +992,6 @@ nsSprocketLayout::AlignChildren(nsIFrame* aBox, } if (childRect.TopLeft() != child->GetPosition()) { - *aNeedsRedraw = true; child->SetBounds(aState, childRect); } diff --git a/layout/xul/base/src/nsSprocketLayout.h b/layout/xul/base/src/nsSprocketLayout.h index 21addaa12610..7e7725981f21 100644 --- a/layout/xul/base/src/nsSprocketLayout.h +++ b/layout/xul/base/src/nsSprocketLayout.h @@ -110,8 +110,7 @@ protected: bool& aFinished); void AlignChildren(nsIFrame* aBox, - nsBoxLayoutState& aState, - bool* aNeedsRedraw); + nsBoxLayoutState& aState); virtual void ComputeChildSizes(nsIFrame* aBox, nsBoxLayoutState& aState,