From 3e91c0d918f5adf9e962f8bbf55dfbc75d8e72b6 Mon Sep 17 00:00:00 2001 From: "troy%netscape.com" Date: Wed, 27 Jan 1999 05:58:43 +0000 Subject: [PATCH] Changed Reflow() to take into account absolutely positioned child frames when computing the desired size git-svn-id: svn://10.0.0.236/trunk@18750 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsHTMLFrame.cpp | 18 ++++++++++++++++++ mozilla/layout/html/base/src/nsHTMLFrame.cpp | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/mozilla/layout/generic/nsHTMLFrame.cpp b/mozilla/layout/generic/nsHTMLFrame.cpp index 9db67e9caf2..71bd7649a1f 100644 --- a/mozilla/layout/generic/nsHTMLFrame.cpp +++ b/mozilla/layout/generic/nsHTMLFrame.cpp @@ -37,8 +37,10 @@ #include "nsIEventStateManager.h" #include "nsIDeviceContext.h" #include "nsIScrollableView.h" +#include "nsIAreaFrame.h" // Interface IDs +static NS_DEFINE_IID(kAreaFrameIID, NS_IAREAFRAME_IID); static NS_DEFINE_IID(kScrollViewIID, NS_ISCROLLABLEVIEW_IID); static NS_DEFINE_IID(kIFrameIID, NS_IFRAME_IID); @@ -227,6 +229,22 @@ RootFrame::Reflow(nsIPresContext& aPresContext, kidReflowState.computedMargin.right; ReflowChild(kidFrame, aPresContext, kidDesiredSize, kidReflowState, aStatus); + + // Get the total size including any space needed for absolute positioned + // elements + // XXX It would be nice if this were part of the reflow metrics... + nsIAreaFrame* areaFrame; + if (NS_SUCCEEDED(kidFrame->QueryInterface(kAreaFrameIID, (void**)&areaFrame))) { + nscoord xMost, yMost; + + areaFrame->GetPositionedInfo(xMost, yMost); + if (xMost > kidDesiredSize.width) { + kidDesiredSize.width = xMost; + } + if (yMost > kidDesiredSize.height) { + kidDesiredSize.height = yMost; + } + } nsRect rect(kidReflowState.computedMargin.left, kidReflowState.computedMargin.top, kidDesiredSize.width, kidDesiredSize.height); diff --git a/mozilla/layout/html/base/src/nsHTMLFrame.cpp b/mozilla/layout/html/base/src/nsHTMLFrame.cpp index 9db67e9caf2..71bd7649a1f 100644 --- a/mozilla/layout/html/base/src/nsHTMLFrame.cpp +++ b/mozilla/layout/html/base/src/nsHTMLFrame.cpp @@ -37,8 +37,10 @@ #include "nsIEventStateManager.h" #include "nsIDeviceContext.h" #include "nsIScrollableView.h" +#include "nsIAreaFrame.h" // Interface IDs +static NS_DEFINE_IID(kAreaFrameIID, NS_IAREAFRAME_IID); static NS_DEFINE_IID(kScrollViewIID, NS_ISCROLLABLEVIEW_IID); static NS_DEFINE_IID(kIFrameIID, NS_IFRAME_IID); @@ -227,6 +229,22 @@ RootFrame::Reflow(nsIPresContext& aPresContext, kidReflowState.computedMargin.right; ReflowChild(kidFrame, aPresContext, kidDesiredSize, kidReflowState, aStatus); + + // Get the total size including any space needed for absolute positioned + // elements + // XXX It would be nice if this were part of the reflow metrics... + nsIAreaFrame* areaFrame; + if (NS_SUCCEEDED(kidFrame->QueryInterface(kAreaFrameIID, (void**)&areaFrame))) { + nscoord xMost, yMost; + + areaFrame->GetPositionedInfo(xMost, yMost); + if (xMost > kidDesiredSize.width) { + kidDesiredSize.width = xMost; + } + if (yMost > kidDesiredSize.height) { + kidDesiredSize.height = yMost; + } + } nsRect rect(kidReflowState.computedMargin.left, kidReflowState.computedMargin.top, kidDesiredSize.width, kidDesiredSize.height);