Bug 1404077 - Remove unnecessary gfxContext::Save/Load in nsTreeBodyFrame::PaintCell. draft
authorcku <cku@mozilla.com>
Mon, 02 Oct 2017 11:46:39 +0800
changeset 673185 7b12f466c922920f492883291301cb24394e14fa
parent 673165 44643fce30b43a8981535c335aaccb45006e456b
child 673263 ca7e8d7606c65bf27ef999cdf4f7a96445513cfd
push id82493
push userbmo:cku@mozilla.com
push dateMon, 02 Oct 2017 03:53:51 +0000
bugs1404077
milestone58.0a1
Bug 1404077 - Remove unnecessary gfxContext::Save/Load in nsTreeBodyFrame::PaintCell. Between this pair of gfxContext::Save/Load, only the draw calls of the DrawTarget are called. Since draw calls do not alter the content of a AureState, we should just remove this pair of Save/Load. MozReview-Commit-ID: BexjGJkO77E
layout/xul/tree/nsTreeBodyFrame.cpp
--- a/layout/xul/tree/nsTreeBodyFrame.cpp
+++ b/layout/xul/tree/nsTreeBodyFrame.cpp
@@ -3313,18 +3313,16 @@ nsTreeBodyFrame::PaintCell(int32_t      
       nsRect twistyRect(aCellRect);
       GetTwistyRect(aRowIndex, aColumn, imageSize, twistyRect, aPresContext,
                     twistyContext);
 
       nsMargin twistyMargin;
       twistyContext->StyleMargin()->GetMargin(twistyMargin);
       twistyRect.Inflate(twistyMargin);
 
-      aRenderingContext.Save();
-
       const nsStyleBorder* borderStyle = lineContext->StyleBorder();
       // Resolve currentcolor values against the treeline context
       nscolor color = lineContext->StyleColor()->
         CalcComplexColor(borderStyle->mBorderLeftColor);
       ColorPattern colorPatt(ToDeviceColor(color));
 
       uint8_t style = borderStyle->GetBorderStyle(eSideLeft);
       StrokeOptions strokeOptions;
@@ -3378,18 +3376,16 @@ nsTreeBodyFrame::PaintCell(int32_t      
         }
 
         int32_t parent;
         if (NS_FAILED(mView->GetParentIndex(currentParent, &parent)) || parent < 0)
           break;
         currentParent = parent;
         srcX -= mIndentation;
       }
-
-      aRenderingContext.Restore();
     }
 
     // Always leave space for the twisty.
     nsRect twistyRect(currX, cellRect.y, remainingWidth, cellRect.height);
     result &= PaintTwisty(aRowIndex, aColumn, twistyRect, aPresContext,
                           aRenderingContext, aDirtyRect, remainingWidth,
                           currX);
   }