зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1156019 - Fix the issue of background-size property, regenerated properties css database & updated tests. r=xidorn
MozReview-Commit-ID: ACRxUEWBbSM --HG-- extra : rebase_source : 87876016c618465552bb86a21e12a5643cd530cc
This commit is contained in:
Родитель
3c3f929c78
Коммит
ae997781f5
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -594,8 +594,15 @@ static void GetKeywordsForProperty(const nsCSSPropertyID aProperty,
|
||||||
if (keywordTable) {
|
if (keywordTable) {
|
||||||
for (size_t i = 0; keywordTable[i].mKeyword != eCSSKeyword_UNKNOWN; ++i) {
|
for (size_t i = 0; keywordTable[i].mKeyword != eCSSKeyword_UNKNOWN; ++i) {
|
||||||
nsCSSKeyword word = keywordTable[i].mKeyword;
|
nsCSSKeyword word = keywordTable[i].mKeyword;
|
||||||
InsertNoDuplicates(aArray,
|
|
||||||
NS_ConvertASCIItoUTF16(nsCSSKeywords::GetStringValue(word)));
|
// These are extra -moz values which are added while rebuilding
|
||||||
|
// the properties db. These values are not relevant and are not
|
||||||
|
// documented on MDN, so filter these out
|
||||||
|
if (word != eCSSKeyword__moz_zoom_in && word != eCSSKeyword__moz_zoom_out &&
|
||||||
|
word != eCSSKeyword__moz_grab && word != eCSSKeyword__moz_grabbing) {
|
||||||
|
InsertNoDuplicates(aArray,
|
||||||
|
NS_ConvertASCIItoUTF16(nsCSSKeywords::GetStringValue(word)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -938,9 +945,7 @@ inDOMUtils::GetCSSValuesForProperty(const nsAString& aProperty,
|
||||||
uint32_t propertyParserVariant = nsCSSProps::ParserVariant(propertyID);
|
uint32_t propertyParserVariant = nsCSSProps::ParserVariant(propertyID);
|
||||||
// Get colors first.
|
// Get colors first.
|
||||||
GetColorsForProperty(propertyParserVariant, array);
|
GetColorsForProperty(propertyParserVariant, array);
|
||||||
if (propertyParserVariant & VARIANT_KEYWORD) {
|
GetKeywordsForProperty(propertyID, array);
|
||||||
GetKeywordsForProperty(propertyID, array);
|
|
||||||
}
|
|
||||||
GetOtherValuesForProperty(propertyParserVariant, array);
|
GetOtherValuesForProperty(propertyParserVariant, array);
|
||||||
} else {
|
} else {
|
||||||
// Property is shorthand.
|
// Property is shorthand.
|
||||||
|
@ -956,9 +961,7 @@ inDOMUtils::GetCSSValuesForProperty(const nsAString& aProperty,
|
||||||
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(subproperty, propertyID,
|
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(subproperty, propertyID,
|
||||||
CSSEnabledState::eForAllContent) {
|
CSSEnabledState::eForAllContent) {
|
||||||
uint32_t propertyParserVariant = nsCSSProps::ParserVariant(*subproperty);
|
uint32_t propertyParserVariant = nsCSSProps::ParserVariant(*subproperty);
|
||||||
if (propertyParserVariant & VARIANT_KEYWORD) {
|
GetKeywordsForProperty(*subproperty, array);
|
||||||
GetKeywordsForProperty(*subproperty, array);
|
|
||||||
}
|
|
||||||
GetOtherValuesForProperty(propertyParserVariant, array);
|
GetOtherValuesForProperty(propertyParserVariant, array);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,28 +12,21 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=877690
|
||||||
|
|
||||||
/** Test for Bug 877690 **/
|
/** Test for Bug 877690 **/
|
||||||
|
|
||||||
// Returns true if array contains item. False otherwise. Raises an exception if
|
|
||||||
// array is not an Array object. If the item is found in array, remove item.
|
|
||||||
function contains(array, item) {
|
|
||||||
if (!array.indexOf) {
|
|
||||||
throw new "First argument is not an array";
|
|
||||||
}
|
|
||||||
var index = array.indexOf(item);
|
|
||||||
if (index == -1) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
array.splice(index, 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns true if values contains all and only the expected values. False otherwise.
|
// Returns true if values contains all and only the expected values. False otherwise.
|
||||||
function testValues(values, expected) {
|
function testValues(values, expected) {
|
||||||
expected.forEach(function (expectedValue) {
|
values.sort();
|
||||||
if (!contains(values, expectedValue)) {
|
expected.sort();
|
||||||
return false;
|
|
||||||
}
|
if (values.length !== expected.length) {
|
||||||
});
|
return false;
|
||||||
return values.length === 0;
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < values.length; ++i) {
|
||||||
|
if (values[i] !== expected[i]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function do_test() {
|
function do_test() {
|
||||||
|
@ -94,7 +87,7 @@ function do_test() {
|
||||||
"snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "transparent", "turquoise",
|
"snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "transparent", "turquoise",
|
||||||
"violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen", "no-repeat", "repeat",
|
"violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen", "no-repeat", "repeat",
|
||||||
"repeat-x", "repeat-y", "space", "round", "fixed", "scroll", "local", "center", "top", "bottom", "left", "right",
|
"repeat-x", "repeat-y", "space", "round", "fixed", "scroll", "local", "center", "top", "bottom", "left", "right",
|
||||||
"border-box", "padding-box", "content-box", "border-box", "padding-box", "content-box", "text", "contain",
|
"border-box", "padding-box", "content-box", "text", "contain",
|
||||||
"cover", "rgb", "hsl", "rgba", "hsla", "none", "-moz-element", "-moz-image-rect", "url", "linear-gradient",
|
"cover", "rgb", "hsl", "rgba", "hsla", "none", "-moz-element", "-moz-image-rect", "url", "linear-gradient",
|
||||||
"radial-gradient", "repeating-linear-gradient", "repeating-radial-gradient", "-moz-linear-gradient",
|
"radial-gradient", "repeating-linear-gradient", "repeating-radial-gradient", "-moz-linear-gradient",
|
||||||
"-moz-radial-gradient", "-moz-repeating-linear-gradient", "-moz-repeating-radial-gradient" ];
|
"-moz-radial-gradient", "-moz-repeating-linear-gradient", "-moz-repeating-radial-gradient" ];
|
||||||
|
@ -102,7 +95,7 @@ function do_test() {
|
||||||
|
|
||||||
var prop = "border";
|
var prop = "border";
|
||||||
var values = getCSSValuesForProperty(prop);
|
var values = getCSSValuesForProperty(prop);
|
||||||
var expected = [ "-moz-calc", "initial", "unset", "aliceblue",
|
var expected = [ "initial", "unset", "aliceblue",
|
||||||
"antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet",
|
"antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet",
|
||||||
"brown", "burlywood", "cadetblue", "calc", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk",
|
"brown", "burlywood", "cadetblue", "calc", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk",
|
||||||
"crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki",
|
"crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki",
|
||||||
|
@ -114,11 +107,11 @@ function do_test() {
|
||||||
"khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan",
|
"khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan",
|
||||||
"lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen",
|
"lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen",
|
||||||
"lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen",
|
"lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen",
|
||||||
"linen", "logical", "magenta", "maroon", "medium", "mediumaquamarine", "mediumblue", "mediumorchid",
|
"linen", "magenta", "maroon", "medium", "mediumaquamarine", "mediumblue", "mediumorchid",
|
||||||
"mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise",
|
"mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise",
|
||||||
"mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "none",
|
"mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "none",
|
||||||
"oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "outset", "palegoldenrod", "palegreen",
|
"oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "outset", "palegoldenrod", "palegreen",
|
||||||
"paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "physical", "pink", "plum", "powderblue",
|
"paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue",
|
||||||
"purple", "rebeccapurple", "red", "repeat", "rgb", "rgba", "ridge", "rosybrown", "round", "royalblue", "saddlebrown",
|
"purple", "rebeccapurple", "red", "repeat", "rgb", "rgba", "ridge", "rosybrown", "round", "royalblue", "saddlebrown",
|
||||||
"salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey",
|
"salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey",
|
||||||
"snow", "solid", "space", "springgreen", "steelblue", "stretch", "tan", "teal", "thick", "thin", "thistle", "tomato",
|
"snow", "solid", "space", "springgreen", "steelblue", "stretch", "tan", "teal", "thick", "thin", "thistle", "tomato",
|
||||||
|
@ -215,32 +208,14 @@ function do_test() {
|
||||||
// test border-image property, for bug 973345
|
// test border-image property, for bug 973345
|
||||||
var prop = "border-image";
|
var prop = "border-image";
|
||||||
var values = getCSSValuesForProperty(prop);
|
var values = getCSSValuesForProperty(prop);
|
||||||
var expected = [ "initial", "unset", "aliceblue",
|
var expected = [ "inherit", "initial", "unset", "repeat", "stretch", "-moz-element", "-moz-image-rect", "url", "linear-gradient", "radial-gradient", "repeating-linear-gradient", "repeating-radial-gradient", "-moz-linear-gradient", "-moz-radial-gradient", "-moz-repeating-linear-gradient", "-moz-repeating-radial-gradient", "fill", "none", "round", "space" ];
|
||||||
"antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet",
|
|
||||||
"brown", "burlywood", "cadetblue", "calc", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk",
|
|
||||||
"crimson", "currentColor", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki",
|
|
||||||
"darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen",
|
|
||||||
"darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "dashed", "deeppink",
|
|
||||||
"deepskyblue", "dimgray", "dimgrey", "dodgerblue", "dotted", "double", "fill", "firebrick", "floralwhite",
|
|
||||||
"forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow",
|
|
||||||
"groove", "hidden", "honeydew", "hotpink", "hsl", "hsla", "indianred", "indigo", "inherit", "inset", "ivory",
|
|
||||||
"khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan",
|
|
||||||
"lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen",
|
|
||||||
"lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen",
|
|
||||||
"linen", "logical", "magenta", "maroon", "medium", "mediumaquamarine", "mediumblue", "mediumorchid",
|
|
||||||
"mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise",
|
|
||||||
"mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "none",
|
|
||||||
"oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "outset", "palegoldenrod", "palegreen",
|
|
||||||
"paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "physical", "pink", "plum", "powderblue",
|
|
||||||
"purple", "rebeccapurple", "red", "repeat", "rgb", "rgba", "ridge", "rosybrown", "round", "royalblue", "saddlebrown",
|
|
||||||
"salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey",
|
|
||||||
"snow", "solid", "springgreen", "steelblue", "stretch", "tan", "teal", "thick", "thin", "thistle", "tomato",
|
|
||||||
"transparent", "turquoise", "-moz-element", "-moz-image-rect", "url", "violet", "wheat", "white", "whitesmoke",
|
|
||||||
"yellow", "yellowgreen", "linear-gradient", "radial-gradient", "repeating-linear-gradient",
|
|
||||||
"repeating-radial-gradient", "-moz-linear-gradient", "-moz-radial-gradient", "-moz-repeating-linear-gradient",
|
|
||||||
"-moz-repeating-radial-gradient" ]
|
|
||||||
ok(testValues(values, expected), "property border-image's values.");
|
ok(testValues(values, expected), "property border-image's values.");
|
||||||
|
|
||||||
|
var prop = "background-size"
|
||||||
|
var values = getCSSValuesForProperty(prop);
|
||||||
|
var expected = [ "inherit", "initial", "unset", "contain", "cover" ];
|
||||||
|
ok(testValues(values, expected), "property background-size's values.");
|
||||||
|
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче