зеркало из https://github.com/mozilla/gecko-dev.git
Bug 958887 part 4. Generate property accessors on the CSS2Properties interface for the dashed-named CSS properties and float that use their actual property names. r=peterv
This commit is contained in:
Родитель
9b823d6509
Коммит
bc34b41022
|
@ -26,6 +26,28 @@ for [name, prop, id, flags, pref] in propList:
|
||||||
# (e.g. on nsComputedDOMStyle).
|
# (e.g. on nsComputedDOMStyle).
|
||||||
props += " [%s] attribute DOMString %s;\n" % (", ".join(extendedAttrs),
|
props += " [%s] attribute DOMString %s;\n" % (", ".join(extendedAttrs),
|
||||||
prop)
|
prop)
|
||||||
|
# Per spec, what's actually supposed to happen here is that we're supposed
|
||||||
|
# to have properties for:
|
||||||
|
#
|
||||||
|
# 1) Each supported CSS property name, camelCased.
|
||||||
|
# 2) Each supported name that contains dashes but doesn't start with a
|
||||||
|
# dash, without any changes to the name.
|
||||||
|
# 3) cssFloat
|
||||||
|
#
|
||||||
|
# Note that "float" will cause a property called "float" to exist due to (1)
|
||||||
|
# in that list.
|
||||||
|
#
|
||||||
|
# In practice, cssFloat is the only case in which "name" doesn't contain "-"
|
||||||
|
# but also doesn't match "prop". So the stuff we did with "prop" covers (3)
|
||||||
|
# and all of (1) except "float". If we now output attributes for all the
|
||||||
|
# cases where "name" doesn't match "prop" and "name" doesn't start with "-",
|
||||||
|
# that will cover "float" and (2).
|
||||||
|
if prop != name and name[0] != "-":
|
||||||
|
extendedAttrs.append('BinaryName="%s"' % prop)
|
||||||
|
# Throw in a '_' before the attribute name, because some of these
|
||||||
|
# property names collide with IDL reserved words.
|
||||||
|
props += " [%s] attribute DOMString _%s;\n" % (", ".join(extendedAttrs),
|
||||||
|
name)
|
||||||
|
|
||||||
idlFile = open(sys.argv[1], "r");
|
idlFile = open(sys.argv[1], "r");
|
||||||
idlTemplate = idlFile.read();
|
idlTemplate = idlFile.read();
|
||||||
|
|
|
@ -121,6 +121,7 @@ skip-if = toolkit == 'android' #bug 536603
|
||||||
[test_descriptor_storage.html]
|
[test_descriptor_storage.html]
|
||||||
[test_descriptor_syntax_errors.html]
|
[test_descriptor_syntax_errors.html]
|
||||||
[test_dont_use_document_colors.html]
|
[test_dont_use_document_colors.html]
|
||||||
|
[test_exposed_prop_accessors.html]
|
||||||
[test_extra_inherit_initial.html]
|
[test_extra_inherit_initial.html]
|
||||||
[test_flexbox_align_self_auto.html]
|
[test_flexbox_align_self_auto.html]
|
||||||
[test_flexbox_child_display_values.xhtml]
|
[test_flexbox_child_display_values.xhtml]
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<!--
|
||||||
|
https://bugzilla.mozilla.org/show_bug.cgi?id=375363
|
||||||
|
-->
|
||||||
|
<head>
|
||||||
|
<title>Test for cloning of CSS property values (including 'inherit', 'initial' and 'unset')</title>
|
||||||
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
<script type="text/javascript" src="property_database.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p id="display"></p>
|
||||||
|
<pre id="test">
|
||||||
|
<script class="testbody" type="text/javascript">
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that makes sure that we have exposed getters/setters for all the
|
||||||
|
* various variants of our CSS property names that the spec calls for.
|
||||||
|
*/
|
||||||
|
for (var prop in gCSSProperties) {
|
||||||
|
var info = gCSSProperties[prop];
|
||||||
|
|
||||||
|
var s = document.createElement("div").style;
|
||||||
|
|
||||||
|
ise(s[info.domProp], "", prop + " should not be set yet");
|
||||||
|
s[info.domProp] = info.initial_values[0];
|
||||||
|
isnot(s[info.domProp], "", prop + " should now be set");
|
||||||
|
if (prop[0] != "-") {
|
||||||
|
ise(s[prop], s[info.domProp],
|
||||||
|
"Getting " + prop + " via name should work")
|
||||||
|
s = document.createElement("div").style;
|
||||||
|
ise(s[info.domProp], "", prop + " should not be set here either");
|
||||||
|
s[prop] = info.initial_values[0];
|
||||||
|
isnot(s[info.prop], "", prop + " should now be set again");
|
||||||
|
ise(s[info.domProp], s[prop],
|
||||||
|
"Setting " + prop + " via name should work");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</pre>
|
||||||
|
</body>
|
||||||
|
</html>
|
Загрузка…
Ссылка в новой задаче