From 6c3d87bc59244248cd48c59a09e125b341d031c5 Mon Sep 17 00:00:00 2001 From: "samuel%sieb.net" Date: Fri, 13 Jun 2003 05:00:35 +0000 Subject: [PATCH] Bug 205850 - add "rightmargin" and "bottommargin" keywords r+sr=bz git-svn-id: svn://10.0.0.236/trunk@143664 18797224-902f-48f8-a5cc-f745e15eee43 --- .../content/html/content/src/nsHTMLAtomList.h | 2 ++ .../html/content/src/nsHTMLBodyElement.cpp | 26 ++++++++++++++++++- .../content/shared/public/nsHTMLAtomList.h | 2 ++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/mozilla/content/html/content/src/nsHTMLAtomList.h b/mozilla/content/html/content/src/nsHTMLAtomList.h index e41da7630db..c5a6e700388 100644 --- a/mozilla/content/html/content/src/nsHTMLAtomList.h +++ b/mozilla/content/html/content/src/nsHTMLAtomList.h @@ -82,6 +82,7 @@ HTML_ATOM(blockquote, "blockquote") HTML_ATOM(body, "body") HTML_ATOM(border, "border") HTML_ATOM(bordercolor, "bordercolor") +HTML_ATOM(bottommargin, "bottommargin") HTML_ATOM(bottompadding, "bottompadding") HTML_ATOM(br, "br") HTML_ATOM(b, "b") @@ -225,6 +226,7 @@ HTML_ATOM(refresh, "refresh") HTML_ATOM(rel, "rel") HTML_ATOM(repeat, "repeat") HTML_ATOM(rev, "rev") +HTML_ATOM(rightmargin, "rightmargin") HTML_ATOM(rightpadding, "rightpadding") HTML_ATOM(rows, "rows") HTML_ATOM(rowspan, "rowspan") diff --git a/mozilla/content/html/content/src/nsHTMLBodyElement.cpp b/mozilla/content/html/content/src/nsHTMLBodyElement.cpp index 2db7bbe54fb..0c681067030 100644 --- a/mozilla/content/html/content/src/nsHTMLBodyElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLBodyElement.cpp @@ -163,7 +163,9 @@ BodyRule::MapRuleInfoInto(nsRuleData* aData) PRInt32 bodyMarginWidth = -1; PRInt32 bodyMarginHeight = -1; PRInt32 bodyTopMargin = -1; + PRInt32 bodyBottomMargin = -1; PRInt32 bodyLeftMargin = -1; + PRInt32 bodyRightMargin = -1; // check the mode (fortunately, the ruleData has a presContext for us to use!) nsCompatibility mode; @@ -206,6 +208,16 @@ BodyRule::MapRuleInfoInto(nsRuleData* aData) margin.mTop.SetFloatValue((float)bodyTopMargin, eCSSUnit_Pixel); } + // bottommargin (IE-attribute) + mPart->GetHTMLAttribute(nsHTMLAtoms::bottommargin, value); + if (eHTMLUnit_Pixel == value.GetUnit()) { + bodyBottomMargin = value.GetPixelValue(); + if (bodyBottomMargin < 0) bodyBottomMargin = 0; + nsCSSRect& margin = aData->mMarginData->mMargin; + if (margin.mBottom.GetUnit() == eCSSUnit_Null) + margin.mBottom.SetFloatValue((float)bodyBottomMargin, eCSSUnit_Pixel); + } + // leftmargin (IE-attribute) mPart->GetHTMLAttribute(nsHTMLAtoms::leftmargin, value); if (eHTMLUnit_Pixel == value.GetUnit()) { @@ -215,6 +227,16 @@ BodyRule::MapRuleInfoInto(nsRuleData* aData) if (margin.mLeft.GetUnit() == eCSSUnit_Null) margin.mLeft.SetFloatValue((float)bodyLeftMargin, eCSSUnit_Pixel); } + + // rightmargin (IE-attribute) + mPart->GetHTMLAttribute(nsHTMLAtoms::rightmargin, value); + if (eHTMLUnit_Pixel == value.GetUnit()) { + bodyRightMargin = value.GetPixelValue(); + if (bodyRightMargin < 0) bodyRightMargin = 0; + nsCSSRect& margin = aData->mMarginData->mMargin; + if (margin.mRight.GetUnit() == eCSSUnit_Null) + margin.mRight.SetFloatValue((float)bodyRightMargin, eCSSUnit_Pixel); + } } } @@ -471,7 +493,9 @@ nsHTMLBodyElement::StringToAttribute(nsIAtom* aAttribute, else if ((aAttribute == nsHTMLAtoms::marginwidth) || (aAttribute == nsHTMLAtoms::marginheight) || (aAttribute == nsHTMLAtoms::topmargin) || - (aAttribute == nsHTMLAtoms::leftmargin)) { + (aAttribute == nsHTMLAtoms::bottommargin) || + (aAttribute == nsHTMLAtoms::leftmargin) || + (aAttribute == nsHTMLAtoms::rightmargin)) { if (aResult.ParseIntWithBounds(aValue, eHTMLUnit_Pixel, 0)) { return NS_CONTENT_ATTR_HAS_VALUE; } diff --git a/mozilla/content/shared/public/nsHTMLAtomList.h b/mozilla/content/shared/public/nsHTMLAtomList.h index e41da7630db..c5a6e700388 100644 --- a/mozilla/content/shared/public/nsHTMLAtomList.h +++ b/mozilla/content/shared/public/nsHTMLAtomList.h @@ -82,6 +82,7 @@ HTML_ATOM(blockquote, "blockquote") HTML_ATOM(body, "body") HTML_ATOM(border, "border") HTML_ATOM(bordercolor, "bordercolor") +HTML_ATOM(bottommargin, "bottommargin") HTML_ATOM(bottompadding, "bottompadding") HTML_ATOM(br, "br") HTML_ATOM(b, "b") @@ -225,6 +226,7 @@ HTML_ATOM(refresh, "refresh") HTML_ATOM(rel, "rel") HTML_ATOM(repeat, "repeat") HTML_ATOM(rev, "rev") +HTML_ATOM(rightmargin, "rightmargin") HTML_ATOM(rightpadding, "rightpadding") HTML_ATOM(rows, "rows") HTML_ATOM(rowspan, "rowspan")