From 1dc5cd043fd3a8d9201e2b07526484930251f9ba Mon Sep 17 00:00:00 2001 From: "dbaron%fas.harvard.edu" Date: Thu, 16 May 2002 19:44:20 +0000 Subject: [PATCH] Fix to fix for bug 134580: quirks mode line height must ignore all whitespace at the beginning of the line, not just what happens to be in the first text node. b=134580 sr=waterson r=attinasi --- layout/generic/nsLineLayout.cpp | 20 ++++++++++++++------ layout/html/base/src/nsLineLayout.cpp | 20 ++++++++++++++------ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/layout/generic/nsLineLayout.cpp b/layout/generic/nsLineLayout.cpp index 139c5abc76b..803d646f4d0 100644 --- a/layout/generic/nsLineLayout.cpp +++ b/layout/generic/nsLineLayout.cpp @@ -2247,6 +2247,8 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) // since this code sets zeroEffectiveSpanBox even when there are // non-empty children. PRBool zeroEffectiveSpanBox = PR_FALSE; + // XXXldb If we really have empty continuations, then all these other + // checks don't make sense for them. if ((emptyContinuation || !InStrictMode()) && ((psd == mRootSpan) || ((0 == spanFramePFD->mBorderPadding.top) && @@ -2267,11 +2269,8 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) // mode) we don't want big line heights for things like //

Text

- // Don't count the first frame if it's only whitespace. (Somehow - // the last frame, if whitespace, is already ignored. So we're not - // quite compatible with Nav4.x, but it's probably good that we're - // ignoring the last frame. Still, I wonder where the code is - // that's doing it.) See bug 134580. + // Don't include any initial whitespace, unless we're preformatted. + // See bug 134580. PRUint32 flag = preMode ? PFD_ISTEXTFRAME : PFD_ISNONWHITESPACETEXTFRAME; zeroEffectiveSpanBox = PR_TRUE; for (PerFrameData* pfd = psd->mFirstFrame; pfd; pfd = pfd->mNext) { @@ -2279,7 +2278,16 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) zeroEffectiveSpanBox = PR_FALSE; break; } - flag = PFD_ISTEXTFRAME; + // The line could begin with multiple all-whitespace text frames, + // and we need to ignore all of them, including those contained + // within other inline frames. + if (flag != PFD_ISTEXTFRAME) { + PRBool empty; + pfd->mFrame->IsEmpty(PR_TRUE, preMode, &empty); + if (!empty) { + flag = PFD_ISTEXTFRAME; + } + } } } psd->mZeroEffectiveSpanBox = zeroEffectiveSpanBox; diff --git a/layout/html/base/src/nsLineLayout.cpp b/layout/html/base/src/nsLineLayout.cpp index 139c5abc76b..803d646f4d0 100644 --- a/layout/html/base/src/nsLineLayout.cpp +++ b/layout/html/base/src/nsLineLayout.cpp @@ -2247,6 +2247,8 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) // since this code sets zeroEffectiveSpanBox even when there are // non-empty children. PRBool zeroEffectiveSpanBox = PR_FALSE; + // XXXldb If we really have empty continuations, then all these other + // checks don't make sense for them. if ((emptyContinuation || !InStrictMode()) && ((psd == mRootSpan) || ((0 == spanFramePFD->mBorderPadding.top) && @@ -2267,11 +2269,8 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) // mode) we don't want big line heights for things like //

Text

- // Don't count the first frame if it's only whitespace. (Somehow - // the last frame, if whitespace, is already ignored. So we're not - // quite compatible with Nav4.x, but it's probably good that we're - // ignoring the last frame. Still, I wonder where the code is - // that's doing it.) See bug 134580. + // Don't include any initial whitespace, unless we're preformatted. + // See bug 134580. PRUint32 flag = preMode ? PFD_ISTEXTFRAME : PFD_ISNONWHITESPACETEXTFRAME; zeroEffectiveSpanBox = PR_TRUE; for (PerFrameData* pfd = psd->mFirstFrame; pfd; pfd = pfd->mNext) { @@ -2279,7 +2278,16 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) zeroEffectiveSpanBox = PR_FALSE; break; } - flag = PFD_ISTEXTFRAME; + // The line could begin with multiple all-whitespace text frames, + // and we need to ignore all of them, including those contained + // within other inline frames. + if (flag != PFD_ISTEXTFRAME) { + PRBool empty; + pfd->mFrame->IsEmpty(PR_TRUE, preMode, &empty); + if (!empty) { + flag = PFD_ISTEXTFRAME; + } + } } } psd->mZeroEffectiveSpanBox = zeroEffectiveSpanBox;