From c66af173cf97068ea603de82ec17c71aec425f5f Mon Sep 17 00:00:00 2001 From: "roc+%cs.cmu.edu" Date: Wed, 1 Sep 2004 13:33:17 +0000 Subject: [PATCH] Bug 257430. nsImageFrame and nsTableRowFrame need to always include their frame bounds in their overflow area. r+sr=dbaron git-svn-id: svn://10.0.0.236/trunk@161574 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsFrame.cpp | 3 +++ mozilla/layout/generic/nsImageFrame.cpp | 1 + mozilla/layout/html/base/src/nsFrame.cpp | 3 +++ mozilla/layout/html/base/src/nsImageFrame.cpp | 1 + mozilla/layout/html/table/src/nsTableRowFrame.cpp | 7 +++++++ mozilla/layout/tables/nsTableRowFrame.cpp | 7 +++++++ 6 files changed, 22 insertions(+) diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index 534e847cb78..886cd632b89 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -4201,6 +4201,9 @@ nsIFrame::FinishAndStoreOverflow(nsRect* aOverflowArea, nsSize aNewSize) // can happen here, e.g. CSS2 outline. // If we find more things other than outline that need to be added, // we should think about starting a new method like GetAdditionalOverflow() + NS_ASSERTION(aNewSize.width == 0 || aNewSize.height == 0 || + aOverflowArea->Contains(nsRect(nsPoint(0, 0), aNewSize)), + "Computed overflow area must contain frame bounds"); PRBool hasOutline; nsRect outlineRect(ComputeOutlineRect(this, &hasOutline, *aOverflowArea)); diff --git a/mozilla/layout/generic/nsImageFrame.cpp b/mozilla/layout/generic/nsImageFrame.cpp index 54bf09b8bea..110484e17e9 100644 --- a/mozilla/layout/generic/nsImageFrame.cpp +++ b/mozilla/layout/generic/nsImageFrame.cpp @@ -1030,6 +1030,7 @@ nsImageFrame::Reflow(nsPresContext* aPresContext, if (aMetrics.mFlags & NS_REFLOW_CALC_MAX_WIDTH) { aMetrics.mMaximumWidth = aMetrics.width; } + aMetrics.mOverflowArea.SetRect(0, 0, aMetrics.width, aMetrics.height); FinishAndStoreOverflow(&aMetrics); NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, diff --git a/mozilla/layout/html/base/src/nsFrame.cpp b/mozilla/layout/html/base/src/nsFrame.cpp index 534e847cb78..886cd632b89 100644 --- a/mozilla/layout/html/base/src/nsFrame.cpp +++ b/mozilla/layout/html/base/src/nsFrame.cpp @@ -4201,6 +4201,9 @@ nsIFrame::FinishAndStoreOverflow(nsRect* aOverflowArea, nsSize aNewSize) // can happen here, e.g. CSS2 outline. // If we find more things other than outline that need to be added, // we should think about starting a new method like GetAdditionalOverflow() + NS_ASSERTION(aNewSize.width == 0 || aNewSize.height == 0 || + aOverflowArea->Contains(nsRect(nsPoint(0, 0), aNewSize)), + "Computed overflow area must contain frame bounds"); PRBool hasOutline; nsRect outlineRect(ComputeOutlineRect(this, &hasOutline, *aOverflowArea)); diff --git a/mozilla/layout/html/base/src/nsImageFrame.cpp b/mozilla/layout/html/base/src/nsImageFrame.cpp index 54bf09b8bea..110484e17e9 100644 --- a/mozilla/layout/html/base/src/nsImageFrame.cpp +++ b/mozilla/layout/html/base/src/nsImageFrame.cpp @@ -1030,6 +1030,7 @@ nsImageFrame::Reflow(nsPresContext* aPresContext, if (aMetrics.mFlags & NS_REFLOW_CALC_MAX_WIDTH) { aMetrics.mMaximumWidth = aMetrics.width; } + aMetrics.mOverflowArea.SetRect(0, 0, aMetrics.width, aMetrics.height); FinishAndStoreOverflow(&aMetrics); NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, diff --git a/mozilla/layout/html/table/src/nsTableRowFrame.cpp b/mozilla/layout/html/table/src/nsTableRowFrame.cpp index ddc21633fbf..5d6f3979ea4 100644 --- a/mozilla/layout/html/table/src/nsTableRowFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableRowFrame.cpp @@ -1317,6 +1317,13 @@ nsTableRowFrame::IR_TargetIsChild(nsPresContext* aPresContext, else { // we dont realign vertical but we need to update the overflow area nsIFrame* cellKidFrame = cellFrame->GetFirstChild(nsnull); if (cellKidFrame) { + // XXX This is bogus. The code above changes the cell width + // and height but leaves the overflow area alone. How can that + // be right? + + // Make sure the overflow area includes the width and height, in any case. + cellMet.mOverflowArea.UnionRect(cellMet.mOverflowArea, + nsRect(0, 0, cellMet.width, cellMet.height)); cellFrame->ConsiderChildOverflow(aPresContext, cellMet.mOverflowArea, cellKidFrame); cellFrame->FinishAndStoreOverflow(&cellMet); if (cellFrame->HasView()) { diff --git a/mozilla/layout/tables/nsTableRowFrame.cpp b/mozilla/layout/tables/nsTableRowFrame.cpp index ddc21633fbf..5d6f3979ea4 100644 --- a/mozilla/layout/tables/nsTableRowFrame.cpp +++ b/mozilla/layout/tables/nsTableRowFrame.cpp @@ -1317,6 +1317,13 @@ nsTableRowFrame::IR_TargetIsChild(nsPresContext* aPresContext, else { // we dont realign vertical but we need to update the overflow area nsIFrame* cellKidFrame = cellFrame->GetFirstChild(nsnull); if (cellKidFrame) { + // XXX This is bogus. The code above changes the cell width + // and height but leaves the overflow area alone. How can that + // be right? + + // Make sure the overflow area includes the width and height, in any case. + cellMet.mOverflowArea.UnionRect(cellMet.mOverflowArea, + nsRect(0, 0, cellMet.width, cellMet.height)); cellFrame->ConsiderChildOverflow(aPresContext, cellMet.mOverflowArea, cellKidFrame); cellFrame->FinishAndStoreOverflow(&cellMet); if (cellFrame->HasView()) {