Skip to content
Snippets Groups Projects
Commit 0332290e authored by kipp%netscape.com's avatar kipp%netscape.com
Browse files

Repaired marginwidth/marginheight handling code

parent 4cfeba18
No related merge requests found
......@@ -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);
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment