diff --git a/layout/html/base/src/nsBodyFrame.cpp b/layout/html/base/src/nsBodyFrame.cpp
index 72bcf9bdc5f1..32e990738297 100644
--- a/layout/html/base/src/nsBodyFrame.cpp
+++ b/layout/html/base/src/nsBodyFrame.cpp
@@ -321,7 +321,8 @@ nsBodyFrame::Reflow(nsIPresContext& aPresContext,
damageArea.y = mRect.YMost();
damageArea.width = aDesiredSize.width;
damageArea.height = aDesiredSize.height - mRect.height;
- if (aDesiredSize.height == mRect.height) {
+ if ((damageArea.height < 0) ||
+ (aDesiredSize.height == mRect.height)) {
// Since we don't know what changed, assume it all changed.
damageArea.y = 0;
damageArea.height = aDesiredSize.height;