author violet <>
Thu, 16 May 2019 00:54:46 +0000
changeset 532851 6730776560c028a402e7112569e6ca8bf6cd742b
parent 469929 620bdfafd42fdd118b14affc2299bff60bfba719
permissions -rw-r--r--
Bug 1383650 - Optimize attribute mapping by not parsing same thing twice r=longsonr Geometry properties are the most used SVG attributes. When authors specify them as attributes, we have to parse them in SVG side. So we don't want to parse them in CSS side again, otherwise the introduced performance loss is relatively high. With this optimization, this feature implementation doesn't slow down overall performace even if there are thousands of geometry elements. Differential Revision:

# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distibuted with this
# file, You can obtain one at http://mozilla.og/MPL/2.0/.

import sys
import buildconfig
from mozbuild.preprocessor import Preprocessor

def main(output, input_file):
    pp = Preprocessor()

    substs = buildconfig.substs

    # Substs taken verbatim.
    substs_vars = (
    for var in substs_vars:
        pp.context[var] = '"%s"' % substs[var]

    # Derived values.
    for key, condition in (
            ('IS_MAC', substs['OS_ARCH'] == 'Darwin'),
            ('IS_LINUX', substs['OS_ARCH'] == 'Linux'),
            ('IS_TEST_BUILD', substs.get('ENABLE_TESTS') == '1'),
            ('IS_DEBUG_BUILD', substs.get('MOZ_DEBUG') == '1'),
            ('CRASHREPORTER', substs.get('MOZ_CRASHREPORTER')),
            ('IS_ASAN', substs.get('MOZ_ASAN'))):
        if condition:
            pp.context[key] = '1'
            pp.context[key] = '0'

        'XPC_BIN_PATH': '"%s/dist/bin"' % buildconfig.topobjdir,
        'CERTS_SRC_DIR': '"%s/build/pgo/certs"' % buildconfig.topsrcdir,

    pp.out = output

if __name__ == '__main__':