diff --git a/content/html/content/src/nsHTMLImageElement.cpp b/content/html/content/src/nsHTMLImageElement.cpp
index 5f46f3f42460..7f05f93df42c 100644
--- a/content/html/content/src/nsHTMLImageElement.cpp
+++ b/content/html/content/src/nsHTMLImageElement.cpp
@@ -244,6 +244,8 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
aContext->GetMutableStyleData(eStyleStruct_Text);
nsStyleSpacing* spacing = (nsStyleSpacing*)
aContext->GetMutableStyleData(eStyleStruct_Spacing);
+
+ // XXX This should ONLY be done if the margin is auto!!!
float p2t = aPresContext->GetPixelsToTwips();
nsStyleCoord three(NSIntPixelsToTwips(3, p2t));
switch (align) {
diff --git a/layout/html/content/src/nsHTMLImageElement.cpp b/layout/html/content/src/nsHTMLImageElement.cpp
index 5f46f3f42460..7f05f93df42c 100644
--- a/layout/html/content/src/nsHTMLImageElement.cpp
+++ b/layout/html/content/src/nsHTMLImageElement.cpp
@@ -244,6 +244,8 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
aContext->GetMutableStyleData(eStyleStruct_Text);
nsStyleSpacing* spacing = (nsStyleSpacing*)
aContext->GetMutableStyleData(eStyleStruct_Spacing);
+
+ // XXX This should ONLY be done if the margin is auto!!!
float p2t = aPresContext->GetPixelsToTwips();
nsStyleCoord three(NSIntPixelsToTwips(3, p2t));
switch (align) {