From c7f877db2d69f640364e755dc11a189d8697e785 Mon Sep 17 00:00:00 2001 From: "dbaron%fas.harvard.edu" Date: Mon, 4 Sep 2000 21:44:48 +0000 Subject: [PATCH] Don't apply top margin to a block containing only floaters. Let it collapse through instead. b=44419 Only do the quirky fix for bug 37657 for tables, not all blocks. b=43086 r=buster@netscape.com git-svn-id: svn://10.0.0.236/trunk@78109 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsBlockFrame.cpp | 18 +++++++++--------- mozilla/layout/generic/nsBlockReflowState.cpp | 18 +++++++++--------- mozilla/layout/generic/nsBlockReflowState.h | 18 +++++++++--------- mozilla/layout/html/base/src/nsBlockFrame.cpp | 18 +++++++++--------- .../html/base/src/nsBlockReflowState.cpp | 18 +++++++++--------- .../layout/html/base/src/nsBlockReflowState.h | 18 +++++++++--------- 6 files changed, 54 insertions(+), 54 deletions(-) diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index ec16151e5fe..3d04a7c8cad 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/layout/generic/nsBlockFrame.cpp @@ -20,6 +20,7 @@ * Contributor(s): * Steve Clark * Robert O'Callahan + * L. David Baron */ #include "nsCOMPtr.h" #include "nsBlockFrame.h" @@ -1153,6 +1154,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, } } +// XXX Does this do anything? It doesn't seem to work.... (bug 29413) // It's possible that the line has clear after semantics if (!aLine->IsBlock() && aLine->HasBreak()) { PRUint8 breakType = aLine->GetBreakType(); @@ -3675,12 +3677,8 @@ nsBlockFrame::ShouldApplyTopMargin(nsBlockReflowState& aState, aState.SetFlag(BRS_APPLYTOPMARGIN, PR_TRUE); return PR_TRUE; } - else if (line->HasFloaters()) { - // A line which preceeds aLine is not empty therefore the top - // margin applies. - aState.SetFlag(BRS_APPLYTOPMARGIN, PR_TRUE); - return PR_TRUE; - } + // No need to apply the top margin if the line has floaters. We + // should collapse anyway (bug 44419) line = line->mNext; } @@ -5954,11 +5952,13 @@ nsBlockReflowState::PlaceFloater(nsFloaterCache* aFloaterCache, // #ifdef FIX_BUG_37657 // Also note that in backwards compatibility mode, we skip this step - // In old browsers, floaters are horizontally stacked regardless of - // available space + // for tables, since in old browsers, floating tables are horizontally + // stacked regardless of available space. (See bug 43086 about + // tables vs. non-tables.) nsCompatibility mode; mPresContext->GetCompatibilityMode(&mode); - if (eCompatibility_NavQuirks != mode) { + if ((eCompatibility_NavQuirks != mode) || + (NS_STYLE_DISPLAY_TABLE != floaterDisplay->mDisplay)) { while (!CanPlaceFloater(region, floaterDisplay->mFloats)) { mY += mAvailSpaceRect.height; GetAvailableSpace(); diff --git a/mozilla/layout/generic/nsBlockReflowState.cpp b/mozilla/layout/generic/nsBlockReflowState.cpp index ec16151e5fe..3d04a7c8cad 100644 --- a/mozilla/layout/generic/nsBlockReflowState.cpp +++ b/mozilla/layout/generic/nsBlockReflowState.cpp @@ -20,6 +20,7 @@ * Contributor(s): * Steve Clark * Robert O'Callahan + * L. David Baron */ #include "nsCOMPtr.h" #include "nsBlockFrame.h" @@ -1153,6 +1154,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, } } +// XXX Does this do anything? It doesn't seem to work.... (bug 29413) // It's possible that the line has clear after semantics if (!aLine->IsBlock() && aLine->HasBreak()) { PRUint8 breakType = aLine->GetBreakType(); @@ -3675,12 +3677,8 @@ nsBlockFrame::ShouldApplyTopMargin(nsBlockReflowState& aState, aState.SetFlag(BRS_APPLYTOPMARGIN, PR_TRUE); return PR_TRUE; } - else if (line->HasFloaters()) { - // A line which preceeds aLine is not empty therefore the top - // margin applies. - aState.SetFlag(BRS_APPLYTOPMARGIN, PR_TRUE); - return PR_TRUE; - } + // No need to apply the top margin if the line has floaters. We + // should collapse anyway (bug 44419) line = line->mNext; } @@ -5954,11 +5952,13 @@ nsBlockReflowState::PlaceFloater(nsFloaterCache* aFloaterCache, // #ifdef FIX_BUG_37657 // Also note that in backwards compatibility mode, we skip this step - // In old browsers, floaters are horizontally stacked regardless of - // available space + // for tables, since in old browsers, floating tables are horizontally + // stacked regardless of available space. (See bug 43086 about + // tables vs. non-tables.) nsCompatibility mode; mPresContext->GetCompatibilityMode(&mode); - if (eCompatibility_NavQuirks != mode) { + if ((eCompatibility_NavQuirks != mode) || + (NS_STYLE_DISPLAY_TABLE != floaterDisplay->mDisplay)) { while (!CanPlaceFloater(region, floaterDisplay->mFloats)) { mY += mAvailSpaceRect.height; GetAvailableSpace(); diff --git a/mozilla/layout/generic/nsBlockReflowState.h b/mozilla/layout/generic/nsBlockReflowState.h index ec16151e5fe..3d04a7c8cad 100644 --- a/mozilla/layout/generic/nsBlockReflowState.h +++ b/mozilla/layout/generic/nsBlockReflowState.h @@ -20,6 +20,7 @@ * Contributor(s): * Steve Clark * Robert O'Callahan + * L. David Baron */ #include "nsCOMPtr.h" #include "nsBlockFrame.h" @@ -1153,6 +1154,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, } } +// XXX Does this do anything? It doesn't seem to work.... (bug 29413) // It's possible that the line has clear after semantics if (!aLine->IsBlock() && aLine->HasBreak()) { PRUint8 breakType = aLine->GetBreakType(); @@ -3675,12 +3677,8 @@ nsBlockFrame::ShouldApplyTopMargin(nsBlockReflowState& aState, aState.SetFlag(BRS_APPLYTOPMARGIN, PR_TRUE); return PR_TRUE; } - else if (line->HasFloaters()) { - // A line which preceeds aLine is not empty therefore the top - // margin applies. - aState.SetFlag(BRS_APPLYTOPMARGIN, PR_TRUE); - return PR_TRUE; - } + // No need to apply the top margin if the line has floaters. We + // should collapse anyway (bug 44419) line = line->mNext; } @@ -5954,11 +5952,13 @@ nsBlockReflowState::PlaceFloater(nsFloaterCache* aFloaterCache, // #ifdef FIX_BUG_37657 // Also note that in backwards compatibility mode, we skip this step - // In old browsers, floaters are horizontally stacked regardless of - // available space + // for tables, since in old browsers, floating tables are horizontally + // stacked regardless of available space. (See bug 43086 about + // tables vs. non-tables.) nsCompatibility mode; mPresContext->GetCompatibilityMode(&mode); - if (eCompatibility_NavQuirks != mode) { + if ((eCompatibility_NavQuirks != mode) || + (NS_STYLE_DISPLAY_TABLE != floaterDisplay->mDisplay)) { while (!CanPlaceFloater(region, floaterDisplay->mFloats)) { mY += mAvailSpaceRect.height; GetAvailableSpace(); diff --git a/mozilla/layout/html/base/src/nsBlockFrame.cpp b/mozilla/layout/html/base/src/nsBlockFrame.cpp index ec16151e5fe..3d04a7c8cad 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.cpp +++ b/mozilla/layout/html/base/src/nsBlockFrame.cpp @@ -20,6 +20,7 @@ * Contributor(s): * Steve Clark * Robert O'Callahan + * L. David Baron */ #include "nsCOMPtr.h" #include "nsBlockFrame.h" @@ -1153,6 +1154,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, } } +// XXX Does this do anything? It doesn't seem to work.... (bug 29413) // It's possible that the line has clear after semantics if (!aLine->IsBlock() && aLine->HasBreak()) { PRUint8 breakType = aLine->GetBreakType(); @@ -3675,12 +3677,8 @@ nsBlockFrame::ShouldApplyTopMargin(nsBlockReflowState& aState, aState.SetFlag(BRS_APPLYTOPMARGIN, PR_TRUE); return PR_TRUE; } - else if (line->HasFloaters()) { - // A line which preceeds aLine is not empty therefore the top - // margin applies. - aState.SetFlag(BRS_APPLYTOPMARGIN, PR_TRUE); - return PR_TRUE; - } + // No need to apply the top margin if the line has floaters. We + // should collapse anyway (bug 44419) line = line->mNext; } @@ -5954,11 +5952,13 @@ nsBlockReflowState::PlaceFloater(nsFloaterCache* aFloaterCache, // #ifdef FIX_BUG_37657 // Also note that in backwards compatibility mode, we skip this step - // In old browsers, floaters are horizontally stacked regardless of - // available space + // for tables, since in old browsers, floating tables are horizontally + // stacked regardless of available space. (See bug 43086 about + // tables vs. non-tables.) nsCompatibility mode; mPresContext->GetCompatibilityMode(&mode); - if (eCompatibility_NavQuirks != mode) { + if ((eCompatibility_NavQuirks != mode) || + (NS_STYLE_DISPLAY_TABLE != floaterDisplay->mDisplay)) { while (!CanPlaceFloater(region, floaterDisplay->mFloats)) { mY += mAvailSpaceRect.height; GetAvailableSpace(); diff --git a/mozilla/layout/html/base/src/nsBlockReflowState.cpp b/mozilla/layout/html/base/src/nsBlockReflowState.cpp index ec16151e5fe..3d04a7c8cad 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowState.cpp +++ b/mozilla/layout/html/base/src/nsBlockReflowState.cpp @@ -20,6 +20,7 @@ * Contributor(s): * Steve Clark * Robert O'Callahan + * L. David Baron */ #include "nsCOMPtr.h" #include "nsBlockFrame.h" @@ -1153,6 +1154,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, } } +// XXX Does this do anything? It doesn't seem to work.... (bug 29413) // It's possible that the line has clear after semantics if (!aLine->IsBlock() && aLine->HasBreak()) { PRUint8 breakType = aLine->GetBreakType(); @@ -3675,12 +3677,8 @@ nsBlockFrame::ShouldApplyTopMargin(nsBlockReflowState& aState, aState.SetFlag(BRS_APPLYTOPMARGIN, PR_TRUE); return PR_TRUE; } - else if (line->HasFloaters()) { - // A line which preceeds aLine is not empty therefore the top - // margin applies. - aState.SetFlag(BRS_APPLYTOPMARGIN, PR_TRUE); - return PR_TRUE; - } + // No need to apply the top margin if the line has floaters. We + // should collapse anyway (bug 44419) line = line->mNext; } @@ -5954,11 +5952,13 @@ nsBlockReflowState::PlaceFloater(nsFloaterCache* aFloaterCache, // #ifdef FIX_BUG_37657 // Also note that in backwards compatibility mode, we skip this step - // In old browsers, floaters are horizontally stacked regardless of - // available space + // for tables, since in old browsers, floating tables are horizontally + // stacked regardless of available space. (See bug 43086 about + // tables vs. non-tables.) nsCompatibility mode; mPresContext->GetCompatibilityMode(&mode); - if (eCompatibility_NavQuirks != mode) { + if ((eCompatibility_NavQuirks != mode) || + (NS_STYLE_DISPLAY_TABLE != floaterDisplay->mDisplay)) { while (!CanPlaceFloater(region, floaterDisplay->mFloats)) { mY += mAvailSpaceRect.height; GetAvailableSpace(); diff --git a/mozilla/layout/html/base/src/nsBlockReflowState.h b/mozilla/layout/html/base/src/nsBlockReflowState.h index ec16151e5fe..3d04a7c8cad 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowState.h +++ b/mozilla/layout/html/base/src/nsBlockReflowState.h @@ -20,6 +20,7 @@ * Contributor(s): * Steve Clark * Robert O'Callahan + * L. David Baron */ #include "nsCOMPtr.h" #include "nsBlockFrame.h" @@ -1153,6 +1154,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, } } +// XXX Does this do anything? It doesn't seem to work.... (bug 29413) // It's possible that the line has clear after semantics if (!aLine->IsBlock() && aLine->HasBreak()) { PRUint8 breakType = aLine->GetBreakType(); @@ -3675,12 +3677,8 @@ nsBlockFrame::ShouldApplyTopMargin(nsBlockReflowState& aState, aState.SetFlag(BRS_APPLYTOPMARGIN, PR_TRUE); return PR_TRUE; } - else if (line->HasFloaters()) { - // A line which preceeds aLine is not empty therefore the top - // margin applies. - aState.SetFlag(BRS_APPLYTOPMARGIN, PR_TRUE); - return PR_TRUE; - } + // No need to apply the top margin if the line has floaters. We + // should collapse anyway (bug 44419) line = line->mNext; } @@ -5954,11 +5952,13 @@ nsBlockReflowState::PlaceFloater(nsFloaterCache* aFloaterCache, // #ifdef FIX_BUG_37657 // Also note that in backwards compatibility mode, we skip this step - // In old browsers, floaters are horizontally stacked regardless of - // available space + // for tables, since in old browsers, floating tables are horizontally + // stacked regardless of available space. (See bug 43086 about + // tables vs. non-tables.) nsCompatibility mode; mPresContext->GetCompatibilityMode(&mode); - if (eCompatibility_NavQuirks != mode) { + if ((eCompatibility_NavQuirks != mode) || + (NS_STYLE_DISPLAY_TABLE != floaterDisplay->mDisplay)) { while (!CanPlaceFloater(region, floaterDisplay->mFloats)) { mY += mAvailSpaceRect.height; GetAvailableSpace();