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
This commit is contained in:
samuel%sieb.net
2003-06-13 05:00:35 +00:00
parent 20f4d111de
commit 6c3d87bc59
3 changed files with 29 additions and 1 deletions

View File

@@ -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")

View File

@@ -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;
}

View File

@@ -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")