diff --git a/mozilla/layout/generic/nsHTMLFrame.cpp b/mozilla/layout/generic/nsHTMLFrame.cpp
index 71bd7649a1f..592920a4a9c 100644
--- a/mozilla/layout/generic/nsHTMLFrame.cpp
+++ b/mozilla/layout/generic/nsHTMLFrame.cpp
@@ -272,6 +272,30 @@ RootFrame::Reflow(nsIPresContext& aPresContext,
aDesiredSize.ascent = aDesiredSize.height;
aDesiredSize.descent = 0;
+ // Set NS_FRAME_OUTSIDE_CHILDREN flag, or reset it, as appropriate
+ nsFrameState kidState;
+ kidFrame->GetFrameState(kidState);
+ if (NS_FRAME_OUTSIDE_CHILDREN & kidState) {
+ nscoord kidXMost = kidReflowState.computedMargin.left +
+ kidDesiredSize.mCombinedArea.XMost();
+ nscoord kidYMost = kidReflowState.computedMargin.top +
+ kidDesiredSize.mCombinedArea.YMost();
+
+ if ((kidXMost > aDesiredSize.width) || (kidYMost > aDesiredSize.height)) {
+ aDesiredSize.mCombinedArea.x = 0;
+ aDesiredSize.mCombinedArea.y = 0;
+ aDesiredSize.mCombinedArea.width = PR_MAX(aDesiredSize.width, kidXMost);
+ aDesiredSize.mCombinedArea.height = PR_MAX(aDesiredSize.height, kidYMost);
+ mState |= NS_FRAME_OUTSIDE_CHILDREN;
+
+ } else {
+ mState &= ~NS_FRAME_OUTSIDE_CHILDREN;
+ }
+
+ } else {
+ mState &= ~NS_FRAME_OUTSIDE_CHILDREN;
+ }
+
// XXX Temporary hack. Remember this for later when our parent resizes us
mNaturalHeight = aDesiredSize.height;
}
diff --git a/mozilla/layout/html/base/src/nsHTMLFrame.cpp b/mozilla/layout/html/base/src/nsHTMLFrame.cpp
index 71bd7649a1f..592920a4a9c 100644
--- a/mozilla/layout/html/base/src/nsHTMLFrame.cpp
+++ b/mozilla/layout/html/base/src/nsHTMLFrame.cpp
@@ -272,6 +272,30 @@ RootFrame::Reflow(nsIPresContext& aPresContext,
aDesiredSize.ascent = aDesiredSize.height;
aDesiredSize.descent = 0;
+ // Set NS_FRAME_OUTSIDE_CHILDREN flag, or reset it, as appropriate
+ nsFrameState kidState;
+ kidFrame->GetFrameState(kidState);
+ if (NS_FRAME_OUTSIDE_CHILDREN & kidState) {
+ nscoord kidXMost = kidReflowState.computedMargin.left +
+ kidDesiredSize.mCombinedArea.XMost();
+ nscoord kidYMost = kidReflowState.computedMargin.top +
+ kidDesiredSize.mCombinedArea.YMost();
+
+ if ((kidXMost > aDesiredSize.width) || (kidYMost > aDesiredSize.height)) {
+ aDesiredSize.mCombinedArea.x = 0;
+ aDesiredSize.mCombinedArea.y = 0;
+ aDesiredSize.mCombinedArea.width = PR_MAX(aDesiredSize.width, kidXMost);
+ aDesiredSize.mCombinedArea.height = PR_MAX(aDesiredSize.height, kidYMost);
+ mState |= NS_FRAME_OUTSIDE_CHILDREN;
+
+ } else {
+ mState &= ~NS_FRAME_OUTSIDE_CHILDREN;
+ }
+
+ } else {
+ mState &= ~NS_FRAME_OUTSIDE_CHILDREN;
+ }
+
// XXX Temporary hack. Remember this for later when our parent resizes us
mNaturalHeight = aDesiredSize.height;
}
diff --git a/mozilla/layout/html/base/src/nsScrollFrame.cpp b/mozilla/layout/html/base/src/nsScrollFrame.cpp
index c4720a5d68e..da1a3bb0385 100644
--- a/mozilla/layout/html/base/src/nsScrollFrame.cpp
+++ b/mozilla/layout/html/base/src/nsScrollFrame.cpp
@@ -333,7 +333,16 @@ nsScrollFrame::Reflow(nsIPresContext& aPresContext,
aStatus);
NS_ASSERTION(NS_FRAME_IS_COMPLETE(aStatus), "bad status");
- // If it's an area frame then get the total size, which includes the
+ // If the frame has child frames that stick outside its bounds, then take
+ // them into account, too
+ nsFrameState kidState;
+ kidFrame->GetFrameState(kidState);
+ if (NS_FRAME_OUTSIDE_CHILDREN & kidState) {
+ kidDesiredSize.width = kidDesiredSize.mCombinedArea.width;
+ kidDesiredSize.height = kidDesiredSize.mCombinedArea.height;
+ }
+
+ // If it's an area frame, then get the total size which includes the
// space taken up by absolutely positioned child elements
nsIAreaFrame* areaFrame;
if (NS_SUCCEEDED(kidFrame->QueryInterface(kAreaFrameIID, (void**)&areaFrame))) {
@@ -383,7 +392,16 @@ nsScrollFrame::Reflow(nsIPresContext& aPresContext,
aStatus);
NS_ASSERTION(NS_FRAME_IS_COMPLETE(aStatus), "bad status");
- // If it's an area frame then get the total size, which includes the
+ // If the frame has child frames that stick outside its bounds, then take
+ // them into account, too
+ nsFrameState kidState;
+ kidFrame->GetFrameState(kidState);
+ if (NS_FRAME_OUTSIDE_CHILDREN & kidState) {
+ kidDesiredSize.width = kidDesiredSize.mCombinedArea.width;
+ kidDesiredSize.height = kidDesiredSize.mCombinedArea.height;
+ }
+
+ // If it's an area frame, then get the total size which includes the
// space taken up by absolutely positioned child elements
nsIAreaFrame* areaFrame;
if (NS_SUCCEEDED(kidFrame->QueryInterface(kAreaFrameIID, (void**)&areaFrame))) {