Bug 722880 - Support for attribute width on mtable. r=karlt

This commit is contained in:
François Wang 2012-02-27 18:57:28 -05:00
parent 0fc58c6dd5
commit b7b50cb81c

View File

@ -146,6 +146,11 @@ nsMathMLElement::ParseAttribute(PRInt32 aNamespaceID,
aValue, aResult); aValue, aResult);
} }
static nsGenericElement::MappedAttributeEntry sMtableStyles[] = {
{ &nsGkAtoms::width },
{ nsnull }
};
static nsGenericElement::MappedAttributeEntry sTokenStyles[] = { static nsGenericElement::MappedAttributeEntry sTokenStyles[] = {
{ &nsGkAtoms::mathsize_ }, { &nsGkAtoms::mathsize_ },
{ &nsGkAtoms::fontsize_ }, { &nsGkAtoms::fontsize_ },
@ -171,6 +176,10 @@ static nsGenericElement::MappedAttributeEntry sCommonPresStyles[] = {
bool bool
nsMathMLElement::IsAttributeMapped(const nsIAtom* aAttribute) const nsMathMLElement::IsAttributeMapped(const nsIAtom* aAttribute) const
{ {
static const MappedAttributeEntry* const mtableMap[] = {
sMtableStyles,
sCommonPresStyles
};
static const MappedAttributeEntry* const tokenMap[] = { static const MappedAttributeEntry* const tokenMap[] = {
sTokenStyles, sTokenStyles,
sCommonPresStyles sCommonPresStyles
@ -194,6 +203,9 @@ nsMathMLElement::IsAttributeMapped(const nsIAtom* aAttribute) const
tag == nsGkAtoms::math) tag == nsGkAtoms::math)
return FindAttributeDependence(aAttribute, mstyleMap); return FindAttributeDependence(aAttribute, mstyleMap);
if (tag == nsGkAtoms::mtable_)
return FindAttributeDependence(aAttribute, mtableMap);
if (tag == nsGkAtoms::maction_ || if (tag == nsGkAtoms::maction_ ||
tag == nsGkAtoms::maligngroup_ || tag == nsGkAtoms::maligngroup_ ||
tag == nsGkAtoms::malignmark_ || tag == nsGkAtoms::malignmark_ ||
@ -211,7 +223,6 @@ nsMathMLElement::IsAttributeMapped(const nsIAtom* aAttribute) const
tag == nsGkAtoms::msub_ || tag == nsGkAtoms::msub_ ||
tag == nsGkAtoms::msubsup_ || tag == nsGkAtoms::msubsup_ ||
tag == nsGkAtoms::msup_ || tag == nsGkAtoms::msup_ ||
tag == nsGkAtoms::mtable_ ||
tag == nsGkAtoms::mtd_ || tag == nsGkAtoms::mtd_ ||
tag == nsGkAtoms::mtr_ || tag == nsGkAtoms::mtr_ ||
tag == nsGkAtoms::munder_ || tag == nsGkAtoms::munder_ ||
@ -459,6 +470,19 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
colorValue->SetColorValue(color); colorValue->SetColorValue(color);
} }
} }
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Position)) {
// width: value
nsCSSValue* width = aData->ValueForWidth();
if (width->GetUnit() == eCSSUnit_Null) {
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::width);
// This does not handle auto and unitless values
if (value && value->Type() == nsAttrValue::eString) {
ParseNumericValue(value->GetStringValue(), *width, 0);
}
}
}
} }
nsresult nsresult