mirror of
https://github.com/servo/servo.git
synced 2025-08-16 02:45:36 +01:00
Run style with all properties enabled
This commit is contained in:
parent
ee3f916b65
commit
919bf17e51
5 changed files with 19 additions and 6 deletions
|
@ -18,15 +18,17 @@ import data
|
|||
|
||||
|
||||
def main():
|
||||
usage = "Usage: %s [ servo | gecko ] [ style-crate | html ]" % sys.argv[0]
|
||||
if len(sys.argv) < 3:
|
||||
usage = "Usage: %s [ servo | gecko ] [ style-crate | html ] [ testing | regular ]" % sys.argv[0]
|
||||
if len(sys.argv) < 4:
|
||||
abort(usage)
|
||||
product = sys.argv[1]
|
||||
output = sys.argv[2]
|
||||
testing = sys.argv[3] == "testing"
|
||||
|
||||
if product not in ["servo", "gecko"] or output not in ["style-crate", "geckolib", "html"]:
|
||||
abort(usage)
|
||||
|
||||
properties = data.PropertiesData(product=product)
|
||||
properties = data.PropertiesData(product=product, testing=testing)
|
||||
rust = render(os.path.join(BASE, "properties.mako.rs"), product=product, data=properties)
|
||||
if output == "style-crate":
|
||||
write(os.environ["OUT_DIR"], "properties.rs", rust)
|
||||
|
|
|
@ -160,8 +160,16 @@ class StyleStruct(object):
|
|||
|
||||
|
||||
class PropertiesData(object):
|
||||
def __init__(self, product):
|
||||
"""
|
||||
The `testing` parameter means that we're running tests.
|
||||
|
||||
In this situation, the `product` value is ignored while choosing
|
||||
which shorthands and longhands to generate; and instead all properties for
|
||||
which code exists for either servo or stylo are generated.
|
||||
"""
|
||||
def __init__(self, product, testing):
|
||||
self.product = product
|
||||
self.testing = testing
|
||||
self.style_structs = []
|
||||
self.current_style_struct = None
|
||||
self.longhands = []
|
||||
|
@ -179,7 +187,7 @@ class PropertiesData(object):
|
|||
|
||||
def declare_longhand(self, name, products="gecko servo", **kwargs):
|
||||
products = products.split()
|
||||
if self.product not in products:
|
||||
if self.product not in products and not self.testing:
|
||||
return
|
||||
|
||||
longhand = Longhand(self.current_style_struct, name, **kwargs)
|
||||
|
@ -194,7 +202,7 @@ class PropertiesData(object):
|
|||
|
||||
def declare_shorthand(self, name, sub_properties, products="gecko servo", *args, **kwargs):
|
||||
products = products.split()
|
||||
if self.product not in products:
|
||||
if self.product not in products and not self.testing:
|
||||
return
|
||||
|
||||
sub_properties = [self.longhands_by_name[s] for s in sub_properties]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue