Fix missing computation half of calc() for border-*-width. (Bug 363249) r=bzbarsky a2.0=blocking2.0:beta6

This commit is contained in:
L. David Baron 2010-09-09 08:21:46 -07:00
Родитель d282153a9d
Коммит e82fb6cb2f
2 изменённых файлов: 80 добавлений и 18 удалений

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

@ -5026,10 +5026,12 @@ nsRuleNode::ComputeBorderData(void* aStartStruct,
(mPresContext->GetBorderWidthTable())[value.GetIntValue()]);
}
// OK to pass bad aParentCoord since we're not passing SETCOORD_INHERIT
else if (SetCoord(value, coord, nsStyleCoord(), SETCOORD_LENGTH,
else if (SetCoord(value, coord, nsStyleCoord(),
SETCOORD_LENGTH | SETCOORD_CALC_LENGTH_ONLY,
aContext, mPresContext, canStoreInRuleTree)) {
NS_ASSERTION(coord.GetUnit() == eStyleUnit_Coord, "unexpected unit");
border->SetBorderWidth(side, coord.GetCoordValue());
// clamp negative calc() to 0.
border->SetBorderWidth(side, NS_MAX(coord.GetCoordValue(), 0));
}
else if (eCSSUnit_Inherit == value.GetUnit()) {
canStoreInRuleTree = PR_FALSE;

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

@ -129,8 +129,18 @@ var gCSSProperties = {
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
get_computed: logical_box_prop_get_computed,
prerequisites: { "-moz-border-end-style": "solid" },
initial_values: [ "medium", "3px" ],
other_values: [ "thin", "thick", "1px", "2em" ],
initial_values: [ "medium", "3px", "-moz-calc(4px - 1px)" ],
other_values: [ "thin", "thick", "1px", "2em",
"-moz-calc(2px)",
"-moz-calc(-2px)",
"-moz-calc(0em)",
"-moz-calc(0)",
"-moz-calc(5em)",
"-moz-calc(3*25px)",
"-moz-calc(25px*3)",
"-moz-calc(3*25px + 5em)",
"-moz-min(3em, 30em,200px, min(500px ,40em))",
],
invalid_values: [ "5%" ]
},
"-moz-border-image": {
@ -303,8 +313,18 @@ var gCSSProperties = {
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
get_computed: logical_box_prop_get_computed,
prerequisites: { "-moz-border-start-style": "solid" },
initial_values: [ "medium", "3px" ],
other_values: [ "thin", "thick", "1px", "2em" ],
initial_values: [ "medium", "3px", "-moz-calc(4px - 1px)" ],
other_values: [ "thin", "thick", "1px", "2em",
"-moz-calc(2px)",
"-moz-calc(-2px)",
"-moz-calc(0em)",
"-moz-calc(0)",
"-moz-calc(5em)",
"-moz-calc(3*25px)",
"-moz-calc(25px*3)",
"-moz-calc(3*25px + 5em)",
"-moz-min(3em, 30em,200px, min(500px ,40em))",
],
invalid_values: [ "5%" ]
},
"-moz-border-top-colors": {
@ -1286,8 +1306,8 @@ var gCSSProperties = {
inherited: false,
type: CSS_TYPE_TRUE_SHORTHAND,
subproperties: [ "border-bottom-color", "border-bottom-style", "border-bottom-width", "border-left-color", "border-left-style", "border-left-width", "border-right-color", "border-right-style", "border-right-width", "border-top-color", "border-top-style", "border-top-width", "-moz-border-top-colors", "-moz-border-right-colors", "-moz-border-bottom-colors", "-moz-border-left-colors", "-moz-border-image" ],
initial_values: [ "none", "medium", "currentColor", "thin", "none medium currentcolor" ],
other_values: [ "solid", "medium solid", "green solid", "10px solid", "thick solid" ],
initial_values: [ "none", "medium", "currentColor", "thin", "none medium currentcolor", "-moz-calc(4px - 1px) none" ],
other_values: [ "solid", "medium solid", "green solid", "10px solid", "thick solid", "-moz-calc(2px) solid blue" ],
invalid_values: [ "5%" ]
},
"border-bottom": {
@ -1322,8 +1342,18 @@ var gCSSProperties = {
inherited: false,
type: CSS_TYPE_LONGHAND,
prerequisites: { "border-bottom-style": "solid" },
initial_values: [ "medium", "3px" ],
other_values: [ "thin", "thick", "1px", "2em" ],
initial_values: [ "medium", "3px", "-moz-calc(4px - 1px)" ],
other_values: [ "thin", "thick", "1px", "2em",
"-moz-calc(2px)",
"-moz-calc(-2px)",
"-moz-calc(0em)",
"-moz-calc(0)",
"-moz-calc(5em)",
"-moz-calc(3*25px)",
"-moz-calc(25px*3)",
"-moz-calc(3*25px + 5em)",
"-moz-min(3em, 30em,200px, min(500px ,40em))",
],
invalid_values: [ "5%" ]
},
"border-collapse": {
@ -1375,8 +1405,18 @@ var gCSSProperties = {
inherited: false,
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
prerequisites: { "border-left-style": "solid" },
initial_values: [ "medium", "3px" ],
other_values: [ "thin", "thick", "1px", "2em" ],
initial_values: [ "medium", "3px", "-moz-calc(4px - 1px)" ],
other_values: [ "thin", "thick", "1px", "2em",
"-moz-calc(2px)",
"-moz-calc(-2px)",
"-moz-calc(0em)",
"-moz-calc(0)",
"-moz-calc(5em)",
"-moz-calc(3*25px)",
"-moz-calc(25px*3)",
"-moz-calc(3*25px + 5em)",
"-moz-min(3em, 30em,200px, min(500px ,40em))",
],
invalid_values: [ "5%" ]
},
"border-right": {
@ -1411,8 +1451,18 @@ var gCSSProperties = {
inherited: false,
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
prerequisites: { "border-right-style": "solid" },
initial_values: [ "medium", "3px" ],
other_values: [ "thin", "thick", "1px", "2em" ],
initial_values: [ "medium", "3px", "-moz-calc(4px - 1px)" ],
other_values: [ "thin", "thick", "1px", "2em",
"-moz-calc(2px)",
"-moz-calc(-2px)",
"-moz-calc(0em)",
"-moz-calc(0)",
"-moz-calc(5em)",
"-moz-calc(3*25px)",
"-moz-calc(25px*3)",
"-moz-calc(3*25px + 5em)",
"-moz-min(3em, 30em,200px, min(500px ,40em))",
],
invalid_values: [ "5%" ]
},
"border-spacing": {
@ -1465,8 +1515,18 @@ var gCSSProperties = {
inherited: false,
type: CSS_TYPE_LONGHAND,
prerequisites: { "border-top-style": "solid" },
initial_values: [ "medium", "3px" ],
other_values: [ "thin", "thick", "1px", "2em" ],
initial_values: [ "medium", "3px", "-moz-calc(4px - 1px)" ],
other_values: [ "thin", "thick", "1px", "2em",
"-moz-calc(2px)",
"-moz-calc(-2px)",
"-moz-calc(0em)",
"-moz-calc(0)",
"-moz-calc(5em)",
"-moz-calc(3*25px)",
"-moz-calc(25px*3)",
"-moz-calc(3*25px + 5em)",
"-moz-min(3em, 30em,200px, min(500px ,40em))",
],
invalid_values: [ "5%" ]
},
"border-width": {
@ -1475,8 +1535,8 @@ var gCSSProperties = {
type: CSS_TYPE_TRUE_SHORTHAND,
subproperties: [ "border-top-width", "border-right-width", "border-bottom-width", "border-left-width" ],
prerequisites: { "border-style": "solid" },
initial_values: [ "medium", "3px", "medium medium", "3px medium medium", "medium 3px medium medium" ],
other_values: [ "thin", "thick", "1px", "2em", "2px 0 0px 1em" ],
initial_values: [ "medium", "3px", "medium medium", "3px medium medium", "medium 3px medium medium", "-moz-calc(3px) 3px -moz-calc(5px - 2px) -moz-calc(2px - -1px)" ],
other_values: [ "thin", "thick", "1px", "2em", "2px 0 0px 1em", "-moz-calc(2em)" ],
invalid_values: [ "5%" ]
},
"bottom": {