mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Add spec argument to property helpers
This commit is contained in:
parent
68ecb04847
commit
29c2db4457
3 changed files with 8 additions and 3 deletions
|
@ -84,12 +84,13 @@ def arg_to_bool(arg):
|
||||||
|
|
||||||
|
|
||||||
class Longhand(object):
|
class Longhand(object):
|
||||||
def __init__(self, style_struct, name, animatable=None, derived_from=None, keyword=None,
|
def __init__(self, style_struct, name, spec="NO SPEC", animatable=None, derived_from=None, keyword=None,
|
||||||
predefined_type=None, custom_cascade=False, experimental=False, internal=False,
|
predefined_type=None, custom_cascade=False, experimental=False, internal=False,
|
||||||
need_clone=False, need_index=False, gecko_ffi_name=None, depend_on_viewport_size=False,
|
need_clone=False, need_index=False, gecko_ffi_name=None, depend_on_viewport_size=False,
|
||||||
allowed_in_keyframe_block=True, complex_color=False, cast_type='u8',
|
allowed_in_keyframe_block=True, complex_color=False, cast_type='u8',
|
||||||
has_uncacheable_values=False, logical=False):
|
has_uncacheable_values=False, logical=False):
|
||||||
self.name = name
|
self.name = name
|
||||||
|
self.spec = spec
|
||||||
self.keyword = keyword
|
self.keyword = keyword
|
||||||
self.predefined_type = predefined_type
|
self.predefined_type = predefined_type
|
||||||
self.ident = to_rust_ident(name)
|
self.ident = to_rust_ident(name)
|
||||||
|
@ -130,9 +131,10 @@ class Longhand(object):
|
||||||
|
|
||||||
|
|
||||||
class Shorthand(object):
|
class Shorthand(object):
|
||||||
def __init__(self, name, sub_properties, experimental=False, internal=False,
|
def __init__(self, name, sub_properties, spec="NO SPEC", experimental=False, internal=False,
|
||||||
allowed_in_keyframe_block=True):
|
allowed_in_keyframe_block=True):
|
||||||
self.name = name
|
self.name = name
|
||||||
|
self.spec = spec
|
||||||
self.ident = to_rust_ident(name)
|
self.ident = to_rust_ident(name)
|
||||||
self.camel_case = to_camel_case(self.ident)
|
self.camel_case = to_camel_case(self.ident)
|
||||||
self.derived_from = None
|
self.derived_from = None
|
||||||
|
|
|
@ -185,6 +185,7 @@
|
||||||
if property is None:
|
if property is None:
|
||||||
return ""
|
return ""
|
||||||
%>
|
%>
|
||||||
|
/// ${property.spec}
|
||||||
pub mod ${property.ident} {
|
pub mod ${property.ident} {
|
||||||
#![allow(unused_imports)]
|
#![allow(unused_imports)]
|
||||||
% if not property.derived_from:
|
% if not property.derived_from:
|
||||||
|
@ -389,6 +390,7 @@
|
||||||
**kwargs)
|
**kwargs)
|
||||||
%>
|
%>
|
||||||
% if shorthand:
|
% if shorthand:
|
||||||
|
/// ${shorthand.spec}
|
||||||
pub mod ${shorthand.ident} {
|
pub mod ${shorthand.ident} {
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
use cssparser::Parser;
|
use cssparser::Parser;
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
|
|
||||||
<% data.new_style_struct("Color", inherited=True) %>
|
<% data.new_style_struct("Color", inherited=True) %>
|
||||||
|
|
||||||
<%helpers:raw_longhand name="color" need_clone="True" animatable="True">
|
<%helpers:raw_longhand name="color" need_clone="True" animatable="True"
|
||||||
|
spec="https://drafts.csswg.org/css-color/#color">
|
||||||
use cssparser::Color as CSSParserColor;
|
use cssparser::Color as CSSParserColor;
|
||||||
use cssparser::RGBA;
|
use cssparser::RGBA;
|
||||||
use values::specified::{CSSColor, CSSRGBA};
|
use values::specified::{CSSColor, CSSRGBA};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue