diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index d0fd07c15bc3..7ee9fdc3a58e 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -427,7 +427,7 @@ public: /** * Get the visible area associated with this presentation context. - * This is the size of the visiable area that is used for + * This is the size of the visible area that is used for * presenting the document. The returned value is in the standard * nscoord units (as scaled by the device context). */ diff --git a/layout/base/tests/Makefile.in b/layout/base/tests/Makefile.in index 76efd20a286c..b8d2ed7c199e 100644 --- a/layout/base/tests/Makefile.in +++ b/layout/base/tests/Makefile.in @@ -94,6 +94,7 @@ _TEST_FILES = \ test_bug445810.html \ test_bug449781.html \ test_bug450930.xhtml \ + test_bug458898.html \ $(NULL) # test_bug396024.html is currently disabled because it interacts badly with # the "You can't print-preview while the page is loading" dialog. diff --git a/layout/base/tests/test_bug458898.html b/layout/base/tests/test_bug458898.html new file mode 100644 index 000000000000..b2f15c805e23 --- /dev/null +++ b/layout/base/tests/test_bug458898.html @@ -0,0 +1,38 @@ + + + + + Test for Bug 458898 + + + + + + +Mozilla Bug 458898 +

+ +
+
+
+ + diff --git a/layout/generic/nsHTMLFrame.cpp b/layout/generic/nsHTMLFrame.cpp index e3045eb2fec8..40cf6d15e5ff 100644 --- a/layout/generic/nsHTMLFrame.cpp +++ b/layout/generic/nsHTMLFrame.cpp @@ -709,9 +709,16 @@ CanvasFrame::Reflow(nsPresContext* aPresContext, viewport->Invalidate(nsRect(nsPoint(0, 0), viewport->GetSize())); } - // Return our desired size (which doesn't matter) + // Return our desired size. Normally it's what we're told, but + // sometimes we can be given an unconstrained height (when a window + // is sizing-to-content), and we should compute our desired height. aDesiredSize.width = aReflowState.ComputedWidth(); - aDesiredSize.height = aReflowState.ComputedHeight(); + if (aReflowState.ComputedHeight() == NS_UNCONSTRAINEDSIZE) { + aDesiredSize.height = kidFrame->GetRect().height + + kidReflowState.mComputedMargin.TopBottom(); + } else { + aDesiredSize.height = aReflowState.ComputedHeight(); + } aDesiredSize.mOverflowArea.UnionRect( nsRect(0, 0, aDesiredSize.width, aDesiredSize.height),