From 31352557b20f356c605d2ece324f8ebd0d01ed08 Mon Sep 17 00:00:00 2001 From: "kipp%netscape.com" Date: Mon, 3 May 1999 20:54:11 +0000 Subject: [PATCH] Tweaked to handle updated line-height calculation code that will now return -1 sometimes git-svn-id: svn://10.0.0.236/trunk@29986 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsLineLayout.cpp | 13 ++++++++++--- mozilla/layout/html/base/src/nsLineLayout.cpp | 13 ++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/mozilla/layout/generic/nsLineLayout.cpp b/mozilla/layout/generic/nsLineLayout.cpp index cc017619a88..8a2a32da27f 100644 --- a/mozilla/layout/generic/nsLineLayout.cpp +++ b/mozilla/layout/generic/nsLineLayout.cpp @@ -1538,9 +1538,16 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) nsHTMLReflowState::CalcLineHeight(mPresContext, parentFrame); nscoord contentHeight = parentPFD->mBounds.height - parentPFD->mBorderPadding.top - parentPFD->mBorderPadding.bottom; - nscoord leading = logicalHeight - contentHeight; - psd->mTopLeading = leading / 2; - psd->mBottomLeading = leading - psd->mTopLeading; + if (logicalHeight > 0) { + nscoord leading = logicalHeight - contentHeight; + psd->mTopLeading = leading / 2; + psd->mBottomLeading = leading - psd->mTopLeading; + } + else { + psd->mTopLeading = 0; + psd->mBottomLeading = 0; + logicalHeight = contentHeight; + } psd->mLogicalHeight = logicalHeight; // The initial values for the min and max Y values are in the spans diff --git a/mozilla/layout/html/base/src/nsLineLayout.cpp b/mozilla/layout/html/base/src/nsLineLayout.cpp index cc017619a88..8a2a32da27f 100644 --- a/mozilla/layout/html/base/src/nsLineLayout.cpp +++ b/mozilla/layout/html/base/src/nsLineLayout.cpp @@ -1538,9 +1538,16 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) nsHTMLReflowState::CalcLineHeight(mPresContext, parentFrame); nscoord contentHeight = parentPFD->mBounds.height - parentPFD->mBorderPadding.top - parentPFD->mBorderPadding.bottom; - nscoord leading = logicalHeight - contentHeight; - psd->mTopLeading = leading / 2; - psd->mBottomLeading = leading - psd->mTopLeading; + if (logicalHeight > 0) { + nscoord leading = logicalHeight - contentHeight; + psd->mTopLeading = leading / 2; + psd->mBottomLeading = leading - psd->mTopLeading; + } + else { + psd->mTopLeading = 0; + psd->mBottomLeading = 0; + logicalHeight = contentHeight; + } psd->mLogicalHeight = logicalHeight; // The initial values for the min and max Y values are in the spans