From a64bae2eaf342cdcb385ca1ff79f9c35db4e6a72 Mon Sep 17 00:00:00 2001 From: "dholbert%cs.stanford.edu" Date: Fri, 9 Nov 2007 17:16:36 +0000 Subject: [PATCH] Bug 398181: Use NSCoordSaturatingAdd/Subtract in 3 places where we might have unconstrained heights. r+sr+a=roc git-svn-id: svn://10.0.0.236/trunk@239069 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsFrame.cpp | 4 ++-- mozilla/layout/generic/nsTextFrameThebes.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index b2419f2e64c..3f49ec1b174 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -2866,12 +2866,12 @@ nsIFrame::InlinePrefWidthData::ForceBreak(nsIRenderingContext *aRenderingContext if (floats_cur > floats_done) floats_done = floats_cur; - currentLine += floats_done; + currentLine = NSCoordSaturatingAdd(currentLine, floats_done); floats.Clear(); } - currentLine -= trailingWhitespace; + currentLine = NSCoordSaturatingSubtract(currentLine, trailingWhitespace, nscoord_MAX); prevLines = PR_MAX(prevLines, currentLine); currentLine = trailingWhitespace = 0; } diff --git a/mozilla/layout/generic/nsTextFrameThebes.cpp b/mozilla/layout/generic/nsTextFrameThebes.cpp index d31d911b32c..d6dd17a25f4 100644 --- a/mozilla/layout/generic/nsTextFrameThebes.cpp +++ b/mozilla/layout/generic/nsTextFrameThebes.cpp @@ -4933,7 +4933,7 @@ nsTextFrame::AddInlinePrefWidthForFlow(nsIRenderingContext *aRenderingContext, // onto one line, so just measure it nscoord width = NSToCoordCeil(mTextRun->GetAdvanceWidth(start, flowEndInTextRun - start, &provider)); - aData->currentLine += width; + aData->currentLine = NSCoordSaturatingAdd(aData->currentLine, width); PRUint32 trimStart = GetEndOfTrimmedText(provider.GetFragment(), start, flowEndInTextRun, &iter);