Implement -moz-border-start and -moz-border-end. Patch by Simon Montagu <smontagu@smontagu.org> and me. b=74880 r/sr=smontagu/dbaron

This commit is contained in:
dbaron%dbaron.org 2007-07-04 18:51:40 +00:00
Родитель 728ecaf07c
Коммит 9d498d4cf6
21 изменённых файлов: 1006 добавлений и 142 удалений

Просмотреть файл

@ -406,7 +406,7 @@ interface nsIDOMCSS2Properties : nsISupports
// raises(DOMException) on setting
};
[scriptable, uuid(8c2e3658-1fe4-452a-92be-b0afaf76f897)]
[scriptable, uuid(c9339b8c-9bdd-4d2a-a61a-55ca609b92bd)]
interface nsIDOMNSCSS2Properties : nsIDOMCSS2Properties
{
/* Non-DOM 2 extensions */
@ -567,4 +567,28 @@ interface nsIDOMNSCSS2Properties : nsIDOMCSS2Properties
attribute DOMString imeMode;
// raises(DOMException) on setting
attribute DOMString MozBorderEnd;
// raises(DOMException) on setting
attribute DOMString MozBorderEndColor;
// raises(DOMException) on setting
attribute DOMString MozBorderEndStyle;
// raises(DOMException) on setting
attribute DOMString MozBorderEndWidth;
// raises(DOMException) on setting
attribute DOMString MozBorderStart;
// raises(DOMException) on setting
attribute DOMString MozBorderStartColor;
// raises(DOMException) on setting
attribute DOMString MozBorderStartStyle;
// raises(DOMException) on setting
attribute DOMString MozBorderStartWidth;
// raises(DOMException) on setting
};

Просмотреть файл

@ -57,7 +57,7 @@
#define NS_FOR_CSS_SIDES(var_) for (PRInt32 var_ = 0; var_ < 4; ++var_)
// {margin,padding}-{left,right}-{ltr,rtl}-source
// {margin,border-{width,style,color},padding}-{left,right}-{ltr,rtl}-source
#define NS_BOXPROP_SOURCE_PHYSICAL 0
#define NS_BOXPROP_SOURCE_LOGICAL 1

Просмотреть файл

@ -90,8 +90,8 @@ center {
blockquote[type=cite] {
display: block;
margin: 1em 0px;
padding-left: 1em;
border-left: solid;
-moz-padding-start: 1em;
-moz-border-start: solid;
border-color: blue;
border-width: thin;
}

Просмотреть файл

@ -347,8 +347,10 @@ nsCSSDeclaration::AppendCSSValueToString(nsCSSProperty aProperty,
case eCSSProperty_background_color:
case eCSSProperty_border_top_color:
case eCSSProperty_border_bottom_color:
case eCSSProperty_border_left_color:
case eCSSProperty_border_right_color:
case eCSSProperty_border_left_color_value:
case eCSSProperty_border_right_color_value:
case eCSSProperty_border_start_color_value:
case eCSSProperty_border_end_color_value:
case eCSSProperty_outline_color: {
// we can lookup the property in the ColorTable and then
// get a string mapping the name
@ -580,6 +582,8 @@ nsCSSDeclaration::GetValue(nsCSSProperty aProperty,
case eCSSProperty_border_right:
case eCSSProperty_border_bottom:
case eCSSProperty_border_left:
case eCSSProperty_border_start:
case eCSSProperty_border_end:
case eCSSProperty_outline: {
const nsCSSProperty* subprops =
nsCSSProps::SubpropertyEntryFor(aProperty);
@ -603,7 +607,19 @@ nsCSSDeclaration::GetValue(nsCSSProperty aProperty,
case eCSSProperty_padding_left:
case eCSSProperty_padding_right:
case eCSSProperty_padding_start:
case eCSSProperty_padding_end: {
case eCSSProperty_padding_end:
case eCSSProperty_border_left_color:
case eCSSProperty_border_left_style:
case eCSSProperty_border_left_width:
case eCSSProperty_border_right_color:
case eCSSProperty_border_right_style:
case eCSSProperty_border_right_width:
case eCSSProperty_border_start_color:
case eCSSProperty_border_start_style:
case eCSSProperty_border_start_width:
case eCSSProperty_border_end_color:
case eCSSProperty_border_end_style:
case eCSSProperty_border_end_width: {
const nsCSSProperty* subprops =
nsCSSProps::SubpropertyEntryFor(aProperty);
NS_ASSERTION(subprops[3] == eCSSProperty_UNKNOWN,
@ -1082,6 +1098,14 @@ case _prop: \
} \
break;
#define NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE_AS(_condition, _prop, _propas, _index) \
case _prop: \
if ((_condition) && _index) { \
AppendPropertyAndValueToString(property, _propas, aString); \
_index = 0; \
} \
break;
void nsCSSDeclaration::PropertyIsSet(PRInt32 & aPropertyIndex, PRInt32 aIndex, PRUint32 & aSet, PRUint32 aValue) const
{
aPropertyIndex = aIndex + 1;
@ -1098,6 +1122,8 @@ nsCSSDeclaration::ToString(nsAString& aString) const
PRInt32 borderBottomWidth = 0, borderBottomStyle = 0, borderBottomColor = 0;
PRInt32 borderLeftWidth = 0, borderLeftStyle = 0, borderLeftColor = 0;
PRInt32 borderRightWidth = 0, borderRightStyle = 0, borderRightColor = 0;
PRInt32 borderStartWidth = 0, borderStartStyle = 0, borderStartColor = 0;
PRInt32 borderEndWidth = 0, borderEndStyle = 0, borderEndColor = 0;
PRInt32 marginTop = 0, marginBottom = 0, marginLeft = 0, marginRight = 0;
PRInt32 paddingTop = 0, paddingBottom = 0, paddingLeft = 0, paddingRight = 0;
PRInt32 bgColor = 0, bgImage = 0, bgRepeat = 0, bgAttachment = 0;
@ -1117,12 +1143,18 @@ nsCSSDeclaration::ToString(nsAString& aString) const
case eCSSProperty_border_bottom_width:
PropertyIsSet(borderBottomWidth, index, borderPropertiesSet, B_BORDER_BOTTOM_WIDTH);
break;
case eCSSProperty_border_left_width:
case eCSSProperty_border_left_width_value:
PropertyIsSet(borderLeftWidth, index, borderPropertiesSet, B_BORDER_LEFT_WIDTH);
break;
case eCSSProperty_border_right_width:
case eCSSProperty_border_right_width_value:
PropertyIsSet(borderRightWidth, index, borderPropertiesSet, B_BORDER_RIGHT_WIDTH);
break;
case eCSSProperty_border_start_width_value:
borderStartWidth = index+1;
break;
case eCSSProperty_border_end_width_value:
borderEndWidth = index+1;
break;
case eCSSProperty_border_top_style:
PropertyIsSet(borderTopStyle, index, borderPropertiesSet, B_BORDER_TOP_STYLE);
@ -1130,12 +1162,18 @@ nsCSSDeclaration::ToString(nsAString& aString) const
case eCSSProperty_border_bottom_style:
PropertyIsSet(borderBottomStyle, index, borderPropertiesSet, B_BORDER_BOTTOM_STYLE);
break;
case eCSSProperty_border_left_style:
case eCSSProperty_border_left_style_value:
PropertyIsSet(borderLeftStyle, index, borderPropertiesSet, B_BORDER_LEFT_STYLE);
break;
case eCSSProperty_border_right_style:
case eCSSProperty_border_right_style_value:
PropertyIsSet(borderRightStyle, index, borderPropertiesSet, B_BORDER_RIGHT_STYLE);
break;
case eCSSProperty_border_start_style_value:
borderStartStyle = index+1;
break;
case eCSSProperty_border_end_style_value:
borderEndStyle = index+1;
break;
case eCSSProperty_border_top_color:
PropertyIsSet(borderTopColor, index, borderPropertiesSet, B_BORDER_TOP_COLOR);
@ -1143,12 +1181,18 @@ nsCSSDeclaration::ToString(nsAString& aString) const
case eCSSProperty_border_bottom_color:
PropertyIsSet(borderBottomColor, index, borderPropertiesSet, B_BORDER_BOTTOM_COLOR);
break;
case eCSSProperty_border_left_color:
case eCSSProperty_border_left_color_value:
PropertyIsSet(borderLeftColor, index, borderPropertiesSet, B_BORDER_LEFT_COLOR);
break;
case eCSSProperty_border_right_color:
case eCSSProperty_border_right_color_value:
PropertyIsSet(borderRightColor, index, borderPropertiesSet, B_BORDER_RIGHT_COLOR);
break;
case eCSSProperty_border_start_color_value:
borderStartColor = index+1;
break;
case eCSSProperty_border_end_color_value:
borderEndColor = index+1;
break;
case eCSSProperty_margin_top: marginTop = index+1; break;
case eCSSProperty_margin_bottom: marginBottom = index+1; break;
@ -1247,6 +1291,16 @@ nsCSSDeclaration::ToString(nsAString& aString) const
#ifdef MOZ_SVG
TryMarkerShorthand(aString, markerEnd, markerMid, markerStart);
#endif
// FIXME The order of the declarations should depend on the *-source
// properties.
if (borderStartWidth && borderStartStyle && borderStartColor &&
TryBorderSideShorthand(aString, eCSSProperty_border_start,
borderStartWidth, borderStartStyle, borderStartColor))
borderStartWidth = borderStartStyle = borderStartColor = 0;
if (borderEndWidth && borderEndStyle && borderEndColor &&
TryBorderSideShorthand(aString, eCSSProperty_border_end,
borderEndWidth, borderEndStyle, borderEndColor))
borderEndWidth = borderEndStyle = borderEndColor = 0;
for (index = 0; index < count; index++) {
nsCSSProperty property = OrderValueAt(index);
@ -1254,30 +1308,48 @@ nsCSSDeclaration::ToString(nsAString& aString) const
NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE(finalBorderPropertiesToSet & B_BORDER_TOP_STYLE,
eCSSProperty_border_top_style, borderTopStyle)
NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE(finalBorderPropertiesToSet & B_BORDER_LEFT_STYLE,
eCSSProperty_border_left_style, borderLeftStyle)
NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE(finalBorderPropertiesToSet & B_BORDER_RIGHT_STYLE,
eCSSProperty_border_right_style, borderRightStyle)
NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE_AS(finalBorderPropertiesToSet & B_BORDER_LEFT_STYLE,
eCSSProperty_border_left_style_value,
eCSSProperty_border_left_style, borderLeftStyle)
NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE_AS(finalBorderPropertiesToSet & B_BORDER_RIGHT_STYLE,
eCSSProperty_border_right_style_value,
eCSSProperty_border_right_style, borderRightStyle)
NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE(finalBorderPropertiesToSet & B_BORDER_BOTTOM_STYLE,
eCSSProperty_border_bottom_style, borderBottomStyle)
NS_CASE_OUTPUT_PROPERTY_VALUE_AS(eCSSProperty_border_start_style_value,
eCSSProperty_border_start_style, borderStartStyle)
NS_CASE_OUTPUT_PROPERTY_VALUE_AS(eCSSProperty_border_end_style_value,
eCSSProperty_border_end_style, borderEndStyle)
NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE(finalBorderPropertiesToSet & B_BORDER_TOP_COLOR,
eCSSProperty_border_top_color, borderTopColor)
NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE(finalBorderPropertiesToSet & B_BORDER_LEFT_COLOR,
eCSSProperty_border_left_color, borderLeftColor)
NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE(finalBorderPropertiesToSet & B_BORDER_RIGHT_COLOR,
eCSSProperty_border_right_color, borderRightColor)
NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE_AS(finalBorderPropertiesToSet & B_BORDER_LEFT_COLOR,
eCSSProperty_border_left_color_value,
eCSSProperty_border_left_color, borderLeftColor)
NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE_AS(finalBorderPropertiesToSet & B_BORDER_RIGHT_COLOR,
eCSSProperty_border_right_color_value,
eCSSProperty_border_right_color, borderRightColor)
NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE(finalBorderPropertiesToSet & B_BORDER_BOTTOM_COLOR,
eCSSProperty_border_bottom_color, borderBottomColor)
NS_CASE_OUTPUT_PROPERTY_VALUE_AS(eCSSProperty_border_start_color_value,
eCSSProperty_border_start_color, borderStartColor)
NS_CASE_OUTPUT_PROPERTY_VALUE_AS(eCSSProperty_border_end_color_value,
eCSSProperty_border_end_color, borderEndColor)
NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE(finalBorderPropertiesToSet & B_BORDER_TOP_WIDTH,
eCSSProperty_border_top_width, borderTopWidth)
NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE(finalBorderPropertiesToSet & B_BORDER_LEFT_WIDTH,
eCSSProperty_border_left_width, borderLeftWidth)
NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE(finalBorderPropertiesToSet & B_BORDER_RIGHT_WIDTH,
eCSSProperty_border_right_width, borderRightWidth)
NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE_AS(finalBorderPropertiesToSet & B_BORDER_LEFT_WIDTH,
eCSSProperty_border_left_width_value,
eCSSProperty_border_left_width, borderLeftWidth)
NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE_AS(finalBorderPropertiesToSet & B_BORDER_RIGHT_WIDTH,
eCSSProperty_border_right_width_value,
eCSSProperty_border_right_width, borderRightWidth)
NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE(finalBorderPropertiesToSet & B_BORDER_BOTTOM_WIDTH,
eCSSProperty_border_bottom_width, borderBottomWidth)
NS_CASE_OUTPUT_PROPERTY_VALUE_AS(eCSSProperty_border_start_width_value,
eCSSProperty_border_start_width, borderStartWidth)
NS_CASE_OUTPUT_PROPERTY_VALUE_AS(eCSSProperty_border_end_width_value,
eCSSProperty_border_end_width, borderEndWidth)
NS_CASE_OUTPUT_PROPERTY_VALUE(eCSSProperty_margin_top, marginTop)
NS_CASE_OUTPUT_PROPERTY_VALUE(eCSSProperty_margin_bottom, marginBottom)
@ -1316,6 +1388,18 @@ nsCSSDeclaration::ToString(nsAString& aString) const
case eCSSProperty_padding_left_rtl_source:
case eCSSProperty_padding_right_ltr_source:
case eCSSProperty_padding_right_rtl_source:
case eCSSProperty_border_left_color_ltr_source:
case eCSSProperty_border_left_color_rtl_source:
case eCSSProperty_border_left_style_ltr_source:
case eCSSProperty_border_left_style_rtl_source:
case eCSSProperty_border_left_width_ltr_source:
case eCSSProperty_border_left_width_rtl_source:
case eCSSProperty_border_right_color_ltr_source:
case eCSSProperty_border_right_color_rtl_source:
case eCSSProperty_border_right_style_ltr_source:
case eCSSProperty_border_right_style_rtl_source:
case eCSSProperty_border_right_width_ltr_source:
case eCSSProperty_border_right_width_rtl_source:
break;
case eCSSProperty_margin_start_value:

Просмотреть файл

@ -312,6 +312,8 @@ protected:
PRBool ParseTreePseudoElement(nsresult& aErrorCode, nsCSSSelector& aSelector);
#endif
void InitBoxPropsAsPhysical(const nsCSSProperty *aSourceProperties);
// Property specific parsing routines
PRBool ParseAzimuth(nsresult& aErrorCode, nsCSSValue& aValue);
PRBool ParseBackground(nsresult& aErrorCode);
@ -325,6 +327,9 @@ protected:
PRBool ParseBorderSide(nsresult& aErrorCode,
const nsCSSProperty aPropIDs[],
PRBool aSetAllSides);
PRBool ParseDirectionalBorderSide(nsresult& aErrorCode,
const nsCSSProperty aPropIDs[],
PRInt32 aSourceType);
PRBool ParseBorderStyle(nsresult& aErrorCode);
PRBool ParseBorderWidth(nsresult& aErrorCode);
PRBool ParseBorderRadius(nsresult& aErrorCode);
@ -3588,6 +3593,9 @@ static const nsCSSProperty kBorderTopIDs[] = {
eCSSProperty_border_top_color
};
static const nsCSSProperty kBorderRightIDs[] = {
eCSSProperty_border_right_width_value,
eCSSProperty_border_right_style_value,
eCSSProperty_border_right_color_value,
eCSSProperty_border_right_width,
eCSSProperty_border_right_style,
eCSSProperty_border_right_color
@ -3598,10 +3606,29 @@ static const nsCSSProperty kBorderBottomIDs[] = {
eCSSProperty_border_bottom_color
};
static const nsCSSProperty kBorderLeftIDs[] = {
eCSSProperty_border_left_width_value,
eCSSProperty_border_left_style_value,
eCSSProperty_border_left_color_value,
eCSSProperty_border_left_width,
eCSSProperty_border_left_style,
eCSSProperty_border_left_color
};
static const nsCSSProperty kBorderStartIDs[] = {
eCSSProperty_border_start_width_value,
eCSSProperty_border_start_style_value,
eCSSProperty_border_start_color_value,
eCSSProperty_border_start_width,
eCSSProperty_border_start_style,
eCSSProperty_border_start_color
};
static const nsCSSProperty kBorderEndIDs[] = {
eCSSProperty_border_end_width_value,
eCSSProperty_border_end_style_value,
eCSSProperty_border_end_color_value,
eCSSProperty_border_end_width,
eCSSProperty_border_end_style,
eCSSProperty_border_end_color
};
PRBool CSSParserImpl::ParseEnum(nsresult& aErrorCode, nsCSSValue& aValue,
const PRInt32 aKeywordTable[])
@ -4263,10 +4290,18 @@ PRBool CSSParserImpl::ParseProperty(nsresult& aErrorCode,
return ParseBorderStyle(aErrorCode);
case eCSSProperty_border_bottom:
return ParseBorderSide(aErrorCode, kBorderBottomIDs, PR_FALSE);
case eCSSProperty_border_end:
return ParseDirectionalBorderSide(aErrorCode, kBorderEndIDs,
NS_BOXPROP_SOURCE_LOGICAL);
case eCSSProperty_border_left:
return ParseBorderSide(aErrorCode, kBorderLeftIDs, PR_FALSE);
return ParseDirectionalBorderSide(aErrorCode, kBorderLeftIDs,
NS_BOXPROP_SOURCE_PHYSICAL);
case eCSSProperty_border_right:
return ParseBorderSide(aErrorCode, kBorderRightIDs, PR_FALSE);
return ParseDirectionalBorderSide(aErrorCode, kBorderRightIDs,
NS_BOXPROP_SOURCE_PHYSICAL);
case eCSSProperty_border_start:
return ParseDirectionalBorderSide(aErrorCode, kBorderStartIDs,
NS_BOXPROP_SOURCE_LOGICAL);
case eCSSProperty_border_top:
return ParseBorderSide(aErrorCode, kBorderTopIDs, PR_FALSE);
case eCSSProperty_border_bottom_colors:
@ -4287,6 +4322,54 @@ PRBool CSSParserImpl::ParseProperty(nsresult& aErrorCode,
aPropID);
case eCSSProperty_border_width:
return ParseBorderWidth(aErrorCode);
case eCSSProperty_border_end_color:
return ParseDirectionalBoxProperty(aErrorCode,
eCSSProperty_border_end_color,
NS_BOXPROP_SOURCE_LOGICAL);
case eCSSProperty_border_left_color:
return ParseDirectionalBoxProperty(aErrorCode,
eCSSProperty_border_left_color,
NS_BOXPROP_SOURCE_PHYSICAL);
case eCSSProperty_border_right_color:
return ParseDirectionalBoxProperty(aErrorCode,
eCSSProperty_border_right_color,
NS_BOXPROP_SOURCE_PHYSICAL);
case eCSSProperty_border_start_color:
return ParseDirectionalBoxProperty(aErrorCode,
eCSSProperty_border_start_color,
NS_BOXPROP_SOURCE_LOGICAL);
case eCSSProperty_border_end_width:
return ParseDirectionalBoxProperty(aErrorCode,
eCSSProperty_border_end_width,
NS_BOXPROP_SOURCE_LOGICAL);
case eCSSProperty_border_left_width:
return ParseDirectionalBoxProperty(aErrorCode,
eCSSProperty_border_left_width,
NS_BOXPROP_SOURCE_PHYSICAL);
case eCSSProperty_border_right_width:
return ParseDirectionalBoxProperty(aErrorCode,
eCSSProperty_border_right_width,
NS_BOXPROP_SOURCE_PHYSICAL);
case eCSSProperty_border_start_width:
return ParseDirectionalBoxProperty(aErrorCode,
eCSSProperty_border_start_width,
NS_BOXPROP_SOURCE_LOGICAL);
case eCSSProperty_border_end_style:
return ParseDirectionalBoxProperty(aErrorCode,
eCSSProperty_border_end_style,
NS_BOXPROP_SOURCE_LOGICAL);
case eCSSProperty_border_left_style:
return ParseDirectionalBoxProperty(aErrorCode,
eCSSProperty_border_left_style,
NS_BOXPROP_SOURCE_PHYSICAL);
case eCSSProperty_border_right_style:
return ParseDirectionalBoxProperty(aErrorCode,
eCSSProperty_border_right_style,
NS_BOXPROP_SOURCE_PHYSICAL);
case eCSSProperty_border_start_style:
return ParseDirectionalBoxProperty(aErrorCode,
eCSSProperty_border_start_style,
NS_BOXPROP_SOURCE_LOGICAL);
case eCSSProperty__moz_border_radius:
return ParseBorderRadius(aErrorCode);
case eCSSProperty__moz_outline_radius:
@ -4383,6 +4466,30 @@ PRBool CSSParserImpl::ParseProperty(nsresult& aErrorCode,
case eCSSProperty_padding_left_rtl_source:
case eCSSProperty_padding_right_ltr_source:
case eCSSProperty_padding_right_rtl_source:
case eCSSProperty_border_end_color_value:
case eCSSProperty_border_left_color_value:
case eCSSProperty_border_right_color_value:
case eCSSProperty_border_start_color_value:
case eCSSProperty_border_left_color_ltr_source:
case eCSSProperty_border_left_color_rtl_source:
case eCSSProperty_border_right_color_ltr_source:
case eCSSProperty_border_right_color_rtl_source:
case eCSSProperty_border_end_style_value:
case eCSSProperty_border_left_style_value:
case eCSSProperty_border_right_style_value:
case eCSSProperty_border_start_style_value:
case eCSSProperty_border_left_style_ltr_source:
case eCSSProperty_border_left_style_rtl_source:
case eCSSProperty_border_right_style_ltr_source:
case eCSSProperty_border_right_style_rtl_source:
case eCSSProperty_border_end_width_value:
case eCSSProperty_border_left_width_value:
case eCSSProperty_border_right_width_value:
case eCSSProperty_border_start_width_value:
case eCSSProperty_border_left_width_ltr_source:
case eCSSProperty_border_left_width_rtl_source:
case eCSSProperty_border_right_width_ltr_source:
case eCSSProperty_border_right_width_rtl_source:
// The user can't use these
REPORT_UNEXPECTED(PEInaccessibleProperty2);
return PR_FALSE;
@ -4426,12 +4533,26 @@ PRBool CSSParserImpl::ParseSingleValueProperty(nsresult& aErrorCode,
case eCSSProperty_border_bottom_colors:
case eCSSProperty_border_left_colors:
case eCSSProperty_border_right_colors:
case eCSSProperty_border_end_color:
case eCSSProperty_border_left_color:
case eCSSProperty_border_right_color:
case eCSSProperty_border_start_color:
case eCSSProperty_border_end_style:
case eCSSProperty_border_left_style:
case eCSSProperty_border_right_style:
case eCSSProperty_border_start_style:
case eCSSProperty_border_end_width:
case eCSSProperty_border_left_width:
case eCSSProperty_border_right_width:
case eCSSProperty_border_start_width:
case eCSSProperty_border_top_colors:
case eCSSProperty_border_spacing:
case eCSSProperty_border_style:
case eCSSProperty_border_bottom:
case eCSSProperty_border_end:
case eCSSProperty_border_left:
case eCSSProperty_border_right:
case eCSSProperty_border_start:
case eCSSProperty_border_top:
case eCSSProperty_border_width:
case eCSSProperty__moz_border_radius:
@ -4480,6 +4601,18 @@ PRBool CSSParserImpl::ParseSingleValueProperty(nsresult& aErrorCode,
case eCSSProperty_padding_left_rtl_source:
case eCSSProperty_padding_right_ltr_source:
case eCSSProperty_padding_right_rtl_source:
case eCSSProperty_border_left_color_ltr_source:
case eCSSProperty_border_left_color_rtl_source:
case eCSSProperty_border_right_color_ltr_source:
case eCSSProperty_border_right_color_rtl_source:
case eCSSProperty_border_left_style_ltr_source:
case eCSSProperty_border_left_style_rtl_source:
case eCSSProperty_border_right_style_ltr_source:
case eCSSProperty_border_right_style_rtl_source:
case eCSSProperty_border_left_width_ltr_source:
case eCSSProperty_border_left_width_rtl_source:
case eCSSProperty_border_right_width_ltr_source:
case eCSSProperty_border_right_width_rtl_source:
NS_ERROR("not currently parsed here");
return PR_FALSE;
@ -4514,20 +4647,26 @@ PRBool CSSParserImpl::ParseSingleValueProperty(nsresult& aErrorCode,
return ParseVariant(aErrorCode, aValue, VARIANT_HK,
nsCSSProps::kBorderCollapseKTable);
case eCSSProperty_border_bottom_color:
case eCSSProperty_border_left_color:
case eCSSProperty_border_right_color:
case eCSSProperty_border_end_color_value: // for internal use
case eCSSProperty_border_left_color_value: // for internal use
case eCSSProperty_border_right_color_value: // for internal use
case eCSSProperty_border_start_color_value: // for internal use
case eCSSProperty_border_top_color:
return ParseVariant(aErrorCode, aValue, VARIANT_HCK,
nsCSSProps::kBorderColorKTable);
case eCSSProperty_border_bottom_style:
case eCSSProperty_border_left_style:
case eCSSProperty_border_right_style:
case eCSSProperty_border_end_style_value: // for internal use
case eCSSProperty_border_left_style_value: // for internal use
case eCSSProperty_border_right_style_value: // for internal use
case eCSSProperty_border_start_style_value: // for internal use
case eCSSProperty_border_top_style:
return ParseVariant(aErrorCode, aValue, VARIANT_HOK,
nsCSSProps::kBorderStyleKTable);
case eCSSProperty_border_bottom_width:
case eCSSProperty_border_left_width:
case eCSSProperty_border_right_width:
case eCSSProperty_border_end_width_value: // for internal use
case eCSSProperty_border_left_width_value: // for internal use
case eCSSProperty_border_right_width_value: // for internal use
case eCSSProperty_border_start_width_value: // for internal use
case eCSSProperty_border_top_width:
return ParsePositiveVariant(aErrorCode, aValue, VARIANT_HKL,
nsCSSProps::kBorderWidthKTable);
@ -4856,6 +4995,16 @@ PRBool CSSParserImpl::ParseSingleValueProperty(nsresult& aErrorCode,
return PR_FALSE;
}
void
CSSParserImpl::InitBoxPropsAsPhysical(const nsCSSProperty *aSourceProperties)
{
nsCSSValue physical(NS_BOXPROP_SOURCE_PHYSICAL, eCSSUnit_Enumerated);
for (const nsCSSProperty *prop = aSourceProperties;
*prop != eCSSProperty_UNKNOWN; ++prop) {
AppendValue(*prop, physical);
}
}
PRBool CSSParserImpl::ParseAzimuth(nsresult& aErrorCode, nsCSSValue& aValue)
{
if (ParseVariant(aErrorCode, aValue, VARIANT_HK | VARIANT_ANGLE,
@ -5154,21 +5303,21 @@ PRBool CSSParserImpl::ParseBackgroundPositionValues(nsresult& aErrorCode)
// These must be in CSS order (top,right,bottom,left) for indexing to work
static const nsCSSProperty kBorderStyleIDs[] = {
eCSSProperty_border_top_style,
eCSSProperty_border_right_style,
eCSSProperty_border_right_style_value,
eCSSProperty_border_bottom_style,
eCSSProperty_border_left_style
eCSSProperty_border_left_style_value
};
static const nsCSSProperty kBorderWidthIDs[] = {
eCSSProperty_border_top_width,
eCSSProperty_border_right_width,
eCSSProperty_border_right_width_value,
eCSSProperty_border_bottom_width,
eCSSProperty_border_left_width
eCSSProperty_border_left_width_value
};
static const nsCSSProperty kBorderColorIDs[] = {
eCSSProperty_border_top_color,
eCSSProperty_border_right_color,
eCSSProperty_border_right_color_value,
eCSSProperty_border_bottom_color,
eCSSProperty_border_left_color
eCSSProperty_border_left_color_value
};
static const nsCSSProperty kBorderRadiusIDs[] = {
eCSSProperty__moz_border_radius_topLeft,
@ -5185,6 +5334,16 @@ static const nsCSSProperty kOutlineRadiusIDs[] = {
PRBool CSSParserImpl::ParseBorderColor(nsresult& aErrorCode)
{
static const nsCSSProperty kBorderColorSources[] = {
eCSSProperty_border_left_color_ltr_source,
eCSSProperty_border_left_color_rtl_source,
eCSSProperty_border_right_color_ltr_source,
eCSSProperty_border_right_color_rtl_source,
eCSSProperty_UNKNOWN
};
// do this now, in case 4 values weren't specified
InitBoxPropsAsPhysical(kBorderColorSources);
return ParseBoxProperties(aErrorCode, mTempData.mMargin.mBorderColor,
kBorderColorIDs);
}
@ -5242,6 +5401,24 @@ PRBool CSSParserImpl::ParseBorderSide(nsresult& aErrorCode,
}
if (aSetAllSides) {
static const nsCSSProperty kBorderSources[] = {
eCSSProperty_border_left_color_ltr_source,
eCSSProperty_border_left_color_rtl_source,
eCSSProperty_border_right_color_ltr_source,
eCSSProperty_border_right_color_rtl_source,
eCSSProperty_border_left_style_ltr_source,
eCSSProperty_border_left_style_rtl_source,
eCSSProperty_border_right_style_ltr_source,
eCSSProperty_border_right_style_rtl_source,
eCSSProperty_border_left_width_ltr_source,
eCSSProperty_border_left_width_rtl_source,
eCSSProperty_border_right_width_ltr_source,
eCSSProperty_border_right_width_rtl_source,
eCSSProperty_UNKNOWN
};
InitBoxPropsAsPhysical(kBorderSources);
// Parsing "border" shorthand; set all four sides to the same thing
for (PRInt32 index = 0; index < 4; index++) {
NS_ASSERTION(numProps == 3, "This code needs updating");
@ -5259,14 +5436,68 @@ PRBool CSSParserImpl::ParseBorderSide(nsresult& aErrorCode,
return PR_TRUE;
}
PRBool CSSParserImpl::ParseDirectionalBorderSide(nsresult& aErrorCode,
const nsCSSProperty aPropIDs[],
PRInt32 aSourceType)
{
const PRInt32 numProps = 3;
nsCSSValue values[numProps];
PRInt32 found = ParseChoice(aErrorCode, values, aPropIDs, numProps);
if ((found < 1) || (PR_FALSE == ExpectEndProperty(aErrorCode, PR_TRUE))) {
return PR_FALSE;
}
if ((found & 1) == 0) { // Provide default border-width
values[0].SetIntValue(NS_STYLE_BORDER_WIDTH_MEDIUM, eCSSUnit_Enumerated);
}
if ((found & 2) == 0) { // Provide default border-style
values[1].SetNoneValue();
}
if ((found & 4) == 0) { // text color will be used
values[2].SetIntValue(NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR, eCSSUnit_Enumerated);
}
for (PRInt32 index = 0; index < numProps; index++) {
const nsCSSProperty* subprops =
nsCSSProps::SubpropertyEntryFor(aPropIDs[index + numProps]);
NS_ASSERTION(subprops[3] == eCSSProperty_UNKNOWN,
"not box property with physical vs. logical cascading");
AppendValue(subprops[0], values[index]);
nsCSSValue typeVal(aSourceType, eCSSUnit_Enumerated);
AppendValue(subprops[1], typeVal);
AppendValue(subprops[2], typeVal);
}
return PR_TRUE;
}
PRBool CSSParserImpl::ParseBorderStyle(nsresult& aErrorCode)
{
static const nsCSSProperty kBorderStyleSources[] = {
eCSSProperty_border_left_style_ltr_source,
eCSSProperty_border_left_style_rtl_source,
eCSSProperty_border_right_style_ltr_source,
eCSSProperty_border_right_style_rtl_source,
eCSSProperty_UNKNOWN
};
// do this now, in case 4 values weren't specified
InitBoxPropsAsPhysical(kBorderStyleSources);
return ParseBoxProperties(aErrorCode, mTempData.mMargin.mBorderStyle,
kBorderStyleIDs);
}
PRBool CSSParserImpl::ParseBorderWidth(nsresult& aErrorCode)
{
static const nsCSSProperty kBorderWidthSources[] = {
eCSSProperty_border_left_width_ltr_source,
eCSSProperty_border_left_width_rtl_source,
eCSSProperty_border_right_width_ltr_source,
eCSSProperty_border_right_width_rtl_source,
eCSSProperty_UNKNOWN
};
// do this now, in case 4 values weren't specified
InitBoxPropsAsPhysical(kBorderWidthSources);
return ParseBoxProperties(aErrorCode, mTempData.mMargin.mBorderWidth,
kBorderWidthIDs);
}
@ -5833,15 +6064,16 @@ PRBool CSSParserImpl::ParseMargin(nsresult& aErrorCode)
eCSSProperty_margin_bottom,
eCSSProperty_margin_left_value
};
static const nsCSSProperty kMarginSources[] = {
eCSSProperty_margin_left_ltr_source,
eCSSProperty_margin_left_rtl_source,
eCSSProperty_margin_right_ltr_source,
eCSSProperty_margin_right_rtl_source,
eCSSProperty_UNKNOWN
};
// do this now, in case 4 values weren't specified
mTempData.SetPropertyBit(eCSSProperty_margin_left_ltr_source);
mTempData.SetPropertyBit(eCSSProperty_margin_left_rtl_source);
mTempData.SetPropertyBit(eCSSProperty_margin_right_ltr_source);
mTempData.SetPropertyBit(eCSSProperty_margin_right_rtl_source);
mTempData.mMargin.mMarginLeftLTRSource.SetIntValue(NS_BOXPROP_SOURCE_PHYSICAL, eCSSUnit_Enumerated);
mTempData.mMargin.mMarginLeftRTLSource.SetIntValue(NS_BOXPROP_SOURCE_PHYSICAL, eCSSUnit_Enumerated);
mTempData.mMargin.mMarginRightLTRSource.SetIntValue(NS_BOXPROP_SOURCE_PHYSICAL, eCSSUnit_Enumerated);
mTempData.mMargin.mMarginRightRTLSource.SetIntValue(NS_BOXPROP_SOURCE_PHYSICAL, eCSSUnit_Enumerated);
InitBoxPropsAsPhysical(kMarginSources);
return ParseBoxProperties(aErrorCode, mTempData.mMargin.mMargin,
kMarginSideIDs);
}
@ -5936,15 +6168,16 @@ PRBool CSSParserImpl::ParsePadding(nsresult& aErrorCode)
eCSSProperty_padding_bottom,
eCSSProperty_padding_left_value
};
static const nsCSSProperty kPaddingSources[] = {
eCSSProperty_padding_left_ltr_source,
eCSSProperty_padding_left_rtl_source,
eCSSProperty_padding_right_ltr_source,
eCSSProperty_padding_right_rtl_source,
eCSSProperty_UNKNOWN
};
// do this now, in case 4 values weren't specified
mTempData.SetPropertyBit(eCSSProperty_padding_left_ltr_source);
mTempData.SetPropertyBit(eCSSProperty_padding_left_rtl_source);
mTempData.SetPropertyBit(eCSSProperty_padding_right_ltr_source);
mTempData.SetPropertyBit(eCSSProperty_padding_right_rtl_source);
mTempData.mMargin.mPaddingLeftLTRSource.SetIntValue(NS_BOXPROP_SOURCE_PHYSICAL, eCSSUnit_Enumerated);
mTempData.mMargin.mPaddingLeftRTLSource.SetIntValue(NS_BOXPROP_SOURCE_PHYSICAL, eCSSUnit_Enumerated);
mTempData.mMargin.mPaddingRightLTRSource.SetIntValue(NS_BOXPROP_SOURCE_PHYSICAL, eCSSUnit_Enumerated);
mTempData.mMargin.mPaddingRightRTLSource.SetIntValue(NS_BOXPROP_SOURCE_PHYSICAL, eCSSUnit_Enumerated);
InitBoxPropsAsPhysical(kPaddingSources);
return ParseBoxProperties(aErrorCode, mTempData.mMargin.mPadding,
kPaddingSideIDs);
}

Просмотреть файл

@ -291,17 +291,73 @@ CSS_PROP_BORDER(border-bottom-style, border_bottom_style, BorderBottomStyle, Mar
CSS_PROP_BORDER(border-bottom-width, border_bottom_width, BorderBottomWidth, Margin, mBorderWidth.mBottom, eCSSType_Value, kBorderWidthKTable)
CSS_PROP_TABLEBORDER(border-collapse, border_collapse, BorderCollapse, Table, mBorderCollapse, eCSSType_Value, kBorderCollapseKTable)
CSS_PROP_SHORTHAND(border-color, border_color, BorderColor)
CSS_PROP_SHORTHAND(-moz-border-end, border_end, MozBorderEnd)
CSS_PROP_SHORTHAND(-moz-border-end-color, border_end_color, MozBorderEndColor)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_BORDER(border-end-color-value, border_end_color_value, X, Margin, mBorderEndColor, eCSSType_Value, kBorderColorKTable)
#endif
CSS_PROP_SHORTHAND(-moz-border-end-style, border_end_style, MozBorderEndStyle)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_BORDER(border-end-style-value, border_end_style_value, X, Margin, mBorderEndStyle, eCSSType_Value, kBorderStyleKTable)
#endif
CSS_PROP_SHORTHAND(-moz-border-end-width, border_end_width, MozBorderEndWidth)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_BORDER(border-end-width-value, border_end_width_value, X, Margin, mBorderEndWidth, eCSSType_Value, kBorderWidthKTable)
#endif
CSS_PROP_SHORTHAND(border-left, border_left, BorderLeft)
CSS_PROP_BORDER(border-left-color, border_left_color, BorderLeftColor, Margin, mBorderColor.mLeft, eCSSType_Value, kBorderColorKTable)
CSS_PROP_SHORTHAND(border-left-color, border_left_color, BorderLeftColor)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_BORDER(border-left-color-value, border_left_color_value, X, Margin, mBorderColor.mLeft, eCSSType_Value, kBorderColorKTable)
CSS_PROP_BORDER(border-left-color-ltr-source, border_left_color_ltr_source, X, Margin, mBorderLeftColorLTRSource, eCSSType_Value, kBoxPropSourceKTable)
CSS_PROP_BORDER(border-left-color-rtl-source, border_left_color_rtl_source, X, Margin, mBorderLeftColorRTLSource, eCSSType_Value, kBoxPropSourceKTable)
#endif
CSS_PROP_BORDER(-moz-border-left-colors, border_left_colors, MozBorderLeftColors, Margin, mBorderColors.mLeft, eCSSType_ValueList, nsnull)
CSS_PROP_BORDER(border-left-style, border_left_style, BorderLeftStyle, Margin, mBorderStyle.mLeft, eCSSType_Value, kBorderStyleKTable) // on/off will need reflow
CSS_PROP_BORDER(border-left-width, border_left_width, BorderLeftWidth, Margin, mBorderWidth.mLeft, eCSSType_Value, kBorderWidthKTable)
CSS_PROP_SHORTHAND(border-left-style, border_left_style, BorderLeftStyle) // on/off will need reflow
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_BORDER(border-left-style-value, border_left_style_value, X, Margin, mBorderStyle.mLeft, eCSSType_Value, kBorderStyleKTable)
CSS_PROP_BORDER(border-left-style-ltr-source, border_left_style_ltr_source, X, Margin, mBorderLeftStyleLTRSource, eCSSType_Value, kBoxPropSourceKTable)
CSS_PROP_BORDER(border-left-style-rtl-source, border_left_style_rtl_source, X, Margin, mBorderLeftStyleRTLSource, eCSSType_Value, kBoxPropSourceKTable)
#endif
CSS_PROP_SHORTHAND(border-left-width, border_left_width, BorderLeftWidth)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_BORDER(border-left-width-value, border_left_width_value, X, Margin, mBorderWidth.mLeft, eCSSType_Value, kBorderWidthKTable)
CSS_PROP_BORDER(border-left-width-ltr-source, border_left_width_ltr_source, X, Margin, mBorderLeftWidthLTRSource, eCSSType_Value, kBoxPropSourceKTable)
CSS_PROP_BORDER(border-left-width-rtl-source, border_left_width_rtl_source, X, Margin, mBorderLeftWidthRTLSource, eCSSType_Value, kBoxPropSourceKTable)
#endif
CSS_PROP_SHORTHAND(border-right, border_right, BorderRight)
CSS_PROP_BORDER(border-right-color, border_right_color, BorderRightColor, Margin, mBorderColor.mRight, eCSSType_Value, kBorderColorKTable)
CSS_PROP_SHORTHAND(border-right-color, border_right_color, BorderRightColor)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_BORDER(border-right-color-value, border_right_color_value, X, Margin, mBorderColor.mRight, eCSSType_Value, kBorderColorKTable)
CSS_PROP_BORDER(border-right-color-ltr-source, border_right_color_ltr_source, X, Margin, mBorderRightColorLTRSource, eCSSType_Value, kBoxPropSourceKTable)
CSS_PROP_BORDER(border-right-color-rtl-source, border_right_color_rtl_source, X, Margin, mBorderRightColorRTLSource, eCSSType_Value, kBoxPropSourceKTable)
#endif
CSS_PROP_BORDER(-moz-border-right-colors, border_right_colors, MozBorderRightColors, Margin, mBorderColors.mRight, eCSSType_ValueList, nsnull)
CSS_PROP_BORDER(border-right-style, border_right_style, BorderRightStyle, Margin, mBorderStyle.mRight, eCSSType_Value, kBorderStyleKTable) // on/off will need reflow
CSS_PROP_BORDER(border-right-width, border_right_width, BorderRightWidth, Margin, mBorderWidth.mRight, eCSSType_Value, kBorderWidthKTable)
CSS_PROP_SHORTHAND(border-right-style, border_right_style, BorderRightStyle) // on/off will need reflow
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_BORDER(border-right-style-value, border_right_style_value, X, Margin, mBorderStyle.mRight, eCSSType_Value, kBorderStyleKTable)
CSS_PROP_BORDER(border-right-style-ltr-source, border_right_style_ltr_source, X, Margin, mBorderRightStyleLTRSource, eCSSType_Value, kBoxPropSourceKTable)
CSS_PROP_BORDER(border-right-style-rtl-source, border_right_style_rtl_source, X, Margin, mBorderRightStyleRTLSource, eCSSType_Value, kBoxPropSourceKTable)
#endif
CSS_PROP_SHORTHAND(border-right-width, border_right_width, BorderRightWidth)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_BORDER(border-right-width-value, border_right_width_value, X, Margin, mBorderWidth.mRight, eCSSType_Value, kBorderWidthKTable)
CSS_PROP_BORDER(border-right-width-ltr-source, border_right_width_ltr_source, X, Margin, mBorderRightWidthLTRSource, eCSSType_Value, kBoxPropSourceKTable)
CSS_PROP_BORDER(border-right-width-rtl-source, border_right_width_rtl_source, X, Margin, mBorderRightWidthRTLSource, eCSSType_Value, kBoxPropSourceKTable)
#endif
CSS_PROP_TABLEBORDER(border-spacing, border_spacing, BorderSpacing, Table, mBorderSpacing, eCSSType_ValuePair, nsnull) // XXX bug 3935
CSS_PROP_SHORTHAND(-moz-border-start, border_start, MozBorderStart)
CSS_PROP_SHORTHAND(-moz-border-start-color, border_start_color, MozBorderStartColor)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_BORDER(border-start-color-value, border_start_color_value, X, Margin, mBorderStartColor, eCSSType_Value, kBorderColorKTable)
#endif
CSS_PROP_SHORTHAND(-moz-border-start-style, border_start_style, MozBorderStartStyle)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_BORDER(border-start-style-value, border_start_style_value, X, Margin, mBorderStartStyle, eCSSType_Value, kBorderStyleKTable)
#endif
CSS_PROP_SHORTHAND(-moz-border-start-width, border_start_width, MozBorderStartWidth)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_BORDER(border-start-width-value, border_start_width_value, X, Margin, mBorderStartWidth, eCSSType_Value, kBorderWidthKTable)
#endif
CSS_PROP_SHORTHAND(border-style, border_style, BorderStyle) // on/off will need reflow
CSS_PROP_SHORTHAND(border-top, border_top, BorderTop)
CSS_PROP_BORDER(border-top-color, border_top_color, BorderTopColor, Margin, mBorderColor.mTop, eCSSType_Value, kBorderColorKTable)

Просмотреть файл

@ -1245,17 +1245,29 @@ static const nsCSSProperty gBackgroundSubpropTable[] = {
static const nsCSSProperty gBorderSubpropTable[] = {
eCSSProperty_border_top_width,
eCSSProperty_border_right_width,
eCSSProperty_border_right_width_value,
eCSSProperty_border_right_width_ltr_source,
eCSSProperty_border_right_width_rtl_source,
eCSSProperty_border_bottom_width,
eCSSProperty_border_left_width,
eCSSProperty_border_left_width_value,
eCSSProperty_border_left_width_ltr_source,
eCSSProperty_border_left_width_rtl_source,
eCSSProperty_border_top_style,
eCSSProperty_border_right_style,
eCSSProperty_border_right_style_value,
eCSSProperty_border_right_style_ltr_source,
eCSSProperty_border_right_style_rtl_source,
eCSSProperty_border_bottom_style,
eCSSProperty_border_left_style,
eCSSProperty_border_left_style_value,
eCSSProperty_border_left_style_ltr_source,
eCSSProperty_border_left_style_rtl_source,
eCSSProperty_border_top_color,
eCSSProperty_border_right_color,
eCSSProperty_border_right_color_value,
eCSSProperty_border_right_color_ltr_source,
eCSSProperty_border_right_color_rtl_source,
eCSSProperty_border_bottom_color,
eCSSProperty_border_left_color,
eCSSProperty_border_left_color_value,
eCSSProperty_border_left_color_ltr_source,
eCSSProperty_border_left_color_rtl_source,
eCSSProperty_UNKNOWN
};
@ -1270,34 +1282,152 @@ static const nsCSSProperty gBorderBottomSubpropTable[] = {
static const nsCSSProperty gBorderColorSubpropTable[] = {
// Code relies on these being in top-right-bottom-left order.
eCSSProperty_border_top_color,
eCSSProperty_border_right_color,
eCSSProperty_border_right_color_value,
eCSSProperty_border_bottom_color,
eCSSProperty_border_left_color,
eCSSProperty_border_left_color_value,
// extras:
eCSSProperty_border_left_color_ltr_source,
eCSSProperty_border_left_color_rtl_source,
eCSSProperty_border_right_color_ltr_source,
eCSSProperty_border_right_color_rtl_source,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gMozBorderEndColorSubpropTable[] = {
// nsCSSParser::ParseDirectionalBoxProperty depends on this order
eCSSProperty_border_end_color_value,
eCSSProperty_border_right_color_ltr_source,
eCSSProperty_border_left_color_rtl_source,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBorderLeftColorSubpropTable[] = {
// nsCSSParser::ParseDirectionalBoxProperty depends on this order
eCSSProperty_border_left_color_value,
eCSSProperty_border_left_color_ltr_source,
eCSSProperty_border_left_color_rtl_source,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBorderRightColorSubpropTable[] = {
// nsCSSParser::ParseDirectionalBoxProperty depends on this order
eCSSProperty_border_right_color_value,
eCSSProperty_border_right_color_ltr_source,
eCSSProperty_border_right_color_rtl_source,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gMozBorderStartColorSubpropTable[] = {
// nsCSSParser::ParseDirectionalBoxProperty depends on this order
eCSSProperty_border_start_color_value,
eCSSProperty_border_left_color_ltr_source,
eCSSProperty_border_right_color_rtl_source,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gMozBorderEndSubpropTable[] = {
// nsCSSDeclaration.cpp output the subproperties in this order.
eCSSProperty_border_end_width_value,
eCSSProperty_border_end_style_value,
eCSSProperty_border_end_color_value,
// extras:
eCSSProperty_border_right_width_ltr_source,
eCSSProperty_border_left_width_rtl_source,
eCSSProperty_border_right_style_ltr_source,
eCSSProperty_border_left_style_rtl_source,
eCSSProperty_border_right_color_ltr_source,
eCSSProperty_border_left_color_rtl_source,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBorderLeftSubpropTable[] = {
// nsCSSDeclaration.cpp outputs the subproperties in this order.
eCSSProperty_border_left_width,
eCSSProperty_border_left_style,
eCSSProperty_border_left_color,
eCSSProperty_border_left_width_value,
eCSSProperty_border_left_style_value,
eCSSProperty_border_left_color_value,
// extras:
eCSSProperty_border_left_width_ltr_source,
eCSSProperty_border_left_width_rtl_source,
eCSSProperty_border_left_style_ltr_source,
eCSSProperty_border_left_style_rtl_source,
eCSSProperty_border_left_color_ltr_source,
eCSSProperty_border_left_color_rtl_source,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBorderRightSubpropTable[] = {
// nsCSSDeclaration.cpp outputs the subproperties in this order.
eCSSProperty_border_right_width,
eCSSProperty_border_right_style,
eCSSProperty_border_right_color,
eCSSProperty_border_right_width_value,
eCSSProperty_border_right_style_value,
eCSSProperty_border_right_color_value,
// extras:
eCSSProperty_border_right_width_ltr_source,
eCSSProperty_border_right_width_rtl_source,
eCSSProperty_border_right_style_ltr_source,
eCSSProperty_border_right_style_rtl_source,
eCSSProperty_border_right_color_ltr_source,
eCSSProperty_border_right_color_rtl_source,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gMozBorderStartSubpropTable[] = {
// nsCSSDeclaration.cpp outputs the subproperties in this order.
eCSSProperty_border_start_width_value,
eCSSProperty_border_start_style_value,
eCSSProperty_border_start_color_value,
// extras:
eCSSProperty_border_left_width_ltr_source,
eCSSProperty_border_right_width_rtl_source,
eCSSProperty_border_left_style_ltr_source,
eCSSProperty_border_right_style_rtl_source,
eCSSProperty_border_left_color_ltr_source,
eCSSProperty_border_right_color_rtl_source,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBorderStyleSubpropTable[] = {
// Code relies on these being in top-right-bottom-left order.
eCSSProperty_border_top_style,
eCSSProperty_border_right_style,
eCSSProperty_border_right_style_value,
eCSSProperty_border_bottom_style,
eCSSProperty_border_left_style,
eCSSProperty_border_left_style_value,
// extras:
eCSSProperty_border_left_style_ltr_source,
eCSSProperty_border_left_style_rtl_source,
eCSSProperty_border_right_style_ltr_source,
eCSSProperty_border_right_style_rtl_source,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBorderLeftStyleSubpropTable[] = {
// nsCSSParser::ParseDirectionalBoxProperty depends on this order
eCSSProperty_border_left_style_value,
eCSSProperty_border_left_style_ltr_source,
eCSSProperty_border_left_style_rtl_source,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBorderRightStyleSubpropTable[] = {
// nsCSSParser::ParseDirectionalBoxProperty depends on this order
eCSSProperty_border_right_style_value,
eCSSProperty_border_right_style_ltr_source,
eCSSProperty_border_right_style_rtl_source,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gMozBorderStartStyleSubpropTable[] = {
// nsCSSParser::ParseDirectionalBoxProperty depends on this order
eCSSProperty_border_start_style_value,
eCSSProperty_border_left_style_ltr_source,
eCSSProperty_border_right_style_rtl_source,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gMozBorderEndStyleSubpropTable[] = {
// nsCSSParser::ParseDirectionalBoxProperty depends on this order
eCSSProperty_border_end_style_value,
eCSSProperty_border_right_style_ltr_source,
eCSSProperty_border_left_style_rtl_source,
eCSSProperty_UNKNOWN
};
@ -1312,9 +1442,46 @@ static const nsCSSProperty gBorderTopSubpropTable[] = {
static const nsCSSProperty gBorderWidthSubpropTable[] = {
// Code relies on these being in top-right-bottom-left order.
eCSSProperty_border_top_width,
eCSSProperty_border_right_width,
eCSSProperty_border_right_width_value,
eCSSProperty_border_bottom_width,
eCSSProperty_border_left_width,
eCSSProperty_border_left_width_value,
// extras:
eCSSProperty_border_left_width_ltr_source,
eCSSProperty_border_left_width_rtl_source,
eCSSProperty_border_right_width_ltr_source,
eCSSProperty_border_right_width_rtl_source,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBorderLeftWidthSubpropTable[] = {
// nsCSSParser::ParseDirectionalBoxProperty depends on this order
eCSSProperty_border_left_width_value,
eCSSProperty_border_left_width_ltr_source,
eCSSProperty_border_left_width_rtl_source,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBorderRightWidthSubpropTable[] = {
// nsCSSParser::ParseDirectionalBoxProperty depends on this order
eCSSProperty_border_right_width_value,
eCSSProperty_border_right_width_ltr_source,
eCSSProperty_border_right_width_rtl_source,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gMozBorderStartWidthSubpropTable[] = {
// nsCSSParser::ParseDirectionalBoxProperty depends on this order
eCSSProperty_border_start_width_value,
eCSSProperty_border_left_width_ltr_source,
eCSSProperty_border_right_width_rtl_source,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gMozBorderEndWidthSubpropTable[] = {
// nsCSSParser::ParseDirectionalBoxProperty depends on this order
eCSSProperty_border_end_width_value,
eCSSProperty_border_right_width_ltr_source,
eCSSProperty_border_left_width_rtl_source,
eCSSProperty_UNKNOWN
};

Просмотреть файл

@ -312,9 +312,27 @@ nsCSSMargin::nsCSSMargin(const nsCSSMargin& aCopy)
mPaddingRightLTRSource(aCopy.mPaddingRightLTRSource),
mPaddingRightRTLSource(aCopy.mPaddingRightRTLSource),
mBorderWidth(aCopy.mBorderWidth),
mBorderStartWidth(aCopy.mBorderStartWidth),
mBorderEndWidth(aCopy.mBorderEndWidth),
mBorderLeftWidthLTRSource(aCopy.mBorderLeftWidthLTRSource),
mBorderLeftWidthRTLSource(aCopy.mBorderLeftWidthRTLSource),
mBorderRightWidthLTRSource(aCopy.mBorderRightWidthLTRSource),
mBorderRightWidthRTLSource(aCopy.mBorderRightWidthRTLSource),
mBorderColor(aCopy.mBorderColor),
mBorderStartColor(aCopy.mBorderStartColor),
mBorderEndColor(aCopy.mBorderEndColor),
mBorderLeftColorLTRSource(aCopy.mBorderLeftColorLTRSource),
mBorderLeftColorRTLSource(aCopy.mBorderLeftColorRTLSource),
mBorderRightColorLTRSource(aCopy.mBorderRightColorLTRSource),
mBorderRightColorRTLSource(aCopy.mBorderRightColorRTLSource),
mBorderColors(aCopy.mBorderColors),
mBorderStyle(aCopy.mBorderStyle),
mBorderStartStyle(aCopy.mBorderStartStyle),
mBorderEndStyle(aCopy.mBorderEndStyle),
mBorderLeftStyleLTRSource(aCopy.mBorderLeftStyleLTRSource),
mBorderLeftStyleRTLSource(aCopy.mBorderLeftStyleRTLSource),
mBorderRightStyleLTRSource(aCopy.mBorderRightStyleLTRSource),
mBorderRightStyleRTLSource(aCopy.mBorderRightStyleRTLSource),
mBorderRadius(aCopy.mBorderRadius),
mOutlineWidth(aCopy.mOutlineWidth),
mOutlineColor(aCopy.mOutlineColor),

Просмотреть файл

@ -304,9 +304,27 @@ struct nsCSSMargin : public nsCSSStruct {
nsCSSValue mPaddingRightLTRSource;
nsCSSValue mPaddingRightRTLSource;
nsCSSRect mBorderWidth;
nsCSSValue mBorderStartWidth;
nsCSSValue mBorderEndWidth;
nsCSSValue mBorderLeftWidthLTRSource;
nsCSSValue mBorderLeftWidthRTLSource;
nsCSSValue mBorderRightWidthLTRSource;
nsCSSValue mBorderRightWidthRTLSource;
nsCSSRect mBorderColor;
nsCSSValue mBorderStartColor;
nsCSSValue mBorderEndColor;
nsCSSValue mBorderLeftColorLTRSource;
nsCSSValue mBorderLeftColorRTLSource;
nsCSSValue mBorderRightColorLTRSource;
nsCSSValue mBorderRightColorRTLSource;
nsCSSValueListRect mBorderColors;
nsCSSRect mBorderStyle;
nsCSSValue mBorderStartStyle;
nsCSSValue mBorderEndStyle;
nsCSSValue mBorderLeftStyleLTRSource;
nsCSSValue mBorderLeftStyleRTLSource;
nsCSSValue mBorderRightStyleLTRSource;
nsCSSValue mBorderRightStyleRTLSource;
nsCSSRect mBorderRadius; // (extension)
nsCSSValue mOutlineWidth;
nsCSSValue mOutlineColor;

Просмотреть файл

@ -1712,11 +1712,9 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
* 'margin-left' in the cascade or the highest 'margin-start'.
*
* Finally, since we can compute the normal (*-left and *-right)
* properties in a loop, this function works by assuming the computation
* for those properties has happened as though we have not implemented
* the logical properties (*-start and *-end). It is the responsibility
* of this function to replace the computed values with the values
* computed from the logical properties when needed.
* properties in a loop, this function works by modifying the data we
* will use in that loop (which the caller must copy from the const
* input).
*/
void
nsRuleNode::AdjustLogicalBoxProp(nsStyleContext* aContext,
@ -1724,10 +1722,8 @@ nsRuleNode::AdjustLogicalBoxProp(nsStyleContext* aContext,
const nsCSSValue& aRTLSource,
const nsCSSValue& aLTRLogicalValue,
const nsCSSValue& aRTLLogicalValue,
const nsStyleSides& aParentRect,
nsStyleSides& aRect,
PRUint8 aSide,
PRInt32 aMask,
nsCSSRect& aValueRect,
PRBool& aInherited)
{
PRBool LTRlogical = aLTRSource.GetUnit() == eCSSUnit_Enumerated &&
@ -1741,19 +1737,12 @@ nsRuleNode::AdjustLogicalBoxProp(nsStyleContext* aContext,
aInherited = PR_TRUE;
PRUint8 dir = aContext->GetStyleVisibility()->mDirection;
nsStyleCoord parentCoord;
nsStyleCoord coord;
aParentRect.Get(aSide, parentCoord);
if (dir == NS_STYLE_DIRECTION_LTR) {
if (LTRlogical &&
SetCoord(aLTRLogicalValue, coord, parentCoord, aMask, aContext,
mPresContext, aInherited))
aRect.Set(aSide, coord);
if (LTRlogical)
aValueRect.*(nsCSSRect::sides[aSide]) = aLTRLogicalValue;
} else {
if (RTLlogical &&
SetCoord(aRTLLogicalValue, coord, parentCoord, aMask, aContext,
mPresContext, aInherited))
aRect.Set(aSide, coord);
if (RTLlogical)
aValueRect.*(nsCSSRect::sides[aSide]) = aRTLLogicalValue;
}
}
}
@ -3262,28 +3251,26 @@ nsRuleNode::ComputeMarginData(nsStyleStruct* aStartStruct,
// margin: length, percent, auto, inherit
nsStyleCoord coord;
nsStyleCoord parentCoord;
nsCSSRect ourMargin(marginData.mMargin);
AdjustLogicalBoxProp(aContext,
marginData.mMarginLeftLTRSource,
marginData.mMarginLeftRTLSource,
marginData.mMarginStart, marginData.mMarginEnd,
NS_SIDE_LEFT, ourMargin, inherited);
AdjustLogicalBoxProp(aContext,
marginData.mMarginRightLTRSource,
marginData.mMarginRightRTLSource,
marginData.mMarginEnd, marginData.mMarginStart,
NS_SIDE_RIGHT, ourMargin, inherited);
NS_FOR_CSS_SIDES(side) {
parentMargin->mMargin.Get(side, parentCoord);
if (SetCoord(marginData.mMargin.*(nsCSSRect::sides[side]),
if (SetCoord(ourMargin.*(nsCSSRect::sides[side]),
coord, parentCoord, SETCOORD_LPAH,
aContext, mPresContext, inherited)) {
margin->mMargin.Set(side, coord);
}
}
AdjustLogicalBoxProp(aContext,
marginData.mMarginLeftLTRSource,
marginData.mMarginLeftRTLSource,
marginData.mMarginStart, marginData.mMarginEnd,
parentMargin->mMargin, margin->mMargin,
NS_SIDE_LEFT, SETCOORD_LPAH, inherited);
AdjustLogicalBoxProp(aContext,
marginData.mMarginRightLTRSource,
marginData.mMarginRightRTLSource,
marginData.mMarginEnd, marginData.mMarginStart,
parentMargin->mMargin, margin->mMargin,
NS_SIDE_RIGHT, SETCOORD_LPAH, inherited);
margin->RecalcData();
COMPUTE_END_RESET(Margin, margin)
}
@ -3301,9 +3288,22 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct,
// border-width, border-*-width: length, enum, inherit
nsStyleCoord coord;
nsStyleCoord parentCoord;
nsCSSRect ourBorderWidth(marginData.mBorderWidth);
AdjustLogicalBoxProp(aContext,
marginData.mBorderLeftWidthLTRSource,
marginData.mBorderLeftWidthRTLSource,
marginData.mBorderStartWidth,
marginData.mBorderEndWidth,
NS_SIDE_LEFT, ourBorderWidth, inherited);
AdjustLogicalBoxProp(aContext,
marginData.mBorderRightWidthLTRSource,
marginData.mBorderRightWidthRTLSource,
marginData.mBorderEndWidth,
marginData.mBorderStartWidth,
NS_SIDE_RIGHT, ourBorderWidth, inherited);
{ // scope for compilers with broken |for| loop scoping
NS_FOR_CSS_SIDES(side) {
const nsCSSValue &value = marginData.mBorderWidth.*(nsCSSRect::sides[side]);
const nsCSSValue &value = ourBorderWidth.*(nsCSSRect::sides[side]);
NS_ASSERTION(eCSSUnit_Percent != value.GetUnit(),
"Percentage borders not implemented yet "
"If implementing, make sure to fix all consumers of "
@ -3344,7 +3344,17 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct,
}
// border-style, border-*-style: enum, none, inherit
const nsCSSRect& ourStyle = marginData.mBorderStyle;
nsCSSRect ourStyle(marginData.mBorderStyle);
AdjustLogicalBoxProp(aContext,
marginData.mBorderLeftStyleLTRSource,
marginData.mBorderLeftStyleRTLSource,
marginData.mBorderStartStyle, marginData.mBorderEndStyle,
NS_SIDE_LEFT, ourStyle, inherited);
AdjustLogicalBoxProp(aContext,
marginData.mBorderRightStyleLTRSource,
marginData.mBorderRightStyleRTLSource,
marginData.mBorderEndStyle, marginData.mBorderStartStyle,
NS_SIDE_RIGHT, ourStyle, inherited);
{ // scope for compilers with broken |for| loop scoping
NS_FOR_CSS_SIDES(side) {
const nsCSSValue &value = ourStyle.*(nsCSSRect::sides[side]);
@ -3388,10 +3398,19 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct,
}
// border-color, border-*-color: color, string, enum, inherit
const nsCSSRect& ourBorderColor = marginData.mBorderColor;
nsCSSRect ourBorderColor(marginData.mBorderColor);
PRBool transparent;
PRBool foreground;
AdjustLogicalBoxProp(aContext,
marginData.mBorderLeftColorLTRSource,
marginData.mBorderLeftColorRTLSource,
marginData.mBorderStartColor, marginData.mBorderEndColor,
NS_SIDE_LEFT, ourBorderColor, inherited);
AdjustLogicalBoxProp(aContext,
marginData.mBorderRightColorLTRSource,
marginData.mBorderRightColorRTLSource,
marginData.mBorderEndColor, marginData.mBorderStartColor,
NS_SIDE_RIGHT, ourBorderColor, inherited);
{ // scope for compilers with broken |for| loop scoping
NS_FOR_CSS_SIDES(side) {
const nsCSSValue &value = ourBorderColor.*(nsCSSRect::sides[side]);
@ -3466,28 +3485,26 @@ nsRuleNode::ComputePaddingData(nsStyleStruct* aStartStruct,
// padding: length, percent, inherit
nsStyleCoord coord;
nsStyleCoord parentCoord;
nsCSSRect ourPadding(marginData.mPadding);
AdjustLogicalBoxProp(aContext,
marginData.mPaddingLeftLTRSource,
marginData.mPaddingLeftRTLSource,
marginData.mPaddingStart, marginData.mPaddingEnd,
NS_SIDE_LEFT, ourPadding, inherited);
AdjustLogicalBoxProp(aContext,
marginData.mPaddingRightLTRSource,
marginData.mPaddingRightRTLSource,
marginData.mPaddingEnd, marginData.mPaddingStart,
NS_SIDE_RIGHT, ourPadding, inherited);
NS_FOR_CSS_SIDES(side) {
parentPadding->mPadding.Get(side, parentCoord);
if (SetCoord(marginData.mPadding.*(nsCSSRect::sides[side]),
if (SetCoord(ourPadding.*(nsCSSRect::sides[side]),
coord, parentCoord, SETCOORD_LPH,
aContext, mPresContext, inherited)) {
padding->mPadding.Set(side, coord);
}
}
AdjustLogicalBoxProp(aContext,
marginData.mPaddingLeftLTRSource,
marginData.mPaddingLeftRTLSource,
marginData.mPaddingStart, marginData.mPaddingEnd,
parentPadding->mPadding, padding->mPadding,
NS_SIDE_LEFT, SETCOORD_LPH, inherited);
AdjustLogicalBoxProp(aContext,
marginData.mPaddingRightLTRSource,
marginData.mPaddingRightRTLSource,
marginData.mPaddingEnd, marginData.mPaddingStart,
parentPadding->mPadding, padding->mPadding,
NS_SIDE_RIGHT, SETCOORD_LPH, inherited);
padding->RecalcData();
COMPUTE_END_RESET(Padding, padding)
}

Просмотреть файл

@ -59,6 +59,7 @@ typedef nsCSSStruct nsRuleDataStruct;
struct nsRuleDataFont;
class nsCSSValue;
struct nsCSSRect;
struct nsInheritedStyleData
{
@ -620,12 +621,10 @@ protected:
const nsCSSValue& aRTLSource,
const nsCSSValue& aLTRLogicalValue,
const nsCSSValue& aRTLLogicalValue,
const nsStyleSides& aParentRect,
nsStyleSides& aRect,
PRUint8 aSide,
PRInt32 aMask,
nsCSSRect& aValueRect,
PRBool& aInherited);
inline RuleDetail CheckSpecifiedProperties(const nsStyleStructID aSID, const nsRuleDataStruct& aRuleDataStruct);
NS_HIDDEN_(const nsStyleStruct*) GetParentData(const nsStyleStructID aSID);

Просмотреть файл

@ -113,6 +113,30 @@ const char *gInaccessibleProperties[] = {
// Don't print the properties that aren't accepted by the parser, per
// CSSParserImpl::ParseProperty
"-x-system-font",
"border-end-color-value",
"border-end-style-value",
"border-end-width-value",
"border-left-color-value",
"border-left-color-ltr-source",
"border-left-color-rtl-source",
"border-left-style-value",
"border-left-style-ltr-source",
"border-left-style-rtl-source",
"border-left-width-value",
"border-left-width-ltr-source",
"border-left-width-rtl-source",
"border-right-color-value",
"border-right-color-ltr-source",
"border-right-color-rtl-source",
"border-right-style-value",
"border-right-style-ltr-source",
"border-right-style-rtl-source",
"border-right-width-value",
"border-right-width-ltr-source",
"border-right-width-rtl-source",
"border-start-color-value",
"border-start-style-value",
"border-start-width-value",
"margin-end-value",
"margin-left-value",
"margin-right-value",

Просмотреть файл

@ -66,7 +66,8 @@ css_properties.js: host_ListCSSProperties$(HOST_BIN_SUFFIX) css_properties_like_
./host_ListCSSProperties$(HOST_BIN_SUFFIX) > $@
cat $(srcdir)/css_properties_like_longhand.js >> $@
_TEST_FILES = test_bug221428.html \
_TEST_FILES = test_bug74880.html \
test_bug221428.html \
test_bug302186.html \
test_bug319381.html \
test_bug365932.html \

Просмотреть файл

@ -109,6 +109,41 @@ var gCSSProperties = {
other_values: [ "red green", "red #fc3", "#ff00cc" ],
invalid_values: [ "red none", "red inherit", "red, green" ]
},
"-moz-border-end": {
domProp: "MozBorderEnd",
inherited: false,
type: CSS_TYPE_TRUE_SHORTHAND,
subproperties: [ "-moz-border-end-color", "-moz-border-end-style", "-moz-border-end-width" ],
initial_values: [ "none", "medium", "currentColor", "none medium currentcolor" ],
other_values: [ "solid", "thin", "green", "medium solid", "green solid", "10px solid", "thick solid", "5px green none" ],
invalid_values: [ "5%" ]
},
"-moz-border-end-color": {
domProp: "MozBorderEndColor",
inherited: false,
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
initial_values: [ "currentColor" ],
other_values: [ "green", "rgba(255,128,0,0.5)", "transparent" ],
invalid_values: [ "#0", "#00", "#0000", "#00000", "#0000000", "#00000000", "#000000000" ]
},
"-moz-border-end-style": {
domProp: "MozBorderEndStyle",
inherited: false,
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
/* XXX hidden is sometimes the same as initial */
initial_values: [ "none" ],
other_values: [ "solid", "dashed", "dotted", "double", "outset", "inset", "groove", "ridge" ],
invalid_values: []
},
"-moz-border-end-width": {
domProp: "MozBorderEndWidth",
inherited: false,
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
prerequisites: { "-moz-border-end-style": "solid" },
initial_values: [ "medium", "3px" ],
other_values: [ "thin", "thick", "1px", "2em" ],
invalid_values: [ "5%" ]
},
"-moz-border-left-colors": {
domProp: "MozBorderLeftColors",
inherited: false,
@ -166,6 +201,41 @@ var gCSSProperties = {
other_values: [ "red green", "red #fc3", "#ff00cc" ],
invalid_values: [ "red none", "red inherit", "red, green" ]
},
"-moz-border-start": {
domProp: "MozBorderStart",
inherited: false,
type: CSS_TYPE_TRUE_SHORTHAND,
subproperties: [ "-moz-border-start-color", "-moz-border-start-style", "-moz-border-start-width" ],
initial_values: [ "none", "medium", "currentColor", "none medium currentcolor" ],
other_values: [ "solid", "thin", "green", "medium solid", "green solid", "10px solid", "thick solid", "5px green none" ],
invalid_values: [ "5%" ]
},
"-moz-border-start-color": {
domProp: "MozBorderStartColor",
inherited: false,
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
initial_values: [ "currentColor" ],
other_values: [ "green", "rgba(255,128,0,0.5)", "transparent" ],
invalid_values: [ "#0", "#00", "#0000", "#00000", "#0000000", "#00000000", "#000000000" ]
},
"-moz-border-start-style": {
domProp: "MozBorderStartStyle",
inherited: false,
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
/* XXX hidden is sometimes the same as initial */
initial_values: [ "none" ],
other_values: [ "solid", "dashed", "dotted", "double", "outset", "inset", "groove", "ridge" ],
invalid_values: []
},
"-moz-border-start-width": {
domProp: "MozBorderStartWidth",
inherited: false,
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
prerequisites: { "-moz-border-start-style": "solid" },
initial_values: [ "medium", "3px" ],
other_values: [ "thin", "thick", "1px", "2em" ],
invalid_values: [ "5%" ]
},
"-moz-border-top-colors": {
domProp: "MozBorderTopColors",
inherited: false,
@ -528,7 +598,7 @@ var gCSSProperties = {
"border-left-color": {
domProp: "borderLeftColor",
inherited: false,
type: CSS_TYPE_LONGHAND,
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
initial_values: [ "currentColor" ],
other_values: [ "green", "rgba(255,128,0,0.5)", "transparent" ],
invalid_values: [ "#0", "#00", "#0000", "#00000", "#0000000", "#00000000", "#000000000" ]
@ -536,7 +606,7 @@ var gCSSProperties = {
"border-left-style": {
domProp: "borderLeftStyle",
inherited: false,
type: CSS_TYPE_LONGHAND,
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
/* XXX hidden is sometimes the same as initial */
initial_values: [ "none" ],
other_values: [ "solid", "dashed", "dotted", "double", "outset", "inset", "groove", "ridge" ],
@ -545,7 +615,7 @@ var gCSSProperties = {
"border-left-width": {
domProp: "borderLeftWidth",
inherited: false,
type: CSS_TYPE_LONGHAND,
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
prerequisites: { "border-left-style": "solid" },
initial_values: [ "medium", "3px" ],
other_values: [ "thin", "thick", "1px", "2em" ],
@ -563,7 +633,7 @@ var gCSSProperties = {
"border-right-color": {
domProp: "borderRightColor",
inherited: false,
type: CSS_TYPE_LONGHAND,
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
initial_values: [ "currentColor" ],
other_values: [ "green", "rgba(255,128,0,0.5)", "transparent" ],
invalid_values: [ "#0", "#00", "#0000", "#00000", "#0000000", "#00000000", "#000000000" ]
@ -571,7 +641,7 @@ var gCSSProperties = {
"border-right-style": {
domProp: "borderRightStyle",
inherited: false,
type: CSS_TYPE_LONGHAND,
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
/* XXX hidden is sometimes the same as initial */
initial_values: [ "none" ],
other_values: [ "solid", "dashed", "dotted", "double", "outset", "inset", "groove", "ridge" ],
@ -580,7 +650,7 @@ var gCSSProperties = {
"border-right-width": {
domProp: "borderRightWidth",
inherited: false,
type: CSS_TYPE_LONGHAND,
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
prerequisites: { "border-right-style": "solid" },
initial_values: [ "medium", "3px" ],
other_values: [ "thin", "thick", "1px", "2em" ],

Просмотреть файл

@ -0,0 +1,120 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=74880
-->
<head>
<title>Test for Bug 74880</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<style type="text/css">
/* so that computed values for other border properties work right */
#display { border-style: solid; }
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=74880">Mozilla Bug 74880</a>
<div style="margin: 1px 2px 3px 4px; border-width: 5px 6px 7px 8px; border-style: dotted dashed solid double; border-color: blue fuchsia green orange; padding: 9px 10px 11px 12px">
<p id="display"></p>
</div>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 74880 **/
var gProps = [
[ "margin-left", "margin-right", "-moz-margin-start", "-moz-margin-end" ],
[ "padding-left", "padding-right", "-moz-padding-start", "-moz-padding-end" ],
[ "border-left-color", "border-right-color", "-moz-border-start-color", "-moz-border-end-color" ],
[ "border-left-style", "border-right-style", "-moz-border-start-style", "-moz-border-end-style" ],
[ "border-left-width", "border-right-width", "-moz-border-start-width", "-moz-border-end-width" ],
];
var gLengthValues = [ "inherit", "-moz-initial", "2px", "1em" ];
var gColorValues = [ "inherit", "-moz-initial", "currentColor", "green" ];
var gStyleValues = [ "inherit", "-moz-initial", "double", "dashed" ];
function values_for(set) {
var values;
if (set[0].match(/style$/))
values = gStyleValues;
else if (set[0].match(/color$/))
values = gColorValues;
else
values = gLengthValues;
return values;
}
var e = document.getElementById("display");
var s = e.style;
var c = window.getComputedStyle(e, "");
for each (var set in gProps) {
var values = values_for(set);
for each (var val in values) {
function check(dir, plogical, pvisual) {
var v0 = c.getPropertyValue(pvisual);
s.setProperty("direction", dir, "");
s.setProperty(pvisual, val, "");
var v1 = c.getPropertyValue(pvisual);
if (val != "-moz-initial" && val != "currentColor")
isnot(v1, v0, "setProperty set the property " + pvisual + ": " + val);
s.removeProperty(pvisual);
is(c.getPropertyValue(pvisual), v0, "removeProperty worked for " + pvisual);
s.setProperty(plogical, val, "")
var v2 = c.getPropertyValue(pvisual);
is(v2, v1, "the logical property " + plogical + ": " + val + " showed up in the right place");
s.removeProperty(plogical);
is(c.getPropertyValue(pvisual), v0, "removeProperty worked for " + plogical);
s.removeProperty("direction");
}
check("ltr", set[2], set[0]);
check("ltr", set[3], set[1]);
check("rtl", set[2], set[1]);
check("rtl", set[3], set[0]);
}
function check_cascading(dir, plogical, pvisual) {
var dirstr = "direction: " + dir + ";";
e.setAttribute("style", dirstr + pvisual + ":" + values[2]);
var v2 = c.getPropertyValue(pvisual);
e.setAttribute("style", dirstr + pvisual + ":" + values[3]);
var v3 = c.getPropertyValue(pvisual);
isnot(v2, v3, "values should produce different computed values");
var desc = ["cascading for", pvisual, "and", plogical, "with direction", dir].join(" ");
e.setAttribute("style", dirstr + pvisual + ":" + values[3] + ";" +
plogical + ":" + values[2]);
is(c.getPropertyValue(pvisual), v2, desc);
e.setAttribute("style", dirstr + plogical + ":" + values[3] + ";" +
pvisual + ":" + values[2]);
is(c.getPropertyValue(pvisual), v2, desc);
e.setAttribute("style", dirstr + pvisual + ":" + values[2] + ";" +
plogical + ":" + values[3]);
is(c.getPropertyValue(pvisual), v3, desc);
e.setAttribute("style", dirstr + plogical + ":" + values[2] + ";" +
pvisual + ":" + values[3]);
is(c.getPropertyValue(pvisual), v3, desc);
e.removeAttribute("style");
}
check_cascading("ltr", set[2], set[0]);
check_cascading("ltr", set[3], set[1]);
check_cascading("rtl", set[2], set[1]);
check_cascading("rtl", set[3], set[0]);
}
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -24,6 +24,14 @@
var gNoComputedStyle = {
"-moz-force-broken-image-icon": true,
"-moz-border-end": true, // NB: shorthand
"-moz-border-end-color": true,
"-moz-border-end-style": true,
"-moz-border-end-width": true,
"-moz-border-start": true, // NB: shorthand
"-moz-border-start-color": true,
"-moz-border-start-style": true,
"-moz-border-start-width": true,
"-moz-margin-end": true,
"-moz-margin-start": true,
"-moz-padding-end": true,

Просмотреть файл

@ -27,7 +27,9 @@ var gDeclaration = document.getElementById("testnode").style;
var gKnownFails = {
/* bug 377519: */
"-moz-border-end": true,
"-moz-border-radius": true,
"-moz-border-start": true,
"-moz-outline-radius": true,
"background": true,
"border": true,
@ -48,7 +50,9 @@ var gKnownFails = {
};
var gKnownFails2 = {
"-moz-border-end": true,
"-moz-border-radius": true,
"-moz-border-start": true,
"-moz-outline-radius": true,
"background": true,
"border": true,

Просмотреть файл

@ -37,6 +37,14 @@
var gNoComputedStyle = {
"-moz-force-broken-image-icon": true,
"-moz-border-end": true, // NB: shorthand
"-moz-border-end-color": true,
"-moz-border-end-style": true,
"-moz-border-end-width": true,
"-moz-border-start": true, // NB: shorthand
"-moz-border-start-color": true,
"-moz-border-start-style": true,
"-moz-border-start-width": true,
"-moz-margin-end": true,
"-moz-margin-start": true,
"-moz-padding-end": true,

Просмотреть файл

@ -27,7 +27,9 @@ var gDeclaration = document.getElementById("testnode").style;
var gKnownFails = {
/* bug 377519: */
"-moz-border-end": true,
"-moz-border-radius": true,
"-moz-border-start": true,
"-moz-outline-radius": true,
"background": true,
"border": true,
@ -48,7 +50,9 @@ var gKnownFails = {
};
var gKnownFails2 = {
"-moz-border-end": true,
"-moz-border-radius": true,
"-moz-border-start": true,
"-moz-outline-radius": true,
"background": true,
"border": true,

Просмотреть файл

@ -37,6 +37,14 @@
var gNoComputedStyle = {
"-moz-force-broken-image-icon": true,
"-moz-border-end": true, // NB: shorthand
"-moz-border-end-color": true,
"-moz-border-end-style": true,
"-moz-border-end-width": true,
"-moz-border-start": true, // NB: shorthand
"-moz-border-start-color": true,
"-moz-border-start-style": true,
"-moz-border-start-width": true,
"-moz-margin-end": true,
"-moz-margin-start": true,
"-moz-padding-end": true,

Просмотреть файл

@ -120,7 +120,8 @@ function xfail_ser_val(property, value)
// not the serialization.
// XXXbz is there any way we could actually filter for that, so that colors
// other than green could be used in the property database here?
if (property.match(/^border(|-bottom|-left|-right|-top)$/) &&
if ((property.match(/^border(|-bottom|-left|-right|-top)$/) ||
property.match(/^-moz-border(|-start|-end)$/)) &&
!value.match(/(green|currentcolor)/i))
return true;