Change round-trip testing for specified sub-properties of a shorthand to setthem all before looking at computed style, since, for example, the specifiedfont-family affects the computed line-height if the specified line-height is"normal". Bug 379809, r=dbaron

This commit is contained in:
bzbarsky@mit.edu 2007-05-15 20:03:34 -07:00
parent 687c24bfdb
commit c64c0e9a5a
2 changed files with 15 additions and 11 deletions

View File

@ -470,7 +470,7 @@ var gCSSProperties = {
type: CSS_TYPE_TRUE_SHORTHAND, type: CSS_TYPE_TRUE_SHORTHAND,
subproperties: [ "border-bottom-color", "border-bottom-style", "border-bottom-width" ], subproperties: [ "border-bottom-color", "border-bottom-style", "border-bottom-width" ],
initial_values: [ "none", "medium", "currentColor", "none medium currentcolor" ], initial_values: [ "none", "medium", "currentColor", "none medium currentcolor" ],
other_values: [ "solid", "thin", "green", "medium solid", "green solid", "10px solid", "thick solid" ], other_values: [ "solid", "thin", "green", "medium solid", "green solid", "10px solid", "thick solid", "5px green none" ],
invalid_values: [ "5%" ] invalid_values: [ "5%" ]
}, },
"border-bottom-color": { "border-bottom-color": {
@ -522,7 +522,7 @@ var gCSSProperties = {
type: CSS_TYPE_TRUE_SHORTHAND, type: CSS_TYPE_TRUE_SHORTHAND,
subproperties: [ "border-left-color", "border-left-style", "border-left-width" ], subproperties: [ "border-left-color", "border-left-style", "border-left-width" ],
initial_values: [ "none", "medium", "currentColor", "none medium currentcolor" ], initial_values: [ "none", "medium", "currentColor", "none medium currentcolor" ],
other_values: [ "solid", "medium solid", "green solid", "10px solid", "thick solid" ], other_values: [ "solid", "thin", "green", "medium solid", "green solid", "10px solid", "thick solid", "5px green none" ],
invalid_values: [ "5%" ] invalid_values: [ "5%" ]
}, },
"border-left-color": { "border-left-color": {
@ -557,7 +557,7 @@ var gCSSProperties = {
type: CSS_TYPE_TRUE_SHORTHAND, type: CSS_TYPE_TRUE_SHORTHAND,
subproperties: [ "border-right-color", "border-right-style", "border-right-width" ], subproperties: [ "border-right-color", "border-right-style", "border-right-width" ],
initial_values: [ "none", "medium", "currentColor", "none medium currentcolor" ], initial_values: [ "none", "medium", "currentColor", "none medium currentcolor" ],
other_values: [ "solid", "medium solid", "green solid", "10px solid", "thick solid" ], other_values: [ "solid", "thin", "green", "medium solid", "green solid", "10px solid", "thick solid", "5px green none" ],
invalid_values: [ "5%" ] invalid_values: [ "5%" ]
}, },
"border-right-color": { "border-right-color": {
@ -610,7 +610,7 @@ var gCSSProperties = {
type: CSS_TYPE_TRUE_SHORTHAND, type: CSS_TYPE_TRUE_SHORTHAND,
subproperties: [ "border-top-color", "border-top-style", "border-top-width" ], subproperties: [ "border-top-color", "border-top-style", "border-top-width" ],
initial_values: [ "none", "medium", "currentColor", "none medium currentcolor" ], initial_values: [ "none", "medium", "currentColor", "none medium currentcolor" ],
other_values: [ "solid", "medium solid", "green solid", "10px solid", "thick solid" ], other_values: [ "solid", "thin", "green", "medium solid", "green solid", "10px solid", "thick solid", "5px green none" ],
invalid_values: [ "5%" ] invalid_values: [ "5%" ]
}, },
"border-top-color": { "border-top-color": {
@ -802,12 +802,7 @@ var gCSSProperties = {
subproperties: [ "font-style", "font-variant", "font-weight", "font-size", "line-height", "font-family", "font-stretch", "font-size-adjust" ], subproperties: [ "font-style", "font-variant", "font-weight", "font-size", "line-height", "font-family", "font-stretch", "font-size-adjust" ],
/* XXX could be sans-serif */ /* XXX could be sans-serif */
initial_values: [ "medium serif" ], initial_values: [ "medium serif" ],
other_values: [ "large serif", other_values: [ "large serif", "9px fantasy", "bold italic small-caps 24px/1.4 Times New Roman, serif", "caption", "icon", "menu", "message-box", "small-caption", "status-bar" ],
/* XXXbz Commented this out for now because it
fails line-height roundtripping on Mac
somehow. See bug 379809 */
/*"9px fantasy",*/
"bold italic small-caps 24px/1.4 Times New Roman, serif", "caption", "icon", "menu", "message-box", "small-caption", "status-bar" ],
invalid_values: [] invalid_values: []
}, },
"font-family": { "font-family": {

View File

@ -120,6 +120,8 @@ function xfail_ser_val(property, value)
// We output unneeded -moz-use-text-color only in the value getter and // We output unneeded -moz-use-text-color only in the value getter and
// not the serialization. // 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)$/) &&
!value.match(/(green|currentcolor)/i)) !value.match(/(green|currentcolor)/i))
return true; return true;
@ -250,6 +252,13 @@ function test_property(property)
for (idx in info.subproperties) { for (idx in info.subproperties) {
var subprop = info.subproperties[idx]; var subprop = info.subproperties[idx];
gDeclaration.setProperty(subprop, step1vals[idx], ""); gDeclaration.setProperty(subprop, step1vals[idx], "");
}
// Now that all the subprops are set, check their values. Note that we
// need this in a separate loop, in case parts of the shorthand affect
// the computed values of other parts.
for (idx in info.subproperties) {
var subprop = info.subproperties[idx];
if (test_computed && !("backend_only" in gCSSProperties[subprop])) { if (test_computed && !("backend_only" in gCSSProperties[subprop])) {
func = func =
xfail_idsersplitparse_compute(property, subprop, value, step1comps[idx]) xfail_idsersplitparse_compute(property, subprop, value, step1comps[idx])
@ -274,8 +283,8 @@ function test_property(property)
property + ": " + value + "'"); property + ": " + value + "'");
} }
if (test_computed && "subproperties" in info) { if (test_computed && "subproperties" in info) {
gDeclaration.removeProperty(property);
for (idx in info.subproperties) { for (idx in info.subproperties) {
gDeclaration.removeProperty(property);
var subprop = info.subproperties[idx]; var subprop = info.subproperties[idx];
if ("backend_only" in gCSSProperties[subprop]) if ("backend_only" in gCSSProperties[subprop])
continue; continue;