tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

GenerateCompositorAnimatableProperties.py (1161B)


      1 # This Source Code Form is subject to the terms of the Mozilla Public
      2 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
      3 # You can obtain one at http://mozilla.org/MPL/2.0/.
      4 
      5 import runpy
      6 
      7 
      8 def generate(output, dataFile):
      9    output.write(
     10        """/* THIS IS AN AUTOGENERATED FILE.  DO NOT EDIT */
     11 #ifndef COMPOSITOR_ANIMATABLE_PROPERTY_LIST
     12 #define COMPOSITOR_ANIMATABLE_PROPERTY_LIST { \\
     13 """
     14    )
     15 
     16    def can_animate_on_compositor(p):
     17        return "CanAnimateOnCompositor" in p.flags and p.type() != "alias"
     18 
     19    properties = runpy.run_path(dataFile)["data"]
     20    properties = filter(can_animate_on_compositor, properties.values())
     21 
     22    count = 0
     23    for p in properties:
     24        output.write("  eCSSProperty_{}, \\\n".format(p.id))
     25        count += 1
     26 
     27    output.write("}\n")
     28    output.write("#endif /* COMPOSITOR_ANIMATABLE_PROPERTY_LIST */\n")
     29 
     30    output.write("\n")
     31    output.write("#ifndef COMPOSITOR_ANIMATABLE_PROPERTY_LIST_LENGTH\n")
     32    output.write(
     33        "#define COMPOSITOR_ANIMATABLE_PROPERTY_LIST_LENGTH {}\n".format(count)
     34    )
     35    output.write("#endif /* COMPOSITOR_ANIMATABLE_PROPERTY_LIST_LENGTH */\n")