diff --git a/mozilla/layout/base/nsCSSRendering.cpp b/mozilla/layout/base/nsCSSRendering.cpp index e5791858b4f..00333447f05 100644 --- a/mozilla/layout/base/nsCSSRendering.cpp +++ b/mozilla/layout/base/nsCSSRendering.cpp @@ -1674,7 +1674,9 @@ ComputeBackgroundAnchorPoint(const nsStyleColor& aColor, } else if (x != 0) { x %= aTileWidth; - x = x - aTileWidth; + if (x > 0) { + x = x - aTileWidth; + } } NS_POSTCONDITION((x >= -(aTileWidth - 1)) && (x <= 0), "bad computed anchor value"); @@ -1708,7 +1710,9 @@ ComputeBackgroundAnchorPoint(const nsStyleColor& aColor, } else if (y != 0) { y %= aTileHeight; - y = y - aTileHeight; + if (y > 0) { + y = y - aTileHeight; + } } NS_POSTCONDITION((y >= -(aTileHeight - 1)) && (y <= 0), "bad computed anchor value"); diff --git a/mozilla/layout/html/style/src/nsCSSRendering.cpp b/mozilla/layout/html/style/src/nsCSSRendering.cpp index e5791858b4f..00333447f05 100644 --- a/mozilla/layout/html/style/src/nsCSSRendering.cpp +++ b/mozilla/layout/html/style/src/nsCSSRendering.cpp @@ -1674,7 +1674,9 @@ ComputeBackgroundAnchorPoint(const nsStyleColor& aColor, } else if (x != 0) { x %= aTileWidth; - x = x - aTileWidth; + if (x > 0) { + x = x - aTileWidth; + } } NS_POSTCONDITION((x >= -(aTileWidth - 1)) && (x <= 0), "bad computed anchor value"); @@ -1708,7 +1710,9 @@ ComputeBackgroundAnchorPoint(const nsStyleColor& aColor, } else if (y != 0) { y %= aTileHeight; - y = y - aTileHeight; + if (y > 0) { + y = y - aTileHeight; + } } NS_POSTCONDITION((y >= -(aTileHeight - 1)) && (y <= 0), "bad computed anchor value");