Bug 786533 - Replace NS_MIN/NS_MAX with std::min/std::max and #include <algorithm> where needed. r=ehsan
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
#include "nsIPresShell.h"
|
||||
|
||||
#include "nsBoxLayoutState.h"
|
||||
#include <algorithm>
|
||||
//for keylistener for "return" check
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDocument.h" //observe documents to send onchangenotifications
|
||||
@@ -200,7 +201,7 @@ nsTextControlFrame::CalcIntrinsicSize(nsRenderingContext* aRenderingContext,
|
||||
// this if charMaxAdvance != charWidth; if they are equal, this is almost
|
||||
// certainly a fixed-width font.
|
||||
if (charWidth != charMaxAdvance) {
|
||||
nscoord internalPadding = NS_MAX(0, charMaxAdvance -
|
||||
nscoord internalPadding = std::max(0, charMaxAdvance -
|
||||
nsPresContext::CSSPixelsToAppUnits(4));
|
||||
nscoord t = nsPresContext::CSSPixelsToAppUnits(1);
|
||||
// Round to a multiple of t
|
||||
@@ -567,8 +568,8 @@ nsTextControlFrame::ReflowTextControlChild(nsIFrame* aKid,
|
||||
// compute available size and frame offsets for child
|
||||
nsSize availSize(aReflowState.ComputedWidth(),
|
||||
aReflowState.ComputedHeight());
|
||||
availSize.width = NS_MAX(availSize.width, 0);
|
||||
availSize.height = NS_MAX(availSize.height, 0);
|
||||
availSize.width = std::max(availSize.width, 0);
|
||||
availSize.height = std::max(availSize.height, 0);
|
||||
|
||||
nsHTMLReflowState kidReflowState(aPresContext, aReflowState,
|
||||
aKid, availSize);
|
||||
@@ -577,13 +578,13 @@ nsTextControlFrame::ReflowTextControlChild(nsIFrame* aKid,
|
||||
nscoord width = availSize.width;
|
||||
width -= kidReflowState.mComputedMargin.LeftRight() +
|
||||
kidReflowState.mComputedBorderPadding.LeftRight();
|
||||
width = NS_MAX(width, 0);
|
||||
width = std::max(width, 0);
|
||||
kidReflowState.SetComputedWidth(width);
|
||||
|
||||
nscoord height = availSize.height;
|
||||
height -= kidReflowState.mComputedMargin.TopBottom() +
|
||||
kidReflowState.mComputedBorderPadding.TopBottom();
|
||||
height = NS_MAX(height, 0);
|
||||
height = std::max(height, 0);
|
||||
kidReflowState.SetComputedHeight(height);
|
||||
|
||||
// compute the offsets
|
||||
@@ -1036,7 +1037,7 @@ nsTextControlFrame::OffsetToDOMPoint(int32_t aOffset,
|
||||
} else {
|
||||
// Otherwise, set the selection on the textnode itself.
|
||||
NS_IF_ADDREF(*aResult = firstNode);
|
||||
*aPosition = NS_MIN(aOffset, int32_t(textLength));
|
||||
*aPosition = std::min(aOffset, int32_t(textLength));
|
||||
}
|
||||
} else {
|
||||
NS_IF_ADDREF(*aResult = rootNode);
|
||||
|
||||
Reference in New Issue
Block a user