mirror of
https://github.com/servo/servo.git
synced 2025-08-13 09:25:32 +01:00
Auto merge of #13163 - Manishearth:conditional-compilation, r=bholley
Use conditional compilation for stylo properties; output unimplemented logs for all properties Till now we were only emitting unimplemented property logs for properties which servo implements but stylo doesn't. This list is getting smaller, and we really should be emitting this for any unexpected property we encounter. I also made it so that longhands which stylo does not implement will not be compiled in stylo builds; instead of what we currently do, which is to parse them and then basically ignore the result. There are still a few exceptions -- we generate stubs for properties that are parts of shorthands because otherwise we'd have to add fiddly conditional compilation to the shorthand code. r? @bholley cc @emilio <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13163) <!-- Reviewable:end -->
This commit is contained in:
commit
58205f1a78
12 changed files with 279 additions and 234 deletions
|
@ -468,39 +468,70 @@ impl Debug for ${style_struct.gecko_struct_name} {
|
|||
|
||||
<%def name="raw_impl_trait(style_struct, skip_longhands='', skip_additionals='')">
|
||||
<%
|
||||
longhands = [x for x in style_struct.longhands
|
||||
longhands = [x for x in style_struct.longhands
|
||||
if not (skip_longhands == "*" or x.name in skip_longhands.split())]
|
||||
|
||||
#
|
||||
# Make a list of types we can't auto-generate.
|
||||
#
|
||||
force_stub = [];
|
||||
# These are currently being shuffled to a different style struct on the gecko side.
|
||||
force_stub += ["backface-visibility", "transform-box", "transform-style"]
|
||||
# These live in an nsFont member in Gecko. Should be straightforward to do manually.
|
||||
force_stub += ["font-kerning", "font-stretch", "font-variant"]
|
||||
# These have unusual representations in gecko.
|
||||
force_stub += ["list-style-type", "text-overflow"]
|
||||
# In a nsTArray, have to be done manually, but probably not too much work
|
||||
# (the "filling them", not the "making them work")
|
||||
force_stub += ["animation-name", "animation-duration",
|
||||
#
|
||||
# Make a list of types we can't auto-generate.
|
||||
#
|
||||
force_stub = [];
|
||||
# These are currently being shuffled to a different style struct on the gecko side.
|
||||
force_stub += ["backface-visibility", "transform-box", "transform-style"]
|
||||
# These live in an nsFont member in Gecko. Should be straightforward to do manually.
|
||||
force_stub += ["font-kerning", "font-stretch", "font-variant"]
|
||||
# These have unusual representations in gecko.
|
||||
force_stub += ["list-style-type", "text-overflow"]
|
||||
# In a nsTArray, have to be done manually, but probably not too much work
|
||||
# (the "filling them", not the "making them work")
|
||||
force_stub += ["animation-name", "animation-duration",
|
||||
"animation-timing-function", "animation-iteration-count",
|
||||
"animation-direction", "animation-play-state",
|
||||
"animation-fill-mode", "animation-delay"]
|
||||
|
||||
# Types used with predefined_type()-defined properties that we can auto-generate.
|
||||
predefined_types = {
|
||||
# These are part of shorthands so we must include them in stylo builds,
|
||||
# but we haven't implemented the stylo glue for the longhand
|
||||
# so we generate a stub
|
||||
force_stub += ["list-style-image", # box
|
||||
"flex-basis", # position
|
||||
|
||||
# transition
|
||||
"transition-duration", "transition-timing-function",
|
||||
"transition-property", "transition-delay",
|
||||
|
||||
"background-size", # background
|
||||
"column-count", # column
|
||||
]
|
||||
|
||||
# Types used with predefined_type()-defined properties that we can auto-generate.
|
||||
predefined_types = {
|
||||
"LengthOrPercentage": impl_style_coord,
|
||||
"LengthOrPercentageOrAuto": impl_style_coord,
|
||||
"LengthOrPercentageOrNone": impl_style_coord,
|
||||
"Number": impl_simple,
|
||||
"Opacity": impl_simple,
|
||||
}
|
||||
}
|
||||
|
||||
keyword_longhands = [x for x in longhands if x.keyword and not x.name in force_stub]
|
||||
predefined_longhands = [x for x in longhands
|
||||
keyword_longhands = [x for x in longhands if x.keyword and not x.name in force_stub]
|
||||
predefined_longhands = [x for x in longhands
|
||||
if x.predefined_type in predefined_types and not x.name in force_stub]
|
||||
stub_longhands = [x for x in longhands if x not in keyword_longhands + predefined_longhands]
|
||||
stub_longhands = [x for x in longhands if x not in keyword_longhands + predefined_longhands]
|
||||
|
||||
# If one of the longhands is not handled
|
||||
# by either:
|
||||
# - being a keyword
|
||||
# - being a predefined longhand
|
||||
# - being a longhand with manual glue code (i.e. in skip_longhands)
|
||||
# - being generated as a stub
|
||||
#
|
||||
# then we raise an error here.
|
||||
#
|
||||
# If you hit this error, please add `product="servo"` to the longhand.
|
||||
# In case the longhand is used in a shorthand, add it to the force_stub
|
||||
# list above.
|
||||
for stub in stub_longhands:
|
||||
if stub.name not in force_stub:
|
||||
raise Exception("Don't know what to do with longhand %s in style struct %s"
|
||||
% (stub.name,style_struct. gecko_struct_name))
|
||||
%>
|
||||
impl ${style_struct.gecko_struct_name} {
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue