Skip to content
Snippets Groups Projects
Commit 13f2c1c3 authored by attinasi%netscape.com's avatar attinasi%netscape.com
Browse files

To fix the bug we added support for hspace and vspace attributes in QuirkMode....

To fix the bug we added support for hspace and vspace attributes in QuirkMode. b=41863 karnaze@netscape.com did part of the fix and we reviewed each others code
parent aee37774
No related branches found
No related tags found
No related merge requests found
......@@ -944,6 +944,16 @@ nsHTMLTableElement::StringToAttribute(nsIAtom* aAttribute,
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
else if (aAttribute == nsHTMLAtoms::hspace) {
if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Pixel)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
else if (aAttribute == nsHTMLAtoms::vspace) {
if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Pixel)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
return NS_CONTENT_ATTR_NOT_THERE;
}
......@@ -1292,6 +1302,26 @@ MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
tableStyle->mRules = value.GetIntValue();
}
// hspace is mapped into left and right margin,
// vspace is mapped into top and bottom margins
// - *** Quirks Mode only ***
if (eCompatibility_NavQuirks == mode) {
aAttributes->GetAttribute(nsHTMLAtoms::hspace, value);
if (value.GetUnit() == eHTMLUnit_Pixel) {
nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), sp2t);
nsStyleCoord hspace(twips);
spacing->mMargin.SetLeft(hspace);
spacing->mMargin.SetRight(hspace);
}
aAttributes->GetAttribute(nsHTMLAtoms::vspace, value);
if (value.GetUnit() == eHTMLUnit_Pixel) {
nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), sp2t);
nsStyleCoord vspace(twips);
spacing->mMargin.SetTop(vspace);
spacing->mMargin.SetBottom(vspace);
}
}
//background: color
nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aContext, aPresContext);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext);
......@@ -1312,7 +1342,9 @@ nsHTMLTableElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
(aAttribute == nsHTMLAtoms::border) ||
(aAttribute == nsHTMLAtoms::frame) ||
(aAttribute == nsHTMLAtoms::width) ||
(aAttribute == nsHTMLAtoms::height)) {
(aAttribute == nsHTMLAtoms::height) ||
(aAttribute == nsHTMLAtoms::hspace) ||
(aAttribute == nsHTMLAtoms::vspace)) {
aHint = NS_STYLE_HINT_REFLOW;
}
else if (aAttribute == nsHTMLAtoms::bordercolor) {
......
......@@ -944,6 +944,16 @@ nsHTMLTableElement::StringToAttribute(nsIAtom* aAttribute,
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
else if (aAttribute == nsHTMLAtoms::hspace) {
if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Pixel)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
else if (aAttribute == nsHTMLAtoms::vspace) {
if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Pixel)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
return NS_CONTENT_ATTR_NOT_THERE;
}
......@@ -1292,6 +1302,26 @@ MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
tableStyle->mRules = value.GetIntValue();
}
// hspace is mapped into left and right margin,
// vspace is mapped into top and bottom margins
// - *** Quirks Mode only ***
if (eCompatibility_NavQuirks == mode) {
aAttributes->GetAttribute(nsHTMLAtoms::hspace, value);
if (value.GetUnit() == eHTMLUnit_Pixel) {
nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), sp2t);
nsStyleCoord hspace(twips);
spacing->mMargin.SetLeft(hspace);
spacing->mMargin.SetRight(hspace);
}
aAttributes->GetAttribute(nsHTMLAtoms::vspace, value);
if (value.GetUnit() == eHTMLUnit_Pixel) {
nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), sp2t);
nsStyleCoord vspace(twips);
spacing->mMargin.SetTop(vspace);
spacing->mMargin.SetBottom(vspace);
}
}
//background: color
nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aContext, aPresContext);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext);
......@@ -1312,7 +1342,9 @@ nsHTMLTableElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
(aAttribute == nsHTMLAtoms::border) ||
(aAttribute == nsHTMLAtoms::frame) ||
(aAttribute == nsHTMLAtoms::width) ||
(aAttribute == nsHTMLAtoms::height)) {
(aAttribute == nsHTMLAtoms::height) ||
(aAttribute == nsHTMLAtoms::hspace) ||
(aAttribute == nsHTMLAtoms::vspace)) {
aHint = NS_STYLE_HINT_REFLOW;
}
else if (aAttribute == nsHTMLAtoms::bordercolor) {
......
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