Add mechanism for returning computed value name of certain longhand properties of our fake shorthands. (Bug 531585) r=bzbarsky

This commit is contained in:
L. David Baron 2009-12-23 14:10:31 -05:00
parent e3e86676fd
commit 68e63e1183
3 changed files with 61 additions and 10 deletions

View File

@ -717,7 +717,8 @@ CSS_PROP_BORDER(
border_left_color_value,
X,
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER |
CSS_PROPERTY_IGNORED_WHEN_COLORS_DISABLED,
CSS_PROPERTY_IGNORED_WHEN_COLORS_DISABLED |
CSS_PROPERTY_REPORT_OTHER_NAME,
Margin,
mBorderColor.mLeft,
eCSSType_Value,
@ -773,7 +774,8 @@ CSS_PROP_BORDER(
border-left-style-value,
border_left_style_value,
X,
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER,
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER |
CSS_PROPERTY_REPORT_OTHER_NAME,
Margin,
mBorderStyle.mLeft,
eCSSType_Value,
@ -815,7 +817,8 @@ CSS_PROP_BORDER(
border-left-width-value,
border_left_width_value,
X,
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER,
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER |
CSS_PROPERTY_REPORT_OTHER_NAME,
Margin,
mBorderWidth.mLeft,
eCSSType_Value,
@ -863,7 +866,8 @@ CSS_PROP_BORDER(
border_right_color_value,
X,
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER |
CSS_PROPERTY_IGNORED_WHEN_COLORS_DISABLED,
CSS_PROPERTY_IGNORED_WHEN_COLORS_DISABLED |
CSS_PROPERTY_REPORT_OTHER_NAME,
Margin,
mBorderColor.mRight,
eCSSType_Value,
@ -919,7 +923,8 @@ CSS_PROP_BORDER(
border-right-style-value,
border_right_style_value,
X,
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER,
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER |
CSS_PROPERTY_REPORT_OTHER_NAME,
Margin,
mBorderStyle.mRight,
eCSSType_Value,
@ -961,7 +966,8 @@ CSS_PROP_BORDER(
border-right-width-value,
border_right_width_value,
X,
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER,
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER |
CSS_PROPERTY_REPORT_OTHER_NAME,
Margin,
mBorderWidth.mRight,
eCSSType_Value,
@ -1651,7 +1657,8 @@ CSS_PROP_MARGIN(
margin-left-value,
margin_left_value,
X,
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER,
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER |
CSS_PROPERTY_REPORT_OTHER_NAME,
Margin,
mMargin.mLeft,
eCSSType_Value,
@ -1693,7 +1700,8 @@ CSS_PROP_MARGIN(
margin-right-value,
margin_right_value,
X,
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER,
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER |
CSS_PROPERTY_REPORT_OTHER_NAME,
Margin,
mMargin.mRight,
eCSSType_Value,
@ -1958,7 +1966,8 @@ CSS_PROP_PADDING(
padding-left-value,
padding_left_value,
X,
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER,
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER |
CSS_PROPERTY_REPORT_OTHER_NAME,
Margin,
mPadding.mLeft,
eCSSType_Value,
@ -2000,7 +2009,8 @@ CSS_PROP_PADDING(
padding-right-value,
padding_right_value,
X,
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER,
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER |
CSS_PROPERTY_REPORT_OTHER_NAME,
Margin,
mPadding.mRight,
eCSSType_Value,

View File

@ -370,6 +370,35 @@ nsCSSProps::GetStringValue(nsCSSFontDesc aFontDescID)
}
}
nsCSSProperty
nsCSSProps::OtherNameFor(nsCSSProperty aProperty)
{
switch (aProperty) {
case eCSSProperty_border_left_color_value:
return eCSSProperty_border_left_color;
case eCSSProperty_border_left_style_value:
return eCSSProperty_border_left_style;
case eCSSProperty_border_left_width_value:
return eCSSProperty_border_left_width;
case eCSSProperty_border_right_color_value:
return eCSSProperty_border_right_color;
case eCSSProperty_border_right_style_value:
return eCSSProperty_border_right_style;
case eCSSProperty_border_right_width_value:
return eCSSProperty_border_right_width;
case eCSSProperty_margin_left_value:
return eCSSProperty_margin_left;
case eCSSProperty_margin_right_value:
return eCSSProperty_margin_right;
case eCSSProperty_padding_left_value:
return eCSSProperty_padding_left;
case eCSSProperty_padding_right_value:
return eCSSProperty_padding_right;
default:
NS_ABORT_IF_FALSE(PR_FALSE, "bad caller");
}
return eCSSProperty_UNKNOWN;
}
/***************************************************************************/

View File

@ -79,6 +79,13 @@
// list.
#define CSS_PROPERTY_IMAGE_IS_IN_ARRAY_0 (1<<6)
// This is a property for which the computed value should generally be
// reported as the computed value of a property of a different name. In
// particular, the directional box properties (margin-left-value, etc.)
// should be reported as being margin-left, etc. Call
// nsCSSProps::OtherNameFor to get the other property.
#define CSS_PROPERTY_REPORT_OTHER_NAME (1<<7)
/**
* Types of animatable values.
*/
@ -152,6 +159,11 @@ public:
static const nsAFlatCString& GetStringValue(nsCSSProperty aProperty);
static const nsAFlatCString& GetStringValue(nsCSSFontDesc aFontDesc);
// Get the property to report the computed value of aProperty as being
// the computed value of. aProperty must have the
// CSS_PROPERTY_REPORT_OTHER_NAME bit set.
static nsCSSProperty OtherNameFor(nsCSSProperty aProperty);
// Given a CSS Property and a Property Enum Value
// Return back a const nsString& representation of the
// value. Return back nullstr if no value is found