Bug 1209780. Propagate the use of MOZ_MUST_USE DrawResult in nsTreeBodyFrame::PaintText. r=seth

This commit is contained in:
Timothy Nikkel 2016-03-09 17:56:35 -06:00
parent 6b3d2d0174
commit cafdb616d3
2 changed files with 21 additions and 13 deletions

View File

@ -3365,7 +3365,8 @@ nsTreeBodyFrame::PaintCell(int32_t aRowIndex,
switch (aColumn->GetType()) {
case nsITreeColumn::TYPE_TEXT:
case nsITreeColumn::TYPE_PASSWORD:
PaintText(aRowIndex, aColumn, elementRect, aPresContext, aRenderingContext, aDirtyRect, currX);
result &= PaintText(aRowIndex, aColumn, elementRect, aPresContext,
aRenderingContext, aDirtyRect, currX);
break;
case nsITreeColumn::TYPE_CHECKBOX:
result &= PaintCheckbox(aRowIndex, aColumn, elementRect, aPresContext,
@ -3383,7 +3384,8 @@ nsTreeBodyFrame::PaintCell(int32_t aRowIndex,
break;
case nsITreeView::PROGRESS_NONE:
default:
PaintText(aRowIndex, aColumn, elementRect, aPresContext, aRenderingContext, aDirtyRect, currX);
result &= PaintText(aRowIndex, aColumn, elementRect, aPresContext,
aRenderingContext, aDirtyRect, currX);
break;
}
break;
@ -3673,7 +3675,7 @@ nsTreeBodyFrame::PaintImage(int32_t aRowIndex,
return result;
}
void
DrawResult
nsTreeBodyFrame::PaintText(int32_t aRowIndex,
nsTreeColumn* aColumn,
const nsRect& aTextRect,
@ -3698,8 +3700,12 @@ nsTreeBodyFrame::PaintText(int32_t aRowIndex,
// necessary
CheckTextForBidi(text);
if (text.Length() == 0)
return; // Don't paint an empty string. XXX What about background/borders? Still paint?
DrawResult result = DrawResult::SUCCESS;
if (text.Length() == 0) {
// Don't paint an empty string. XXX What about background/borders? Still paint?
return result;
}
int32_t appUnitsPerDevPixel = PresContext()->AppUnitsPerDevPixel();
DrawTarget* drawTarget = aRenderingContext.GetDrawTarget();
@ -3745,7 +3751,8 @@ nsTreeBodyFrame::PaintText(int32_t aRowIndex,
if (!isRTL)
aCurrX += textRect.width + textMargin.LeftRight();
PaintBackgroundLayer(textContext, aPresContext, aRenderingContext, textRect, aDirtyRect);
result &= PaintBackgroundLayer(textContext, aPresContext, aRenderingContext,
textRect, aDirtyRect);
// Time to paint our text.
textRect.Deflate(bp);
@ -3799,6 +3806,7 @@ nsTreeBodyFrame::PaintText(int32_t aRowIndex,
ctx->PopGroupAndBlend();
}
return result;
}
DrawResult

View File

@ -259,13 +259,13 @@ protected:
nscoord& aCurrX);
// This method paints the text string inside a particular cell of the tree.
void PaintText(int32_t aRowIndex,
nsTreeColumn* aColumn,
const nsRect& aTextRect,
nsPresContext* aPresContext,
nsRenderingContext& aRenderingContext,
const nsRect& aDirtyRect,
nscoord& aCurrX);
DrawResult PaintText(int32_t aRowIndex,
nsTreeColumn* aColumn,
const nsRect& aTextRect,
nsPresContext* aPresContext,
nsRenderingContext& aRenderingContext,
const nsRect& aDirtyRect,
nscoord& aCurrX);
// This method paints the checkbox inside a particular cell of the tree.
DrawResult PaintCheckbox(int32_t aRowIndex,