зеркало из https://github.com/mozilla/pjs.git
Rewrite code to avoid using maxLevel b=366183 r=enndeakin sr=roc
This commit is contained in:
Родитель
d5f3d89a7e
Коммит
50f7b0fe8c
|
@ -2936,7 +2936,8 @@ nsTreeBodyFrame::PaintCell(PRInt32 aRowIndex,
|
||||||
// Resolve the style to use for the connecting lines.
|
// Resolve the style to use for the connecting lines.
|
||||||
nsStyleContext* lineContext = GetPseudoStyleContext(nsCSSAnonBoxes::moztreeline);
|
nsStyleContext* lineContext = GetPseudoStyleContext(nsCSSAnonBoxes::moztreeline);
|
||||||
|
|
||||||
if (lineContext->GetStyleVisibility()->IsVisibleOrCollapsed() && level) {
|
if (mIndentation && level &&
|
||||||
|
lineContext->GetStyleVisibility()->IsVisibleOrCollapsed()) {
|
||||||
// Paint the thread lines.
|
// Paint the thread lines.
|
||||||
|
|
||||||
// Get the size of the twisty. We don't want to paint the twisty
|
// Get the size of the twisty. We don't want to paint the twisty
|
||||||
|
@ -2965,20 +2966,19 @@ nsTreeBodyFrame::PaintCell(PRInt32 aRowIndex,
|
||||||
style = borderStyle->GetBorderStyle(NS_SIDE_LEFT);
|
style = borderStyle->GetBorderStyle(NS_SIDE_LEFT);
|
||||||
aRenderingContext.SetLineStyle(ConvertBorderStyleToLineStyle(style));
|
aRenderingContext.SetLineStyle(ConvertBorderStyleToLineStyle(style));
|
||||||
|
|
||||||
nscoord lineX = currX;
|
nscoord srcX = currX + twistyRect.width - mIndentation / 2;
|
||||||
nscoord lineY = (aRowIndex - mTopRowIndex) * mRowHeight + aPt.y;
|
nscoord lineY = (aRowIndex - mTopRowIndex) * mRowHeight + aPt.y;
|
||||||
|
|
||||||
// Compute the maximal level to paint.
|
// Don't paint off our cell.
|
||||||
PRInt32 maxLevel = level;
|
if (srcX <= cellRect.x + cellRect.width) {
|
||||||
if (maxLevel > cellRect.width / mIndentation)
|
nscoord destX = currX + twistyRect.width;
|
||||||
maxLevel = cellRect.width / mIndentation;
|
if (destX > cellRect.x + cellRect.width)
|
||||||
|
destX = cellRect.x + cellRect.width;
|
||||||
|
aRenderingContext.DrawLine(srcX, lineY + mRowHeight / 2, destX, lineY + mRowHeight / 2);
|
||||||
|
}
|
||||||
|
|
||||||
PRInt32 currentParent = aRowIndex;
|
PRInt32 currentParent = aRowIndex;
|
||||||
for (PRInt32 i = level; i > 0; i--) {
|
for (PRInt32 i = level; i > 0; i--) {
|
||||||
if (i <= maxLevel) {
|
|
||||||
lineX = currX + twistyRect.width + mIndentation / 2;
|
|
||||||
|
|
||||||
nscoord srcX = lineX - (level - i + 1) * mIndentation;
|
|
||||||
if (srcX <= cellRect.x + cellRect.width) {
|
if (srcX <= cellRect.x + cellRect.width) {
|
||||||
// Paint full vertical line only if we have next sibling.
|
// Paint full vertical line only if we have next sibling.
|
||||||
PRBool hasNextSibling;
|
PRBool hasNextSibling;
|
||||||
|
@ -2988,23 +2988,12 @@ nsTreeBodyFrame::PaintCell(PRInt32 aRowIndex,
|
||||||
else if (i == level)
|
else if (i == level)
|
||||||
aRenderingContext.DrawLine(srcX, lineY, srcX, lineY + mRowHeight / 2);
|
aRenderingContext.DrawLine(srcX, lineY, srcX, lineY + mRowHeight / 2);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
PRInt32 parent;
|
PRInt32 parent;
|
||||||
if (NS_FAILED(mView->GetParentIndex(currentParent, &parent)) || parent < 0)
|
if (NS_FAILED(mView->GetParentIndex(currentParent, &parent)) || parent < 0)
|
||||||
break;
|
break;
|
||||||
currentParent = parent;
|
currentParent = parent;
|
||||||
}
|
srcX -= mIndentation;
|
||||||
|
|
||||||
// Don't paint off our cell.
|
|
||||||
if (level == maxLevel) {
|
|
||||||
nscoord srcX = lineX - mIndentation + 16;
|
|
||||||
if (srcX <= cellRect.x + cellRect.width) {
|
|
||||||
nscoord destX = lineX - mIndentation / 2;
|
|
||||||
if (destX > cellRect.x + cellRect.width)
|
|
||||||
destX = cellRect.x + cellRect.width;
|
|
||||||
aRenderingContext.DrawLine(srcX, lineY + mRowHeight / 2, destX, lineY + mRowHeight / 2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
aRenderingContext.PopState();
|
aRenderingContext.PopState();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче