diff --git a/content/canvas/src/nsCanvasRenderingContext2D.cpp b/content/canvas/src/nsCanvasRenderingContext2D.cpp index c8bdee8a5c2..7ece7e781cf 100644 --- a/content/canvas/src/nsCanvasRenderingContext2D.cpp +++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp @@ -609,11 +609,14 @@ nsCanvasRenderingContext2D::StyleColorToString(const nscolor& aColor, nsAString& NS_GET_B(aColor)), aStr); } else { - CopyUTF8toUTF16(nsPrintfCString(100, "rgba(%d,%d,%d,%0.2f)", + // "%0.5f" in nsPrintfCString would use the locale-specific + // decimal separator. That's why we have to do this: + PRUint32 alpha = NS_GET_A(aColor) * 100000 / 255; + CopyUTF8toUTF16(nsPrintfCString(100, "rgba(%d, %d, %d, 0.%d)", NS_GET_R(aColor), NS_GET_G(aColor), NS_GET_B(aColor), - NS_GET_A(aColor) / 255.0f), + alpha), aStr); } }