dom/bindings/GenerateCSS2PropertiesWebIDL.py

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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/.
     5 import sys
     6 import string
     8 propList = eval(sys.stdin.read())
     9 props = ""
    10 for [prop, id, flags, pref] in propList:
    11     extendedAttrs = ["Throws", "TreatNullAs=EmptyString"]
    12     # To limit the overhead of Func= annotations, we only generate them when
    13     # necessary, which is when the
    14     # CSS_PROPERTY_ALWAYS_ENABLED_IN_CHROME_OR_CERTIFIED_APP flag is set.
    15     # Otherwise, we try to get by with just a Pref= annotation or no annotation
    16     # at all.
    17     if "CSS_PROPERTY_ALWAYS_ENABLED_IN_CHROME_OR_CERTIFIED_APP" in flags:
    18         extendedAttrs.append('Func="IsCSSPropertyExposedToJS<eCSSProperty_%s>"' % id)
    19     # The following is an 'elif' because it is the responsibility of
    20     # IsCSSPropertyExposedToJS to handle the pref if there is one.
    21     elif pref is not "":
    22         extendedAttrs.append('Pref="%s"' % pref)
    23     if not prop.startswith("Moz"):
    24         prop = prop[0].lower() + prop[1:]
    25     # Unfortunately, even some of the getters here are fallible
    26     # (e.g. on nsComputedDOMStyle).
    27     props += "  [%s] attribute DOMString %s;\n" % (", ".join(extendedAttrs),
    28                                                    prop)
    30 idlFile = open(sys.argv[1], "r");
    31 idlTemplate = idlFile.read();
    32 idlFile.close();
    34 print ("/* THIS IS AN AUTOGENERATED FILE.  DO NOT EDIT */\n\n" +
    35        string.Template(idlTemplate).substitute({ "props": props }))

mercurial