Replace PR_MIN/PR_MAX with NS_MIN/NS_MAX. b=512106 r=roc

This commit is contained in:
Mats Palmgren 2009-09-16 17:01:36 +02:00
Родитель e3c69e8a13
Коммит 3b948e3546
81 изменённых файлов: 514 добавлений и 508 удалений

Просмотреть файл

@ -459,7 +459,7 @@ nsBidiPresUtils::Resolve(nsBlockFrame* aBlockFrame,
propTable->SetProperty(frame, nsGkAtoms::baseLevel,
NS_INT32_TO_PTR(paraLevel), nsnull, nsnull);
if (isTextFrame) {
PRInt32 typeLimit = PR_MIN(logicalLimit, lineOffset + fragmentLength);
PRInt32 typeLimit = NS_MIN(logicalLimit, lineOffset + fragmentLength);
CalculateCharType(lineOffset, typeLimit, logicalLimit, runLength,
runCount, charType, prevType);
// IBMBIDI - Egypt - Start
@ -1421,7 +1421,7 @@ nsresult nsBidiPresUtils::ProcessText(const PRUnichar* aText,
PRInt32 subRunLength = limit - start;
PRInt32 lineOffset = start;
PRInt32 typeLimit = PR_MIN(limit, aLength);
PRInt32 typeLimit = NS_MIN(limit, aLength);
PRInt32 subRunCount = 1;
PRInt32 subRunLimit = typeLimit;

Просмотреть файл

@ -521,7 +521,7 @@ ComputePixelRadii(const nscoord *aTwipsRadii,
gfxFloat sum = radii[hc1] + radii[hc2];
// avoid floating point division in the normal case
if (length < sum)
f = PR_MIN(f, length/sum);
f = NS_MIN(f, length/sum);
}
if (f < 1.0) {
NS_FOR_CSS_HALF_CORNERS(corner) {
@ -2026,9 +2026,9 @@ PaintBackgroundLayer(nsPresContext* aPresContext,
float scaleFitX = double(bgPositioningArea.width) / imageSize.width;
float scaleFitY = double(bgPositioningArea.height) / imageSize.height;
if (aLayer.mSize.mWidthType == nsStyleBackground::Size::eCover) {
scaleX = scaleY = PR_MAX(scaleFitX, scaleFitY);
scaleX = scaleY = NS_MAX(scaleFitX, scaleFitY);
} else {
scaleX = scaleY = PR_MIN(scaleFitX, scaleFitY);
scaleX = scaleY = NS_MIN(scaleFitX, scaleFitY);
}
break;
}
@ -2551,7 +2551,7 @@ nsCSSRendering::DrawTableBorderSegment(nsIRenderingContext& aContext,
// make the min dash length for the ends 1/2 the dash length
nscoord minDashLength = (NS_STYLE_BORDER_STYLE_DASHED == aBorderStyle)
? RoundFloatToPixel(((float)dashLength) / 2.0f, twipsPerPixel) : dashLength;
minDashLength = PR_MAX(minDashLength, twipsPerPixel);
minDashLength = NS_MAX(minDashLength, twipsPerPixel);
nscoord numDashSpaces = 0;
nscoord startDashLength = minDashLength;
nscoord endDashLength = minDashLength;
@ -2763,7 +2763,7 @@ nsCSSRendering::PaintDecorationLine(gfxContext* aGfxContext,
return;
}
gfxFloat lineHeight = PR_MAX(NS_round(aLineSize.height), 1.0);
gfxFloat lineHeight = NS_MAX(NS_round(aLineSize.height), 1.0);
PRBool contextIsSaved = PR_FALSE;
gfxFloat oldLineWidth;
@ -2902,7 +2902,7 @@ nsCSSRendering::PaintDecorationLine(gfxContext* aGfxContext,
gfxPoint pt(rect.pos);
gfxFloat rightMost = pt.x + rect.Width() + lineHeight;
gfxFloat adv = rect.Height() - lineHeight;
gfxFloat flatLengthAtVertex = PR_MAX((lineHeight - 1.0) * 2.0, 1.0);
gfxFloat flatLengthAtVertex = NS_MAX((lineHeight - 1.0) * 2.0, 1.0);
pt.x -= lineHeight;
aGfxContext->MoveTo(pt); // 1
@ -2983,12 +2983,12 @@ nsCSSRendering::GetTextDecorationRectInternal(const gfxPoint& aPt,
r.size.width = NS_round(aLineSize.width);
gfxFloat lineHeight = NS_round(aLineSize.height);
lineHeight = PR_MAX(lineHeight, 1.0);
lineHeight = NS_MAX(lineHeight, 1.0);
gfxFloat ascent = NS_round(aAscent);
gfxFloat descentLimit = NS_floor(aDescentLimit);
gfxFloat suggestedMaxRectHeight = PR_MAX(PR_MIN(ascent, descentLimit), 1.0);
gfxFloat suggestedMaxRectHeight = NS_MAX(NS_MIN(ascent, descentLimit), 1.0);
r.size.height = lineHeight;
if (aStyle == DECORATION_STYLE_DOUBLE) {
/**
@ -3007,13 +3007,13 @@ nsCSSRendering::GetTextDecorationRectInternal(const gfxPoint& aPt,
* +-------------------------------------------+
*/
gfxFloat gap = NS_round(lineHeight / 2.0);
gap = PR_MAX(gap, 1.0);
gap = NS_MAX(gap, 1.0);
r.size.height = lineHeight * 2.0 + gap;
if (canLiftUnderline) {
if (r.Height() > suggestedMaxRectHeight) {
// Don't shrink the line height, because the thickness has some meaning.
// We can just shrink the gap at this time.
r.size.height = PR_MAX(suggestedMaxRectHeight, lineHeight * 2.0 + 1.0);
r.size.height = NS_MAX(suggestedMaxRectHeight, lineHeight * 2.0 + 1.0);
}
}
} else if (aStyle == DECORATION_STYLE_WAVY) {
@ -3037,7 +3037,7 @@ nsCSSRendering::GetTextDecorationRectInternal(const gfxPoint& aPt,
// because the thickness has some meaning. E.g., the 1px wavy line and
// 2px wavy line can be used for different meaning in IME selections
// at same time.
r.size.height = PR_MAX(suggestedMaxRectHeight, lineHeight * 2.0);
r.size.height = NS_MAX(suggestedMaxRectHeight, lineHeight * 2.0);
}
}
}
@ -3055,7 +3055,7 @@ nsCSSRendering::GetTextDecorationRectInternal(const gfxPoint& aPt,
// far as possible.
gfxFloat offsetBottomAligned = -descentLimit + r.Height();
gfxFloat offsetTopAligned = 0.0;
offset = PR_MIN(offsetBottomAligned, offsetTopAligned);
offset = NS_MIN(offsetBottomAligned, offsetTopAligned);
}
}
break;
@ -3064,7 +3064,7 @@ nsCSSRendering::GetTextDecorationRectInternal(const gfxPoint& aPt,
break;
case NS_STYLE_TEXT_DECORATION_LINE_THROUGH: {
gfxFloat extra = NS_floor(r.Height() / 2.0 + 0.5);
extra = PR_MAX(extra, lineHeight);
extra = NS_MAX(extra, lineHeight);
offset = aOffset - lineHeight + extra;
break;
}

Просмотреть файл

@ -202,17 +202,17 @@ nsCSSBorderRenderer::ComputeInnerRadii(const gfxCornerSizes& aRadii,
{
gfxCornerSizes& iRadii = *aInnerRadiiRet;
iRadii[C_TL].width = PR_MAX(0.0, aRadii[C_TL].width - aBorderSizes[NS_SIDE_LEFT]);
iRadii[C_TL].height = PR_MAX(0.0, aRadii[C_TL].height - aBorderSizes[NS_SIDE_TOP]);
iRadii[C_TL].width = NS_MAX(0.0, aRadii[C_TL].width - aBorderSizes[NS_SIDE_LEFT]);
iRadii[C_TL].height = NS_MAX(0.0, aRadii[C_TL].height - aBorderSizes[NS_SIDE_TOP]);
iRadii[C_TR].width = PR_MAX(0.0, aRadii[C_TR].width - aBorderSizes[NS_SIDE_RIGHT]);
iRadii[C_TR].height = PR_MAX(0.0, aRadii[C_TR].height - aBorderSizes[NS_SIDE_TOP]);
iRadii[C_TR].width = NS_MAX(0.0, aRadii[C_TR].width - aBorderSizes[NS_SIDE_RIGHT]);
iRadii[C_TR].height = NS_MAX(0.0, aRadii[C_TR].height - aBorderSizes[NS_SIDE_TOP]);
iRadii[C_BR].width = PR_MAX(0.0, aRadii[C_BR].width - aBorderSizes[NS_SIDE_RIGHT]);
iRadii[C_BR].height = PR_MAX(0.0, aRadii[C_BR].height - aBorderSizes[NS_SIDE_BOTTOM]);
iRadii[C_BR].width = NS_MAX(0.0, aRadii[C_BR].width - aBorderSizes[NS_SIDE_RIGHT]);
iRadii[C_BR].height = NS_MAX(0.0, aRadii[C_BR].height - aBorderSizes[NS_SIDE_BOTTOM]);
iRadii[C_BL].width = PR_MAX(0.0, aRadii[C_BL].width - aBorderSizes[NS_SIDE_LEFT]);
iRadii[C_BL].height = PR_MAX(0.0, aRadii[C_BL].height - aBorderSizes[NS_SIDE_BOTTOM]);
iRadii[C_BL].width = NS_MAX(0.0, aRadii[C_BL].width - aBorderSizes[NS_SIDE_LEFT]);
iRadii[C_BL].height = NS_MAX(0.0, aRadii[C_BL].height - aBorderSizes[NS_SIDE_BOTTOM]);
}
/*static*/ void
@ -236,14 +236,14 @@ ComputeBorderCornerDimensions(const gfxRect& aOuterRect,
// Always round up to whole pixels for the corners; it's safe to
// make the corners bigger than necessary, and this way we ensure
// that we avoid seams.
(*aDimsRet)[C_TL] = gfxSize(ceil(PR_MAX(leftWidth, aRadii[C_TL].width)),
ceil(PR_MAX(topWidth, aRadii[C_TL].height)));
(*aDimsRet)[C_TR] = gfxSize(ceil(PR_MAX(rightWidth, aRadii[C_TR].width)),
ceil(PR_MAX(topWidth, aRadii[C_TR].height)));
(*aDimsRet)[C_BR] = gfxSize(ceil(PR_MAX(rightWidth, aRadii[C_BR].width)),
ceil(PR_MAX(bottomWidth, aRadii[C_BR].height)));
(*aDimsRet)[C_BL] = gfxSize(ceil(PR_MAX(leftWidth, aRadii[C_BL].width)),
ceil(PR_MAX(bottomWidth, aRadii[C_BL].height)));
(*aDimsRet)[C_TL] = gfxSize(ceil(NS_MAX(leftWidth, aRadii[C_TL].width)),
ceil(NS_MAX(topWidth, aRadii[C_TL].height)));
(*aDimsRet)[C_TR] = gfxSize(ceil(NS_MAX(rightWidth, aRadii[C_TR].width)),
ceil(NS_MAX(topWidth, aRadii[C_TR].height)));
(*aDimsRet)[C_BR] = gfxSize(ceil(NS_MAX(rightWidth, aRadii[C_BR].width)),
ceil(NS_MAX(bottomWidth, aRadii[C_BR].height)));
(*aDimsRet)[C_BL] = gfxSize(ceil(NS_MAX(leftWidth, aRadii[C_BL].width)),
ceil(NS_MAX(bottomWidth, aRadii[C_BL].height)));
}
}
@ -430,7 +430,7 @@ MaybeMoveToMidPoint(gfxPoint& aP0, gfxPoint& aP1, const gfxPoint& aMidPoint)
gfxPoint ps = aP1 - aP0;
if (ps.x != 0.0 && ps.y != 0.0) {
gfxFloat k = PR_MIN((aMidPoint.x - aP0.x) / ps.x,
gfxFloat k = NS_MIN((aMidPoint.x - aP0.x) / ps.x,
(aMidPoint.y - aP1.y) / ps.y);
aP1 = aP0 + ps * k;
}
@ -679,7 +679,7 @@ nsCSSBorderRenderer::DrawBorderSidesCompositeColors(PRIntn aSides, const nsBorde
gfxRect siRect;
gfxFloat maxBorderWidth = 0;
NS_FOR_CSS_SIDES (i) {
maxBorderWidth = PR_MAX(maxBorderWidth, mBorderWidths[i]);
maxBorderWidth = NS_MAX(maxBorderWidth, mBorderWidths[i]);
}
gfxFloat fakeBorderSizes[4];
@ -700,11 +700,11 @@ nsCSSBorderRenderer::DrawBorderSidesCompositeColors(PRIntn aSides, const nsBorde
tl = siRect.TopLeft();
br = siRect.BottomRight();
tl.x = PR_MIN(tl.x, itl.x);
tl.y = PR_MIN(tl.y, itl.y);
tl.x = NS_MIN(tl.x, itl.x);
tl.y = NS_MIN(tl.y, itl.y);
br.x = PR_MAX(br.x, ibr.x);
br.y = PR_MAX(br.y, ibr.y);
br.x = NS_MAX(br.x, ibr.x);
br.y = NS_MAX(br.y, ibr.y);
siRect.pos = tl;
siRect.size.width = br.x - tl.x;

Просмотреть файл

@ -193,7 +193,7 @@ nsCaret::Metrics nsCaret::ComputeMetrics(nsIFrame* aFrame, PRInt32 aOffset, nsco
caretWidth += nsPresContext::CSSPixelsToAppUnits(1);
}
nscoord bidiIndicatorSize = nsPresContext::CSSPixelsToAppUnits(kMinBidiIndicatorPixels);
bidiIndicatorSize = PR_MAX(caretWidth, bidiIndicatorSize);
bidiIndicatorSize = NS_MAX(caretWidth, bidiIndicatorSize);
// Round them to device pixels. Always round down, except that anything
// between 0 and 1 goes up to 1 so we don't let the caret disappear.
@ -789,8 +789,8 @@ nsCaret::GetCaretFrameForNodeOffset(nsIContent* aContentNode,
if ((levelBefore != levelAfter) || (aBidiLevel != levelBefore))
{
aBidiLevel = PR_MAX(aBidiLevel, PR_MIN(levelBefore, levelAfter)); // rule c3
aBidiLevel = PR_MIN(aBidiLevel, PR_MAX(levelBefore, levelAfter)); // rule c4
aBidiLevel = NS_MAX(aBidiLevel, NS_MIN(levelBefore, levelAfter)); // rule c3
aBidiLevel = NS_MIN(aBidiLevel, NS_MAX(levelBefore, levelAfter)); // rule c4
if (aBidiLevel == levelBefore // rule c1
|| (aBidiLevel > levelBefore && aBidiLevel < levelAfter && !((aBidiLevel ^ levelBefore) & 1)) // rule c5
|| (aBidiLevel < levelBefore && aBidiLevel > levelAfter && !((aBidiLevel ^ levelBefore) & 1))) // rule c9

Просмотреть файл

@ -578,17 +578,17 @@ static PRBool RoundedRectContainsRect(const nsRect& aRoundedRect,
// rectFullHeight and rectFullWidth together will approximately contain
// the total area of the frame minus the rounded corners.
nsRect rectFullHeight = aRoundedRect;
nscoord xDiff = PR_MAX(aRadii[NS_CORNER_TOP_LEFT_X], aRadii[NS_CORNER_BOTTOM_LEFT_X]);
nscoord xDiff = NS_MAX(aRadii[NS_CORNER_TOP_LEFT_X], aRadii[NS_CORNER_BOTTOM_LEFT_X]);
rectFullHeight.x += xDiff;
rectFullHeight.width -= PR_MAX(aRadii[NS_CORNER_TOP_RIGHT_X],
rectFullHeight.width -= NS_MAX(aRadii[NS_CORNER_TOP_RIGHT_X],
aRadii[NS_CORNER_BOTTOM_RIGHT_X]) + xDiff;
if (rectFullHeight.Contains(aContainedRect))
return PR_TRUE;
nsRect rectFullWidth = aRoundedRect;
nscoord yDiff = PR_MAX(aRadii[NS_CORNER_TOP_LEFT_Y], aRadii[NS_CORNER_TOP_RIGHT_Y]);
nscoord yDiff = NS_MAX(aRadii[NS_CORNER_TOP_LEFT_Y], aRadii[NS_CORNER_TOP_RIGHT_Y]);
rectFullWidth.y += yDiff;
rectFullWidth.height -= PR_MAX(aRadii[NS_CORNER_BOTTOM_LEFT_Y],
rectFullWidth.height -= NS_MAX(aRadii[NS_CORNER_BOTTOM_LEFT_Y],
aRadii[NS_CORNER_BOTTOM_RIGHT_Y]) + yDiff;
if (rectFullWidth.Contains(aContainedRect))
return PR_TRUE;

Просмотреть файл

@ -1161,7 +1161,7 @@ DocumentViewerImpl::PermitUnload(PRBool *aPermitUnload)
// Limit the length of the text the page can inject into this
// dialogue to 1024 characters.
PRInt32 len = PR_MIN(text.Length(), 1024);
PRInt32 len = NS_MIN(text.Length(), 1024U);
nsAutoString msg;
if (len == 0) {

Просмотреть файл

@ -2108,7 +2108,7 @@ nsLayoutUtils::ComputeWidthValue(
min = aFrame->GetMinWidth(aRenderingContext),
fill = aContainingBlockWidth -
(aBoxSizingToMarginEdge + aContentEdgeToBoxSizing);
result = PR_MAX(min, PR_MIN(pref, fill));
result = NS_MAX(min, NS_MIN(pref, fill));
NS_ASSERTION(result >= 0, "width less than zero");
}
break;
@ -3131,10 +3131,10 @@ nsLayoutUtils::GetRectDifferenceStrips(const nsRect& aR1, const nsRect& aR2,
nsRect* aHStrip, nsRect* aVStrip) {
NS_ASSERTION(aR1.TopLeft() == aR2.TopLeft(),
"expected rects at the same position");
nsRect unionRect(aR1.x, aR1.y, PR_MAX(aR1.width, aR2.width),
PR_MAX(aR1.height, aR2.height));
nscoord VStripStart = PR_MIN(aR1.width, aR2.width);
nscoord HStripStart = PR_MIN(aR1.height, aR2.height);
nsRect unionRect(aR1.x, aR1.y, NS_MAX(aR1.width, aR2.width),
NS_MAX(aR1.height, aR2.height));
nscoord VStripStart = NS_MIN(aR1.width, aR2.width);
nscoord HStripStart = NS_MIN(aR1.height, aR2.height);
*aVStrip = unionRect;
aVStrip->x += VStripStart;
aVStrip->width -= VStripStart;

Просмотреть файл

@ -5334,9 +5334,9 @@ PresShell::ClipListToRange(nsDisplayListBuilder *aBuilder,
frame->GetOffsets(frameStartOffset, frameEndOffset);
PRInt32 hilightStart =
atStart ? PR_MAX(aRange->StartOffset(), frameStartOffset) : frameStartOffset;
atStart ? NS_MAX(aRange->StartOffset(), frameStartOffset) : frameStartOffset;
PRInt32 hilightEnd =
atEnd ? PR_MIN(aRange->EndOffset(), frameEndOffset) : frameEndOffset;
atEnd ? NS_MIN(aRange->EndOffset(), frameEndOffset) : frameEndOffset;
if (hilightStart < hilightEnd) {
// determine the location of the start and end edges of the range.
nsPoint startPoint, endPoint;
@ -5348,9 +5348,9 @@ PresShell::ClipListToRange(nsDisplayListBuilder *aBuilder,
// Because of rtl, the end point may be to the left of the
// start point, so x is set to the lowest value
nsRect textRect(aBuilder->ToReferenceFrame(frame), frame->GetSize());
nscoord x = PR_MIN(startPoint.x, endPoint.x);
nscoord x = NS_MIN(startPoint.x, endPoint.x);
textRect.x += x;
textRect.width = PR_MAX(startPoint.x, endPoint.x) - x;
textRect.width = NS_MAX(startPoint.x, endPoint.x) - x;
surfaceRect.UnionRect(surfaceRect, textRect);
// wrap the item in an nsDisplayClip so that it can be clipped to
@ -5494,9 +5494,9 @@ PresShell::PaintRangePaintInfo(nsTArray<nsAutoPtr<RangePaintInfo> >* aItems,
// direction produces the smallest result determines how much should be
// scaled.
if (pixelArea.width > maxWidth)
scale = PR_MIN(scale, float(maxWidth) / pixelArea.width);
scale = NS_MIN(scale, float(maxWidth) / pixelArea.width);
if (pixelArea.height > maxHeight)
scale = PR_MIN(scale, float(maxHeight) / pixelArea.height);
scale = NS_MIN(scale, float(maxHeight) / pixelArea.height);
pixelArea.width = NSToIntFloor(float(pixelArea.width) * scale);
pixelArea.height = NSToIntFloor(float(pixelArea.height) * scale);
@ -7198,7 +7198,7 @@ PresShell::DoReflow(nsIFrame* target, PRBool aInterruptible)
if (size.height != NS_UNCONSTRAINEDSIZE) {
nscoord computedHeight =
size.height - reflowState.mComputedBorderPadding.TopBottom();
computedHeight = PR_MAX(computedHeight, 0);
computedHeight = NS_MAX(computedHeight, 0);
reflowState.SetComputedHeight(computedHeight);
}
NS_ASSERTION(reflowState.ComputedWidth() ==

Просмотреть файл

@ -458,7 +458,7 @@ nsComboboxControlFrame::ReflowDropdown(nsPresContext* aPresContext,
nscoord forcedWidth = aReflowState.ComputedWidth() +
aReflowState.mComputedBorderPadding.LeftRight() -
kidReflowState.mComputedBorderPadding.LeftRight();
kidReflowState.SetComputedWidth(PR_MAX(kidReflowState.ComputedWidth(),
kidReflowState.SetComputedWidth(NS_MAX(kidReflowState.ComputedWidth(),
forcedWidth));
// ensure we start off hidden
@ -583,7 +583,7 @@ nsComboboxControlFrame::GetIntrinsicWidth(nsIRenderingContext* aRenderingContext
scrollbarWidth,
nscoord_MAX);
displayWidth = PR_MAX(dropdownContentWidth, displayWidth);
displayWidth = NS_MAX(dropdownContentWidth, displayWidth);
}
// add room for the dropmarker button if there is one

Просмотреть файл

@ -366,7 +366,7 @@ nsFieldSetFrame::GetIntrinsicWidth(nsIRenderingContext* aRenderingContext,
aType);
}
return PR_MAX(legendWidth, contentWidth);
return NS_MAX(legendWidth, contentWidth);
}
@ -512,15 +512,15 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
// by the amount of content-height the legend is eating up, unless our
// height is unconstrained (in which case the child's will be too).
if (aReflowState.ComputedHeight() != NS_UNCONSTRAINEDSIZE) {
kidReflowState.SetComputedHeight(PR_MAX(0, aReflowState.ComputedHeight() - mLegendSpace));
kidReflowState.SetComputedHeight(NS_MAX(0, aReflowState.ComputedHeight() - mLegendSpace));
}
kidReflowState.mComputedMinHeight =
PR_MAX(0, aReflowState.mComputedMinHeight - mLegendSpace);
NS_MAX(0, aReflowState.mComputedMinHeight - mLegendSpace);
if (aReflowState.mComputedMaxHeight != NS_UNCONSTRAINEDSIZE) {
kidReflowState.mComputedMaxHeight =
PR_MAX(0, aReflowState.mComputedMaxHeight - mLegendSpace);
NS_MAX(0, aReflowState.mComputedMaxHeight - mLegendSpace);
}
nsHTMLReflowMetrics kidDesiredSize(aDesiredSize.mFlags);

Просмотреть файл

@ -65,7 +65,7 @@ PaintCheckMark(nsIFrame* aFrame,
// of the 7x7 unit checkmark
// Scale the checkmark based on the smallest dimension
nscoord paintScale = PR_MIN(rect.width, rect.height) / checkSize;
nscoord paintScale = NS_MIN(rect.width, rect.height) / checkSize;
nsPoint paintCenter(rect.x + rect.width / 2,
rect.y + rect.height / 2);

Просмотреть файл

@ -319,12 +319,12 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext,
NS_ASSERTION(extraright >=0, "How'd that happen?");
// Do not allow the extras to be bigger than the relevant padding
extraleft = PR_MIN(extraleft, aReflowState.mComputedPadding.left);
extraright = PR_MIN(extraright, aReflowState.mComputedPadding.right);
extraleft = NS_MIN(extraleft, aReflowState.mComputedPadding.left);
extraright = NS_MIN(extraright, aReflowState.mComputedPadding.right);
xoffset -= extraleft;
availSize.width += extraleft + extraright;
}
availSize.width = PR_MAX(availSize.width,0);
availSize.width = NS_MAX(availSize.width,0);
nsHTMLReflowState reflowState(aPresContext, aReflowState, aFirstKid,
availSize);
@ -338,7 +338,7 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext,
// XXXbz this assumes border-box sizing.
nscoord minInternalHeight = aReflowState.mComputedMinHeight -
aReflowState.mComputedBorderPadding.TopBottom();
minInternalHeight = PR_MAX(minInternalHeight, 0);
minInternalHeight = NS_MAX(minInternalHeight, 0);
// center child vertically
nscoord yoff = 0;

Просмотреть файл

@ -489,7 +489,7 @@ GetOptGroupLabelsHeight(nsPresContext* aPresContext,
nscoord optionsHeight = aRowHeight * numOptions;
nsIFrame* frame = aPresContext->GetPresShell()->GetPrimaryFrameFor(child);
nscoord totalHeight = frame ? frame->GetSize().height : 0;
height += PR_MAX(0, totalHeight - optionsHeight);
height += NS_MAX(0, totalHeight - optionsHeight);
}
}
return height;
@ -1940,7 +1940,7 @@ nsListControlFrame::CalcIntrinsicHeight(nscoord aHeightOfARow,
if (aNumberOfOptions < 2) {
// Add in 1 aHeightOfARow also when aNumberOfOptions == 0
mNumDisplayRows = 1;
extraHeight = PR_MAX(aHeightOfARow, labelHeight);
extraHeight = NS_MAX(aHeightOfARow, labelHeight);
}
else if (aNumberOfOptions * aHeightOfARow + labelHeight >
kMaxDropDownRows * aHeightOfARow) {

Просмотреть файл

@ -655,7 +655,7 @@ nsTextInputSelectionImpl::ScrollSelectionIntoView(PRInt16 aType, PRInt16 aRegion
const nsRect portRect = scrollableView->View()->GetBounds();
const nsRect viewRect = view->GetBounds();
if (viewRect.XMost() < portRect.width) {
return scrollableView->ScrollTo(PR_MAX(viewRect.width - portRect.width, 0), -viewRect.y, 0);
return scrollableView->ScrollTo(NS_MAX(viewRect.width - portRect.width, 0), -viewRect.y, 0);
}
return rv;
@ -1265,7 +1265,7 @@ nsTextControlFrame::CalcIntrinsicSize(nsIRenderingContext* aRenderingContext,
// this if charMaxAdvance != charWidth; if they are equal, this is almost
// certainly a fixed-width font.
if (charWidth != charMaxAdvance) {
nscoord internalPadding = PR_MAX(0, charMaxAdvance -
nscoord internalPadding = NS_MAX(0, charMaxAdvance -
nsPresContext::CSSPixelsToAppUnits(4));
nscoord t = nsPresContext::CSSPixelsToAppUnits(1);
// Round to a multiple of t

Просмотреть файл

@ -528,10 +528,10 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
rect.TopLeft());
} else if (oldRect.Size() != rect.Size()) {
// Invalidate the area where the frame changed size.
nscoord innerWidth = PR_MIN(oldRect.width, rect.width);
nscoord innerHeight = PR_MIN(oldRect.height, rect.height);
nscoord outerWidth = PR_MAX(oldRect.width, rect.width);
nscoord outerHeight = PR_MAX(oldRect.height, rect.height);
nscoord innerWidth = NS_MIN(oldRect.width, rect.width);
nscoord innerHeight = NS_MIN(oldRect.height, rect.height);
nscoord outerWidth = NS_MAX(oldRect.width, rect.width);
nscoord outerHeight = NS_MAX(oldRect.height, rect.height);
aKidFrame->GetParent()->Invalidate(
nsRect(rect.x + innerWidth, rect.y, outerWidth - innerWidth, outerHeight));
// Invalidate the horizontal strip

Просмотреть файл

@ -863,11 +863,11 @@ CalculateContainingBlockSizeForAbsolutes(const nsHTMLReflowState& aReflowState,
// We found a reflow state for the outermost wrapping frame, so use
// its computed metrics if available
if (aLastRS->ComputedWidth() != NS_UNCONSTRAINEDSIZE) {
cbSize.width = PR_MAX(0,
cbSize.width = NS_MAX(0,
aLastRS->ComputedWidth() + aLastRS->mComputedPadding.LeftRight() - scrollbars.LeftRight());
}
if (aLastRS->ComputedHeight() != NS_UNCONSTRAINEDSIZE) {
cbSize.height = PR_MAX(0,
cbSize.height = NS_MAX(0,
aLastRS->ComputedHeight() + aLastRS->mComputedPadding.TopBottom() - scrollbars.TopBottom());
}
}
@ -1267,7 +1267,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
{
// Truncate bottom margin if it doesn't fit to our available height.
bottomEdgeOfChildren =
PR_MIN(bottomEdgeOfChildren + aState.mPrevBottomMargin.get(),
NS_MIN(bottomEdgeOfChildren + aState.mPrevBottomMargin.get(),
aState.mReflowState.availableHeight);
}
}
@ -1276,7 +1276,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
// bottom margin of any floated elements; e.g., inside a table cell.
nscoord floatHeight =
aState.ClearFloats(bottomEdgeOfChildren, NS_STYLE_CLEAR_LEFT_AND_RIGHT);
bottomEdgeOfChildren = PR_MAX(bottomEdgeOfChildren, floatHeight);
bottomEdgeOfChildren = NS_MAX(bottomEdgeOfChildren, floatHeight);
}
// Compute final height
@ -1293,7 +1293,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
// first frame's height. Add it back to get the content height.
computedHeightLeftOver += aReflowState.mComputedBorderPadding.top;
// We may have stretched the frame beyond its computed height. Oh well.
computedHeightLeftOver = PR_MAX(0, computedHeightLeftOver);
computedHeightLeftOver = NS_MAX(0, computedHeightLeftOver);
}
NS_ASSERTION(!( IS_TRUE_OVERFLOW_CONTAINER(this)
&& computedHeightLeftOver ),
@ -1316,7 +1316,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
// break. If our bottom border/padding straddles the break
// point, then this will increase our height and push the
// border/padding to the next page/column.
aMetrics.height = PR_MAX(aReflowState.availableHeight,
aMetrics.height = NS_MAX(aReflowState.availableHeight,
aState.mY + nonCarriedOutVerticalMargin);
NS_FRAME_SET_INCOMPLETE(aState.mReflowStatus);
if (!GetNextInFlow())
@ -1328,10 +1328,10 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
// Do extend the height to at least consume the available
// height, otherwise our left/right borders (for example) won't
// extend all the way to the break.
aMetrics.height = PR_MAX(aReflowState.availableHeight,
aMetrics.height = NS_MAX(aReflowState.availableHeight,
aState.mY + nonCarriedOutVerticalMargin);
// ... but don't take up more height than is available
aMetrics.height = PR_MIN(aMetrics.height,
aMetrics.height = NS_MIN(aMetrics.height,
borderPadding.top + computedHeightLeftOver);
// XXX It's pretty wrong that our bottom border still gets drawn on
// on its own on the last-in-flow, even if we ran out of height
@ -1358,7 +1358,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
else {
NS_ASSERTION(aReflowState.availableHeight != NS_UNCONSTRAINEDSIZE,
"Shouldn't be incomplete if availableHeight is UNCONSTRAINED.");
aMetrics.height = PR_MAX(aState.mY, aReflowState.availableHeight);
aMetrics.height = NS_MAX(aState.mY, aReflowState.availableHeight);
if (aReflowState.availableHeight == NS_UNCONSTRAINEDSIZE)
// This should never happen, but it does. See bug 414255
aMetrics.height = aState.mY;
@ -1373,7 +1373,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
}
// Screen out negative heights --- can happen due to integer overflows :-(
aMetrics.height = PR_MAX(0, aMetrics.height);
aMetrics.height = NS_MAX(0, aMetrics.height);
*aBottomEdgeOfChildren = bottomEdgeOfChildren;
#ifdef DEBUG_blocks
@ -1431,7 +1431,7 @@ nsBlockFrame::ComputeCombinedArea(const nsHTMLReflowState& aReflowState,
// to the bottom edge of the children
bottomEdgeOfContents += aReflowState.mComputedPadding.bottom;
}
area.height = PR_MAX(area.YMost(), bottomEdgeOfContents) - area.y;
area.height = NS_MAX(area.YMost(), bottomEdgeOfContents) - area.y;
}
#ifdef NOISY_COMBINED_AREA
ListTag(stdout);
@ -2232,8 +2232,8 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState)
nsLayoutUtils::GetCenteredFontBaseline(fm, aState.mMinLineHeight);
nscoord minDescent = aState.mMinLineHeight - minAscent;
aState.mY += PR_MAX(minAscent, metrics.ascent) +
PR_MAX(minDescent, metrics.height - metrics.ascent);
aState.mY += NS_MAX(minAscent, metrics.ascent) +
NS_MAX(minDescent, metrics.height - metrics.ascent);
nscoord offset = minAscent - metrics.ascent;
if (offset > 0) {
@ -4078,7 +4078,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
nsRect oldFloatAvailableSpace(aFloatAvailableSpace);
// As we redo for floats, we can't reduce the amount of height we're
// checking.
aAvailableSpaceHeight = PR_MAX(aAvailableSpaceHeight, aLine->mBounds.height);
aAvailableSpaceHeight = NS_MAX(aAvailableSpaceHeight, aLine->mBounds.height);
aFloatAvailableSpace =
aState.GetFloatAvailableSpaceForHeight(aLine->mBounds.y,
aAvailableSpaceHeight,
@ -5538,7 +5538,7 @@ nsBlockFrame::AdjustFloatAvailableSpace(nsBlockReflowState& aState,
nscoord contentYOffset = aState.mY - aState.BorderPadding().top;
nscoord availHeight = NS_UNCONSTRAINEDSIZE == aState.mContentArea.height
? NS_UNCONSTRAINEDSIZE
: PR_MAX(0, aState.mContentArea.height - contentYOffset);
: NS_MAX(0, aState.mContentArea.height - contentYOffset);
#ifdef DISABLE_FLOAT_BREAKING_IN_COLUMNS
if (availHeight != NS_UNCONSTRAINEDSIZE &&
@ -6577,7 +6577,7 @@ nsBlockFrame::ReflowBullet(nsBlockReflowState& aState,
if (rs.mStyleVisibility->mDirection == NS_STYLE_DIRECTION_LTR) {
// Note: floatAvailSpace.x is relative to the content box and never
// less than zero. Converting to frame coordinates and subtracting
// the padding and border cancel each other out, and the PR_MAX()
// the padding and border cancel each other out, and the NS_MAX()
// with 0 (or with the left border+padding) is even implied in the
// right place.
x = floatAvailSpace.x - reflowState.mComputedMargin.right - aMetrics.width;
@ -6586,7 +6586,7 @@ nsBlockFrame::ReflowBullet(nsBlockReflowState& aState,
// give us offsets from the left content edge. Then we add the left
// border/padding to get into frame coordinates, and the right
// border/padding and the bullet's margin to offset the position.
x = PR_MIN(rs.ComputedWidth(), floatAvailSpace.XMost())
x = NS_MIN(rs.ComputedWidth(), floatAvailSpace.XMost())
+ rs.mComputedBorderPadding.LeftRight()
+ reflowState.mComputedMargin.left;
}
@ -6788,8 +6788,8 @@ nsBlockFrame::WidthToClearPastFloats(nsBlockReflowState& aState,
// FIXME: This doesn't treat the caption and table independently,
// since we adjust by only the smaller margin, and the table outer
// frame doesn't know about it.
result.marginLeft = PR_MIN(tableMargin.left, captionMargin.left);
result.marginRight = PR_MIN(tableMargin.right, captionMargin.right);
result.marginLeft = NS_MIN(tableMargin.left, captionMargin.left);
result.marginRight = NS_MIN(tableMargin.right, captionMargin.right);
} else {
NS_ASSERTION(captionSide == NS_STYLE_CAPTION_SIDE_LEFT ||
captionSide == NS_STYLE_CAPTION_SIDE_RIGHT,

Просмотреть файл

@ -125,7 +125,7 @@ nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState,
// the bottom border and padding. The content area height doesn't
// include either border or padding edge.
mBottomEdge = aReflowState.availableHeight - borderPadding.bottom;
mContentArea.height = PR_MAX(0, mBottomEdge - borderPadding.top);
mContentArea.height = NS_MAX(0, mBottomEdge - borderPadding.top);
}
else {
// When we are not in a paginated situation then we always use
@ -212,16 +212,16 @@ nsBlockReflowState::ComputeReplacedBlockOffsetsForFloats(nsIFrame* aFrame,
"unexpected aReplacedWidth");
nscoord leftFloatXOffset = aFloatAvailableSpace.x;
leftOffset = PR_MAX(leftFloatXOffset, os.mComputedMargin.left) -
leftOffset = NS_MAX(leftFloatXOffset, os.mComputedMargin.left) -
(aReplacedWidth ? aReplacedWidth->marginLeft
: os.mComputedMargin.left);
leftOffset = PR_MAX(leftOffset, 0); // in case of negative margin
leftOffset = NS_MAX(leftOffset, 0); // in case of negative margin
nscoord rightFloatXOffset =
mContentArea.width - aFloatAvailableSpace.XMost();
rightOffset = PR_MAX(rightFloatXOffset, os.mComputedMargin.right) -
rightOffset = NS_MAX(rightFloatXOffset, os.mComputedMargin.right) -
(aReplacedWidth ? aReplacedWidth->marginRight
: os.mComputedMargin.right);
rightOffset = PR_MAX(rightOffset, 0); // in case of negative margin
rightOffset = NS_MAX(rightOffset, 0); // in case of negative margin
}
aLeftResult = leftOffset;
aRightResult = rightOffset;
@ -244,7 +244,7 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame,
aResult.y = mY;
aResult.height = GetFlag(BRS_UNCONSTRAINEDHEIGHT)
? NS_UNCONSTRAINEDSIZE
: PR_MAX(0, mReflowState.availableHeight - mY);
: NS_MAX(0, mReflowState.availableHeight - mY);
// mY might be greater than mBottomEdge if the block's top margin pushes
// it off the page/column. Negative available height can confuse other code
// and is nonsense in principle.
@ -920,7 +920,7 @@ nsBlockReflowState::FlowAndPlaceFloat(nsIFrame* aFloat,
// if the float split, then take up all of the vertical height
if (NS_FRAME_IS_NOT_COMPLETE(aReflowStatus) &&
(NS_UNCONSTRAINEDSIZE != mContentArea.height)) {
region.height = PR_MAX(region.height, mContentArea.height - floatY);
region.height = NS_MAX(region.height, mContentArea.height - floatY);
}
nsresult rv =
// spacemanager translation is inset by the border+padding.
@ -1046,10 +1046,10 @@ nsBlockReflowState::ClearFloats(nscoord aY, PRUint8 aBreakType,
nsBlockFrame::WidthToClearPastFloats(*this, floatAvailableSpace.mRect,
aReplacedBlock);
if (!floatAvailableSpace.mHasFloats ||
PR_MAX(floatAvailableSpace.mRect.x, replacedWidth.marginLeft) +
NS_MAX(floatAvailableSpace.mRect.x, replacedWidth.marginLeft) +
replacedWidth.borderBoxWidth +
PR_MAX(mContentArea.width -
PR_MIN(mContentArea.width,
NS_MAX(mContentArea.width -
NS_MIN(mContentArea.width,
floatAvailableSpace.mRect.XMost()),
replacedWidth.marginRight) <=
mContentArea.width) {

Просмотреть файл

@ -1297,7 +1297,7 @@ nsBulletFrame::GetDesiredSize(nsPresContext* aCX,
case NS_STYLE_LIST_STYLE_CIRCLE:
case NS_STYLE_LIST_STYLE_SQUARE:
fm->GetMaxAscent(ascent);
bulletSize = PR_MAX(nsPresContext::CSSPixelsToAppUnits(MIN_BULLET_SIZE),
bulletSize = NS_MAX(nsPresContext::CSSPixelsToAppUnits(MIN_BULLET_SIZE),
NSToCoordRound(0.8f * (float(ascent) / 2.0f)));
mPadding.bottom = NSToCoordRound(float(ascent) / 8.0f);
aMetrics.width = mPadding.right + bulletSize;

Просмотреть файл

@ -309,7 +309,7 @@ GetAvailableContentWidth(const nsHTMLReflowState& aReflowState)
nscoord borderPaddingWidth =
aReflowState.mComputedBorderPadding.left +
aReflowState.mComputedBorderPadding.right;
return PR_MAX(0, aReflowState.availableWidth - borderPaddingWidth);
return NS_MAX(0, aReflowState.availableWidth - borderPaddingWidth);
}
static nscoord
@ -321,7 +321,7 @@ GetAvailableContentHeight(const nsHTMLReflowState& aReflowState)
nscoord borderPaddingHeight =
aReflowState.mComputedBorderPadding.top +
aReflowState.mComputedBorderPadding.bottom;
return PR_MAX(0, aReflowState.availableHeight - borderPaddingHeight);
return NS_MAX(0, aReflowState.availableHeight - borderPaddingHeight);
}
static nscoord
@ -369,7 +369,7 @@ nsColumnSetFrame::ChooseColumnStrategy(const nsHTMLReflowState& aReflowState)
// This expression uses truncated rounding, which is what we
// want
PRInt32 maxColumns = (availContentWidth + colGap)/(colGap + colWidth);
numColumns = PR_MAX(1, PR_MIN(numColumns, maxColumns));
numColumns = NS_MAX(1, NS_MIN(numColumns, maxColumns));
}
} else if (numColumns > 0 && availContentWidth != NS_INTRINSICSIZE) {
nscoord widthMinusGaps = availContentWidth - colGap*(numColumns - 1);
@ -379,7 +379,7 @@ nsColumnSetFrame::ChooseColumnStrategy(const nsHTMLReflowState& aReflowState)
}
// Take care of the situation where there's only one column but it's
// still too wide
colWidth = PR_MAX(1, PR_MIN(colWidth, availContentWidth));
colWidth = NS_MAX(1, NS_MIN(colWidth, availContentWidth));
nscoord expectedWidthLeftOver = 0;
@ -402,7 +402,7 @@ nsColumnSetFrame::ChooseColumnStrategy(const nsHTMLReflowState& aReflowState)
// Compute extra space and divide it among the columns
nscoord extraSpace =
PR_MAX(0, availContentWidth - (colWidth*numColumns + colGap*(numColumns - 1)));
NS_MAX(0, availContentWidth - (colWidth*numColumns + colGap*(numColumns - 1)));
nscoord extraToColumns = extraSpace/numColumns;
colWidth += extraToColumns;
expectedWidthLeftOver = extraSpace - (extraToColumns*numColumns);
@ -417,7 +417,7 @@ nsColumnSetFrame::ChooseColumnStrategy(const nsHTMLReflowState& aReflowState)
// and balancing is required. Let's just use one column then.
numColumns = 1;
}
colHeight = PR_MIN(mLastBalanceHeight, GetAvailableContentHeight(aReflowState));
colHeight = NS_MIN(mLastBalanceHeight, GetAvailableContentHeight(aReflowState));
} else {
// No balancing, so don't limit the column count
numColumns = PR_INT32_MAX;
@ -470,7 +470,7 @@ nsColumnSetFrame::GetMinWidth(nsIRenderingContext *aRenderingContext) {
// As available width reduces to zero, we reduce our number of columns
// to one, and don't enforce the column width, so just return the min
// of the child's min-width with any specified column width.
width = PR_MIN(width, colWidth);
width = NS_MIN(width, colWidth);
} else {
NS_ASSERTION(colStyle->mColumnCount > 0,
"column-count and column-width can't both be auto");
@ -479,8 +479,8 @@ nsColumnSetFrame::GetMinWidth(nsIRenderingContext *aRenderingContext) {
colWidth = width;
width *= colStyle->mColumnCount;
// The multiplication above can make 'width' negative (integer overflow),
// so use PR_MAX to protect against that.
width = PR_MAX(width, colWidth);
// so use NS_MAX to protect against that.
width = NS_MAX(width, colWidth);
}
// XXX count forced column breaks here? Maybe we should return the child's
// min-width times the minimum number of columns.
@ -515,8 +515,8 @@ nsColumnSetFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext) {
nscoord width = colWidth*numColumns + colGap*(numColumns - 1);
// The multiplication above can make 'width' negative (integer overflow),
// so use PR_MAX to protect against that.
result = PR_MAX(width, colWidth);
// so use NS_MAX to protect against that.
result = NS_MAX(width, colWidth);
return result;
}
@ -691,7 +691,7 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize,
allFit = PR_FALSE;
}
if (childContentBottom > availSize.height) {
aColData.mMaxOverflowingHeight = PR_MAX(childContentBottom,
aColData.mMaxOverflowingHeight = NS_MAX(childContentBottom,
aColData.mMaxOverflowingHeight);
}
}
@ -699,7 +699,7 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize,
contentRect.UnionRect(contentRect, child->GetRect());
ConsiderChildOverflow(overflowRect, child);
contentBottom = PR_MAX(contentBottom, childContentBottom);
contentBottom = NS_MAX(contentBottom, childContentBottom);
aColData.mLastHeight = childContentBottom;
aColData.mSumHeight += childContentBottom;
@ -818,7 +818,7 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize,
}
}
aColData.mMaxHeight = contentBottom;
contentRect.height = PR_MAX(contentRect.height, contentBottom);
contentRect.height = NS_MAX(contentRect.height, contentBottom);
mLastFrameStatus = aStatus;
// contentRect included the borderPadding.left,borderPadding.top of the child rects
@ -831,20 +831,20 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize,
contentSize.height = aReflowState.ComputedHeight();
} else {
if (NS_UNCONSTRAINEDSIZE != aReflowState.mComputedMaxHeight) {
contentSize.height = PR_MIN(aReflowState.mComputedMaxHeight, contentSize.height);
contentSize.height = NS_MIN(aReflowState.mComputedMaxHeight, contentSize.height);
}
if (NS_UNCONSTRAINEDSIZE != aReflowState.mComputedMinHeight) {
contentSize.height = PR_MAX(aReflowState.mComputedMinHeight, contentSize.height);
contentSize.height = NS_MAX(aReflowState.mComputedMinHeight, contentSize.height);
}
}
if (aReflowState.ComputedWidth() != NS_INTRINSICSIZE) {
contentSize.width = aReflowState.ComputedWidth();
} else {
if (NS_UNCONSTRAINEDSIZE != aReflowState.mComputedMaxWidth) {
contentSize.width = PR_MIN(aReflowState.mComputedMaxWidth, contentSize.width);
contentSize.width = NS_MIN(aReflowState.mComputedMaxWidth, contentSize.width);
}
if (NS_UNCONSTRAINEDSIZE != aReflowState.mComputedMinWidth) {
contentSize.width = PR_MAX(aReflowState.mComputedMinWidth, contentSize.width);
contentSize.width = NS_MAX(aReflowState.mComputedMinWidth, contentSize.width);
}
}
@ -950,29 +950,29 @@ nsColumnSetFrame::Reflow(nsPresContext* aPresContext,
// Record what we learned from the last reflow
if (feasible) {
// maxHeight is feasible. Also, mLastBalanceHeight is feasible.
knownFeasibleHeight = PR_MIN(knownFeasibleHeight, colData.mMaxHeight);
knownFeasibleHeight = PR_MIN(knownFeasibleHeight, mLastBalanceHeight);
knownFeasibleHeight = NS_MIN(knownFeasibleHeight, colData.mMaxHeight);
knownFeasibleHeight = NS_MIN(knownFeasibleHeight, mLastBalanceHeight);
// Furthermore, no height less than the height of the last
// column can ever be feasible. (We might be able to reduce the
// height of a non-last column by moving content to a later column,
// but we can't do that with the last column.)
if (mFrames.GetLength() == config.mBalanceColCount) {
knownInfeasibleHeight = PR_MAX(knownInfeasibleHeight,
knownInfeasibleHeight = NS_MAX(knownInfeasibleHeight,
colData.mLastHeight - 1);
}
} else {
knownInfeasibleHeight = PR_MAX(knownInfeasibleHeight, mLastBalanceHeight);
knownInfeasibleHeight = NS_MAX(knownInfeasibleHeight, mLastBalanceHeight);
// If a column didn't fit in its available height, then its current
// height must be the minimum height for unbreakable content in
// the column, and therefore no smaller height can be feasible.
knownInfeasibleHeight = PR_MAX(knownInfeasibleHeight,
knownInfeasibleHeight = NS_MAX(knownInfeasibleHeight,
colData.mMaxOverflowingHeight - 1);
if (unboundedLastColumn) {
// The last column is unbounded, so all content got reflowed, so the
// mColMaxHeight is feasible.
knownFeasibleHeight = PR_MIN(knownFeasibleHeight,
knownFeasibleHeight = NS_MIN(knownFeasibleHeight,
colData.mMaxHeight);
}
}
@ -1012,7 +1012,7 @@ nsColumnSetFrame::Reflow(nsPresContext* aPresContext,
// 600 twips is arbitrary. It's about two line-heights.
nextGuess = colData.mSumHeight/config.mBalanceColCount + 600;
// Sanitize it
nextGuess = PR_MIN(PR_MAX(nextGuess, knownInfeasibleHeight + 1),
nextGuess = NS_MIN(NS_MAX(nextGuess, knownInfeasibleHeight + 1),
knownFeasibleHeight - 1);
} else if (knownFeasibleHeight == NS_INTRINSICSIZE) {
// This can happen when we had a next-in-flow so we didn't
@ -1021,7 +1021,7 @@ nsColumnSetFrame::Reflow(nsPresContext* aPresContext,
nextGuess = knownInfeasibleHeight*2 + 600;
}
// Don't bother guessing more than our height constraint.
nextGuess = PR_MIN(availableContentHeight, nextGuess);
nextGuess = NS_MIN(availableContentHeight, nextGuess);
#ifdef DEBUG_roc
printf("*** nsColumnSetFrame::Reflow balancing choosing next guess=%d\n", nextGuess);

Просмотреть файл

@ -486,14 +486,14 @@ nsFloatManager::ClearFloats(nscoord aY, PRUint8 aBreakType) const
const FloatInfo &tail = mFloats[mFloats.Length() - 1];
switch (aBreakType) {
case NS_STYLE_CLEAR_LEFT_AND_RIGHT:
bottom = PR_MAX(bottom, tail.mLeftYMost);
bottom = PR_MAX(bottom, tail.mRightYMost);
bottom = NS_MAX(bottom, tail.mLeftYMost);
bottom = NS_MAX(bottom, tail.mRightYMost);
break;
case NS_STYLE_CLEAR_LEFT:
bottom = PR_MAX(bottom, tail.mLeftYMost);
bottom = NS_MAX(bottom, tail.mLeftYMost);
break;
case NS_STYLE_CLEAR_RIGHT:
bottom = PR_MAX(bottom, tail.mRightYMost);
bottom = NS_MAX(bottom, tail.mRightYMost);
break;
default:
// Do nothing

Просмотреть файл

@ -2690,7 +2690,7 @@ static FrameTarget GetSelectionClosestFrame(nsIFrame* aFrame, nsPoint aPoint)
if (fromLeft >= 0 && fromRight <= 0) {
xDistance = 0;
} else {
xDistance = PR_MIN(abs(fromLeft), abs(fromRight));
xDistance = NS_MIN(abs(fromLeft), abs(fromRight));
}
if (xDistance <= closestXDistance)
@ -2705,7 +2705,7 @@ static FrameTarget GetSelectionClosestFrame(nsIFrame* aFrame, nsPoint aPoint)
if (fromTop >= 0 && fromBottom <= 0)
yDistance = 0;
else
yDistance = PR_MIN(abs(fromTop), abs(fromBottom));
yDistance = NS_MIN(abs(fromTop), abs(fromBottom));
if (yDistance < closestYDistance)
{
@ -2921,7 +2921,7 @@ void
nsIFrame::InlineMinWidthData::ForceBreak(nsIRenderingContext *aRenderingContext)
{
currentLine -= trailingWhitespace;
prevLines = PR_MAX(prevLines, currentLine);
prevLines = NS_MAX(prevLines, currentLine);
currentLine = trailingWhitespace = 0;
for (PRUint32 i = 0, i_end = floats.Length(); i != i_end; ++i) {
@ -2989,7 +2989,7 @@ nsIFrame::InlinePrefWidthData::ForceBreak(nsIRenderingContext *aRenderingContext
// Negative-width floats don't change the available space so they
// shouldn't change our intrinsic line width either.
floats_cur =
NSCoordSaturatingAdd(floats_cur, PR_MAX(0, floatWidth));
NSCoordSaturatingAdd(floats_cur, NS_MAX(0, floatWidth));
}
nscoord floats_cur =
@ -3004,7 +3004,7 @@ nsIFrame::InlinePrefWidthData::ForceBreak(nsIRenderingContext *aRenderingContext
currentLine =
NSCoordSaturatingSubtract(currentLine, trailingWhitespace, nscoord_MAX);
prevLines = PR_MAX(prevLines, currentLine);
prevLines = NS_MAX(prevLines, currentLine);
currentLine = trailingWhitespace = 0;
skipWhitespace = PR_TRUE;
}
@ -3865,7 +3865,7 @@ ComputeOutlineAndEffectsRect(nsIFrame* aFrame, PRBool* aAnyOutlineOrEffects,
}
nscoord offset = outline->mOutlineOffset;
nscoord inflateBy = PR_MAX(width + offset, 0);
nscoord inflateBy = NS_MAX(width + offset, 0);
r.Inflate(inflateBy, inflateBy);
*aAnyOutlineOrEffects = PR_TRUE;
}
@ -6455,7 +6455,7 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState,
if (aWidth != NS_INTRINSICSIZE) {
nscoord computedWidth =
aWidth - reflowState.mComputedBorderPadding.LeftRight();
computedWidth = PR_MAX(computedWidth, 0);
computedWidth = NS_MAX(computedWidth, 0);
reflowState.SetComputedWidth(computedWidth);
}
@ -6468,7 +6468,7 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState,
if (aHeight != NS_INTRINSICSIZE) {
nscoord computedHeight =
aHeight - reflowState.mComputedBorderPadding.TopBottom();
computedHeight = PR_MAX(computedHeight, 0);
computedHeight = NS_MAX(computedHeight, 0);
reflowState.SetComputedHeight(computedHeight);
} else {
reflowState.SetComputedHeight(

Просмотреть файл

@ -638,10 +638,10 @@ nsSubDocumentFrame::ReflowFinished()
// border and padding, so we can't trust those. Subtracting
// them might make things negative.
innerSize.width -= usedBorderPadding.LeftRight();
innerSize.width = PR_MAX(innerSize.width, 0);
innerSize.width = NS_MAX(innerSize.width, 0);
innerSize.height -= usedBorderPadding.TopBottom();
innerSize.height = PR_MAX(innerSize.height, 0);
innerSize.height = NS_MAX(innerSize.height, 0);
}
PRInt32 cx = presContext->AppUnitsToDevPixels(innerSize.width);

Просмотреть файл

@ -418,13 +418,13 @@ nsHTMLScrollFrame::TryLayout(ScrollReflowState* aState,
// XXXldb Can we depend more on ComputeSize here?
nsSize desiredInsideBorderSize;
desiredInsideBorderSize.width = vScrollbarDesiredWidth +
PR_MAX(aKidMetrics->width, hScrollbarMinWidth);
NS_MAX(aKidMetrics->width, hScrollbarMinWidth);
desiredInsideBorderSize.height = hScrollbarDesiredHeight +
PR_MAX(aKidMetrics->height, vScrollbarMinHeight);
NS_MAX(aKidMetrics->height, vScrollbarMinHeight);
aState->mInsideBorderSize =
ComputeInsideBorderSize(aState, desiredInsideBorderSize);
nsSize scrollPortSize = nsSize(PR_MAX(0, aState->mInsideBorderSize.width - vScrollbarDesiredWidth),
PR_MAX(0, aState->mInsideBorderSize.height - hScrollbarDesiredHeight));
nsSize scrollPortSize = nsSize(NS_MAX(0, aState->mInsideBorderSize.width - vScrollbarDesiredWidth),
NS_MAX(0, aState->mInsideBorderSize.height - hScrollbarDesiredHeight));
if (!aForce) {
nsRect scrolledRect = mInner.GetScrolledRect(scrollPortSize);
@ -488,7 +488,7 @@ nsHTMLScrollFrame::ReflowScrolledFrame(ScrollReflowState* aState,
nsHTMLReflowMetrics* aMetrics,
PRBool aFirstPass)
{
// these could be NS_UNCONSTRAINEDSIZE ... PR_MIN arithmetic should
// these could be NS_UNCONSTRAINEDSIZE ... NS_MIN arithmetic should
// be OK
nscoord paddingLR = aState->mReflowState.mComputedPadding.LeftRight();
@ -506,16 +506,16 @@ nsHTMLScrollFrame::ReflowScrolledFrame(ScrollReflowState* aState,
nsSize hScrollbarPrefSize =
mInner.mHScrollbarBox->GetPrefSize(const_cast<nsBoxLayoutState&>(aState->mBoxState));
if (computedHeight != NS_UNCONSTRAINEDSIZE)
computedHeight = PR_MAX(0, computedHeight - hScrollbarPrefSize.height);
computedMinHeight = PR_MAX(0, computedMinHeight - hScrollbarPrefSize.height);
computedHeight = NS_MAX(0, computedHeight - hScrollbarPrefSize.height);
computedMinHeight = NS_MAX(0, computedMinHeight - hScrollbarPrefSize.height);
if (computedMaxHeight != NS_UNCONSTRAINEDSIZE)
computedMaxHeight = PR_MAX(0, computedMaxHeight - hScrollbarPrefSize.height);
computedMaxHeight = NS_MAX(0, computedMaxHeight - hScrollbarPrefSize.height);
}
if (aAssumeVScroll) {
nsSize vScrollbarPrefSize =
mInner.mVScrollbarBox->GetPrefSize(const_cast<nsBoxLayoutState&>(aState->mBoxState));
availWidth = PR_MAX(0, availWidth - vScrollbarPrefSize.width);
availWidth = NS_MAX(0, availWidth - vScrollbarPrefSize.width);
}
// We're forcing the padding on our scrolled frame, so let it know what that
@ -2061,8 +2061,8 @@ nsXULScrollFrame::LayoutScrollArea(nsBoxLayoutState& aState, const nsRect& aRect
if (childRect.width < aRect.width || childRect.height < aRect.height)
{
childRect.width = PR_MAX(childRect.width, aRect.width);
childRect.height = PR_MAX(childRect.height, aRect.height);
childRect.width = NS_MAX(childRect.width, aRect.width);
childRect.height = NS_MAX(childRect.height, aRect.height);
// remove overflow area when we update the bounds,
// because we've already accounted for it
@ -2424,7 +2424,7 @@ nsGfxScrollFrameInner::ReflowFinished()
nscoord pageincrement = nscoord(scrollArea.height - fontHeight);
nscoord pageincrementMin = nscoord(float(scrollArea.height) * 0.8);
FinishReflowForScrollbar(vScroll, minY, maxY, curPosY,
PR_MAX(pageincrement,pageincrementMin),
NS_MAX(pageincrement,pageincrementMin),
fontHeight);
}
if (hScroll) {
@ -2497,9 +2497,9 @@ static void AdjustScrollbarRect(nsIView* aView, nsPresContext* aPresContext,
return;
if (aVertical)
aRect.height = PR_MAX(0, resizerRect.y - aRect.y);
aRect.height = NS_MAX(0, resizerRect.y - aRect.y);
else
aRect.width = PR_MAX(0, resizerRect.x - aRect.x);
aRect.width = NS_MAX(0, resizerRect.x - aRect.x);
}
void
@ -2641,7 +2641,7 @@ nsGfxScrollFrameInner::GetScrolledRect(const nsSize& aScrollPortSize) const
// When the scrolled frame is RTL, this means moving it in our left-based
// coordinate system, so we need to compensate for its extra width here by
// effectively repositioning the frame.
nscoord extraWidth = PR_MAX(0, mScrolledFrame->GetSize().width - aScrollPortSize.width);
nscoord extraWidth = NS_MAX(0, mScrolledFrame->GetSize().width - aScrollPortSize.width);
x2 += extraWidth;
}

Просмотреть файл

@ -194,7 +194,7 @@ nsHTMLCanvasFrame::Reflow(nsPresContext* aPresContext,
if (GetPrevInFlow()) {
nscoord y = GetContinuationOffset(&aMetrics.width);
aMetrics.height -= y + mBorderPadding.top;
aMetrics.height = PR_MAX(0, aMetrics.height);
aMetrics.height = NS_MAX(0, aMetrics.height);
}
aMetrics.mOverflowArea.SetRect(0, 0, aMetrics.width, aMetrics.height);
@ -301,7 +301,7 @@ nsHTMLCanvasFrame::GetContinuationOffset(nscoord* aWidth) const
offset += rect.height;
}
offset -= mBorderPadding.top;
offset = PR_MAX(0, offset);
offset = NS_MAX(0, offset);
}
return offset;
}

Просмотреть файл

@ -182,7 +182,7 @@ nsDisplayTextShadow::Paint(nsDisplayListBuilder* aBuilder,
nsIRenderingContext* aCtx,
const nsRect& aDirtyRect)
{
mBlurRadius = PR_MAX(mBlurRadius, 0);
mBlurRadius = NS_MAX(mBlurRadius, 0);
nsCOMPtr<nsIFontMetrics> fm;
nsLayoutUtils::GetFontMetricsForFrame(mFrame, getter_AddRefs(fm));

Просмотреть файл

@ -1544,7 +1544,7 @@ CalcQuirkContainingBlockHeight(const nsHTMLReflowState* aCBReflowState)
}
// Make sure not to return a negative height here!
return PR_MAX(result, 0);
return NS_MAX(result, 0);
}
// Called by InitConstraints() to compute the containing block rectangle for
// the element. Handles the special logic for absolutely positioned elements
@ -2249,16 +2249,16 @@ nsHTMLReflowState::ApplyMinMaxConstraints(nscoord* aFrameWidth,
{
if (aFrameWidth) {
if (NS_UNCONSTRAINEDSIZE != mComputedMaxWidth) {
*aFrameWidth = PR_MIN(*aFrameWidth, mComputedMaxWidth);
*aFrameWidth = NS_MIN(*aFrameWidth, mComputedMaxWidth);
}
*aFrameWidth = PR_MAX(*aFrameWidth, mComputedMinWidth);
*aFrameWidth = NS_MAX(*aFrameWidth, mComputedMinWidth);
}
if (aFrameHeight) {
if (NS_UNCONSTRAINEDSIZE != mComputedMaxHeight) {
*aFrameHeight = PR_MIN(*aFrameHeight, mComputedMaxHeight);
*aFrameHeight = NS_MIN(*aFrameHeight, mComputedMaxHeight);
}
*aFrameHeight = PR_MAX(*aFrameHeight, mComputedMinHeight);
*aFrameHeight = NS_MAX(*aFrameHeight, mComputedMinHeight);
}
}

Просмотреть файл

@ -55,6 +55,7 @@
#include "nsHTMLReflowMetrics.h"
#include "gfxMatrix.h"
#include "nsFrameList.h"
#include "nsAlgorithm.h"
/**
* New rules of reflow:
@ -1050,8 +1051,8 @@ public:
PRInt32 secondaryOffset;
// Helpers for places that need the ends of the offsets and expect them in
// numerical order, as opposed to wanting the primary and secondary offsets
PRInt32 StartOffset() { return PR_MIN(offset, secondaryOffset); }
PRInt32 EndOffset() { return PR_MAX(offset, secondaryOffset); }
PRInt32 StartOffset() { return NS_MIN(offset, secondaryOffset); }
PRInt32 EndOffset() { return NS_MAX(offset, secondaryOffset); }
// This boolean indicates whether the associated content is before or after
// the offset; the most visible use is to allow the caret to know which line
// to display on.

Просмотреть файл

@ -779,7 +779,7 @@ nsImageFrame::Reflow(nsPresContext* aPresContext,
aMetrics.width = GetPrevInFlow()->GetSize().width;
nscoord y = GetContinuationOffset();
aMetrics.height -= y + aReflowState.mComputedBorderPadding.top;
aMetrics.height = PR_MAX(0, aMetrics.height);
aMetrics.height = NS_MAX(0, aMetrics.height);
}
@ -802,7 +802,7 @@ nsImageFrame::Reflow(nsPresContext* aPresContext,
aMetrics.height > aReflowState.availableHeight) {
// our desired height was greater than 0, so to avoid infinite
// splitting, use 1 pixel as the min
aMetrics.height = PR_MAX(nsPresContext::CSSPixelsToAppUnits(1), aReflowState.availableHeight);
aMetrics.height = NS_MAX(nsPresContext::CSSPixelsToAppUnits(1), aReflowState.availableHeight);
aStatus = NS_FRAME_NOT_COMPLETE;
}

Просмотреть файл

@ -39,6 +39,7 @@
/* a set of ranges on a number-line */
#include "nsIntervalSet.h"
#include "nsAlgorithm.h"
#include NEW_H
nsIntervalSet::nsIntervalSet(IntervalSetAlloc aAlloc, IntervalSetFree aFree,
@ -88,8 +89,8 @@ void nsIntervalSet::IncludeInterval(coord_type aBegin, coord_type aEnd)
Interval *subsumed = newInterval->mNext;
while (subsumed && subsumed->mBegin <= aEnd) {
newInterval->mBegin = PR_MIN(newInterval->mBegin, subsumed->mBegin);
newInterval->mEnd = PR_MAX(newInterval->mEnd, subsumed->mEnd);
newInterval->mBegin = NS_MIN(newInterval->mBegin, subsumed->mBegin);
newInterval->mEnd = NS_MAX(newInterval->mEnd, subsumed->mEnd);
newInterval->mNext = subsumed->mNext;
FreeInterval(subsumed);
subsumed = newInterval->mNext;

Просмотреть файл

@ -790,12 +790,12 @@ nsObjectFrame::GetDesiredSize(nsPresContext* aPresContext,
nsIAtom *atom = mContent->Tag();
if (atom == nsGkAtoms::applet || atom == nsGkAtoms::embed) {
if (aMetrics.width == NS_UNCONSTRAINEDSIZE) {
aMetrics.width = PR_MIN(PR_MAX(nsPresContext::CSSPixelsToAppUnits(EMBED_DEF_WIDTH),
aMetrics.width = NS_MIN(NS_MAX(nsPresContext::CSSPixelsToAppUnits(EMBED_DEF_WIDTH),
aReflowState.mComputedMinWidth),
aReflowState.mComputedMaxWidth);
}
if (aMetrics.height == NS_UNCONSTRAINEDSIZE) {
aMetrics.height = PR_MIN(PR_MAX(nsPresContext::CSSPixelsToAppUnits(EMBED_DEF_HEIGHT),
aMetrics.height = NS_MIN(NS_MAX(nsPresContext::CSSPixelsToAppUnits(EMBED_DEF_HEIGHT),
aReflowState.mComputedMinHeight),
aReflowState.mComputedMaxHeight);
}
@ -805,8 +805,8 @@ nsObjectFrame::GetDesiredSize(nsPresContext* aPresContext,
// exceed the maximum size of X coordinates. See bug #225357 for
// more information. In theory Gtk2 can handle large coordinates,
// but underlying plugins can't.
aMetrics.height = PR_MIN(aPresContext->DevPixelsToAppUnits(PR_INT16_MAX), aMetrics.height);
aMetrics.width = PR_MIN(aPresContext->DevPixelsToAppUnits(PR_INT16_MAX), aMetrics.width);
aMetrics.height = NS_MIN(aPresContext->DevPixelsToAppUnits(PR_INT16_MAX), aMetrics.height);
aMetrics.width = NS_MIN(aPresContext->DevPixelsToAppUnits(PR_INT16_MAX), aMetrics.width);
#endif
}

Просмотреть файл

@ -1575,7 +1575,7 @@ void nsFrameSelection::BidiLevelFromMove(nsIPresShell* aPresShell,
case nsIDOMKeyEvent::DOM_VK_UP:
case nsIDOMKeyEvent::DOM_VK_DOWN:
GetPrevNextBidiLevels(aContext, aNode, aContentOffset, &firstFrame, &secondFrame, &firstLevel, &secondLevel);
aPresShell->SetCaretBidiLevel(PR_MIN(firstLevel, secondLevel));
aPresShell->SetCaretBidiLevel(NS_MIN(firstLevel, secondLevel));
break;
*/
@ -2735,10 +2735,10 @@ nsFrameSelection::UnselectCells(nsIContent *aTableContent,
if (!tableLayout)
return NS_ERROR_FAILURE;
PRInt32 minRowIndex = PR_MIN(aStartRowIndex, aEndRowIndex);
PRInt32 maxRowIndex = PR_MAX(aStartRowIndex, aEndRowIndex);
PRInt32 minColIndex = PR_MIN(aStartColumnIndex, aEndColumnIndex);
PRInt32 maxColIndex = PR_MAX(aStartColumnIndex, aEndColumnIndex);
PRInt32 minRowIndex = NS_MIN(aStartRowIndex, aEndRowIndex);
PRInt32 maxRowIndex = NS_MAX(aStartRowIndex, aEndRowIndex);
PRInt32 minColIndex = NS_MIN(aStartColumnIndex, aEndColumnIndex);
PRInt32 maxColIndex = NS_MAX(aStartColumnIndex, aEndColumnIndex);
// Strong reference because we sometimes remove the range
nsCOMPtr<nsIRange> range = GetFirstCellRange();
@ -4413,8 +4413,8 @@ nsTypedSelection::LookUpSelection(nsIContent *aContent, PRInt32 aContentOffset,
if (startOffset < (aContentOffset + aContentLength) &&
endOffset > aContentOffset) {
// this range is totally inside the requested content range
start = PR_MAX(0, startOffset - aContentOffset);
end = PR_MIN(aContentLength, endOffset - aContentOffset);
start = NS_MAX(0, startOffset - aContentOffset);
end = NS_MIN(aContentLength, endOffset - aContentOffset);
}
// otherwise, range is inside the requested node, but does not intersect
// the requested content range, so ignore it
@ -4422,7 +4422,7 @@ nsTypedSelection::LookUpSelection(nsIContent *aContent, PRInt32 aContentOffset,
if (startOffset < (aContentOffset + aContentLength)) {
// the beginning of the range is inside the requested node, but the
// end is outside, select everything from there to the end
start = PR_MAX(0, startOffset - aContentOffset);
start = NS_MAX(0, startOffset - aContentOffset);
end = aContentLength;
}
} else if (endNode == aContent) {
@ -4430,7 +4430,7 @@ nsTypedSelection::LookUpSelection(nsIContent *aContent, PRInt32 aContentOffset,
// the end of the range is inside the requested node, but the beginning
// is outside, select everything from the beginning to there
start = 0;
end = PR_MIN(aContentLength, endOffset - aContentOffset);
end = NS_MIN(aContentLength, endOffset - aContentOffset);
}
} else {
// this range does not begin or end in the requested node, but since
@ -6350,7 +6350,7 @@ nsTypedSelection::SelectionLanguageChange(PRBool aLangRTL)
// (if the new language corresponds to the orientation of that character) and this level plus 1
// (if the new language corresponds to the opposite orientation)
if ((level != levelBefore) && (level != levelAfter))
level = PR_MIN(levelBefore, levelAfter);
level = NS_MIN(levelBefore, levelAfter);
if ((level & 1) == aLangRTL)
mFrameSelection->SetCaretBidiLevel(level);
else

Просмотреть файл

@ -212,10 +212,10 @@ nsSimplePageSequenceFrame::Reflow(nsPresContext* aPresContext,
// sanity check the values. three inches are sometimes needed
PRInt32 inchInTwips = NS_INCHES_TO_TWIPS(3.0);
edgeTwips.top = PR_MIN(PR_MAX(edgeTwips.top, 0), inchInTwips);
edgeTwips.bottom = PR_MIN(PR_MAX(edgeTwips.bottom, 0), inchInTwips);
edgeTwips.left = PR_MIN(PR_MAX(edgeTwips.left, 0), inchInTwips);
edgeTwips.right = PR_MIN(PR_MAX(edgeTwips.right, 0), inchInTwips);
edgeTwips.top = NS_MIN(NS_MAX(edgeTwips.top, 0), inchInTwips);
edgeTwips.bottom = NS_MIN(NS_MAX(edgeTwips.bottom, 0), inchInTwips);
edgeTwips.left = NS_MIN(NS_MAX(edgeTwips.left, 0), inchInTwips);
edgeTwips.right = NS_MIN(NS_MAX(edgeTwips.right, 0), inchInTwips);
mPageData->mEdgePaperMargin =
aPresContext->TwipsToAppUnits(edgeTwips + unwriteableTwips);
@ -239,12 +239,12 @@ nsSimplePageSequenceFrame::Reflow(nsPresContext* aPresContext,
// Compute the size of each page and the x coordinate that each page will
// be placed at
nscoord extraThreshold = PR_MAX(pageSize.width, pageSize.height)/10;
nscoord extraThreshold = NS_MAX(pageSize.width, pageSize.height)/10;
PRInt32 gapInTwips = nsContentUtils::GetIntPref("print.print_extra_margin");
gapInTwips = PR_MAX(0, gapInTwips);
gapInTwips = NS_MAX(0, gapInTwips);
nscoord extraGap = aPresContext->TwipsToAppUnits(gapInTwips);
extraGap = PR_MIN(extraGap, extraThreshold); // clamp to 1/10 of the largest dim of the page
extraGap = NS_MIN(extraGap, extraThreshold); // clamp to 1/10 of the largest dim of the page
nscoord deadSpaceGap = 0;
if (isPrintPreview) {

Просмотреть файл

@ -3112,7 +3112,7 @@ nsTextPaintStyle::InitCommonColors()
defaultWindowBackgroundColor);
mSufficientContrast =
PR_MIN(PR_MIN(NS_SUFFICIENT_LUMINOSITY_DIFFERENCE,
NS_MIN(NS_MIN(NS_SUFFICIENT_LUMINOSITY_DIFFERENCE,
NS_LUMINOSITY_DIFFERENCE(selectionTextColor,
selectionBGColor)),
NS_LUMINOSITY_DIFFERENCE(defaultWindowBackgroundColor,
@ -4154,9 +4154,9 @@ ComputeSelectionUnderlineHeight(nsPresContext* aPresContext,
// current font size.
PRInt32 defaultFontSize =
aPresContext->AppUnitsToDevPixels(nsStyleFont(aPresContext).mFont.size);
gfxFloat fontSize = PR_MIN(gfxFloat(defaultFontSize),
gfxFloat fontSize = NS_MIN(gfxFloat(defaultFontSize),
aFontMetrics.emHeight);
fontSize = PR_MAX(fontSize, 1.0);
fontSize = NS_MAX(fontSize, 1.0);
return NS_ceil(fontSize / 20);
}
default:
@ -4433,7 +4433,7 @@ nsTextFrame::PaintOneShadow(PRUint32 aOffset, PRUint32 aLength,
gfxContext* aCtx, const nscolor& aForegroundColor)
{
gfxPoint shadowOffset(aShadowDetails->mXOffset, aShadowDetails->mYOffset);
nscoord blurRadius = PR_MAX(aShadowDetails->mRadius, 0);
nscoord blurRadius = NS_MAX(aShadowDetails->mRadius, 0);
gfxTextRun::Metrics shadowMetrics =
mTextRun->MeasureText(aOffset, aLength, gfxFont::LOOSE_INK_EXTENTS,
@ -4513,8 +4513,8 @@ nsTextFrame::PaintTextWithSelectionColors(gfxContext* aCtx,
SelectionDetails *sdptr = aDetails;
PRBool anyBackgrounds = PR_FALSE;
while (sdptr) {
PRInt32 start = PR_MAX(0, sdptr->mStart - contentOffset);
PRInt32 end = PR_MIN(contentLength, sdptr->mEnd - contentOffset);
PRInt32 start = NS_MAX(0, sdptr->mStart - contentOffset);
PRInt32 end = NS_MIN(contentLength, sdptr->mEnd - contentOffset);
SelectionType type = sdptr->mType;
if (start < end) {
allTypes |= type;
@ -4609,8 +4609,8 @@ nsTextFrame::PaintTextSelectionDecorations(gfxContext* aCtx,
SelectionDetails *sdptr = aDetails;
while (sdptr) {
if (sdptr->mType == aSelectionType) {
PRInt32 start = PR_MAX(0, sdptr->mStart - contentOffset);
PRInt32 end = PR_MIN(contentLength, sdptr->mEnd - contentOffset);
PRInt32 start = NS_MAX(0, sdptr->mStart - contentOffset);
PRInt32 end = NS_MIN(contentLength, sdptr->mEnd - contentOffset);
for (i = start; i < end; ++i) {
selectedChars[i] = sdptr;
}
@ -4984,7 +4984,7 @@ nsTextFrame::CombineSelectionUnderlineRect(nsPresContext* aPresContext,
gfxSize size(aPresContext->AppUnitsToGfxUnits(aRect.width),
ComputeSelectionUnderlineHeight(aPresContext,
metrics, sd->mType));
relativeSize = PR_MAX(relativeSize, 1.0f);
relativeSize = NS_MAX(relativeSize, 1.0f);
size.height *= relativeSize;
decorationArea =
nsCSSRendering::GetTextDecorationRect(aPresContext, size,
@ -5123,8 +5123,8 @@ nsTextFrame::GetPointFromOffset(PRInt32 inOffset,
}
PRInt32 trimmedOffset = properties.GetStart().GetOriginalOffset();
PRInt32 trimmedEnd = trimmedOffset + properties.GetOriginalLength();
inOffset = PR_MAX(inOffset, trimmedOffset);
inOffset = PR_MIN(inOffset, trimmedEnd);
inOffset = NS_MAX(inOffset, trimmedOffset);
inOffset = NS_MIN(inOffset, trimmedEnd);
iter.SetOriginalOffset(inOffset);
@ -5283,7 +5283,7 @@ nsTextFrame::PeekOffsetCharacter(PRBool aForward, PRInt32* aOffset)
if (!aForward) {
PRInt32 i;
for (i = PR_MIN(trimmed.GetEnd(), startOffset) - 1;
for (i = NS_MIN(trimmed.GetEnd(), startOffset) - 1;
i >= trimmed.mStart; --i) {
iter.SetOriginalOffset(i);
if (IsAcceptableCaretPosition(iter, mTextRun, this)) {
@ -6100,7 +6100,7 @@ nsTextFrame::Reflow(nsPresContext* aPresContext,
FindFirstLetterRange(frag, mTextRun, offset, iter, &firstLetterLength);
if (newLineOffset >= 0) {
// Don't allow a preformatted newline to be part of a first-letter.
firstLetterLength = PR_MIN(firstLetterLength, length - 1);
firstLetterLength = NS_MIN(firstLetterLength, length - 1);
if (length == 1) {
// There is no text to be consumed by the first-letter before the
// preformatted newline. Note that the first letter is therefore
@ -6306,13 +6306,13 @@ nsTextFrame::Reflow(nsPresContext* aPresContext,
// first-letter frames should use the tight bounding box metrics for ascent/descent
// for good drop-cap effects
if (GetStateBits() & TEXT_FIRST_LETTER) {
textMetrics.mAscent = PR_MAX(0, -textMetrics.mBoundingBox.Y());
textMetrics.mDescent = PR_MAX(0, textMetrics.mBoundingBox.YMost());
textMetrics.mAscent = NS_MAX(gfxFloat(0.0), -textMetrics.mBoundingBox.Y());
textMetrics.mDescent = NS_MAX(gfxFloat(0.0), textMetrics.mBoundingBox.YMost());
}
// Setup metrics for caller
// Disallow negative widths
aMetrics.width = NSToCoordCeil(PR_MAX(0, textMetrics.mAdvanceWidth));
aMetrics.width = NSToCoordCeil(NS_MAX(gfxFloat(0.0), textMetrics.mAdvanceWidth));
if (transformedCharsFit == 0 && !usedHyphenation) {
aMetrics.ascent = 0;
@ -6329,8 +6329,8 @@ nsTextFrame::Reflow(nsPresContext* aPresContext,
nsIFontMetrics* fm = provider.GetFontMetrics();
fm->GetMaxAscent(fontAscent);
fm->GetMaxDescent(fontDescent);
aMetrics.ascent = PR_MAX(NSToCoordCeil(textMetrics.mAscent), fontAscent);
nscoord descent = PR_MAX(NSToCoordCeil(textMetrics.mDescent), fontDescent);
aMetrics.ascent = NS_MAX(NSToCoordCeil(textMetrics.mAscent), fontAscent);
nscoord descent = NS_MAX(NSToCoordCeil(textMetrics.mDescent), fontDescent);
aMetrics.height = aMetrics.ascent + descent;
}
@ -6849,8 +6849,8 @@ nsTextFrame::AdjustOffsetsForBidi(PRInt32 aStart, PRInt32 aEnd)
// the bidi resolver can be very evil when columns/pages are involved. Don't
// let it violate our invariants.
PRInt32 prevOffset = prev->GetContentOffset();
aStart = PR_MAX(aStart, prevOffset);
aEnd = PR_MAX(aEnd, prevOffset);
aStart = NS_MAX(aStart, prevOffset);
aEnd = NS_MAX(aEnd, prevOffset);
prev->ClearTextRun();
}

Просмотреть файл

@ -261,7 +261,7 @@ PRBool nsSkipCharsRunIterator::NextRun() {
return PR_FALSE;
PRInt32 length;
mSkipped = mIterator.IsOriginalCharSkipped(&length);
mRunLength = PR_MIN(length, mRemainingLength);
mRunLength = NS_MIN(length, mRemainingLength);
} while (!mVisitSkipped && mSkipped);
return PR_TRUE;

Просмотреть файл

@ -158,7 +158,7 @@ CorrectForAspectRatio(const gfxRect& aRect, const nsIntSize& aRatio)
"Nothing to draw");
// Choose scale factor that scales aRatio to just fit into aRect
gfxFloat scale =
PR_MIN(aRect.Width()/aRatio.width, aRect.Height()/aRatio.height);
NS_MIN(aRect.Width()/aRatio.width, aRect.Height()/aRatio.height);
gfxSize scaledRatio(scale*aRatio.width, scale*aRatio.height);
gfxPoint topLeft((aRect.Width() - scaledRatio.width)/2,
(aRect.Height() - scaledRatio.height)/2);

Просмотреть файл

@ -1006,7 +1006,7 @@ IsSizeOK(nsPresContext* aPresContext, nscoord a, nscoord b, PRUint32 aHint)
// i.e. within 10% and within 5pt
PRBool isNearer = PR_FALSE;
if (aHint & (NS_STRETCH_NEARER | NS_STRETCH_LARGEOP)) {
float c = PR_MAX(float(b) * NS_MATHML_DELIMITER_FACTOR,
float c = NS_MAX(float(b) * NS_MATHML_DELIMITER_FACTOR,
float(b) - aPresContext->PointsToAppUnits(NS_MATHML_DELIMITER_SHORTFALL_POINTS));
isNearer = PRBool(float(PR_ABS(b - a)) <= (float(b) - c));
}
@ -1789,7 +1789,7 @@ nsMathMLChar::GetMaxWidth(nsPresContext* aPresContext,
StretchInternal(aPresContext, aRenderingContext, direction, container,
bm, aStretchHint | NS_STRETCH_MAXWIDTH);
return PR_MAX(bm.width, bm.rightBearing) - PR_MIN(0, bm.leftBearing);
return NS_MAX(bm.width, bm.rightBearing) - NS_MIN(0, bm.leftBearing);
}
nsresult
@ -2361,8 +2361,8 @@ nsMathMLChar::PaintVertically(nsPresContext* aPresContext,
for (i = 0; i < bottom; ++i) {
// Make sure not to draw outside the character
nscoord dy = PR_MAX(end[i], aRect.y);
nscoord fillEnd = PR_MIN(start[i+1], aRect.YMost());
nscoord dy = NS_MAX(end[i], aRect.y);
nscoord fillEnd = NS_MIN(start[i+1], aRect.YMost());
#ifdef SHOW_BORDERS
// exact area to fill
aRenderingContext.SetColor(NS_RGB(255,0,0));
@ -2373,7 +2373,7 @@ nsMathMLChar::PaintVertically(nsPresContext* aPresContext,
#endif
while (dy < fillEnd) {
clipRect.y = dy;
clipRect.height = PR_MIN(bm.ascent + bm.descent, fillEnd - dy);
clipRect.height = NS_MIN(bm.ascent + bm.descent, fillEnd - dy);
AutoPushClipRect clip(aRenderingContext, clipRect);
dy += bm.ascent;
aRenderingContext.DrawString(&chGlue.code, 1, dx, dy);
@ -2588,8 +2588,8 @@ nsMathMLChar::PaintHorizontally(nsPresContext* aPresContext,
for (i = 0; i < right; ++i) {
// Make sure not to draw outside the character
nscoord dx = PR_MAX(end[i], aRect.x);
nscoord fillEnd = PR_MIN(start[i+1], aRect.XMost());
nscoord dx = NS_MAX(end[i], aRect.x);
nscoord fillEnd = NS_MIN(start[i+1], aRect.XMost());
#ifdef SHOW_BORDERS
// rectangles in-between that are to be filled
aRenderingContext.SetColor(NS_RGB(255,0,0));
@ -2600,7 +2600,7 @@ nsMathMLChar::PaintHorizontally(nsPresContext* aPresContext,
#endif
while (dx < fillEnd) {
clipRect.x = dx;
clipRect.width = PR_MIN(bm.rightBearing - bm.leftBearing, fillEnd - dx);
clipRect.width = NS_MIN(bm.rightBearing - bm.leftBearing, fillEnd - dx);
AutoPushClipRect clip(aRenderingContext, clipRect);
dx -= bm.leftBearing;
aRenderingContext.DrawString(&chGlue.code, 1, dx, dy);

Просмотреть файл

@ -218,9 +218,9 @@ nsMathMLTokenFrame::Place(nsIRenderingContext& aRenderingContext,
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
aDesiredSize.width = mBoundingMetrics.width;
aDesiredSize.ascent = PR_MAX(mBoundingMetrics.ascent, ascent);
aDesiredSize.ascent = NS_MAX(mBoundingMetrics.ascent, ascent);
aDesiredSize.height = aDesiredSize.ascent +
PR_MAX(mBoundingMetrics.descent, descent);
NS_MAX(mBoundingMetrics.descent, descent);
if (aPlaceOrigin) {
nscoord dy, dx = 0;

Просмотреть файл

@ -437,8 +437,8 @@ nsMathMLmencloseFrame::PlaceInternal(nsIRenderingContext& aRenderingContext,
IsToDraw(NOTATION_RADICAL) ||
IsToDraw(NOTATION_LONGDIV)) {
// set a minimal value for the base height
bmBase.ascent = PR_MAX(bmOne.ascent, bmBase.ascent);
bmBase.descent = PR_MAX(0, bmBase.descent);
bmBase.ascent = NS_MAX(bmOne.ascent, bmBase.ascent);
bmBase.descent = NS_MAX(0, bmBase.descent);
}
mBoundingMetrics.ascent = bmBase.ascent;
@ -469,15 +469,15 @@ nsMathMLmencloseFrame::PlaceInternal(nsIRenderingContext& aRenderingContext,
// Update horizontal parameters
padding2 = ratio * bmBase.width;
dx_left = PR_MAX(dx_left, padding2);
dx_right = PR_MAX(dx_right, padding2);
dx_left = NS_MAX(dx_left, padding2);
dx_right = NS_MAX(dx_right, padding2);
// Update vertical parameters
padding2 = ratio * (bmBase.ascent + bmBase.descent);
mBoundingMetrics.ascent = PR_MAX(mBoundingMetrics.ascent,
mBoundingMetrics.ascent = NS_MAX(mBoundingMetrics.ascent,
bmBase.ascent + padding2);
mBoundingMetrics.descent = PR_MAX(mBoundingMetrics.descent,
mBoundingMetrics.descent = NS_MAX(mBoundingMetrics.descent,
bmBase.descent + padding2);
}
@ -489,7 +489,7 @@ nsMathMLmencloseFrame::PlaceInternal(nsIRenderingContext& aRenderingContext,
GetMaxWidth(PresContext(), aRenderingContext);
// Update horizontal parameters
dx_left = PR_MAX(dx_left, longdiv_width);
dx_left = NS_MAX(dx_left, longdiv_width);
} else {
// Stretch the parenthesis to the appropriate height if it is not
// big enough.
@ -505,17 +505,17 @@ nsMathMLmencloseFrame::PlaceInternal(nsIRenderingContext& aRenderingContext,
mMathMLChar[mLongDivCharIndex].GetBoundingMetrics(bmLongdivChar);
// Update horizontal parameters
dx_left = PR_MAX(dx_left, bmLongdivChar.width);
dx_left = NS_MAX(dx_left, bmLongdivChar.width);
// Update vertical parameters
longdivAscent = bmBase.ascent + psi + mRuleThickness;
longdivDescent = PR_MAX(bmBase.descent,
longdivDescent = NS_MAX(bmBase.descent,
(bmLongdivChar.ascent + bmLongdivChar.descent -
longdivAscent));
mBoundingMetrics.ascent = PR_MAX(mBoundingMetrics.ascent,
mBoundingMetrics.ascent = NS_MAX(mBoundingMetrics.ascent,
longdivAscent);
mBoundingMetrics.descent = PR_MAX(mBoundingMetrics.descent,
mBoundingMetrics.descent = NS_MAX(mBoundingMetrics.descent,
longdivDescent);
}
}
@ -528,7 +528,7 @@ nsMathMLmencloseFrame::PlaceInternal(nsIRenderingContext& aRenderingContext,
GetMaxWidth(PresContext(), aRenderingContext);
// Update horizontal parameters
dx_left = PR_MAX(dx_left, radical_width);
dx_left = NS_MAX(dx_left, radical_width);
} else {
// Stretch the radical symbol to the appropriate height if it is not
// big enough.
@ -544,17 +544,17 @@ nsMathMLmencloseFrame::PlaceInternal(nsIRenderingContext& aRenderingContext,
mMathMLChar[mRadicalCharIndex].GetBoundingMetrics(bmRadicalChar);
// Update horizontal parameters
dx_left = PR_MAX(dx_left, bmRadicalChar.width);
dx_left = NS_MAX(dx_left, bmRadicalChar.width);
// Update vertical parameters
radicalAscent = bmBase.ascent + psi + mRuleThickness;
radicalDescent = PR_MAX(bmBase.descent,
radicalDescent = NS_MAX(bmBase.descent,
(bmRadicalChar.ascent + bmRadicalChar.descent -
radicalAscent));
mBoundingMetrics.ascent = PR_MAX(mBoundingMetrics.ascent,
mBoundingMetrics.ascent = NS_MAX(mBoundingMetrics.ascent,
radicalAscent);
mBoundingMetrics.descent = PR_MAX(mBoundingMetrics.descent,
mBoundingMetrics.descent = NS_MAX(mBoundingMetrics.descent,
radicalDescent);
}
}
@ -565,22 +565,22 @@ nsMathMLmencloseFrame::PlaceInternal(nsIRenderingContext& aRenderingContext,
IsToDraw(NOTATION_ROUNDEDBOX) ||
(IsToDraw(NOTATION_LEFT) && IsToDraw(NOTATION_RIGHT))) {
// center the menclose around the content (horizontally)
dx_left = dx_right = PR_MAX(dx_left, dx_right);
dx_left = dx_right = NS_MAX(dx_left, dx_right);
}
///////////////
// The maximum size is now computed: set the remaining parameters
mBoundingMetrics.width = dx_left + bmBase.width + dx_right;
mBoundingMetrics.leftBearing = PR_MIN(0, dx_left + bmBase.leftBearing);
mBoundingMetrics.leftBearing = NS_MIN(0, dx_left + bmBase.leftBearing);
mBoundingMetrics.rightBearing =
PR_MAX(mBoundingMetrics.width, dx_left + bmBase.rightBearing);
NS_MAX(mBoundingMetrics.width, dx_left + bmBase.rightBearing);
aDesiredSize.width = mBoundingMetrics.width;
aDesiredSize.ascent = PR_MAX(mBoundingMetrics.ascent, baseSize.ascent);
aDesiredSize.ascent = NS_MAX(mBoundingMetrics.ascent, baseSize.ascent);
aDesiredSize.height = aDesiredSize.ascent +
PR_MAX(mBoundingMetrics.descent, baseSize.height - baseSize.ascent);
NS_MAX(mBoundingMetrics.descent, baseSize.height - baseSize.ascent);
if (IsToDraw(NOTATION_LONGDIV) || IsToDraw(NOTATION_RADICAL)) {
// get the leading to be left at the top of the resulting frame
@ -591,16 +591,16 @@ nsMathMLmencloseFrame::PlaceInternal(nsIRenderingContext& aRenderingContext,
nscoord desiredSizeDescent = aDesiredSize.height - aDesiredSize.ascent;
if (IsToDraw(NOTATION_LONGDIV)) {
desiredSizeAscent = PR_MAX(desiredSizeAscent,
desiredSizeAscent = NS_MAX(desiredSizeAscent,
longdivAscent + leading);
desiredSizeDescent = PR_MAX(desiredSizeDescent,
desiredSizeDescent = NS_MAX(desiredSizeDescent,
longdivDescent + mRuleThickness);
}
if (IsToDraw(NOTATION_RADICAL)) {
desiredSizeAscent = PR_MAX(desiredSizeAscent,
desiredSizeAscent = NS_MAX(desiredSizeAscent,
radicalAscent + leading);
desiredSizeDescent = PR_MAX(desiredSizeDescent,
desiredSizeDescent = NS_MAX(desiredSizeDescent,
radicalDescent + mRuleThickness);
}
@ -612,7 +612,7 @@ nsMathMLmencloseFrame::PlaceInternal(nsIRenderingContext& aRenderingContext,
IsToDraw(NOTATION_ROUNDEDBOX) ||
(IsToDraw(NOTATION_TOP) && IsToDraw(NOTATION_BOTTOM))) {
// center the menclose around the content (vertically)
nscoord dy = PR_MAX(aDesiredSize.ascent - bmBase.ascent,
nscoord dy = NS_MAX(aDesiredSize.ascent - bmBase.ascent,
aDesiredSize.height - aDesiredSize.ascent -
bmBase.descent);

Просмотреть файл

@ -386,7 +386,7 @@ nsMathMLmfencedFrame::doReflow(nsPresContext* aPresContext,
// we need to center around the axis
if (firstChild) { // do nothing for an empty <mfenced></mfenced>
nscoord delta = PR_MAX(containerSize.ascent - axisHeight,
nscoord delta = NS_MAX(containerSize.ascent - axisHeight,
containerSize.descent + axisHeight);
containerSize.ascent = delta + axisHeight;
containerSize.descent = delta - axisHeight;

Просмотреть файл

@ -323,8 +323,8 @@ nsMathMLmfracFrame::Place(nsIRenderingContext& aRenderingContext,
// our last visit there)
nsEmbellishData coreData;
GetEmbellishDataFrom(mEmbellishData.coreFrame, coreData);
nscoord leftSpace = PR_MAX(onePixel, coreData.leftSpace);
nscoord rightSpace = PR_MAX(onePixel, coreData.rightSpace);
nscoord leftSpace = NS_MAX(onePixel, coreData.leftSpace);
nscoord rightSpace = NS_MAX(onePixel, coreData.rightSpace);
// see if the linethickness attribute is there
nsAutoString value;
@ -406,7 +406,7 @@ nsMathMLmfracFrame::Place(nsIRenderingContext& aRenderingContext,
// XXX Need revisiting the width. TeX uses the exact width
// e.g. in $$\huge\frac{\displaystyle\int}{i}$$
nscoord width = PR_MAX(bmNum.width, bmDen.width);
nscoord width = NS_MAX(bmNum.width, bmDen.width);
nscoord dxNum = leftSpace + (width - sizeNum.width)/2;
nscoord dxDen = leftSpace + (width - sizeDen.width)/2;
width += leftSpace + rightSpace;
@ -428,11 +428,11 @@ nsMathMLmfracFrame::Place(nsIRenderingContext& aRenderingContext,
dxDen = width - rightSpace - sizeDen.width;
mBoundingMetrics.rightBearing =
PR_MAX(dxNum + bmNum.rightBearing, dxDen + bmDen.rightBearing);
NS_MAX(dxNum + bmNum.rightBearing, dxDen + bmDen.rightBearing);
if (mBoundingMetrics.rightBearing < width - rightSpace)
mBoundingMetrics.rightBearing = width - rightSpace;
mBoundingMetrics.leftBearing =
PR_MIN(dxNum + bmNum.leftBearing, dxDen + bmDen.leftBearing);
NS_MIN(dxNum + bmNum.leftBearing, dxDen + bmDen.leftBearing);
if (mBoundingMetrics.leftBearing > leftSpace)
mBoundingMetrics.leftBearing = leftSpace;
mBoundingMetrics.ascent = bmNum.ascent + numShift;

Просмотреть файл

@ -175,7 +175,7 @@ nsMathMLmmultiscriptsFrame::Place(nsIRenderingContext& aRenderingContext,
// scriptspace from TeX for extra spacing after sup/subscript (0.5pt in plain TeX)
// forced to be at least 1 pixel here
nscoord onePixel = nsPresContext::CSSPixelsToAppUnits(1);
nscoord scriptSpace = PR_MAX(PresContext()->PointsToAppUnits(0.5f), onePixel);
nscoord scriptSpace = NS_MAX(PresContext()->PointsToAppUnits(0.5f), onePixel);
/////////////////////////////////////
// first the shift for the subscript
@ -191,11 +191,11 @@ nsMathMLmmultiscriptsFrame::Place(nsIRenderingContext& aRenderingContext,
if (0 < mSubScriptShift) {
// the user has set the subscriptshift attribute
float scaler = ((float) subScriptShift2) / subScriptShift1;
subScriptShift1 = PR_MAX(subScriptShift1, mSubScriptShift);
subScriptShift1 = NS_MAX(subScriptShift1, mSubScriptShift);
subScriptShift2 = NSToCoordRound(scaler * subScriptShift1);
}
// the font dependent shift
nscoord subScriptShift = PR_MAX(subScriptShift1,subScriptShift2);
nscoord subScriptShift = NS_MAX(subScriptShift1,subScriptShift2);
/////////////////////////////////////
// next the shift for the superscript
@ -213,7 +213,7 @@ nsMathMLmmultiscriptsFrame::Place(nsIRenderingContext& aRenderingContext,
// the user has set the superscriptshift attribute
float scaler2 = ((float) supScriptShift2) / supScriptShift1;
float scaler3 = ((float) supScriptShift3) / supScriptShift1;
supScriptShift1 = PR_MAX(supScriptShift1, mSupScriptShift);
supScriptShift1 = NS_MAX(supScriptShift1, mSupScriptShift);
supScriptShift2 = NSToCoordRound(scaler2 * supScriptShift1);
supScriptShift3 = NSToCoordRound(scaler3 * supScriptShift1);
}
@ -302,10 +302,10 @@ nsMathMLmmultiscriptsFrame::Place(nsIRenderingContext& aRenderingContext,
GetSubDropFromChild (subScriptFrame, subDrop);
// parameter v, Rule 18a, App. G, TeXbook
minSubScriptShift = bmBase.descent + subDrop;
trySubScriptShift = PR_MAX(minSubScriptShift,subScriptShift);
trySubScriptShift = NS_MAX(minSubScriptShift,subScriptShift);
mBoundingMetrics.descent =
PR_MAX(mBoundingMetrics.descent,bmSubScript.descent);
descent = PR_MAX(descent,subScriptSize.height - subScriptSize.ascent);
NS_MAX(mBoundingMetrics.descent,bmSubScript.descent);
descent = NS_MAX(descent,subScriptSize.height - subScriptSize.ascent);
width = bmSubScript.width + scriptSpace;
rightBearing = bmSubScript.rightBearing;
}
@ -322,12 +322,12 @@ nsMathMLmmultiscriptsFrame::Place(nsIRenderingContext& aRenderingContext,
minShiftFromXHeight = NSToCoordRound
((bmSupScript.descent + (1.0f/4.0f) * xHeight));
trySupScriptShift =
PR_MAX(minSupScriptShift,PR_MAX(minShiftFromXHeight,supScriptShift));
NS_MAX(minSupScriptShift,NS_MAX(minShiftFromXHeight,supScriptShift));
mBoundingMetrics.ascent =
PR_MAX(mBoundingMetrics.ascent,bmSupScript.ascent);
ascent = PR_MAX(ascent,supScriptSize.ascent);
width = PR_MAX(width, bmSupScript.width + scriptSpace);
rightBearing = PR_MAX(rightBearing, bmSupScript.rightBearing);
NS_MAX(mBoundingMetrics.ascent,bmSupScript.ascent);
ascent = NS_MAX(ascent,supScriptSize.ascent);
width = NS_MAX(width, bmSupScript.width + scriptSpace);
rightBearing = NS_MAX(rightBearing, bmSupScript.rightBearing);
if (!mprescriptsFrame) { // we are still looping over base & postscripts
mBoundingMetrics.rightBearing = mBoundingMetrics.width + rightBearing;
@ -338,7 +338,7 @@ nsMathMLmmultiscriptsFrame::Place(nsIRenderingContext& aRenderingContext,
if (firstPrescriptsPair) {
firstPrescriptsPair = PR_FALSE;
mBoundingMetrics.leftBearing =
PR_MIN(bmSubScript.leftBearing, bmSupScript.leftBearing);
NS_MIN(bmSubScript.leftBearing, bmSupScript.leftBearing);
}
}
width = rightBearing = 0;
@ -363,8 +363,8 @@ nsMathMLmmultiscriptsFrame::Place(nsIRenderingContext& aRenderingContext,
trySubScriptShift -= gap;
}
maxSubScriptShift = PR_MAX(maxSubScriptShift, trySubScriptShift);
maxSupScriptShift = PR_MAX(maxSupScriptShift, trySupScriptShift);
maxSubScriptShift = NS_MAX(maxSubScriptShift, trySubScriptShift);
maxSupScriptShift = NS_MAX(maxSupScriptShift, trySupScriptShift);
trySubScriptShift = subScriptShift;
trySupScriptShift = supScriptShift;
@ -388,15 +388,15 @@ nsMathMLmmultiscriptsFrame::Place(nsIRenderingContext& aRenderingContext,
// we left out the base during our bounding box updates, so ...
mBoundingMetrics.ascent =
PR_MAX(mBoundingMetrics.ascent+maxSupScriptShift,bmBase.ascent);
NS_MAX(mBoundingMetrics.ascent+maxSupScriptShift,bmBase.ascent);
mBoundingMetrics.descent =
PR_MAX(mBoundingMetrics.descent+maxSubScriptShift,bmBase.descent);
NS_MAX(mBoundingMetrics.descent+maxSubScriptShift,bmBase.descent);
// get the reflow metrics ...
aDesiredSize.ascent =
PR_MAX(ascent+maxSupScriptShift,baseSize.ascent);
NS_MAX(ascent+maxSupScriptShift,baseSize.ascent);
aDesiredSize.height = aDesiredSize.ascent +
PR_MAX(descent+maxSubScriptShift,baseSize.height - baseSize.ascent);
NS_MAX(descent+maxSubScriptShift,baseSize.height - baseSize.ascent);
aDesiredSize.width = mBoundingMetrics.width;
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
@ -439,7 +439,7 @@ nsMathMLmmultiscriptsFrame::Place(nsIRenderingContext& aRenderingContext,
GetReflowAndBoundingMetricsFor(supScriptFrame, supScriptSize, bmSupScript);
// center w.r.t. largest width
width = PR_MAX(subScriptSize.width, supScriptSize.width);
width = NS_MAX(subScriptSize.width, supScriptSize.width);
dy = aDesiredSize.ascent - subScriptSize.ascent +
maxSubScriptShift;

Просмотреть файл

@ -674,13 +674,13 @@ nsMathMLmoFrame::Stretch(nsIRenderingContext& aRenderingContext,
if (isVertical && NS_MATHML_OPERATOR_IS_SYMMETRIC(mFlags)) {
// we need to center about the axis
nscoord delta = PR_MAX(container.ascent - axisHeight,
nscoord delta = NS_MAX(container.ascent - axisHeight,
container.descent + axisHeight);
container.ascent = delta + axisHeight;
container.descent = delta - axisHeight;
// get ready in case we encounter user-desired min-max size
delta = PR_MAX(initialSize.ascent - axisHeight,
delta = NS_MAX(initialSize.ascent - axisHeight,
initialSize.descent + axisHeight);
initialSize.ascent = delta + axisHeight;
initialSize.descent = delta - axisHeight;
@ -696,21 +696,21 @@ nsMathMLmoFrame::Stretch(nsIRenderingContext& aRenderingContext,
// try to maintain the aspect ratio of the char
float aspect = mMaxSize / float(initialSize.ascent + initialSize.descent);
container.ascent =
PR_MIN(container.ascent, nscoord(initialSize.ascent * aspect));
NS_MIN(container.ascent, nscoord(initialSize.ascent * aspect));
container.descent =
PR_MIN(container.descent, nscoord(initialSize.descent * aspect));
NS_MIN(container.descent, nscoord(initialSize.descent * aspect));
// below we use a type cast instead of a conversion to avoid a VC++ bug
// see http://support.microsoft.com/support/kb/articles/Q115/7/05.ASP
container.width =
PR_MIN(container.width, (nscoord)mMaxSize);
NS_MIN(container.width, (nscoord)mMaxSize);
}
else { // multiplicative value
container.ascent =
PR_MIN(container.ascent, nscoord(initialSize.ascent * mMaxSize));
NS_MIN(container.ascent, nscoord(initialSize.ascent * mMaxSize));
container.descent =
PR_MIN(container.descent, nscoord(initialSize.descent * mMaxSize));
NS_MIN(container.descent, nscoord(initialSize.descent * mMaxSize));
container.width =
PR_MIN(container.width, nscoord(initialSize.width * mMaxSize));
NS_MIN(container.width, nscoord(initialSize.width * mMaxSize));
}
if (isVertical && !NS_MATHML_OPERATOR_IS_SYMMETRIC(mFlags)) {
@ -737,19 +737,19 @@ nsMathMLmoFrame::Stretch(nsIRenderingContext& aRenderingContext,
// try to maintain the aspect ratio of the char
float aspect = mMinSize / float(initialSize.ascent + initialSize.descent);
container.ascent =
PR_MAX(container.ascent, nscoord(initialSize.ascent * aspect));
NS_MAX(container.ascent, nscoord(initialSize.ascent * aspect));
container.descent =
PR_MAX(container.descent, nscoord(initialSize.descent * aspect));
NS_MAX(container.descent, nscoord(initialSize.descent * aspect));
container.width =
PR_MAX(container.width, (nscoord)mMinSize);
NS_MAX(container.width, (nscoord)mMinSize);
}
else { // multiplicative value
container.ascent =
PR_MAX(container.ascent, nscoord(initialSize.ascent * mMinSize));
NS_MAX(container.ascent, nscoord(initialSize.ascent * mMinSize));
container.descent =
PR_MAX(container.descent, nscoord(initialSize.descent * mMinSize));
NS_MAX(container.descent, nscoord(initialSize.descent * mMinSize));
container.width =
PR_MAX(container.width, nscoord(initialSize.width * mMinSize));
NS_MAX(container.width, nscoord(initialSize.width * mMinSize));
}
if (isVertical && !NS_MATHML_OPERATOR_IS_SYMMETRIC(mFlags)) {
@ -849,9 +849,9 @@ nsMathMLmoFrame::Stretch(nsIRenderingContext& aRenderingContext,
nscoord ascent, descent;
fm->GetMaxAscent(ascent);
fm->GetMaxDescent(descent);
aDesiredStretchSize.ascent = PR_MAX(mBoundingMetrics.ascent + leading, ascent);
aDesiredStretchSize.ascent = NS_MAX(mBoundingMetrics.ascent + leading, ascent);
aDesiredStretchSize.height = aDesiredStretchSize.ascent +
PR_MAX(mBoundingMetrics.descent + leading, descent);
NS_MAX(mBoundingMetrics.descent + leading, descent);
}
aDesiredStretchSize.width = mBoundingMetrics.width;
aDesiredStretchSize.mBoundingMetrics = mBoundingMetrics;

Просмотреть файл

@ -308,14 +308,14 @@ nsMathMLmoverFrame::Place(nsIRenderingContext& aRenderingContext,
bigOpSpacing1, dummy,
bigOpSpacing3, dummy,
bigOpSpacing5);
delta1 = PR_MAX(bigOpSpacing1, (bigOpSpacing3 - bmOver.descent));
delta1 = NS_MAX(bigOpSpacing1, (bigOpSpacing3 - bmOver.descent));
delta2 = bigOpSpacing5;
// XXX This is not a TeX rule...
// delta1 (as computed above) can become really big when bmOver.descent is
// negative, e.g., if the content is &OverBar. In such case, we use the height
if (bmOver.descent < 0)
delta1 = PR_MAX(bigOpSpacing1, (bigOpSpacing3 - (bmOver.ascent + bmOver.descent)));
delta1 = NS_MAX(bigOpSpacing1, (bigOpSpacing3 - (bmOver.ascent + bmOver.descent)));
}
else {
// Rule 12, App. G, TeXbook
@ -373,7 +373,7 @@ nsMathMLmoverFrame::Place(nsIRenderingContext& aRenderingContext,
dxOver += correction + (mBoundingMetrics.width - overWidth)/2;
}
else {
mBoundingMetrics.width = PR_MAX(bmBase.width, overWidth);
mBoundingMetrics.width = NS_MAX(bmBase.width, overWidth);
dxOver += correction/2 + (mBoundingMetrics.width - overWidth)/2;
}
dxBase = (mBoundingMetrics.width - bmBase.width) / 2;
@ -382,12 +382,12 @@ nsMathMLmoverFrame::Place(nsIRenderingContext& aRenderingContext,
bmOver.ascent + bmOver.descent + delta1 + bmBase.ascent;
mBoundingMetrics.descent = bmBase.descent;
mBoundingMetrics.leftBearing =
PR_MIN(dxBase + bmBase.leftBearing, dxOver + bmOver.leftBearing);
NS_MIN(dxBase + bmBase.leftBearing, dxOver + bmOver.leftBearing);
mBoundingMetrics.rightBearing =
PR_MAX(dxBase + bmBase.rightBearing, dxOver + bmOver.rightBearing);
NS_MAX(dxBase + bmBase.rightBearing, dxOver + bmOver.rightBearing);
aDesiredSize.ascent =
PR_MAX(mBoundingMetrics.ascent + delta2,
NS_MAX(mBoundingMetrics.ascent + delta2,
overSize.ascent + bmOver.descent + delta1 + bmBase.ascent);
aDesiredSize.height = aDesiredSize.ascent +
baseSize.height - baseSize.ascent;

Просмотреть файл

@ -451,7 +451,7 @@ nsMathMLmpaddedFrame::Place(nsIRenderingContext& aRenderingContext,
if (mLeftSpaceSign != NS_MATHML_SIGN_INVALID ||
mWidthSign != NS_MATHML_SIGN_INVALID) { // there was padding on the right
// dismiss the right italic correction now (so that our parent won't correct us)
mBoundingMetrics.width = PR_MAX(0, lspace + width);
mBoundingMetrics.width = NS_MAX(0, lspace + width);
mBoundingMetrics.rightBearing = mBoundingMetrics.width;
}

Просмотреть файл

@ -323,16 +323,16 @@ nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
// the baseline will be that of the base.
mBoundingMetrics.ascent = bmBase.ascent + psi + ruleThickness;
mBoundingMetrics.descent =
PR_MAX(bmBase.descent,
NS_MAX(bmBase.descent,
(bmSqr.ascent + bmSqr.descent - mBoundingMetrics.ascent));
mBoundingMetrics.width = bmSqr.width + bmBase.width;
mBoundingMetrics.leftBearing = bmSqr.leftBearing;
mBoundingMetrics.rightBearing = bmSqr.width +
PR_MAX(bmBase.width, bmBase.rightBearing); // take also care of the rule
NS_MAX(bmBase.width, bmBase.rightBearing); // take also care of the rule
aDesiredSize.ascent = mBoundingMetrics.ascent + leading;
aDesiredSize.height = aDesiredSize.ascent +
PR_MAX(baseSize.height - baseSize.ascent,
NS_MAX(baseSize.height - baseSize.ascent,
mBoundingMetrics.descent + ruleThickness);
aDesiredSize.width = mBoundingMetrics.width;
@ -380,9 +380,9 @@ nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
mBoundingMetrics.width = dx + bmBase.width;
mBoundingMetrics.leftBearing =
PR_MIN(dxIndex + bmIndex.leftBearing, dxSqr + bmSqr.leftBearing);
NS_MIN(dxIndex + bmIndex.leftBearing, dxSqr + bmSqr.leftBearing);
mBoundingMetrics.rightBearing = dx +
PR_MAX(bmBase.width, bmBase.rightBearing);
NS_MAX(bmBase.width, bmBase.rightBearing);
aDesiredSize.width = mBoundingMetrics.width;
aDesiredSize.mBoundingMetrics = mBoundingMetrics;

Просмотреть файл

@ -124,7 +124,7 @@ nsMathMLmsubFrame::PlaceSubScript (nsPresContext* aPresContext,
nscoord aScriptSpace)
{
// force the scriptSpace to be atleast 1 pixel
aScriptSpace = PR_MAX(nsPresContext::CSSPixelsToAppUnits(1), aScriptSpace);
aScriptSpace = NS_MAX(nsPresContext::CSSPixelsToAppUnits(1), aScriptSpace);
////////////////////////////////////
// Get the children's desired sizes
@ -171,31 +171,31 @@ nsMathMLmsubFrame::PlaceSubScript (nsPresContext* aPresContext,
GetSubScriptShifts (fm, subScriptShift, dummy);
subScriptShift =
PR_MAX(subScriptShift, aUserSubScriptShift);
NS_MAX(subScriptShift, aUserSubScriptShift);
// get actual subscriptshift to be used
// Rule 18b, App. G, TeXbook
nscoord actualSubScriptShift =
PR_MAX(minSubScriptShift,PR_MAX(subScriptShift,minShiftFromXHeight));
NS_MAX(minSubScriptShift,NS_MAX(subScriptShift,minShiftFromXHeight));
// get bounding box for base + subscript
nsBoundingMetrics boundingMetrics;
boundingMetrics.ascent =
PR_MAX(bmBase.ascent, bmSubScript.ascent - actualSubScriptShift);
NS_MAX(bmBase.ascent, bmSubScript.ascent - actualSubScriptShift);
boundingMetrics.descent =
PR_MAX(bmBase.descent, bmSubScript.descent + actualSubScriptShift);
NS_MAX(bmBase.descent, bmSubScript.descent + actualSubScriptShift);
// add aScriptSpace to the subscript's width
boundingMetrics.width = bmBase.width + bmSubScript.width + aScriptSpace;
boundingMetrics.leftBearing = bmBase.leftBearing;
boundingMetrics.rightBearing = PR_MAX(bmBase.rightBearing, bmBase.width +
PR_MAX(bmSubScript.width + aScriptSpace, bmSubScript.rightBearing));
boundingMetrics.rightBearing = NS_MAX(bmBase.rightBearing, bmBase.width +
NS_MAX(bmSubScript.width + aScriptSpace, bmSubScript.rightBearing));
aFrame->SetBoundingMetrics (boundingMetrics);
// reflow metrics
aDesiredSize.ascent =
PR_MAX(baseSize.ascent, subScriptSize.ascent - actualSubScriptShift);
NS_MAX(baseSize.ascent, subScriptSize.ascent - actualSubScriptShift);
aDesiredSize.height = aDesiredSize.ascent +
PR_MAX(baseSize.height - baseSize.ascent,
NS_MAX(baseSize.height - baseSize.ascent,
subScriptSize.height - subScriptSize.ascent + actualSubScriptShift);
aDesiredSize.width = boundingMetrics.width;
aDesiredSize.mBoundingMetrics = boundingMetrics;

Просмотреть файл

@ -142,7 +142,7 @@ nsMathMLmsubsupFrame::PlaceSubSupScript(nsPresContext* aPresContext,
{
// force the scriptSpace to be atleast 1 pixel
nscoord onePixel = nsPresContext::CSSPixelsToAppUnits(1);
aScriptSpace = PR_MAX(onePixel, aScriptSpace);
aScriptSpace = NS_MAX(onePixel, aScriptSpace);
////////////////////////////////////
// Get the children's desired sizes
@ -212,14 +212,14 @@ nsMathMLmsubsupFrame::PlaceSubSupScript(nsPresContext* aPresContext,
if (0 < aUserSubScriptShift) {
// the user has set the subscriptshift attribute
float scaler = ((float) subScriptShift2) / subScriptShift1;
subScriptShift1 = PR_MAX(subScriptShift1, aUserSubScriptShift);
subScriptShift1 = NS_MAX(subScriptShift1, aUserSubScriptShift);
subScriptShift2 = NSToCoordRound(scaler * subScriptShift1);
}
// get a tentative value for subscriptshift
// Rule 18d, App. G, TeXbook
nscoord subScriptShift =
PR_MAX(minSubScriptShift,PR_MAX(subScriptShift1,subScriptShift2));
NS_MAX(minSubScriptShift,NS_MAX(subScriptShift1,subScriptShift2));
//////////////////////////////////////////////////
// Get supscript shift
@ -244,7 +244,7 @@ nsMathMLmsubsupFrame::PlaceSubSupScript(nsPresContext* aPresContext,
// the user has set the superscriptshift attribute
float scaler2 = ((float) supScriptShift2) / supScriptShift1;
float scaler3 = ((float) supScriptShift3) / supScriptShift1;
supScriptShift1 = PR_MAX(supScriptShift1, aUserSupScriptShift);
supScriptShift1 = NS_MAX(supScriptShift1, aUserSupScriptShift);
supScriptShift2 = NSToCoordRound(scaler2 * supScriptShift1);
supScriptShift3 = NSToCoordRound(scaler3 * supScriptShift1);
}
@ -272,7 +272,7 @@ nsMathMLmsubsupFrame::PlaceSubSupScript(nsPresContext* aPresContext,
// get tentative value for superscriptshift
// Rule 18c, App. G, TeXbook
supScriptShift =
PR_MAX(minSupScriptShift,PR_MAX(supScriptShift,minShiftFromXHeight));
NS_MAX(minSupScriptShift,NS_MAX(supScriptShift,minShiftFromXHeight));
//////////////////////////////////////////////////
// Negotiate between supScriptShift and subScriptShift
@ -304,9 +304,9 @@ nsMathMLmsubsupFrame::PlaceSubSupScript(nsPresContext* aPresContext,
// get bounding box for base + subscript + superscript
nsBoundingMetrics boundingMetrics;
boundingMetrics.ascent =
PR_MAX(bmBase.ascent, (bmSupScript.ascent + supScriptShift));
NS_MAX(bmBase.ascent, (bmSupScript.ascent + supScriptShift));
boundingMetrics.descent =
PR_MAX(bmBase.descent, (bmSubScript.descent + subScriptShift));
NS_MAX(bmBase.descent, (bmSubScript.descent + subScriptShift));
// leave aScriptSpace after both super/subscript
// add italicCorrection between base and superscript
@ -316,20 +316,20 @@ nsMathMLmsubsupFrame::PlaceSubSupScript(nsPresContext* aPresContext,
GetItalicCorrection(bmBase, italicCorrection);
italicCorrection += onePixel;
boundingMetrics.width = bmBase.width + aScriptSpace +
PR_MAX((italicCorrection + bmSupScript.width), bmSubScript.width);
NS_MAX((italicCorrection + bmSupScript.width), bmSubScript.width);
boundingMetrics.leftBearing = bmBase.leftBearing;
boundingMetrics.rightBearing = bmBase.width +
PR_MAX((italicCorrection + bmSupScript.rightBearing), bmSubScript.rightBearing);
NS_MAX((italicCorrection + bmSupScript.rightBearing), bmSubScript.rightBearing);
aFrame->SetBoundingMetrics(boundingMetrics);
// reflow metrics
aDesiredSize.ascent =
PR_MAX(baseSize.ascent,
PR_MAX(subScriptSize.ascent - subScriptShift,
NS_MAX(baseSize.ascent,
NS_MAX(subScriptSize.ascent - subScriptShift,
supScriptSize.ascent + supScriptShift));
aDesiredSize.height = aDesiredSize.ascent +
PR_MAX(baseSize.height - baseSize.ascent,
PR_MAX(subScriptSize.height - subScriptSize.ascent + subScriptShift,
NS_MAX(baseSize.height - baseSize.ascent,
NS_MAX(subScriptSize.height - subScriptSize.ascent + subScriptShift,
supScriptSize.height - subScriptSize.ascent - supScriptShift));
aDesiredSize.width = boundingMetrics.width;
aDesiredSize.mBoundingMetrics = boundingMetrics;

Просмотреть файл

@ -125,7 +125,7 @@ nsMathMLmsupFrame::PlaceSuperScript(nsPresContext* aPresContext,
{
// force the scriptSpace to be at least 1 pixel
nscoord onePixel = nsPresContext::CSSPixelsToAppUnits(1);
aScriptSpace = PR_MAX(onePixel, aScriptSpace);
aScriptSpace = NS_MAX(onePixel, aScriptSpace);
////////////////////////////////////
// Get the children's desired sizes
@ -180,7 +180,7 @@ nsMathMLmsupFrame::PlaceSuperScript(nsPresContext* aPresContext,
float scaler2 = ((float) supScriptShift2) / supScriptShift1;
float scaler3 = ((float) supScriptShift3) / supScriptShift1;
supScriptShift1 =
PR_MAX(supScriptShift1, aUserSupScriptShift);
NS_MAX(supScriptShift1, aUserSupScriptShift);
supScriptShift2 = NSToCoordRound(scaler2 * supScriptShift1);
supScriptShift3 = NSToCoordRound(scaler3 * supScriptShift1);
}
@ -208,14 +208,14 @@ nsMathMLmsupFrame::PlaceSuperScript(nsPresContext* aPresContext,
// get actual supscriptshift to be used
// Rule 18c, App. G, TeXbook
nscoord actualSupScriptShift =
PR_MAX(minSupScriptShift,PR_MAX(supScriptShift,minShiftFromXHeight));
NS_MAX(minSupScriptShift,NS_MAX(supScriptShift,minShiftFromXHeight));
// bounding box
nsBoundingMetrics boundingMetrics;
boundingMetrics.ascent =
PR_MAX(bmBase.ascent, (bmSupScript.ascent + actualSupScriptShift));
NS_MAX(bmBase.ascent, (bmSupScript.ascent + actualSupScriptShift));
boundingMetrics.descent =
PR_MAX(bmBase.descent, (bmSupScript.descent - actualSupScriptShift));
NS_MAX(bmBase.descent, (bmSupScript.descent - actualSupScriptShift));
// leave aScriptSpace after superscript
// add italicCorrection between base and superscript
@ -231,9 +231,9 @@ nsMathMLmsupFrame::PlaceSuperScript(nsPresContext* aPresContext,
// reflow metrics
aDesiredSize.ascent =
PR_MAX(baseSize.ascent, (supScriptSize.ascent + actualSupScriptShift));
NS_MAX(baseSize.ascent, (supScriptSize.ascent + actualSupScriptShift));
aDesiredSize.height = aDesiredSize.ascent +
PR_MAX(baseSize.height - baseSize.ascent,
NS_MAX(baseSize.height - baseSize.ascent,
(supScriptSize.height - supScriptSize.ascent - actualSupScriptShift));
aDesiredSize.width = boundingMetrics.width;
aDesiredSize.mBoundingMetrics = boundingMetrics;

Просмотреть файл

@ -768,7 +768,7 @@ nsMathMLmtdFrame::GetRowSpan()
rowspan = value.ToInteger(&error);
if (error || rowspan < 0)
rowspan = 1;
rowspan = PR_MIN(rowspan, MAX_ROWSPAN);
rowspan = NS_MIN(rowspan, MAX_ROWSPAN);
}
}
return rowspan;

Просмотреть файл

@ -305,7 +305,7 @@ nsMathMLmunderFrame::Place(nsIRenderingContext& aRenderingContext,
dummy, bigOpSpacing2,
dummy, bigOpSpacing4,
bigOpSpacing5);
delta1 = PR_MAX(bigOpSpacing2, (bigOpSpacing4 - bmUnder.ascent));
delta1 = NS_MAX(bigOpSpacing2, (bigOpSpacing4 - bmUnder.ascent));
delta2 = bigOpSpacing5;
}
else {
@ -328,7 +328,7 @@ nsMathMLmunderFrame::Place(nsIRenderingContext& aRenderingContext,
dxUnder = -bmUnder.leftBearing;
}
nscoord maxWidth = PR_MAX(bmBase.width, underWidth);
nscoord maxWidth = NS_MAX(bmBase.width, underWidth);
if (NS_MATHML_EMBELLISH_IS_ACCENTUNDER(mEmbellishData.flags)) {
dxUnder += (maxWidth - underWidth)/2;
}
@ -338,18 +338,18 @@ nsMathMLmunderFrame::Place(nsIRenderingContext& aRenderingContext,
dxBase = (maxWidth - bmBase.width)/2;
mBoundingMetrics.width =
PR_MAX(dxBase + bmBase.width, dxUnder + bmUnder.width);
NS_MAX(dxBase + bmBase.width, dxUnder + bmUnder.width);
mBoundingMetrics.ascent = bmBase.ascent;
mBoundingMetrics.descent =
bmBase.descent + delta1 + bmUnder.ascent + bmUnder.descent;
mBoundingMetrics.leftBearing =
PR_MIN(dxBase + bmBase.leftBearing, dxUnder + bmUnder.leftBearing);
NS_MIN(dxBase + bmBase.leftBearing, dxUnder + bmUnder.leftBearing);
mBoundingMetrics.rightBearing =
PR_MAX(dxBase + bmBase.rightBearing, dxUnder + bmUnder.rightBearing);
NS_MAX(dxBase + bmBase.rightBearing, dxUnder + bmUnder.rightBearing);
aDesiredSize.ascent = baseSize.ascent;
aDesiredSize.height = aDesiredSize.ascent +
PR_MAX(mBoundingMetrics.descent + delta2,
NS_MAX(mBoundingMetrics.descent + delta2,
bmBase.descent + delta1 + bmUnder.ascent +
underSize.height - underSize.ascent);
aDesiredSize.width = mBoundingMetrics.width;

Просмотреть файл

@ -347,7 +347,7 @@ nsMathMLmunderoverFrame::Place(nsIRenderingContext& aRenderingContext,
dummy, bigOpSpacing2,
dummy, bigOpSpacing4,
bigOpSpacing5);
underDelta1 = PR_MAX(bigOpSpacing2, (bigOpSpacing4 - bmUnder.ascent));
underDelta1 = NS_MAX(bigOpSpacing2, (bigOpSpacing4 - bmUnder.ascent));
underDelta2 = bigOpSpacing5;
}
else {
@ -371,14 +371,14 @@ nsMathMLmunderoverFrame::Place(nsIRenderingContext& aRenderingContext,
bigOpSpacing1, dummy,
bigOpSpacing3, dummy,
bigOpSpacing5);
overDelta1 = PR_MAX(bigOpSpacing1, (bigOpSpacing3 - bmOver.descent));
overDelta1 = NS_MAX(bigOpSpacing1, (bigOpSpacing3 - bmOver.descent));
overDelta2 = bigOpSpacing5;
// XXX This is not a TeX rule...
// delta1 (as computed abvove) can become really big when bmOver.descent is
// negative, e.g., if the content is &OverBar. In such case, we use the height
if (bmOver.descent < 0)
overDelta1 = PR_MAX(bigOpSpacing1, (bigOpSpacing3 - (bmOver.ascent + bmOver.descent)));
overDelta1 = NS_MAX(bigOpSpacing1, (bigOpSpacing3 - (bmOver.ascent + bmOver.descent)));
}
else {
// Rule 12, App. G, TeXbook
@ -410,7 +410,7 @@ nsMathMLmunderoverFrame::Place(nsIRenderingContext& aRenderingContext,
dxOver += correction + (mBoundingMetrics.width - overWidth)/2;
}
else {
mBoundingMetrics.width = PR_MAX(bmBase.width, overWidth);
mBoundingMetrics.width = NS_MAX(bmBase.width, overWidth);
dxOver += correction/2 + (mBoundingMetrics.width - overWidth)/2;
}
dxBase = (mBoundingMetrics.width - bmBase.width)/2;
@ -420,9 +420,9 @@ nsMathMLmunderoverFrame::Place(nsIRenderingContext& aRenderingContext,
mBoundingMetrics.descent =
bmBase.descent + underDelta1 + bmUnder.ascent + bmUnder.descent;
mBoundingMetrics.leftBearing =
PR_MIN(dxBase + bmBase.leftBearing, dxOver + bmOver.leftBearing);
NS_MIN(dxBase + bmBase.leftBearing, dxOver + bmOver.leftBearing);
mBoundingMetrics.rightBearing =
PR_MAX(dxBase + bmBase.rightBearing, dxOver + bmOver.rightBearing);
NS_MAX(dxBase + bmBase.rightBearing, dxOver + bmOver.rightBearing);
//////////
// pass 2, do what <munder> does: attach the underscript on the previous
@ -433,7 +433,7 @@ nsMathMLmunderoverFrame::Place(nsIRenderingContext& aRenderingContext,
nsBoundingMetrics bmAnonymousBase = mBoundingMetrics;
nscoord ascentAnonymousBase =
PR_MAX(mBoundingMetrics.ascent + overDelta2,
NS_MAX(mBoundingMetrics.ascent + overDelta2,
overSize.ascent + bmOver.descent + overDelta1 + bmBase.ascent);
GetItalicCorrection(bmAnonymousBase, correction);
@ -445,7 +445,7 @@ nsMathMLmunderoverFrame::Place(nsIRenderingContext& aRenderingContext,
dxUnder = -bmUnder.leftBearing;
}
nscoord maxWidth = PR_MAX(bmAnonymousBase.width, underWidth);
nscoord maxWidth = NS_MAX(bmAnonymousBase.width, underWidth);
if (NS_MATHML_EMBELLISH_IS_ACCENTUNDER(mEmbellishData.flags)) {
dxUnder += (maxWidth - underWidth)/2;;
}
@ -460,15 +460,15 @@ nsMathMLmunderoverFrame::Place(nsIRenderingContext& aRenderingContext,
dxBase += dxAnonymousBase;
mBoundingMetrics.width =
PR_MAX(dxAnonymousBase + bmAnonymousBase.width, dxUnder + bmUnder.width);
NS_MAX(dxAnonymousBase + bmAnonymousBase.width, dxUnder + bmUnder.width);
mBoundingMetrics.leftBearing =
PR_MIN(dxAnonymousBase + bmAnonymousBase.leftBearing, dxUnder + bmUnder.leftBearing);
NS_MIN(dxAnonymousBase + bmAnonymousBase.leftBearing, dxUnder + bmUnder.leftBearing);
mBoundingMetrics.rightBearing =
PR_MAX(dxAnonymousBase + bmAnonymousBase.rightBearing, dxUnder + bmUnder.rightBearing);
NS_MAX(dxAnonymousBase + bmAnonymousBase.rightBearing, dxUnder + bmUnder.rightBearing);
aDesiredSize.ascent = ascentAnonymousBase;
aDesiredSize.height = aDesiredSize.ascent +
PR_MAX(mBoundingMetrics.descent + underDelta2,
NS_MAX(mBoundingMetrics.descent + underDelta2,
bmAnonymousBase.descent + underDelta1 + bmUnder.ascent +
underSize.height - underSize.ascent);
aDesiredSize.width = mBoundingMetrics.width;

Просмотреть файл

@ -1666,7 +1666,7 @@ nsPrintEngine::SetupToPrintContent()
// Only Shrink if we are smaller
if (mPrt->mShrinkRatio < 0.998f) {
// Clamp Shrink to Fit to 60%
mPrt->mShrinkRatio = PR_MAX(mPrt->mShrinkRatio, 0.60f);
mPrt->mShrinkRatio = NS_MAX(mPrt->mShrinkRatio, 0.60f);
for (PRUint32 i=0;i<mPrt->mPrintDocList.Length();i++) {
nsPrintObject* po = mPrt->mPrintDocList.ElementAt(i);
@ -2234,13 +2234,13 @@ nsPrintEngine::DoPrint(nsPrintObject * aPO)
if (startRect.y < 0) {
// Reduce height to be the height of the positive-territory
// region of original rect
startRect.height = PR_MAX(0, startRect.YMost());
startRect.height = NS_MAX(0, startRect.YMost());
startRect.y = 0;
}
if (endRect.y < 0) {
// Reduce height to be the height of the positive-territory
// region of original rect
endRect.height = PR_MAX(0, endRect.YMost());
endRect.height = NS_MAX(0, endRect.YMost());
endRect.y = 0;
}
NS_ASSERTION(endRect.y >= startRect.y,

Просмотреть файл

@ -584,7 +584,7 @@ void RuleHash::EnumerateAllRules(PRInt32 aNameSpace, nsIAtom* aTag,
if (mEnumListSize < testCount) {
delete [] mEnumList;
mEnumListSize = PR_MAX(testCount, MIN_ENUM_LIST_SIZE);
mEnumListSize = NS_MAX(testCount, MIN_ENUM_LIST_SIZE);
mEnumList = new RuleValue*[mEnumListSize];
}

Просмотреть файл

@ -3773,7 +3773,7 @@ nsComputedDOMStyle::SetValueToCoord(nsROCSSPrimitiveValue* aValue,
if (aPercentageBaseGetter &&
(this->*aPercentageBaseGetter)(percentageBase)) {
nscoord val = nscoord(aCoord.GetPercentValue() * percentageBase);
aValue->SetAppUnits(PR_MAX(aMinAppUnits, PR_MIN(val, aMaxAppUnits)));
aValue->SetAppUnits(NS_MAX(aMinAppUnits, NS_MIN(val, aMaxAppUnits)));
} else {
aValue->SetPercent(aCoord.GetPercentValue());
}
@ -3787,7 +3787,7 @@ nsComputedDOMStyle::SetValueToCoord(nsROCSSPrimitiveValue* aValue,
case eStyleUnit_Coord:
{
nscoord val = aCoord.GetCoordValue();
aValue->SetAppUnits(PR_MAX(aMinAppUnits, PR_MIN(val, aMaxAppUnits)));
aValue->SetAppUnits(NS_MAX(aMinAppUnits, NS_MIN(val, aMaxAppUnits)));
}
break;

Просмотреть файл

@ -398,7 +398,7 @@ private:
* the percent value of aCoord is set as a percent value on aValue. aTable,
* if not null, is the keyword table to handle eStyleUnit_Enumerated. When
* calling SetAppUnits on aValue (for coord or percent values), the value
* passed in will be PR_MAX of the value in aMinAppUnits and the PR_MIN of
* passed in will be NS_MAX of the value in aMinAppUnits and the NS_MIN of
* the actual value in aCoord and the value in aMaxAppUnits.
*
* XXXbz should caller pass in some sort of bitfield indicating which units

Просмотреть файл

@ -2034,7 +2034,7 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
mPresContext->GetCachedIntPref(kPresContext_MinimumFontSize);
if (minimumFontSize > 0 && !mPresContext->IsChrome()) {
fontData->mFont.size = PR_MAX(fontData->mSize, minimumFontSize);
fontData->mFont.size = NS_MAX(fontData->mSize, minimumFontSize);
}
else {
fontData->mFont.size = fontData->mSize;
@ -2502,12 +2502,12 @@ ComputeScriptLevelSize(const nsStyleFont* aFont, const nsStyleFont* aParentFont,
// Compute the size we would have had if minscriptsize had never been
// applied, also prevent overflow (bug 413274)
*aUnconstrainedSize =
NSToCoordRound(PR_MIN(aParentFont->mScriptUnconstrainedSize*scriptLevelScale,
nscoord_MAX));
NSToCoordRound(NS_MIN(aParentFont->mScriptUnconstrainedSize*scriptLevelScale,
double(nscoord_MAX)));
// Compute the size we could get via scriptlevel change
nscoord scriptLevelSize =
NSToCoordRound(PR_MIN(aParentFont->mSize*scriptLevelScale,
nscoord_MAX));
NSToCoordRound(NS_MIN(aParentFont->mSize*scriptLevelScale,
double(nscoord_MAX)));
if (scriptLevelScale <= 1.0) {
if (aParentFont->mSize <= minScriptSize) {
// We can't decrease the font size at all, so just stick to no change
@ -2516,12 +2516,12 @@ ComputeScriptLevelSize(const nsStyleFont* aFont, const nsStyleFont* aParentFont,
return aParentFont->mSize;
}
// We can decrease, so apply constraint #1
return PR_MAX(minScriptSize, scriptLevelSize);
return NS_MAX(minScriptSize, scriptLevelSize);
} else {
// scriptminsize can only make sizes larger than the unconstrained size
NS_ASSERTION(*aUnconstrainedSize <= scriptLevelSize, "How can this ever happen?");
// Apply constraint #2
return PR_MIN(scriptLevelSize, PR_MAX(*aUnconstrainedSize, minScriptSize));
return NS_MIN(scriptLevelSize, NS_MAX(*aUnconstrainedSize, minScriptSize));
}
}
#endif
@ -2724,7 +2724,7 @@ nsRuleNode::SetFont(nsPresContext* aPresContext, nsStyleContext* aContext,
case eSystemFont_List:
// Assumption: system defined font is proportional
systemFont.size =
PR_MAX(defaultVariableFont->size - aPresContext->PointsToAppUnits(2), 0);
NS_MAX(defaultVariableFont->size - aPresContext->PointsToAppUnits(2), 0);
break;
}
#endif
@ -5642,7 +5642,7 @@ nsRuleNode::ComputeColumnData(void* aStartStruct,
} else if (eCSSUnit_Integer == columnData.mColumnCount.GetUnit()) {
column->mColumnCount = columnData.mColumnCount.GetIntValue();
// Max 1000 columns - wallpaper for bug 345583.
column->mColumnCount = PR_MIN(column->mColumnCount, 1000);
column->mColumnCount = NS_MIN(column->mColumnCount, 1000U);
} else if (eCSSUnit_Inherit == columnData.mColumnCount.GetUnit()) {
canStoreInRuleTree = PR_FALSE;
column->mColumnCount = parent->mColumnCount;

Просмотреть файл

@ -555,7 +555,7 @@ nsStyleAnimation::StoreComputedValue(nsCSSProperty aProperty,
if (!aPresContext->IsChrome()) {
nscoord minimumFontSize =
aPresContext->GetCachedIntPref(kPresContext_MinimumFontSize);
font->mFont.size = PR_MAX(font->mSize, minimumFontSize);
font->mFont.size = NS_MAX(font->mSize, minimumFontSize);
} else {
font->mFont.size = font->mSize;
}

Просмотреть файл

@ -1435,7 +1435,7 @@ ConvertToPixelCoord(const nsStyleCoord& aCoord, PRInt32 aPercentScale)
return 0;
}
NS_ABORT_IF_FALSE(pixelValue >= 0, "we ensured non-negative while parsing");
pixelValue = PR_MIN(pixelValue, PR_INT32_MAX); // avoid overflow
pixelValue = NS_MIN(pixelValue, double(PR_INT32_MAX)); // avoid overflow
return NS_lround(pixelValue);
}
@ -1599,13 +1599,13 @@ nsStyleBackground::nsStyleBackground(const nsStyleBackground& aSource)
PRUint32 count = mLayers.Length();
if (count != aSource.mLayers.Length()) {
NS_WARNING("truncating counts due to out-of-memory");
mAttachmentCount = PR_MAX(mAttachmentCount, count);
mClipCount = PR_MAX(mClipCount, count);
mOriginCount = PR_MAX(mOriginCount, count);
mRepeatCount = PR_MAX(mRepeatCount, count);
mPositionCount = PR_MAX(mPositionCount, count);
mImageCount = PR_MAX(mImageCount, count);
mSizeCount = PR_MAX(mSizeCount, count);
mAttachmentCount = NS_MAX(mAttachmentCount, count);
mClipCount = NS_MAX(mClipCount, count);
mOriginCount = NS_MAX(mOriginCount, count);
mRepeatCount = NS_MAX(mRepeatCount, count);
mPositionCount = NS_MAX(mPositionCount, count);
mImageCount = NS_MAX(mImageCount, count);
mSizeCount = NS_MAX(mSizeCount, count);
}
}

Просмотреть файл

@ -65,6 +65,7 @@
#include "nsIURI.h"
#include "nsCSSValue.h"
#include "nsStyleTransformMatrix.h"
#include "nsAlgorithm.h"
class nsIFrame;
class imgIRequest;
@ -666,14 +667,14 @@ class nsCSSShadowArray {
// but values between zero and one device pixels are always rounded up to
// one device pixel.
#define NS_ROUND_BORDER_TO_PIXELS(l,tpp) \
((l) == 0) ? 0 : PR_MAX((tpp), (l) / (tpp) * (tpp))
((l) == 0) ? 0 : NS_MAX((tpp), (l) / (tpp) * (tpp))
// Outline offset is rounded to the nearest integer number of pixels, but values
// between zero and one device pixels are always rounded up to one device pixel.
// Note that the offset can be negative.
#define NS_ROUND_OFFSET_TO_PIXELS(l,tpp) \
(((l) == 0) ? 0 : \
((l) > 0) ? PR_MAX( (tpp), ((l) + ((tpp) / 2)) / (tpp) * (tpp)) : \
PR_MIN(-(tpp), ((l) - ((tpp) / 2)) / (tpp) * (tpp)))
((l) > 0) ? NS_MAX( (tpp), ((l) + ((tpp) / 2)) / (tpp) * (tpp)) : \
NS_MIN(-(tpp), ((l) - ((tpp) / 2)) / (tpp) * (tpp)))
// Returns if the given border style type is visible or not
static PRBool IsVisibleBorderStyle(PRUint8 aStyle)

Просмотреть файл

@ -305,7 +305,7 @@ nscoord nsStyleUtil::FindNextSmallerFontSize(nscoord aFontSize, PRInt32 aBasePoi
}
}
else { // smaller than HTML table, drop by 1px
smallerSize = PR_MAX(aFontSize - onePx, onePx);
smallerSize = NS_MAX(aFontSize - onePx, onePx);
}
return smallerSize;
}

Просмотреть файл

@ -1353,8 +1353,8 @@ nsSVGGlyphFrame::EnsureTextRun(float *aDrawScale, float *aMetricsScale,
textRunSize = PRECISE_SIZE;
} else {
textRunSize = size*contextScale;
textRunSize = PR_MAX(textRunSize, CLAMP_MIN_SIZE);
textRunSize = PR_MIN(textRunSize, CLAMP_MAX_SIZE);
textRunSize = NS_MAX(textRunSize, double(CLAMP_MIN_SIZE));
textRunSize = NS_MIN(textRunSize, double(CLAMP_MAX_SIZE));
}
const nsFont& font = fontData->mFont;

Просмотреть файл

@ -289,13 +289,13 @@ nsSVGTextContainerFrame::GetSubStringLength(PRUint32 charnum, PRUint32 nchars)
while (node) {
PRUint32 count = node->GetNumberOfChars();
if (count > charnum) {
PRUint32 fragmentChars = PR_MIN(nchars, count);
PRUint32 fragmentChars = NS_MIN(nchars, count);
float fragmentLength = node->GetSubStringLength(charnum, fragmentChars);
length += fragmentLength;
nchars -= fragmentChars;
if (nchars == 0) break;
}
charnum -= PR_MIN(charnum, count);
charnum -= NS_MIN(charnum, count);
node = GetNextGlyphFragmentChildNode(node);
}

Просмотреть файл

@ -1216,9 +1216,9 @@ nsSVGUtils::ConvertToSurfaceSize(const gfxSize& aSize, PRBool *aResultOverflows)
if (*aResultOverflows ||
!gfxASurface::CheckSurfaceSize(surfaceSize)) {
surfaceSize.width = PR_MIN(NS_SVG_OFFSCREEN_MAX_DIMENSION,
surfaceSize.width = NS_MIN(NS_SVG_OFFSCREEN_MAX_DIMENSION,
surfaceSize.width);
surfaceSize.height = PR_MIN(NS_SVG_OFFSCREEN_MAX_DIMENSION,
surfaceSize.height = NS_MIN(NS_SVG_OFFSCREEN_MAX_DIMENSION,
surfaceSize.height);
*aResultOverflows = PR_TRUE;
}

Просмотреть файл

@ -137,7 +137,7 @@ GetWidthInfo(nsIRenderingContext *aRenderingContext,
nsGkAtoms::nowrap)) {
minCoord = w;
}
prefCoord = PR_MAX(w, minCoord);
prefCoord = NS_MAX(w, minCoord);
} else if (unit == eStyleUnit_Percent) {
prefPercent = stylePos->mWidth.GetPercentValue();
} else if (unit == eStyleUnit_Enumerated && aIsCell) {

Просмотреть файл

@ -323,7 +323,7 @@ FixedTableLayoutStrategy::ComputeColumnWidths(const nsHTMLReflowState& aReflowSt
// had percentage widths. The spec doesn't say to do this,
// but we've always done it in the past, and so does WinIE6.
nscoord pctUsed = NSToCoordFloor(pctTotal * float(tableWidth));
nscoord reduce = PR_MIN(pctUsed, -unassignedSpace);
nscoord reduce = NS_MIN(pctUsed, -unassignedSpace);
float reduceRatio = float(reduce) / pctTotal;
for (PRInt32 col = 0; col < colCount; ++col) {
nsTableColFrame *colFrame = mTableFrame->GetColFrame(col);

Просмотреть файл

@ -484,8 +484,8 @@ nsTableCellMap::InsertRows(nsTableRowGroupFrame& aParent,
nsTableRowGroupFrame* rg = cellMap->GetRowGroup();
if (rg == &aParent) {
cellMap->InsertRows(*this, aRows, rowIndex, aConsiderSpans, aDamageArea);
aDamageArea.y = PR_MIN(aFirstRowIndex, aDamageArea.y);
aDamageArea.height = PR_MAX(0, GetRowCount() - aDamageArea.y);
aDamageArea.y = NS_MIN(aFirstRowIndex, aDamageArea.y);
aDamageArea.height = NS_MAX(0, GetRowCount() - aDamageArea.y);
#ifdef DEBUG_TABLE_CELLMAP
Dump("after InsertRows");
#endif
@ -527,7 +527,7 @@ nsTableCellMap::RemoveRows(PRInt32 aFirstRowIndex,
cellMap->RemoveRows(*this, rowIndex, aNumRowsToRemove, aConsiderSpans, aDamageArea);
nsTableRowGroupFrame* rg = cellMap->GetRowGroup();
aDamageArea.y += (rg) ? rg->GetStartRowIndex() : 0;
aDamageArea.height = PR_MAX(0, GetRowCount() - aFirstRowIndex);
aDamageArea.height = NS_MAX(0, GetRowCount() - aFirstRowIndex);
if (mBCInfo) {
for (PRInt32 rowX = aFirstRowIndex + aNumRowsToRemove - 1; rowX >= aFirstRowIndex; rowX--) {
if (PRUint32(rowX) < mBCInfo->mRightBorders.Length()) {
@ -592,7 +592,7 @@ nsTableCellMap::InsertCells(nsTArray<nsTableCellFrame*>& aCellFrames,
cellMap->InsertCells(*this, aCellFrames, rowIndex, aColIndexBefore, aDamageArea);
nsTableRowGroupFrame* rg = cellMap->GetRowGroup();
aDamageArea.y += (rg) ? rg->GetStartRowIndex() : 0;
aDamageArea.width = PR_MAX(0, GetColCount() - aColIndexBefore - 1);
aDamageArea.width = NS_MAX(0, GetColCount() - aColIndexBefore - 1);
break;
}
rowIndex -= cellMap->GetRowCount();
@ -621,7 +621,7 @@ nsTableCellMap::RemoveCell(nsTableCellFrame* aCellFrame,
aDamageArea.y += (rg) ? rg->GetStartRowIndex() : 0;
PRInt32 colIndex;
aCellFrame->GetColIndex(colIndex);
aDamageArea.width = PR_MAX(0, GetColCount() - colIndex - 1);
aDamageArea.width = NS_MAX(0, GetColCount() - colIndex - 1);
#ifdef DEBUG_TABLE_CELLMAP
Dump("after RemoveCell");
#endif
@ -646,8 +646,8 @@ SetDamageArea(PRInt32 aXOrigin,
{
aDamageArea.x = aXOrigin;
aDamageArea.y = aYOrigin;
aDamageArea.width = PR_MAX(1, aWidth);
aDamageArea.height = PR_MAX(1, aHeight);
aDamageArea.width = NS_MAX(1, aWidth);
aDamageArea.height = NS_MAX(1, aHeight);
}
void
@ -1376,7 +1376,7 @@ nsCellMap::InsertRows(nsTableCellMap& aMap,
if (!aConsiderSpans) {
// update mContentRowCount, since non-empty rows will be added
mContentRowCount = PR_MAX(aFirstRowIndex, mContentRowCount);
mContentRowCount = NS_MAX(aFirstRowIndex, mContentRowCount);
ExpandWithRows(aMap, aRows, aFirstRowIndex, aDamageArea);
return;
}
@ -1386,7 +1386,7 @@ nsCellMap::InsertRows(nsTableCellMap& aMap,
aFirstRowIndex, 0, numCols - 1);
// update mContentRowCount, since non-empty rows will be added
mContentRowCount = PR_MAX(aFirstRowIndex, mContentRowCount);
mContentRowCount = NS_MAX(aFirstRowIndex, mContentRowCount);
// if any of the new cells span out of the new rows being added, then rebuild
// XXX it would be better to only rebuild the portion of the map that follows the new rows
@ -1508,7 +1508,7 @@ nsCellMap::AppendCell(nsTableCellMap& aMap,
aMap.RebuildConsideringCells(this, &newCellArray, aRowIndex, startColIndex, PR_TRUE, aDamageArea);
return origData;
}
mContentRowCount = PR_MAX(mContentRowCount, aRowIndex + 1);
mContentRowCount = NS_MAX(mContentRowCount, aRowIndex + 1);
// add new cols to the table map if necessary
PRInt32 endColIndex = startColIndex + colSpan - 1;
@ -1931,7 +1931,7 @@ void nsCellMap::ExpandWithCells(nsTableCellMap& aMap,
}
cellFrame->SetColIndex(startColIndex);
}
PRInt32 damageHeight = PR_MIN(GetRowGroup()->GetRowCount() - aRowIndex, aRowSpan);
PRInt32 damageHeight = NS_MIN(GetRowGroup()->GetRowCount() - aRowIndex, aRowSpan);
SetDamageArea(aColIndex, aRowIndex, 1 + endColIndex - aColIndex, damageHeight, aDamageArea);
PRInt32 rowX;
@ -2056,7 +2056,7 @@ PRInt32 nsCellMap::GetEffectiveColSpan(const nsTableCellMap& aMap,
nsTableCellFrame* cellFrame = origData->GetCellFrame();
if (cellFrame) {
// possible change the number of colums to iterate
maxCols = PR_MIN(aColIndex + cellFrame->GetColSpan(), maxCols);
maxCols = NS_MIN(aColIndex + cellFrame->GetColSpan(), maxCols);
if (colX >= maxCols)
break;
}
@ -2087,7 +2087,7 @@ nsCellMap::GetRowSpanForNewCell(nsTableCellFrame* aCellFrameToAdd,
if (0 == rowSpan) {
// Use a min value of 2 for a zero rowspan to make computations easier
// elsewhere. Zero rowspans are only content dependent!
rowSpan = PR_MAX(2, mContentRowCount - aRowIndex);
rowSpan = NS_MAX(2, mContentRowCount - aRowIndex);
aIsZeroRowSpan = PR_TRUE;
}
return rowSpan;
@ -2187,7 +2187,7 @@ void nsCellMap::ShrinkWithoutCell(nsTableCellMap& aMap,
// endIndexForRow points at the first slot we don't want to clean up. This
// makes the aColIndex == 0 case work right with our unsigned int colX.
NS_ASSERTION(endColIndex + 1 <= row.Length(), "span beyond the row size!");
PRUint32 endIndexForRow = PR_MIN(endColIndex + 1, row.Length());
PRUint32 endIndexForRow = NS_MIN(endColIndex + 1, row.Length());
// Since endIndexForRow <= row.Length(), enough to compare aColIndex to it.
if (PRUint32(aColIndex) < endIndexForRow) {
@ -2270,7 +2270,7 @@ nsCellMap::RebuildConsideringRows(nsTableCellMap& aMap,
// aStartRowIndex might be after all existing rows so we should limit the
// copy to the amount of exisiting rows
PRUint32 copyEndRowIndex = PR_MIN(numOrigRows, PRUint32(aStartRowIndex));
PRUint32 copyEndRowIndex = NS_MIN(numOrigRows, PRUint32(aStartRowIndex));
// rowX keeps track of where we are in mRows while setting up the
// new cellmap.
@ -2363,7 +2363,7 @@ nsCellMap::RebuildConsideringCells(nsTableCellMap& aMap,
// the new cells might extend the previous column number
NS_ASSERTION(aNumOrigCols >= aColIndex, "Appending cells far beyond cellmap data?!");
PRInt32 numCols = aInsert ? PR_MAX(aNumOrigCols, aColIndex + 1) : aNumOrigCols;
PRInt32 numCols = aInsert ? NS_MAX(aNumOrigCols, aColIndex + 1) : aNumOrigCols;
// build the new cell map. Hard to say what, if anything, we can preallocate
// here... Should come back to that sometime, perhaps.
@ -2845,7 +2845,7 @@ nsCellMapColumnIterator::AdvanceRowGroup()
mCurMapContentRowCount = mCurMap->GetRowCount();
PRUint32 rowArrayLength = mCurMap->mRows.Length();
mCurMapRelevantRowCount = PR_MIN(mCurMapContentRowCount, rowArrayLength);
mCurMapRelevantRowCount = NS_MIN(mCurMapContentRowCount, rowArrayLength);
} while (0 == mCurMapRelevantRowCount);
NS_ASSERTION(mCurMapRelevantRowCount != 0 || !mCurMap,

Просмотреть файл

@ -43,6 +43,7 @@
#include "nsTPtrArray.h"
#include "nsRect.h"
#include "nsCOMPtr.h"
#include "nsAlgorithm.h"
#undef DEBUG_TABLE_CELLMAP
@ -629,7 +630,7 @@ public:
if (mCurMap) {
mCurMapContentRowCount = mCurMap->GetRowCount();
PRUint32 rowArrayLength = mCurMap->mRows.Length();
mCurMapRelevantRowCount = PR_MIN(mCurMapContentRowCount, rowArrayLength);
mCurMapRelevantRowCount = NS_MIN(mCurMapContentRowCount, rowArrayLength);
if (mCurMapRelevantRowCount == 0 && mOrigCells > 0) {
// This row group is useless; advance!
AdvanceRowGroup();

Просмотреть файл

@ -591,7 +591,7 @@ void nsTableCellFrame::VerticallyAlignChild(nscoord aMaxAscent)
kidYTop = (height - childHeight - bottomInset + topInset) / 2;
}
// if the content is larger than the cell height align from top
kidYTop = PR_MAX(0, kidYTop);
kidYTop = NS_MAX(0, kidYTop);
if (kidYTop != kidRect.y) {
// Invalidate at the old position first

Просмотреть файл

@ -118,14 +118,14 @@ struct nsTableReflowState {
if (NS_UNCONSTRAINEDSIZE != availSize.width) {
availSize.width -= borderPadding.left + borderPadding.right
+ (2 * cellSpacingX);
availSize.width = PR_MAX(0, availSize.width);
availSize.width = NS_MAX(0, availSize.width);
}
availSize.height = aAvailHeight;
if (NS_UNCONSTRAINEDSIZE != availSize.height) {
availSize.height -= borderPadding.top + borderPadding.bottom
+ (2 * table->GetCellSpacingY());
availSize.height = PR_MAX(0, availSize.height);
availSize.height = NS_MAX(0, availSize.height);
}
}
@ -634,7 +634,7 @@ void nsTableFrame::InsertCol(nsTableColFrame& aColFrame,
}
// for now, just bail and recalc all of the collapsing borders
if (IsBorderCollapse()) {
nsRect damageArea(0, 0, PR_MAX(1, GetColCount()), PR_MAX(1, GetRowCount()));
nsRect damageArea(0, 0, NS_MAX(1, GetColCount()), NS_MAX(1, GetRowCount()));
SetBCDamageArea(damageArea);
}
}
@ -1429,7 +1429,7 @@ nsTableFrame::SetColumnDimensions(nscoord aHeight,
nsTableIterator iter(mColGroups);
nsIFrame* colGroupFrame = iter.First();
PRBool tableIsLTR = GetStyleVisibility()->mDirection == NS_STYLE_DIRECTION_LTR;
PRInt32 colX =tableIsLTR ? 0 : PR_MAX(0, GetColCount() - 1);
PRInt32 colX =tableIsLTR ? 0 : NS_MAX(0, GetColCount() - 1);
PRInt32 tableColIncr = tableIsLTR ? 1 : -1;
nsPoint colGroupOrigin(aBorderPadding.left + cellSpacingX,
aBorderPadding.top + cellSpacingY);
@ -2348,7 +2348,7 @@ nsTableFrame::RemoveFrame(nsIAtom* aListName,
// for now, just bail and recalc all of the collapsing borders
// XXXldb [reflow branch merging 20060830] do we still need this?
if (IsBorderCollapse()) {
nsRect damageArea(0, 0, PR_MAX(1, GetColCount()), PR_MAX(1, GetRowCount()));
nsRect damageArea(0, 0, NS_MAX(1, GetColCount()), NS_MAX(1, GetRowCount()));
SetBCDamageArea(damageArea);
}
PresContext()->PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
@ -3156,7 +3156,7 @@ nsTableFrame::DistributeHeightToRows(const nsHTMLReflowState& aReflowState,
nsRect rowRect = rowFrame->GetRect();
if ((amountUsed < aAmount) && rowFrame->HasPctHeight()) {
nscoord pctHeight = rowFrame->GetHeight(pctBasis);
nscoord amountForRow = PR_MIN(aAmount - amountUsed, pctHeight - rowRect.height);
nscoord amountForRow = NS_MIN(aAmount - amountUsed, pctHeight - rowRect.height);
if (amountForRow > 0) {
nsRect oldRowRect = rowRect;
rowRect.height += amountForRow;
@ -3313,7 +3313,7 @@ nsTableFrame::DistributeHeightToRows(const nsHTMLReflowState& aReflowState,
// gets the remainder
nscoord amountForRow = (rowFrame == lastEligibleRow)
? aAmount - amountUsed : NSToCoordRound(((float)(heightToDistribute)) * ratio);
amountForRow = PR_MIN(amountForRow, aAmount - amountUsed);
amountForRow = NS_MIN(amountForRow, aAmount - amountUsed);
if (yOriginRow != rowRect.y) {
rowFrame->InvalidateOverflowRect();
@ -3537,7 +3537,7 @@ nsTableFrame::CalcBorderBoxHeight(const nsHTMLReflowState& aState)
nsMargin borderPadding = GetChildAreaOffset(&aState);
height += borderPadding.top + borderPadding.bottom;
}
height = PR_MAX(0, height);
height = NS_MAX(0, height);
return height;
}
@ -3938,8 +3938,8 @@ void
nsTableFrame::SetBCDamageArea(const nsRect& aValue)
{
nsRect newRect(aValue);
newRect.width = PR_MAX(1, newRect.width);
newRect.height = PR_MAX(1, newRect.height);
newRect.width = NS_MAX(1, newRect.width);
newRect.height = NS_MAX(1, newRect.height);
if (!IsBorderCollapse()) {
NS_ASSERTION(PR_FALSE, "invalid call - not border collapse model");
@ -4323,7 +4323,7 @@ BCMapCellInfo::SetInfo(nsTableRowFrame* aNewRow,
// col group frame info
mColGroup = static_cast<nsTableColGroupFrame*>(mLeftCol->GetParent());
PRInt32 cgStart = mColGroup->GetStartColumnIndex();
PRInt32 cgEnd = PR_MAX(0, cgStart + mColGroup->GetColCount() - 1);
PRInt32 cgEnd = NS_MAX(0, cgStart + mColGroup->GetColCount() - 1);
mCgAtLeft = (cgStart == aColIndex);
mCgAtRight = (cgEnd == aColIndex + mColSpan - 1);
}
@ -5021,7 +5021,7 @@ struct BCCorners
BCCornerInfo& operator [](PRInt32 i) const
{ NS_ASSERTION((i >= startIndex) && (i <= endIndex), "program error");
return corners[PR_MAX(PR_MIN(i, endIndex), startIndex) - startIndex]; }
return corners[NS_MAX(NS_MIN(i, endIndex), startIndex) - startIndex]; }
PRInt32 startIndex;
PRInt32 endIndex;
@ -5047,7 +5047,7 @@ struct BCCellBorders
BCCellBorder& operator [](PRInt32 i) const
{ NS_ASSERTION((i >= startIndex) && (i <= endIndex), "program error");
return borders[PR_MAX(PR_MIN(i, endIndex), startIndex) - startIndex]; }
return borders[NS_MAX(NS_MIN(i, endIndex), startIndex) - startIndex]; }
PRInt32 startIndex;
PRInt32 endIndex;
@ -5178,12 +5178,12 @@ nsTableFrame::ExpandBCDamageArea(nsRect& aRect) const
if ((dStartY >= rgStartY) && (dStartY <= rgEndY)) {
// the damage area starts in the row group
iterStartY = dStartY;
iterEndY = PR_MIN(dEndY, rgEndY);
iterEndY = NS_MIN(dEndY, rgEndY);
}
else if ((dEndY >= rgStartY) && (dEndY <= rgEndY)) {
// the damage area ends in the row group
iterStartY = rgStartY;
iterEndY = PR_MIN(dEndY, rgStartY);
iterEndY = NS_MIN(dEndY, rgStartY);
}
else if ((rgStartY >= dStartY) && (rgEndY <= dEndY)) {
// the damage area contains the row group
@ -5231,7 +5231,7 @@ nsTableFrame::ExpandBCDamageArea(nsRect& aRect) const
static PRUint8
LimitBorderWidth(PRUint16 aWidth)
{
return PR_MIN(MAX_TABLE_BORDER_WIDTH, aWidth);
return NS_MIN(PRUint16(MAX_TABLE_BORDER_WIDTH), aWidth);
}
#define TABLE_EDGE PR_TRUE
@ -5410,7 +5410,7 @@ void
BCMapCellInfo::SetTableTopBorderWidth(BCPixelSize aWidth)
{
mTableBCData->mTopBorderWidth =
LimitBorderWidth(PR_MAX(mTableBCData->mTopBorderWidth, (PRUint8) aWidth));
LimitBorderWidth(NS_MAX(mTableBCData->mTopBorderWidth, aWidth));
}
void
@ -5426,7 +5426,7 @@ BCMapCellInfo::SetTableLeftBorderWidth(PRInt32 aRowY, BCPixelSize aWidth)
}
}
mTableBCData->mLeftBorderWidth =
LimitBorderWidth(PR_MAX(mTableBCData->mLeftBorderWidth, aWidth));
LimitBorderWidth(NS_MAX(mTableBCData->mLeftBorderWidth, aWidth));
}
void
@ -5442,7 +5442,7 @@ BCMapCellInfo::SetTableRightBorderWidth(PRInt32 aRowY, BCPixelSize aWidth)
}
}
mTableBCData->mRightBorderWidth =
LimitBorderWidth(PR_MAX(mTableBCData->mRightBorderWidth, aWidth));
LimitBorderWidth(NS_MAX(mTableBCData->mRightBorderWidth, aWidth));
}
void
@ -5450,12 +5450,12 @@ BCMapCellInfo::SetRightBorderWidths(BCPixelSize aWidth)
{
// update the borders of the cells and cols affected
if (mCell) {
mCell->SetBorderWidth(mEndSide, PR_MAX(aWidth,
mCell->SetBorderWidth(mEndSide, NS_MAX(aWidth,
mCell->GetBorderWidth(mEndSide)));
}
if (mRightCol) {
BCPixelSize half = BC_BORDER_LEFT_HALF(aWidth);
mRightCol->SetRightBorderWidth(PR_MAX(half,
mRightCol->SetRightBorderWidth(NS_MAX(nscoord(half),
mRightCol->GetRightBorderWidth()));
}
}
@ -5465,12 +5465,12 @@ BCMapCellInfo::SetBottomBorderWidths(BCPixelSize aWidth)
{
// update the borders of the affected cells and rows
if (mCell) {
mCell->SetBorderWidth(NS_SIDE_BOTTOM, PR_MAX(aWidth,
mCell->SetBorderWidth(NS_SIDE_BOTTOM, NS_MAX(aWidth,
mCell->GetBorderWidth(NS_SIDE_BOTTOM)));
}
if (mBottomRow) {
BCPixelSize half = BC_BORDER_TOP_HALF(aWidth);
mBottomRow->SetBottomBCBorderWidth(PR_MAX(half,
mBottomRow->SetBottomBCBorderWidth(NS_MAX(nscoord(half),
mBottomRow->GetBottomBCBorderWidth()));
}
}
@ -5478,24 +5478,26 @@ void
BCMapCellInfo::SetTopBorderWidths(BCPixelSize aWidth)
{
if (mCell) {
mCell->SetBorderWidth(NS_SIDE_TOP, PR_MAX(aWidth,
mCell->SetBorderWidth(NS_SIDE_TOP, NS_MAX(aWidth,
mCell->GetBorderWidth(NS_SIDE_TOP)));
}
if (mTopRow) {
BCPixelSize half = BC_BORDER_BOTTOM_HALF(aWidth);
mTopRow->SetTopBCBorderWidth(PR_MAX(half, mTopRow->GetTopBCBorderWidth()));
mTopRow->SetTopBCBorderWidth(NS_MAX(nscoord(half),
mTopRow->GetTopBCBorderWidth()));
}
}
void
BCMapCellInfo::SetLeftBorderWidths(BCPixelSize aWidth)
{
if (mCell) {
mCell->SetBorderWidth(mStartSide, PR_MAX(aWidth,
mCell->SetBorderWidth(mStartSide, NS_MAX(aWidth,
mCell->GetBorderWidth(mStartSide)));
}
if (mLeftCol) {
BCPixelSize half = BC_BORDER_RIGHT_HALF(aWidth);
mLeftCol->SetLeftBorderWidth(PR_MAX(half, mLeftCol->GetLeftBorderWidth()));
mLeftCol->SetLeftBorderWidth(NS_MAX(nscoord(half),
mLeftCol->GetLeftBorderWidth()));
}
}
@ -5503,7 +5505,7 @@ void
BCMapCellInfo::SetTableBottomBorderWidth(BCPixelSize aWidth)
{
mTableBCData->mBottomBorderWidth =
LimitBorderWidth(PR_MAX(mTableBCData->mBottomBorderWidth, aWidth));
LimitBorderWidth(NS_MAX(mTableBCData->mBottomBorderWidth, aWidth));
}
void
@ -5848,8 +5850,8 @@ nsTableFrame::CalcBCBorders()
currentBorder = CompareBorders(!CELL_CORNER, currentBorder,
adjacentBorder, !HORIZONTAL);
segLength = PR_MAX(1, ajaInfo.mRowIndex + ajaInfo.mRowSpan - rowY);
segLength = PR_MIN(segLength, info.mRowIndex + info.mRowSpan - rowY);
segLength = NS_MAX(1, ajaInfo.mRowIndex + ajaInfo.mRowSpan - rowY);
segLength = NS_MIN(segLength, info.mRowIndex + info.mRowSpan - rowY);
// update lastVerBorders and see if a new segment starts
startSeg = SetBorder(currentBorder,
@ -5982,8 +5984,8 @@ nsTableFrame::CalcBCBorders()
adjacentBorder = ajaInfo.GetTopInternalBorder();
currentBorder = CompareBorders(!CELL_CORNER, currentBorder,
adjacentBorder, HORIZONTAL);
segLength = PR_MAX(1, ajaInfo.mColIndex + ajaInfo.mColSpan - colX);
segLength = PR_MIN(segLength, info.mColIndex + info.mColSpan - colX);
segLength = NS_MAX(1, ajaInfo.mColIndex + ajaInfo.mColSpan - colX);
segLength = NS_MIN(segLength, info.mColIndex + info.mColSpan - colX);
// update, store the bottom left corner
BCCornerInfo& blCorner = bottomCorners[colX]; // bottom left
@ -6512,7 +6514,7 @@ BCVerticalSeg::Start(BCMapBorderIterator& aIter,
nscoord cornerSubWidth = (aIter.bcData) ? aIter.bcData->GetCorner(ownerSide, bevel) : 0;
PRBool topBevel = (aVerSegWidth > 0) ? bevel : PR_FALSE;
nscoord maxHorSegHeight = PR_MAX(aPrevHorSegHeight, aHorSegHeight);
nscoord maxHorSegHeight = NS_MAX(aPrevHorSegHeight, aHorSegHeight);
nscoord offset = CalcVerCornerOffset(ownerSide, cornerSubWidth, maxHorSegHeight,
PR_TRUE, topBevel);
@ -6590,7 +6592,7 @@ BCHorizontalSeg::Start(BCMapBorderIterator& aIter,
{
owner = aBorderOwner;
leftBevel = (aHorSegHeight > 0) ? aBevel : PR_FALSE;
nscoord maxVerSegWidth = PR_MAX(aTopVerSegWidth, aBottomVerSegWidth);
nscoord maxVerSegWidth = NS_MAX(aTopVerSegWidth, aBottomVerSegWidth);
nscoord offset = CalcHorCornerOffset(aCornerOwnerSide, aSubWidth, maxVerSegWidth,
PR_TRUE, leftBevel, aTableIsLTR);
leftBevelOffset = (leftBevel && (aHorSegHeight > 0)) ? maxVerSegWidth : 0;
@ -6793,7 +6795,7 @@ nsTableFrame::PaintBCBorders(nsIRenderingContext& aRenderingContext,
bevel = PR_FALSE; // ???
}
PRBool endBevel = (info.segWidth > 0) ? bevel : PR_FALSE;
nscoord bottomHorSegHeight = PR_MAX(prevHorSegHeight, horSegHeight);
nscoord bottomHorSegHeight = NS_MAX(prevHorSegHeight, horSegHeight);
nscoord endOffset = CalcVerCornerOffset(ownerSide, cornerSubWidth, bottomHorSegHeight,
PR_FALSE, endBevel);
info.segHeight += endOffset;
@ -6906,7 +6908,7 @@ nsTableFrame::PaintBCBorders(nsIRenderingContext& aRenderingContext,
}
}
cornerSubWidth = (iter.bcData) ? iter.bcData->GetCorner(ownerSide, bevel) : 0;
nscoord verWidth = PR_MAX(verInfo[xAdj].segWidth, leftSegWidth);
nscoord verWidth = NS_MAX(nscoord(verInfo[xAdj].segWidth), leftSegWidth);
if (iter.isNewRow || (iter.IsLeftMost() && iter.IsBottomMost())) {
horSeg.y = nextY;
nextY = nextY + iter.row->GetSize().height;

Просмотреть файл

@ -549,7 +549,7 @@ nsTableOuterFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
nscoord capPref =
nsLayoutUtils::IntrinsicForContainer(aRenderingContext, mCaptionFrame,
iwt);
maxWidth = PR_MAX(maxWidth, capPref);
maxWidth = NS_MAX(maxWidth, capPref);
}
break;
}
@ -679,23 +679,23 @@ nsTableOuterFrame::SetDesiredSize(PRUint8 aCaptionSide,
}
switch(aCaptionSide) {
case NS_STYLE_CAPTION_SIDE_LEFT:
aWidth = PR_MAX(aInnerMargin.left, aCaptionMargin.left + captionWidth + aCaptionMargin.right) +
aWidth = NS_MAX(aInnerMargin.left, aCaptionMargin.left + captionWidth + aCaptionMargin.right) +
innerWidth + aInnerMargin.right;
break;
case NS_STYLE_CAPTION_SIDE_RIGHT:
aWidth = PR_MAX(aInnerMargin.right, aCaptionMargin.left + captionWidth + aCaptionMargin.right) +
aWidth = NS_MAX(aInnerMargin.right, aCaptionMargin.left + captionWidth + aCaptionMargin.right) +
innerWidth + aInnerMargin.left;
break;
default:
aWidth = aInnerMargin.left + innerWidth + aInnerMargin.right;
aWidth = PR_MAX(aWidth, captionRect.XMost() + aCaptionMargin.right);
aWidth = NS_MAX(aWidth, captionRect.XMost() + aCaptionMargin.right);
}
aHeight = innerRect.YMost() + aInnerMargin.bottom;
if (NS_STYLE_CAPTION_SIDE_BOTTOM != aCaptionSide) {
aHeight = PR_MAX(aHeight, captionRect.YMost() + aCaptionMargin.bottom);
aHeight = NS_MAX(aHeight, captionRect.YMost() + aCaptionMargin.bottom);
}
else {
aHeight = PR_MAX(aHeight, captionRect.YMost() + aCaptionMargin.bottom +
aHeight = NS_MAX(aHeight, captionRect.YMost() + aCaptionMargin.bottom +
aInnerMargin.bottom);
}
@ -827,10 +827,10 @@ nsTableOuterFrame::GetCaptionOrigin(PRUint32 aCaptionSide,
aOrigin.y = aInnerMargin.top;
switch (GetCaptionVerticalAlign()) {
case NS_STYLE_VERTICAL_ALIGN_MIDDLE:
aOrigin.y = PR_MAX(0, aInnerMargin.top + ((aInnerSize.height - aCaptionSize.height) / 2));
aOrigin.y = NS_MAX(0, aInnerMargin.top + ((aInnerSize.height - aCaptionSize.height) / 2));
break;
case NS_STYLE_VERTICAL_ALIGN_BOTTOM:
aOrigin.y = PR_MAX(0, aInnerMargin.top + aInnerSize.height - aCaptionSize.height);
aOrigin.y = NS_MAX(0, aInnerMargin.top + aInnerSize.height - aCaptionSize.height);
break;
default:
break;
@ -893,7 +893,7 @@ nsTableOuterFrame::GetInnerOrigin(PRUint32 aCaptionSide,
if (aInnerMargin.left < minCapWidth) {
// shift the inner table to get some place for the caption
aInnerMargin.right += aInnerMargin.left - minCapWidth;
aInnerMargin.right = PR_MAX(0, aInnerMargin.right);
aInnerMargin.right = NS_MAX(0, aInnerMargin.right);
aInnerMargin.left = minCapWidth;
}
aOrigin.x = aInnerMargin.left;
@ -921,10 +921,10 @@ nsTableOuterFrame::GetInnerOrigin(PRUint32 aCaptionSide,
aOrigin.y = aInnerMargin.top;
switch (GetCaptionVerticalAlign()) {
case NS_STYLE_VERTICAL_ALIGN_MIDDLE:
aOrigin.y = PR_MAX(aInnerMargin.top, (aCaptionSize.height - aInnerSize.height) / 2);
aOrigin.y = NS_MAX(aInnerMargin.top, (aCaptionSize.height - aInnerSize.height) / 2);
break;
case NS_STYLE_VERTICAL_ALIGN_BOTTOM:
aOrigin.y = PR_MAX(aInnerMargin.top, aCaptionSize.height - aInnerSize.height);
aOrigin.y = NS_MAX(aInnerMargin.top, aCaptionSize.height - aInnerSize.height);
break;
default:
break;

Просмотреть файл

@ -75,14 +75,14 @@ void nsTableCellReflowState::FixUp(const nsSize& aAvailSpace)
if (NS_UNCONSTRAINEDSIZE != ComputedWidth()) {
nscoord computedWidth =
aAvailSpace.width - mComputedBorderPadding.LeftRight();
computedWidth = PR_MAX(0, computedWidth);
computedWidth = NS_MAX(0, computedWidth);
SetComputedWidth(computedWidth);
}
if (NS_UNCONSTRAINEDSIZE != ComputedHeight() &&
NS_UNCONSTRAINEDSIZE != aAvailSpace.height) {
nscoord computedHeight =
aAvailSpace.height - mComputedBorderPadding.TopBottom();
computedHeight = PR_MAX(0, computedHeight);
computedHeight = NS_MAX(0, computedHeight);
SetComputedHeight(computedHeight);
}
}
@ -109,7 +109,7 @@ nsTableRowFrame::InitChildReflowState(nsPresContext& aPresContext,
void
nsTableRowFrame::SetFixedHeight(nscoord aValue)
{
nscoord height = PR_MAX(0, aValue);
nscoord height = NS_MAX(0, aValue);
if (HasFixedHeight()) {
if (height > mStyleFixedHeight) {
mStyleFixedHeight = height;
@ -127,7 +127,7 @@ void
nsTableRowFrame::SetPctHeight(float aPctValue,
PRBool aForce)
{
nscoord height = PR_MAX(0, NSToCoordRound(aPctValue * 100.0f));
nscoord height = NS_MAX(0, NSToCoordRound(aPctValue * 100.0f));
if (HasPctHeight()) {
if ((height > mStylePctHeight) || aForce) {
mStylePctHeight = height;
@ -446,7 +446,7 @@ nscoord nsTableRowFrame::GetRowBaseline()
while (childFrame) {
if (IS_TABLE_CELL(childFrame->GetType())) {
nsIFrame* firstKid = childFrame->GetFirstChild(nsnull);
ascent = PR_MAX(ascent, firstKid->GetRect().YMost());
ascent = NS_MAX(ascent, firstKid->GetRect().YMost());
}
// Get the next child
childFrame = iter.Next();
@ -461,9 +461,9 @@ nsTableRowFrame::GetHeight(nscoord aPctBasis) const
height = NSToCoordRound(GetPctHeight() * (float)aPctBasis);
}
if (HasFixedHeight()) {
height = PR_MAX(height, GetFixedHeight());
height = NS_MAX(height, GetFixedHeight());
}
return PR_MAX(height, GetContentHeight());
return NS_MAX(height, GetContentHeight());
}
void
@ -788,7 +788,7 @@ nscoord CalcHeightFromUnpaginatedHeight(nsPresContext* aPresContext,
height -= prevInFlow->GetSize().height;
}
}
return PR_MAX(height, 0);
return NS_MAX(height, 0);
}
NS_METHOD
@ -962,7 +962,7 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
UpdateHeight(desiredSize.height, ascent, descent, &aTableFrame, cellFrame);
}
else {
cellMaxHeight = PR_MAX(cellMaxHeight, desiredSize.height);
cellMaxHeight = NS_MAX(cellMaxHeight, desiredSize.height);
PRInt32 rowSpan = aTableFrame.GetEffectiveRowSpan((nsTableCellFrame&)*kidFrame);
if (1 == rowSpan) {
SetContentHeight(cellMaxHeight);
@ -1010,7 +1010,7 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
aDesiredSize.height = CalcHeight(aReflowState);
if (GetPrevInFlow()) {
nscoord height = CalcHeightFromUnpaginatedHeight(aPresContext, *this);
aDesiredSize.height = PR_MAX(aDesiredSize.height, height);
aDesiredSize.height = NS_MAX(aDesiredSize.height, height);
}
else {
if (isPaginated && HasStyleHeight()) {
@ -1019,7 +1019,7 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
SetUnpaginatedHeight(aPresContext, aDesiredSize.height);
}
if (isPaginated && HasUnpaginatedHeight()) {
aDesiredSize.height = PR_MAX(aDesiredSize.height, GetUnpaginatedHeight(aPresContext));
aDesiredSize.height = NS_MAX(aDesiredSize.height, GetUnpaginatedHeight(aPresContext));
}
}
}
@ -1031,7 +1031,7 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
styleHeight = aReflowState.availableHeight;
NS_FRAME_SET_INCOMPLETE(aStatus);
}
aDesiredSize.height = PR_MAX(cellMaxHeight, styleHeight);
aDesiredSize.height = NS_MAX(cellMaxHeight, styleHeight);
}
nsRect rowRect(0, 0, aDesiredSize.width, aDesiredSize.height);
aDesiredSize.mOverflowArea.UnionRect(aDesiredSize.mOverflowArea, rowRect);

Просмотреть файл

@ -611,7 +611,7 @@ nsTableRowGroupFrame::CalculateRowHeights(nsPresContext* aPresContext,
for (rowFrame = startRowFrame, rowIndex = 0; rowFrame; rowFrame = rowFrame->GetNextRow(), rowIndex++) {
nscoord nonPctHeight = rowFrame->GetContentHeight();
if (isPaginated) {
nonPctHeight = PR_MAX(nonPctHeight, rowFrame->GetSize().height);
nonPctHeight = NS_MAX(nonPctHeight, rowFrame->GetSize().height);
}
if (!rowFrame->GetPrevInFlow()) {
if (rowFrame->HasPctHeight()) {
@ -619,7 +619,7 @@ nsTableRowGroupFrame::CalculateRowHeights(nsPresContext* aPresContext,
rowInfo[rowIndex].pctHeight = rowFrame->GetHeight(pctHeightBasis);
}
rowInfo[rowIndex].hasStyleHeight = rowFrame->HasStyleHeight();
nonPctHeight = PR_MAX(nonPctHeight, rowFrame->GetFixedHeight());
nonPctHeight = NS_MAX(nonPctHeight, rowFrame->GetFixedHeight());
}
UpdateHeights(rowInfo[rowIndex], nonPctHeight, heightOfRows, heightOfUnStyledRows);
@ -714,7 +714,7 @@ nsTableRowGroupFrame::CalculateRowHeights(nsPresContext* aPresContext,
// give rows their percentage, except for the first row which gets the remainder
nscoord extraForRow = (0 == spanX) ? extra - extraUsed
: NSToCoordRound(((float)(extra)) * percent);
extraForRow = PR_MIN(extraForRow, extra - extraUsed);
extraForRow = NS_MIN(extraForRow, extra - extraUsed);
// update the row height
UpdateHeights(rowInfo[rowIndex + spanX], extraForRow, heightOfRows, heightOfUnStyledRows);
extraUsed += extraForRow;
@ -742,7 +742,7 @@ nsTableRowGroupFrame::CalculateRowHeights(nsPresContext* aPresContext,
nscoord extraForRow = (numSpecialRowsSpanned - 1 == numSpecialRowsAllocated)
? extra - extraUsed
: NSToCoordRound(((float)(extra)) * percent);
extraForRow = PR_MIN(extraForRow, extra - extraUsed);
extraForRow = NS_MIN(extraForRow, extra - extraUsed);
// update the row height
UpdateHeights(rowInfo[rowIndex + spanX], extraForRow, heightOfRows, heightOfUnStyledRows);
extraUsed += extraForRow;
@ -768,7 +768,7 @@ nsTableRowGroupFrame::CalculateRowHeights(nsPresContext* aPresContext,
if (rInfo.hasPctHeight) {
nscoord rowExtra = (rInfo.pctHeight > rInfo.height)
? rInfo.pctHeight - rInfo.height: 0;
rowExtra = PR_MIN(rowExtra, extra);
rowExtra = NS_MIN(rowExtra, extra);
UpdateHeights(rInfo, rowExtra, heightOfRows, heightOfUnStyledRows);
extra -= rowExtra;
}
@ -795,7 +795,7 @@ nsTableRowGroupFrame::CalculateRowHeights(nsPresContext* aPresContext,
nscoord extraForRow = (numRows - 1 == rowIndex)
? extraComputedHeight - extraUsed
: NSToCoordRound(((float)extraComputedHeight) * percent);
extraForRow = PR_MIN(extraForRow, extraComputedHeight - extraUsed);
extraForRow = NS_MIN(extraForRow, extraComputedHeight - extraUsed);
// update the row height
UpdateHeights(rowInfo[rowIndex], extraForRow, heightOfRows, heightOfUnStyledRows);
extraUsed += extraForRow;
@ -986,7 +986,7 @@ nsTableRowGroupFrame::SplitSpanningCells(nsPresContext& aPresContext,
nscoord cellHeight = row->ReflowCellFrame(&aPresContext, aReflowState,
isTopOfPage, cell,
cellAvailHeight, status);
aDesiredHeight = PR_MAX(aDesiredHeight, rowPos.y + cellHeight);
aDesiredHeight = NS_MAX(aDesiredHeight, rowPos.y + cellHeight);
if (NS_FRAME_IS_COMPLETE(status)) {
if (cellHeight > cellAvailHeight) {
aFirstTruncatedRow = row;
@ -1103,9 +1103,9 @@ nsTableRowGroupFrame::SplitRowGroup(nsPresContext* aPresContext,
// row (on the page) or there is at least 5% of the current page available
// XXX this 5% should be made a preference
if (!prevRowFrame || (availHeight - aDesiredSize.height > pageHeight / 20)) {
nsSize availSize(availWidth, PR_MAX(availHeight - rowRect.y, 0));
nsSize availSize(availWidth, NS_MAX(availHeight - rowRect.y, 0));
// don't let the available height exceed what CalculateRowHeights set for it
availSize.height = PR_MIN(availSize.height, rowRect.height);
availSize.height = NS_MIN(availSize.height, rowRect.height);
nsHTMLReflowState rowReflowState(aPresContext, aReflowState,
rowFrame, availSize,
@ -1260,7 +1260,7 @@ nsTableRowGroupFrame::SplitRowGroup(nsPresContext* aPresContext,
} // if (firstTruncatedRow == firstRowThisPage)
} // if (firstTruncatedRow)
else {
aDesiredSize.height = PR_MAX(aDesiredSize.height, yMost);
aDesiredSize.height = NS_MAX(aDesiredSize.height, yMost);
if (contRow) {
aStatus = NS_FRAME_NOT_COMPLETE;
}
@ -1533,7 +1533,7 @@ nsTableRowGroupFrame::GetHeightBasis(const nsHTMLReflowState& aReflowState)
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (tableFrame) {
if ((aReflowState.ComputedHeight() > 0) && (aReflowState.ComputedHeight() < NS_UNCONSTRAINEDSIZE)) {
nscoord cellSpacing = PR_MAX(0, GetRowCount() - 1) * tableFrame->GetCellSpacingY();
nscoord cellSpacing = NS_MAX(0, GetRowCount() - 1) * tableFrame->GetCellSpacingY();
result = aReflowState.ComputedHeight() - cellSpacing;
}
else {
@ -1543,7 +1543,7 @@ nsTableRowGroupFrame::GetHeightBasis(const nsHTMLReflowState& aReflowState)
}
if (parentRS && (tableFrame == parentRS->frame) &&
(parentRS->ComputedHeight() > 0) && (parentRS->ComputedHeight() < NS_UNCONSTRAINEDSIZE)) {
nscoord cellSpacing = PR_MAX(0, tableFrame->GetRowCount() + 1) * tableFrame->GetCellSpacingY();
nscoord cellSpacing = NS_MAX(0, tableFrame->GetRowCount() + 1) * tableFrame->GetCellSpacingY();
result = parentRS->ComputedHeight() - cellSpacing;
}
}
@ -1915,7 +1915,7 @@ nsTableRowGroupFrame::FrameCursorData::AppendFrame(nsIFrame* aFrame)
return PR_TRUE;
nscoord overflowAbove = -overflowRect.y;
nscoord overflowBelow = overflowRect.YMost() - aFrame->GetSize().height;
mOverflowAbove = PR_MAX(mOverflowAbove, overflowAbove);
mOverflowBelow = PR_MAX(mOverflowBelow, overflowBelow);
mOverflowAbove = NS_MAX(mOverflowAbove, overflowAbove);
mOverflowBelow = NS_MAX(mOverflowBelow, overflowBelow);
return mFrames.AppendElement(aFrame) != nsnull;
}

Просмотреть файл

@ -216,7 +216,7 @@ nsGridRowLeafLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, ns
}
// initialize the box size here
max = PR_MAX(min, max);
max = NS_MAX(min, max);
pref = nsBox::BoundsCheck(min, pref, max);
current = new (aState) nsBoxSize();

Просмотреть файл

@ -977,8 +977,8 @@ nsBox::BoundsCheck(nscoord aMin, nscoord aPref, nscoord aMax)
nsSize
nsBox::BoundsCheckMinMax(const nsSize& aMinSize, const nsSize& aMaxSize)
{
return nsSize(PR_MAX(aMaxSize.width, aMinSize.width),
PR_MAX(aMaxSize.height, aMinSize.height));
return nsSize(NS_MAX(aMaxSize.width, aMinSize.width),
NS_MAX(aMaxSize.height, aMinSize.height));
}
nsSize

Просмотреть файл

@ -636,7 +636,7 @@ nsBoxFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
GetBorderAndPadding(bp);
result = minSize.width - bp.LeftRight();
result = PR_MAX(result, 0);
result = NS_MAX(result, 0);
return result;
}
@ -658,7 +658,7 @@ nsBoxFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
GetBorderAndPadding(bp);
result = prefSize.width - bp.LeftRight();
result = PR_MAX(result, 0);
result = NS_MAX(result, 0);
return result;
}

Просмотреть файл

@ -65,7 +65,7 @@ nsListItemFrame::GetPrefSize(nsBoxLayoutState& aState)
// guarantee that our preferred height doesn't exceed the standard
// listbox row height
size.height = PR_MAX(mRect.height, size.height);
size.height = NS_MAX(mRect.height, size.height);
return size;
}

Просмотреть файл

@ -405,15 +405,15 @@ nsSliderFrame::DoLayout(nsBoxLayoutState& aState)
PRInt32 maxPos = GetMaxPosition(scrollbar);
PRInt32 pageIncrement = GetPageIncrement(scrollbar);
maxPos = PR_MAX(minPos, maxPos);
curPos = PR_MAX(minPos, PR_MIN(curPos, maxPos));
maxPos = NS_MAX(minPos, maxPos);
curPos = NS_MAX(minPos, NS_MIN(curPos, maxPos));
nscoord& availableLength = IsHorizontal() ? clientRect.width : clientRect.height;
nscoord& thumbLength = IsHorizontal() ? thumbSize.width : thumbSize.height;
if ((pageIncrement + maxPos - minPos) > 0 && thumbBox->GetFlex(aState) > 0) {
float ratio = float(pageIncrement) / float(maxPos - minPos + pageIncrement);
thumbLength = PR_MAX(thumbLength, NSToCoordRound(availableLength * ratio));
thumbLength = NS_MAX(thumbLength, NSToCoordRound(availableLength * ratio));
}
// Round the thumb's length to device pixels.
@ -687,8 +687,8 @@ nsSliderFrame::CurrentPositionChanged(nsPresContext* aPresContext,
PRInt32 minPos = GetMinPosition(scrollbar);
PRInt32 maxPos = GetMaxPosition(scrollbar);
maxPos = PR_MAX(minPos, maxPos);
curPos = PR_MAX(minPos, PR_MIN(curPos, maxPos));
maxPos = NS_MAX(minPos, maxPos);
curPos = NS_MAX(minPos, NS_MIN(curPos, maxPos));
// get the thumb's rect
nsIFrame* thumbFrame = mFrames.FirstChild();

Просмотреть файл

@ -363,8 +363,8 @@ nsSprocketLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState)
prefSize = nsBox::BoundsCheck(minSize, prefSize, maxSize);
AddMargin(child, prefSize);
width = PR_MIN(prefSize.width, originalClientRect.width);
height = PR_MIN(prefSize.height, originalClientRect.height);
width = NS_MIN(prefSize.width, originalClientRect.width);
height = NS_MIN(prefSize.height, originalClientRect.height);
}
}
@ -907,7 +907,7 @@ nsSprocketLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, nsBox
// clamp all the flexes
currentBox = aBoxSizes;
while (currentBox) {
currentBox->flex = PR_MIN(currentBox->flex, maxAllowedFlex);
currentBox->flex = NS_MIN(currentBox->flex, maxAllowedFlex);
currentBox = currentBox->next;
}
}
@ -920,7 +920,7 @@ nsSprocketLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, nsBox
// we specified all our children are equal size;
if (frameState & NS_STATE_EQUAL_SIZE) {
smallestMaxWidth = PR_MAX(smallestMaxWidth, biggestMinWidth);
smallestMaxWidth = NS_MAX(smallestMaxWidth, biggestMinWidth);
biggestPrefWidth = nsBox::BoundsCheck(biggestMinWidth, biggestPrefWidth, smallestMaxWidth);
currentBox = aBoxSizes;

Просмотреть файл

@ -306,7 +306,7 @@ nsStackLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState)
nsSize min = child->GetMinSize(aState);
nsSize max = child->GetMaxSize(aState);
nscoord width = clientRect.width - offset.LeftRight() - margin.LeftRight();
childRect.width = PR_MAX(min.width, PR_MIN(max.width, width));
childRect.width = NS_MAX(min.width, NS_MIN(max.width, width));
}
else {
childRect.width = child->GetPrefSize(aState).width;
@ -323,7 +323,7 @@ nsStackLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState)
nsSize min = child->GetMinSize(aState);
nsSize max = child->GetMaxSize(aState);
nscoord height = clientRect.height - offset.TopBottom() - margin.TopBottom();
childRect.height = PR_MAX(min.height, PR_MIN(max.height, height));
childRect.height = NS_MAX(min.height, NS_MIN(max.height, height));
}
else {
childRect.height = child->GetPrefSize(aState).height;

Просмотреть файл

@ -571,7 +571,7 @@ void nsTextBoxFrame::PaintOneShadow(gfxContext* aCtx,
const nsRect& aDirtyRect) {
nsPoint shadowOffset(aShadowDetails->mXOffset,
aShadowDetails->mYOffset);
nscoord blurRadius = PR_MAX(aShadowDetails->mRadius, 0);
nscoord blurRadius = NS_MAX(aShadowDetails->mRadius, 0);
nsRect shadowRect(aTextRect);
shadowRect.MoveBy(shadowOffset);

Просмотреть файл

@ -448,7 +448,7 @@ nsTreeBodyFrame::ReflowFinished()
mPageLength = mInnerBox.height / mRowHeight;
}
PRInt32 lastPageTopRow = PR_MAX(0, mRowCount - mPageLength);
PRInt32 lastPageTopRow = NS_MAX(0, mRowCount - mPageLength);
if (mTopRowIndex > lastPageTopRow)
ScrollToRowInternal(parts, lastPageTopRow);
@ -1921,7 +1921,7 @@ nsTreeBodyFrame::RowCountChanged(PRInt32 aIndex, PRInt32 aCount)
else if (mTopRowIndex >= aIndex) {
// This is a full-blown invalidate.
if (mTopRowIndex + mPageLength > mRowCount - 1) {
mTopRowIndex = PR_MAX(0, mRowCount - 1 - mPageLength);
mTopRowIndex = NS_MAX(0, mRowCount - 1 - mPageLength);
}
needsInvalidation = PR_TRUE;
}
@ -1953,7 +1953,7 @@ nsTreeBodyFrame::EndUpdateBatch()
mView->GetRowCount(&mRowCount);
if (countBeforeUpdate != mRowCount) {
if (mTopRowIndex + mPageLength > mRowCount - 1) {
mTopRowIndex = PR_MAX(0, mRowCount - 1 - mPageLength);
mTopRowIndex = NS_MAX(0, mRowCount - 1 - mPageLength);
}
FullScrollbarsUpdate(PR_FALSE);
}
@ -4356,8 +4356,8 @@ nsTreeBodyFrame::OffsetForHorzScroll(nsRect& rect, PRBool clip)
return PR_FALSE;
if (clip) {
nscoord leftEdge = PR_MAX(rect.x, mInnerBox.x);
nscoord rightEdge = PR_MIN(rect.XMost(), mInnerBox.XMost());
nscoord leftEdge = NS_MAX(rect.x, mInnerBox.x);
nscoord rightEdge = NS_MIN(rect.XMost(), mInnerBox.XMost());
rect.x = leftEdge;
rect.width = rightEdge - leftEdge;