diff --git a/mozilla/content/html/content/src/nsHTMLAtomList.h b/mozilla/content/html/content/src/nsHTMLAtomList.h index 0639866302e..94c24802db4 100644 --- a/mozilla/content/html/content/src/nsHTMLAtomList.h +++ b/mozilla/content/html/content/src/nsHTMLAtomList.h @@ -183,6 +183,7 @@ HTML_ATOM(layout, "layout") HTML_ATOM(li, "li") HTML_ATOM(link, "link") HTML_ATOM(left, "left") +HTML_ATOM(leftmargin, "leftmargin") HTML_ATOM(leftpadding, "leftpadding") HTML_ATOM(legend, "legend") HTML_ATOM(legendContentPseudo, ":legend-content") @@ -275,6 +276,7 @@ HTML_ATOM(textPseudo, ":-moz-text") HTML_ATOM(th, "th") HTML_ATOM(title, "title") HTML_ATOM(top, "top") +HTML_ATOM(topmargin, "topmargin") HTML_ATOM(toppadding, "toppadding") HTML_ATOM(tr, "tr") HTML_ATOM(tt, "tt") diff --git a/mozilla/content/html/content/src/nsHTMLBodyElement.cpp b/mozilla/content/html/content/src/nsHTMLBodyElement.cpp index f6ec3bf4f2e..82cb89f5866 100644 --- a/mozilla/content/html/content/src/nsHTMLBodyElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLBodyElement.cpp @@ -289,6 +289,14 @@ BodyRule::MapRuleInfoInto(nsRuleData* aData) PRInt32 bodyMarginWidth = -1; PRInt32 bodyMarginHeight = -1; + PRInt32 bodyTopMargin = -1; + PRInt32 bodyLeftMargin = -1; + + // check the mode (fortunately, the ruleData has a presContext for us to use!) + nsCompatibility mode; + NS_ASSERTION(aData->mPresContext, "null presContext in ruleNode was unexpected"); + aData->mPresContext->GetCompatibilityMode(&mode); + if (attrCount > 0) { // if marginwidth/marginheight are set, reflect them as 'margin' @@ -313,6 +321,29 @@ BodyRule::MapRuleInfoInto(nsRuleData* aData) if (margin->mBottom.GetUnit() == eCSSUnit_Null) margin->mBottom.SetFloatValue((float)bodyMarginHeight, eCSSUnit_Pixel); } + + if (eCompatibility_NavQuirks == mode){ + // topmargin (IE-attribute) + mPart->GetHTMLAttribute(nsHTMLAtoms::topmargin, value); + if (eHTMLUnit_Pixel == value.GetUnit()) { + bodyTopMargin = value.GetPixelValue(); + if (bodyTopMargin < 0) bodyTopMargin = 0; + nsCSSRect* margin = aData->mMarginData->mMargin; + if (margin->mTop.GetUnit() == eCSSUnit_Null) + margin->mTop.SetFloatValue((float)bodyTopMargin, eCSSUnit_Pixel); + } + + // leftmargin (IE-attribute) + mPart->GetHTMLAttribute(nsHTMLAtoms::leftmargin, value); + if (eHTMLUnit_Pixel == value.GetUnit()) { + bodyLeftMargin = value.GetPixelValue(); + if (bodyLeftMargin < 0) bodyLeftMargin = 0; + nsCSSRect* margin = aData->mMarginData->mMargin; + if (margin->mLeft.GetUnit() == eCSSUnit_Null) + margin->mLeft.SetFloatValue((float)bodyLeftMargin, eCSSUnit_Pixel); + } + } + } // if marginwidth or marginheight is set in the and not set in the
@@ -321,8 +352,6 @@ BodyRule::MapRuleInfoInto(nsRuleData* aData) nsCOMPtr