Bug 1331903 part 1 - Fix test_inherit_computation.html test for width and inline-size. r?dbaron
MozReview-Commit-ID: HoGM5x7xVMK
--- a/layout/style/test/property_database.js
+++ b/layout/style/test/property_database.js
@@ -3954,18 +3954,23 @@ var gCSSProperties = {
initial_values: [ "normal" ],
other_values: [ "pre", "nowrap", "pre-wrap", "pre-line", "-moz-pre-space" ],
invalid_values: []
},
"width": {
domProp: "width",
inherited: false,
type: CSS_TYPE_LONGHAND,
- /* computed value tests for width test more with display:block */
- prerequisites: { "display": "block" },
+ prerequisites: {
+ // computed value tests for width test more with display:block
+ "display": "block",
+ // add some margin to avoid the initial "auto" value getting
+ // resolved to the same length as the parent element.
+ "margin-left": "5px",
+ },
initial_values: [ " auto" ],
/* XXX these have prerequisites */
other_values: [ "15px", "3em", "15%",
// these three keywords compute to the initial value only when the
// writing mode is vertical, and we're testing with a horizontal
// writing mode
"-moz-max-content", "-moz-min-content", "-moz-fit-content",
// whether -moz-available computes to the initial value depends on
@@ -5101,17 +5106,22 @@ var gCSSProperties = {
domProp: "inlineSize",
inherited: false,
type: CSS_TYPE_LONGHAND,
logical: true,
axis: true,
get_computed: logical_axis_prop_get_computed,
/* XXX testing auto has prerequisites */
initial_values: [ "auto" ],
- prerequisites: { "display": "block" },
+ prerequisites: {
+ "display": "block",
+ // add some margin to avoid the initial "auto" value getting
+ // resolved to the same length as the parent element.
+ "margin-left": "5px",
+ },
other_values: [ "15px", "3em", "15%",
// these three keywords compute to the initial value only when the
// writing mode is vertical, and we're testing with a horizontal
// writing mode
"-moz-max-content", "-moz-min-content", "-moz-fit-content",
// whether -moz-available computes to the initial value depends on
// the container size, and for the container size we're testing
// with, it does
--- a/layout/style/test/test_inherit_computation.html
+++ b/layout/style/test/test_inherit_computation.html
@@ -122,19 +122,25 @@ function test_property(property)
property + "'");
gParentRuleTop.style.removeProperty(property);
gChildRule1.style.setProperty(property, info.other_values[0], "");
var inherit_initial_computed_n = get_computed_value_node(gNChild, property);
var inherit_initial_computed_f = get_computed_value_node(gFChild, property);
is(inherit_initial_computed_n, initial_computed_n,
keyword + " should cause inheritance of initial value for '" +
property + "'");
- is(inherit_initial_computed_f, initial_computed_f,
- keyword + " should cause inheritance of initial value for '" +
- property + "'");
+ // For width and inline-size, getComputedStyle returns used value
+ // when the element is displayed. Their initial value "auto" makes
+ // the element fill available space of the parent, so it doesn't
+ // make sense to compare it with the value we get before.
+ if (property != "width" && property != "inline-size") {
+ is(inherit_initial_computed_f, initial_computed_f,
+ keyword + " should cause inheritance of initial value for '" +
+ property + "'");
+ }
gParentRuleTop.style.removeProperty(property);
gChildRule1.style.removeProperty(property);
gChildRule2.style.removeProperty(property);
}
if ("prerequisites" in info) {
var prereqs = info.prerequisites;
for (var prereq in prereqs) {