diff --git a/mozilla/layout/base/nsCSSRendering.cpp b/mozilla/layout/base/nsCSSRendering.cpp
index e079fb48f10..7a8148d3969 100644
--- a/mozilla/layout/base/nsCSSRendering.cpp
+++ b/mozilla/layout/base/nsCSSRendering.cpp
@@ -881,16 +881,16 @@ void nsCSSRendering::PaintBackground(nsIPresContext& aPresContext,
ycount = 0;
break;
case NS_STYLE_BG_REPEAT_X:
- xcount = (PRIntn) (aBounds.width / tileWidth);
+ xcount = (tileWidth == 0) ? 0 : (PRIntn) (aBounds.width / tileWidth);
ycount = 0;
break;
case NS_STYLE_BG_REPEAT_Y:
xcount = 0;
- ycount = (PRIntn) (aBounds.height / tileHeight);
+ ycount = (tileHeight == 0) ? 0 : (PRIntn) (aBounds.height / tileHeight);
break;
case NS_STYLE_BG_REPEAT_XY:
- xcount = (PRIntn) (aBounds.width / tileWidth);
- ycount = (PRIntn) (aBounds.height / tileHeight);
+ xcount = (tileWidth == 0) ? 0 : (PRIntn) (aBounds.width / tileWidth);
+ ycount = (tileHeight == 0) ? 0 : (PRIntn) (aBounds.height / tileHeight);
break;
}
diff --git a/mozilla/layout/html/style/src/nsCSSRendering.cpp b/mozilla/layout/html/style/src/nsCSSRendering.cpp
index e079fb48f10..7a8148d3969 100644
--- a/mozilla/layout/html/style/src/nsCSSRendering.cpp
+++ b/mozilla/layout/html/style/src/nsCSSRendering.cpp
@@ -881,16 +881,16 @@ void nsCSSRendering::PaintBackground(nsIPresContext& aPresContext,
ycount = 0;
break;
case NS_STYLE_BG_REPEAT_X:
- xcount = (PRIntn) (aBounds.width / tileWidth);
+ xcount = (tileWidth == 0) ? 0 : (PRIntn) (aBounds.width / tileWidth);
ycount = 0;
break;
case NS_STYLE_BG_REPEAT_Y:
xcount = 0;
- ycount = (PRIntn) (aBounds.height / tileHeight);
+ ycount = (tileHeight == 0) ? 0 : (PRIntn) (aBounds.height / tileHeight);
break;
case NS_STYLE_BG_REPEAT_XY:
- xcount = (PRIntn) (aBounds.width / tileWidth);
- ycount = (PRIntn) (aBounds.height / tileHeight);
+ xcount = (tileWidth == 0) ? 0 : (PRIntn) (aBounds.width / tileWidth);
+ ycount = (tileHeight == 0) ? 0 : (PRIntn) (aBounds.height / tileHeight);
break;
}
diff --git a/mozilla/webshell/tests/viewer/samples/test9.html b/mozilla/webshell/tests/viewer/samples/test9.html
index 1a2aac8d1eb..12f9f6bdf39 100644
--- a/mozilla/webshell/tests/viewer/samples/test9.html
+++ b/mozilla/webshell/tests/viewer/samples/test9.html
@@ -8,5 +8,7 @@
hello
+
+