Bug 1334330 - Part 6: stylo: Use GenericSpecifiedValue abstraction for table elements; r=emilio

MozReview-Commit-ID: 6wo4iw4zEWP
This commit is contained in:
Manish Goregaokar
2017-01-26 16:51:01 -08:00
parent a2e18900da
commit 33a682c81d
10 changed files with 170 additions and 254 deletions

View File

@@ -167,39 +167,20 @@ HTMLTableSectionElement::ParseAttribute(int32_t aNamespaceID,
void
HTMLTableSectionElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aGenericData)
GenericSpecifiedValues* aData)
{
nsRuleData* aData = aGenericData->AsRuleData();
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Position)) {
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Position))) {
// height: value
nsCSSValue* height = aData->ValueForHeight();
if (height->GetUnit() == eCSSUnit_Null) {
if (!aData->PropertyIsSet(eCSSProperty_height)) {
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::height);
if (value && value->Type() == nsAttrValue::eInteger)
height->SetFloatValue((float)value->GetIntegerValue(), eCSSUnit_Pixel);
aData->SetPixelValue(eCSSProperty_height, (float)value->GetIntegerValue());
}
}
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Text)) {
nsCSSValue* textAlign = aData->ValueForTextAlign();
if (textAlign->GetUnit() == eCSSUnit_Null) {
// align: enum
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::align);
if (value && value->Type() == nsAttrValue::eEnum)
textAlign->SetIntValue(value->GetEnumValue(), eCSSUnit_Enumerated);
}
}
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Display)) {
nsCSSValue* verticalAlign = aData->ValueForVerticalAlign();
if (verticalAlign->GetUnit() == eCSSUnit_Null) {
// valign: enum
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::valign);
if (value && value->Type() == nsAttrValue::eEnum)
verticalAlign->SetIntValue(value->GetEnumValue(), eCSSUnit_Enumerated);
}
}
nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aGenericData);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aGenericData);
nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapVAlignAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aData);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
}
NS_IMETHODIMP_(bool)