From 1053177d73568d42c3912e9046b0eff7653c1941 Mon Sep 17 00:00:00 2001 From: "karnaze%netscape.com" Date: Sun, 30 Apr 2000 22:29:01 +0000 Subject: [PATCH] Fix for Linux bustage, bug 37643. Give outer table reflow state initial computed values of 0 to avoid excessive reflows from boxes. --- layout/generic/nsHTMLReflowState.cpp | 2 +- layout/html/base/src/nsHTMLReflowState.cpp | 2 +- layout/html/document/src/html.css | 2 ++ layout/html/table/src/nsTableOuterFrame.cpp | 6 ++++-- layout/html/tests/table/bugs/file_list.txt | 2 +- layout/style/html.css | 2 ++ layout/tables/nsTableOuterFrame.cpp | 6 ++++-- layout/xul/base/src/nsTreeOuterFrame.cpp | 2 -- layout/xul/base/src/nsTreeRowGroupFrame.cpp | 4 +++- 9 files changed, 18 insertions(+), 10 deletions(-) diff --git a/layout/generic/nsHTMLReflowState.cpp b/layout/generic/nsHTMLReflowState.cpp index 374c8f0df035..453aad09db9e 100644 --- a/layout/generic/nsHTMLReflowState.cpp +++ b/layout/generic/nsHTMLReflowState.cpp @@ -1798,7 +1798,7 @@ nsHTMLReflowState::ComputeBlockBoxData(nsIPresContext* aPresContext, nsCOMPtr fType; frame->GetFrameType(getter_AddRefs(fType)); if (nsLayoutAtoms::tableOuterFrame == fType.get()) { - mComputedWidth = NS_SHRINKWRAPWIDTH; + mComputedWidth = 0; // XXX temp fix for trees } else if (nsLayoutAtoms::tableFrame == fType.get()) { mComputedWidth = NS_SHRINKWRAPWIDTH; if (eStyleUnit_Auto == mStyleSpacing->mMargin.GetLeftUnit()) { diff --git a/layout/html/base/src/nsHTMLReflowState.cpp b/layout/html/base/src/nsHTMLReflowState.cpp index 374c8f0df035..453aad09db9e 100644 --- a/layout/html/base/src/nsHTMLReflowState.cpp +++ b/layout/html/base/src/nsHTMLReflowState.cpp @@ -1798,7 +1798,7 @@ nsHTMLReflowState::ComputeBlockBoxData(nsIPresContext* aPresContext, nsCOMPtr fType; frame->GetFrameType(getter_AddRefs(fType)); if (nsLayoutAtoms::tableOuterFrame == fType.get()) { - mComputedWidth = NS_SHRINKWRAPWIDTH; + mComputedWidth = 0; // XXX temp fix for trees } else if (nsLayoutAtoms::tableFrame == fType.get()) { mComputedWidth = NS_SHRINKWRAPWIDTH; if (eStyleUnit_Auto == mStyleSpacing->mMargin.GetLeftUnit()) { diff --git a/layout/html/document/src/html.css b/layout/html/document/src/html.css index 0f88a98afd91..af56a92a3f95 100644 --- a/layout/html/document/src/html.css +++ b/layout/html/document/src/html.css @@ -1305,6 +1305,8 @@ sourcetext { /* XXX should not be in HTML namespace */ padding: 0px; float: inherit; position: inherit; + width: 0px; /* hack for boxes */ + height: 0px; /* hack for boxes */ } :table-cell { diff --git a/layout/html/table/src/nsTableOuterFrame.cpp b/layout/html/table/src/nsTableOuterFrame.cpp index 2f4a59601ca8..117fc0c8ea4d 100644 --- a/layout/html/table/src/nsTableOuterFrame.cpp +++ b/layout/html/table/src/nsTableOuterFrame.cpp @@ -841,12 +841,14 @@ nsTableOuterFrame::OuterReflowChild(nsIPresContext* aPresContext, // Normally, the outer table's mComputed values are NS_INTRINSICSIZE since they // depend on the caption and inner table. Boxes can force a size. - if (aOuterRS.mComputedWidth != NS_INTRINSICSIZE) { + if ((aOuterRS.mComputedWidth != NS_INTRINSICSIZE) && + (aOuterRS.mComputedWidth != 0)) { childRS.mComputedWidth = aOuterRS.mComputedWidth - aMargin.left - childRS.mComputedBorderPadding.left - childRS.mComputedBorderPadding.right - aMargin.right; childRS.mComputedWidth = PR_MAX(0, childRS.mComputedWidth); } - if (aOuterRS.mComputedHeight != NS_INTRINSICSIZE) { + if ((aOuterRS.mComputedHeight != NS_INTRINSICSIZE) && + (aOuterRS.mComputedHeight != 0)) { childRS.mComputedHeight = aOuterRS.mComputedHeight - aMargin.top - childRS.mComputedBorderPadding.top - childRS.mComputedBorderPadding.bottom - aMargin.bottom; childRS.mComputedHeight = PR_MAX(0, childRS.mComputedHeight); diff --git a/layout/html/tests/table/bugs/file_list.txt b/layout/html/tests/table/bugs/file_list.txt index edffef8e3092..2c547fbaf387 100644 --- a/layout/html/tests/table/bugs/file_list.txt +++ b/layout/html/tests/table/bugs/file_list.txt @@ -111,7 +111,7 @@ file:///s|/mozilla/layout/html/tests/table/bugs/bug23235.html file:///s|/mozilla/layout/html/tests/table/bugs/bug23299.html file:///s|/mozilla/layout/html/tests/table/bugs/bug23847.html file:///s|/mozilla/layout/html/tests/table/bugs/bug23994.html -file:///s|/mozilla/layout/html/tests/table/bugs/bug24200.html +#file:///s|/mozilla/layout/html/tests/table/bugs/bug24200.html file:///s|/mozilla/layout/html/tests/table/bugs/bug24627.html file:///s|/mozilla/layout/html/tests/table/bugs/bug24410.html file:///s|/mozilla/layout/html/tests/table/bugs/bug24503.html diff --git a/layout/style/html.css b/layout/style/html.css index 0f88a98afd91..af56a92a3f95 100644 --- a/layout/style/html.css +++ b/layout/style/html.css @@ -1305,6 +1305,8 @@ sourcetext { /* XXX should not be in HTML namespace */ padding: 0px; float: inherit; position: inherit; + width: 0px; /* hack for boxes */ + height: 0px; /* hack for boxes */ } :table-cell { diff --git a/layout/tables/nsTableOuterFrame.cpp b/layout/tables/nsTableOuterFrame.cpp index 2f4a59601ca8..117fc0c8ea4d 100644 --- a/layout/tables/nsTableOuterFrame.cpp +++ b/layout/tables/nsTableOuterFrame.cpp @@ -841,12 +841,14 @@ nsTableOuterFrame::OuterReflowChild(nsIPresContext* aPresContext, // Normally, the outer table's mComputed values are NS_INTRINSICSIZE since they // depend on the caption and inner table. Boxes can force a size. - if (aOuterRS.mComputedWidth != NS_INTRINSICSIZE) { + if ((aOuterRS.mComputedWidth != NS_INTRINSICSIZE) && + (aOuterRS.mComputedWidth != 0)) { childRS.mComputedWidth = aOuterRS.mComputedWidth - aMargin.left - childRS.mComputedBorderPadding.left - childRS.mComputedBorderPadding.right - aMargin.right; childRS.mComputedWidth = PR_MAX(0, childRS.mComputedWidth); } - if (aOuterRS.mComputedHeight != NS_INTRINSICSIZE) { + if ((aOuterRS.mComputedHeight != NS_INTRINSICSIZE) && + (aOuterRS.mComputedHeight != 0)) { childRS.mComputedHeight = aOuterRS.mComputedHeight - aMargin.top - childRS.mComputedBorderPadding.top - childRS.mComputedBorderPadding.bottom - aMargin.bottom; childRS.mComputedHeight = PR_MAX(0, childRS.mComputedHeight); diff --git a/layout/xul/base/src/nsTreeOuterFrame.cpp b/layout/xul/base/src/nsTreeOuterFrame.cpp index faa8ae68fd7f..580d35b0e6ea 100644 --- a/layout/xul/base/src/nsTreeOuterFrame.cpp +++ b/layout/xul/base/src/nsTreeOuterFrame.cpp @@ -121,7 +121,6 @@ nsTreeOuterFrame::Reflow(nsIPresContext* aPresContext, goodState.reason = eReflowReason_Resize; return Reflow(aPresContext, aDesiredSize, goodState, aStatus); } - if (aReflowState.mComputedWidth == NS_UNCONSTRAINEDSIZE) { NS_WARNING("Inefficient XUL: Reflowing outer tree frame with unconstrained width, try giving it a width in CSS!"); nsHTMLReflowState goodState(aReflowState); @@ -133,7 +132,6 @@ nsTreeOuterFrame::Reflow(nsIPresContext* aPresContext, NS_WARNING("Inefficient XUL: Reflowing outer tree frame with unconstrained height, try giving it a height in CSS!"); } //printf("TOF Width: %d, TOF Height: %d\n", aReflowState.mComputedWidth, aReflowState.mComputedHeight); - nsresult rv = nsTableOuterFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus); nsITreeFrame* tree = FindTreeFrame(aPresContext); diff --git a/layout/xul/base/src/nsTreeRowGroupFrame.cpp b/layout/xul/base/src/nsTreeRowGroupFrame.cpp index b39503c443da..7c60b77068f1 100644 --- a/layout/xul/base/src/nsTreeRowGroupFrame.cpp +++ b/layout/xul/base/src/nsTreeRowGroupFrame.cpp @@ -835,7 +835,9 @@ nsTreeRowGroupFrame::SetScrollbarFrame(nsIPresContext* aPresContext, nsIFrame* a nsIFrame* result; nsScrollbarButtonFrame::GetChildWithTag(aPresContext, nsXULAtoms::slider, aFrame, result); - ((nsSliderFrame*)result)->SetScrollbarListener(this); + if (result) { + ((nsSliderFrame*)result)->SetScrollbarListener(this); + } } PRBool nsTreeRowGroupFrame::RowGroupDesiresExcessSpace()