style: Replace "internal" properties with "enabled_in"

This allows enabling properties in ua sheets and chrome differently.

The setup is:

  * enabled_in needs to be one of the four values:
    ["", "ua", "chrome", "content"]

  * "chrome" implies "ua", and implies that they're explicitly enabled.

  * "" implies the property will never be parsed.

  * "content" implies the property is accessible unconditionally, modulo a pref.

Experimental still keeps trumping over those when the pref is enabled.

This PR replaces uses of internal="" by enabled_in="ua" or enabled_in="".

This may seem that it changes behavior, but since the properties where I added
enabled_in="" already unconditionally error from parse it's not.

Next step is annotating chrome-only properties.
This commit is contained in:
Emilio Cobos Álvarez 2017-11-17 17:52:28 +01:00
parent 07fd6155aa
commit 01e41d0439
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
6 changed files with 54 additions and 31 deletions

View file

@ -174,7 +174,7 @@ pub mod shorthands {
for p in data.longhands:
if p.name in ['direction', 'unicode-bidi']:
continue;
if p.internal:
if not p.enabled_in_content() and not p.experimental(product):
continue;
if p.logical:
logical_longhands.append(p.name)
@ -1303,7 +1303,7 @@ impl PropertyId {
${id_set("ENABLED_IN_UA_SHEETS", lambda p: p.explicitly_enabled_in_ua_sheets())}
${id_set("ENABLED_IN_CHROME", lambda p: p.explicitly_enabled_in_chrome())}
${id_set("EXPERIMENTAL", lambda p: p.experimental(product))}
${id_set("ALWAYS_ENABLED", lambda p: not p.experimental(product) and not p.explicitly_enabled_in_ua_sheets())}
${id_set("ALWAYS_ENABLED", lambda p: not p.experimental(product) and p.enabled_in_content())}
let passes_pref_check = || {
% if product == "servo":
@ -3605,13 +3605,15 @@ impl AliasId {
}
}
// FIXME(emilio): This macro doesn't account for experimental properties, so
// even with the pref disabled you can set them from CSSOM in Servo.
#[macro_export]
macro_rules! css_properties_accessors {
($macro_name: ident) => {
$macro_name! {
% for kind, props in [("Longhand", data.longhands), ("Shorthand", data.shorthands)]:
% for property in props:
% if not property.derived_from and not property.internal:
% if not property.derived_from and property.enabled_in_content():
% for name in [property.name] + property.alias:
% if '-' in name:
[${to_rust_ident(name).capitalize()}, Set${to_rust_ident(name).capitalize()},