Repaired marginwidth/marginheight handling code

git-svn-id: svn://10.0.0.236/trunk@14283 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
kipp%netscape.com 1998-11-09 17:51:05 +00:00
parent fc00faf9c4
commit fe24aed36f
2 changed files with 40 additions and 2 deletions

View File

@ -400,7 +400,26 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
NS_RELEASE(presShell);
}
// marginwidth/height get set by a special style rule
// marginwidth/marginheight
// XXX: see ua.css for related code in the BODY rule
float p2t;
p2t = aPresContext->GetPixelsToTwips();
nsStyleSpacing* spacing = (nsStyleSpacing*)
aContext->GetMutableStyleData(eStyleStruct_Spacing);
aAttributes->GetAttribute(nsHTMLAtoms::marginwidth, value);
if (eHTMLUnit_Pixel == value.GetUnit()) {
nscoord v = NSToCoordFloor(value.GetPixelValue() * p2t);
nsStyleCoord c(v);
spacing->mPadding.SetLeft(c);
spacing->mPadding.SetRight(c);
}
aAttributes->GetAttribute(nsHTMLAtoms::marginheight, value);
if (eHTMLUnit_Pixel == value.GetUnit()) {
nscoord v = NSToCoordFloor(value.GetPixelValue() * p2t);
nsStyleCoord c(v);
spacing->mPadding.SetTop(c);
spacing->mPadding.SetBottom(c);
}
// set up the basefont (defaults to 3)
nsStyleFont* font = (nsStyleFont*)aContext->GetMutableStyleData(eStyleStruct_Font);

View File

@ -400,7 +400,26 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
NS_RELEASE(presShell);
}
// marginwidth/height get set by a special style rule
// marginwidth/marginheight
// XXX: see ua.css for related code in the BODY rule
float p2t;
p2t = aPresContext->GetPixelsToTwips();
nsStyleSpacing* spacing = (nsStyleSpacing*)
aContext->GetMutableStyleData(eStyleStruct_Spacing);
aAttributes->GetAttribute(nsHTMLAtoms::marginwidth, value);
if (eHTMLUnit_Pixel == value.GetUnit()) {
nscoord v = NSToCoordFloor(value.GetPixelValue() * p2t);
nsStyleCoord c(v);
spacing->mPadding.SetLeft(c);
spacing->mPadding.SetRight(c);
}
aAttributes->GetAttribute(nsHTMLAtoms::marginheight, value);
if (eHTMLUnit_Pixel == value.GetUnit()) {
nscoord v = NSToCoordFloor(value.GetPixelValue() * p2t);
nsStyleCoord c(v);
spacing->mPadding.SetTop(c);
spacing->mPadding.SetBottom(c);
}
// set up the basefont (defaults to 3)
nsStyleFont* font = (nsStyleFont*)aContext->GetMutableStyleData(eStyleStruct_Font);