From 7d1c8186143134af87c39249308c82fcf1311386 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Wed, 16 May 2007 03:03:34 +0000 Subject: [PATCH] Change round-trip testing for specified sub-properties of a shorthand to set them all before looking at computed style, since, for example, the specified font-family affects the computed line-height if the specified line-height is "normal". Bug 379809, r=dbaron --- layout/style/test/property_database.js | 15 +++++---------- layout/style/test/test_value_storage.html | 11 ++++++++++- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index e4cc154d9e9..4ad42fc630b 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -470,7 +470,7 @@ var gCSSProperties = { type: CSS_TYPE_TRUE_SHORTHAND, subproperties: [ "border-bottom-color", "border-bottom-style", "border-bottom-width" ], 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%" ] }, "border-bottom-color": { @@ -522,7 +522,7 @@ var gCSSProperties = { type: CSS_TYPE_TRUE_SHORTHAND, subproperties: [ "border-left-color", "border-left-style", "border-left-width" ], 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%" ] }, "border-left-color": { @@ -557,7 +557,7 @@ var gCSSProperties = { type: CSS_TYPE_TRUE_SHORTHAND, subproperties: [ "border-right-color", "border-right-style", "border-right-width" ], 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%" ] }, "border-right-color": { @@ -610,7 +610,7 @@ var gCSSProperties = { type: CSS_TYPE_TRUE_SHORTHAND, subproperties: [ "border-top-color", "border-top-style", "border-top-width" ], 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%" ] }, "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" ], /* XXX could be sans-serif */ initial_values: [ "medium serif" ], - other_values: [ "large serif", - /* 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" ], + 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" ], invalid_values: [] }, "font-family": { diff --git a/layout/style/test/test_value_storage.html b/layout/style/test/test_value_storage.html index d71945cf1d5..ad976ea1cfe 100644 --- a/layout/style/test/test_value_storage.html +++ b/layout/style/test/test_value_storage.html @@ -120,6 +120,8 @@ function xfail_ser_val(property, value) // We output unneeded -moz-use-text-color only in the value getter and // 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)$/) && !value.match(/(green|currentcolor)/i)) return true; @@ -250,6 +252,13 @@ function test_property(property) for (idx in info.subproperties) { var subprop = info.subproperties[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])) { func = xfail_idsersplitparse_compute(property, subprop, value, step1comps[idx]) @@ -274,8 +283,8 @@ function test_property(property) property + ": " + value + "'"); } if (test_computed && "subproperties" in info) { - gDeclaration.removeProperty(property); for (idx in info.subproperties) { + gDeclaration.removeProperty(property); var subprop = info.subproperties[idx]; if ("backend_only" in gCSSProperties[subprop]) continue;