Make parsing of keyframe declaration blocks spec-compliant.

Exclude animation properties.
This commit is contained in:
Simon Sapin 2016-08-17 20:49:06 +02:00
parent 901aaeaf68
commit ab846ab196
6 changed files with 115 additions and 21 deletions

View file

@ -65,7 +65,8 @@ class Keyword(object):
class Longhand(object):
def __init__(self, style_struct, name, animatable=None, derived_from=None, keyword=None,
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):
self.name = name
self.keyword = keyword
self.predefined_type = predefined_type
@ -80,6 +81,13 @@ class Longhand(object):
self.depend_on_viewport_size = depend_on_viewport_size
self.derived_from = (derived_from or "").split()
# https://drafts.csswg.org/css-animations/#keyframes
# > The <declaration-list> inside of <keyframe-block> accepts any CSS property
# > except those defined in this specification,
# > but does accept the `animation-play-state` property and interprets it specially.
self.allowed_in_keyframe_block = allowed_in_keyframe_block \
and allowed_in_keyframe_block != "False"
# This is done like this since just a plain bool argument seemed like
# really random.
if animatable is None:
@ -98,7 +106,8 @@ class Longhand(object):
class Shorthand(object):
def __init__(self, name, sub_properties, experimental=False, internal=False):
def __init__(self, name, sub_properties, experimental=False, internal=False,
allowed_in_keyframe_block=True):
self.name = name
self.ident = to_rust_ident(name)
self.camel_case = to_camel_case(self.ident)
@ -107,6 +116,13 @@ class Shorthand(object):
self.sub_properties = sub_properties
self.internal = internal
# https://drafts.csswg.org/css-animations/#keyframes
# > The <declaration-list> inside of <keyframe-block> accepts any CSS property
# > except those defined in this specification,
# > but does accept the `animation-play-state` property and interprets it specially.
self.allowed_in_keyframe_block = allowed_in_keyframe_block \
and allowed_in_keyframe_block != "False"
class Method(object):
def __init__(self, name, return_type=None, arg_types=None, is_mut=False):