Bug 1334330 - Part 8: stylo: Use GenericSpecifiedValue abstraction for <iframe>; r?emilio
MozReview-Commit-ID: GUiRcgSlLWI
--- a/dom/html/HTMLIFrameElement.cpp
+++ b/dom/html/HTMLIFrameElement.cpp
@@ -96,68 +96,39 @@ HTMLIFrameElement::ParseAttribute(int32_
}
return nsGenericHTMLFrameElement::ParseAttribute(aNamespaceID, aAttribute,
aValue, aResult);
}
void
HTMLIFrameElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
- GenericSpecifiedValues* aGenericData)
+ GenericSpecifiedValues* aData)
{
- nsRuleData* aData = aGenericData->AsRuleData();
- if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Border)) {
+ if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Border))) {
// frameborder: 0 | 1 (| NO | YES in quirks mode)
// If frameborder is 0 or No, set border to 0
// else leave it as the value set in html.css
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::frameborder);
if (value && value->Type() == nsAttrValue::eEnum) {
int32_t frameborder = value->GetEnumValue();
if (NS_STYLE_FRAME_0 == frameborder ||
NS_STYLE_FRAME_NO == frameborder ||
NS_STYLE_FRAME_OFF == frameborder) {
- nsCSSValue* borderLeftWidth = aData->ValueForBorderLeftWidth();
- if (borderLeftWidth->GetUnit() == eCSSUnit_Null)
- borderLeftWidth->SetFloatValue(0.0f, eCSSUnit_Pixel);
- nsCSSValue* borderRightWidth = aData->ValueForBorderRightWidth();
- if (borderRightWidth->GetUnit() == eCSSUnit_Null)
- borderRightWidth->SetFloatValue(0.0f, eCSSUnit_Pixel);
- nsCSSValue* borderTopWidth = aData->ValueForBorderTopWidth();
- if (borderTopWidth->GetUnit() == eCSSUnit_Null)
- borderTopWidth->SetFloatValue(0.0f, eCSSUnit_Pixel);
- nsCSSValue* borderBottomWidth = aData->ValueForBorderBottomWidth();
- if (borderBottomWidth->GetUnit() == eCSSUnit_Null)
- borderBottomWidth->SetFloatValue(0.0f, eCSSUnit_Pixel);
+ aData->SetPixelValueIfUnset(eCSSProperty_border_top_width, 0.0f);
+ aData->SetPixelValueIfUnset(eCSSProperty_border_right_width, 0.0f);
+ aData->SetPixelValueIfUnset(eCSSProperty_border_bottom_width, 0.0f);
+ aData->SetPixelValueIfUnset(eCSSProperty_border_left_width, 0.0f);
}
}
}
- 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);
- if (value && value->Type() == nsAttrValue::eInteger)
- width->SetFloatValue((float)value->GetIntegerValue(), eCSSUnit_Pixel);
- else if (value && value->Type() == nsAttrValue::ePercent)
- width->SetPercentValue(value->GetPercentValue());
- }
- // height: value
- nsCSSValue* height = aData->ValueForHeight();
- if (height->GetUnit() == eCSSUnit_Null) {
- const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::height);
- if (value && value->Type() == nsAttrValue::eInteger)
- height->SetFloatValue((float)value->GetIntegerValue(), eCSSUnit_Pixel);
- else if (value && value->Type() == nsAttrValue::ePercent)
- height->SetPercentValue(value->GetPercentValue());
- }
- }
-
- nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aGenericData);
- nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aGenericData);
+ nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
+ nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData);
+ nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
}
NS_IMETHODIMP_(bool)
HTMLIFrameElement::IsAttributeMapped(const nsIAtom* aAttribute) const
{
static const MappedAttributeEntry attributes[] = {
{ &nsGkAtoms::width },
{ &nsGkAtoms::height },