layout/style/moz.build
author Nika Layzell <nika@thelayzells.com>
Tue, 25 Sep 2018 17:34:53 +0200
changeset 507828 5e6dae0c1e5a4939ccd406f14607f7fafffd45a7
parent 503929 ead2368dc0789fb877c2df60ec0a2b9f30c8c6e9
child 508701 48eb1f0778e6ea78ef272b1a7103d8f227f16d5e
permissions -rw-r--r--
Bug 1448426 - Wrap windows.h to avoid problematic define statements, r=froydnj,glandium By default, windows.h exposes a large number of problematic define statements which are UpperCamelCase, such as a define from `CreateWindow` to `CreateWindow{A,W}`. As many of these names are generic (e.g. CreateFile, CreateWindow), they can mess up Gecko code that may legitimately have its own methods with the same names. The header also defines some traditional SCREAMING_SNAKE_CASE defines which can mess up our code by conflicting with local values. This patch adds a simple code generator which generates wrappers for these defines, and uses them to wrap the windows.h wrapper using the `stl_wrappers` mechanism, allowing us to use windows.h in more places. Differential Revision: https://phabricator.services.mozilla.com/D10932

# -*- 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 distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

with Files('**'):
    BUG_COMPONENT = ('Core', 'CSS Parsing and Computation')

with Files('nsComputedDOMStyle.*'):
    BUG_COMPONENT = ('Core', 'DOM: CSS Object Model')

with Files('nsROCSSPrimitiveValue.*'):
    BUG_COMPONENT = ('Core', 'DOM: CSS Object Model')

with Files('CSSRuleList.*'):
    BUG_COMPONENT = ('Core', 'DOM: CSS Object Model')

with Files('nsDOM*'):
    BUG_COMPONENT = ('Core', 'DOM: CSS Object Model')

with Files('AnimationCollection.*'):
    BUG_COMPONENT = ('Core', 'CSS Transitions and Animations')

with Files('AnimationCommon.*'):
    BUG_COMPONENT = ('Core', 'CSS Transitions and Animations')

with Files('nsAnimationManager.*'):
    BUG_COMPONENT = ('Core', 'CSS Transitions and Animations')

with Files('nsTransitionManager.*'):
    BUG_COMPONENT = ('Core', 'CSS Transitions and Animations')

with Files('StyleAnimationValue.*'):
    BUG_COMPONENT = ('Core', 'CSS Transitions and Animations')

DIRS += ['xbl-marquee']
TEST_DIRS += ['test']

EXPORTS += [
    '!nsCSSPropertyID.h',
    'AnimationCommon.h',
    'CounterStyleManager.h',
    'nsAnimationManager.h',
    'nsCSSAnonBoxes.h',
    'nsCSSAnonBoxList.h',
    'nsCSSCounterDescList.h',
    'nsCSSFontDescList.h',
    'nsCSSKeywordList.h',
    'nsCSSKeywords.h',
    'nsCSSPropertyIDSet.h',
    'nsCSSProps.h',
    'nsCSSPseudoElementList.h',
    'nsCSSPseudoElements.h',
    'nsCSSValue.h',
    'nsDOMCSSAttrDeclaration.h',
    'nsDOMCSSDeclaration.h',
    'nsICSSDeclaration.h',
    'nsICSSLoaderObserver.h',
    'nsLayoutStylesheetCache.h',
    'nsMediaFeatures.h',
    'nsStyleAutoArray.h',
    'nsStyleConsts.h',
    'nsStyleCoord.h',
    'nsStyleStruct.h',
    'nsStyleStructFwd.h',
    'nsStyleStructInlines.h',
    'nsStyleStructList.h',
    'nsStyleTransformMatrix.h',
    'nsStyleUtil.h',
    'nsTimingFunction.h',
]

EXPORTS.mozilla += [
    '!ServoCSSPropList.h',
    'AnimationCollection.h',
    'BindingStyleRule.h',
    'BorrowedTypeList.h',
    'CachedInheritingStyles.h',
    'ComputedStyle.h',
    'ComputedStyleInlines.h',
    'CSSEnabledState.h',
    'CSSPropFlags.h',
    'DeclarationBlock.h',
    'DocumentStyleRootIterator.h',
    'GeckoBindings.h',
    'LayerAnimationInfo.h',
    'MappedDeclarations.h',
    'MediaFeatureChange.h',
    'PostTraversalTask.h',
    'PreloadedStyleSheet.h',
    'RustCell.h',
    'ServoArcTypeList.h',
    'ServoBindings.h',
    'ServoBindingTypes.h',
    'ServoBoxedTypeList.h',
    'ServoComputedData.h',
    'ServoComputedDataInlines.h',
    'ServoCSSParser.h',
    'ServoCSSRuleList.h',
    'ServoElementSnapshot.h',
    'ServoElementSnapshotTable.h',
    'ServoStyleSet.h',
    'ServoStyleSetInlines.h',
    'ServoTraversalStatistics.h',
    'ServoTypes.h',
    'ServoUtils.h',
    'SheetType.h',
    'StyleAnimationValue.h',
    'StyleComplexColor.h',
    'StyleSheet.h',
    'StyleSheetInfo.h',
    'StyleSheetInlines.h',
    'URLExtraData.h',
]

EXPORTS.mozilla.dom += [
    'CSS.h',
    'CSSCounterStyleRule.h',
    'CSSFontFaceRule.h',
    'CSSFontFeatureValuesRule.h',
    'CSSImportRule.h',
    'CSSKeyframeRule.h',
    'CSSKeyframesRule.h',
    'CSSMediaRule.h',
    'CSSMozDocumentRule.h',
    'CSSNamespaceRule.h',
    'CSSPageRule.h',
    'CSSRuleList.h',
    'CSSStyleRule.h',
    'CSSSupportsRule.h',
    'CSSValue.h',
    'FontFace.h',
    'FontFaceSet.h',
    'FontFaceSetIterator.h',
    'MediaList.h',
    'MediaQueryList.h',
    'PaintWorkletGlobalScope.h',
]

EXPORTS.mozilla.css += [
    'DocumentMatchingFunction.h',
    'ErrorReporter.h',
    'GroupRule.h',
    'ImageLoader.h',
    'Loader.h',
    'Rule.h',
    'SheetLoadData.h',
    'SheetParsingMode.h',
    'StreamLoader.h',
]

UNIFIED_SOURCES += [
    'AnimationCollection.cpp',
    'BindingStyleRule.cpp',
    'CachedInheritingStyles.cpp',
    'ComputedStyle.cpp',
    'CounterStyleManager.cpp',
    'CSS.cpp',
    'CSSCounterStyleRule.cpp',
    'CSSFontFaceRule.cpp',
    'CSSFontFeatureValuesRule.cpp',
    'CSSImportRule.cpp',
    'CSSKeyframeRule.cpp',
    'CSSKeyframesRule.cpp',
    'CSSMediaRule.cpp',
    'CSSMozDocumentRule.cpp',
    'CSSNamespaceRule.cpp',
    'CSSPageRule.cpp',
    'CSSRuleList.cpp',
    'CSSStyleRule.cpp',
    'CSSSupportsRule.cpp',
    'DeclarationBlock.cpp',
    'DocumentStyleRootIterator.cpp',
    'ErrorReporter.cpp',
    'FontFace.cpp',
    'FontFaceSet.cpp',
    'FontFaceSetIterator.cpp',
    'GeckoBindings.cpp',
    'GroupRule.cpp',
    'ImageLoader.cpp',
    'LayerAnimationInfo.cpp',
    'Loader.cpp',
    'MappedDeclarations.cpp',
    'MediaList.cpp',
    'MediaQueryList.cpp',
    'nsAnimationManager.cpp',
    'nsComputedDOMStyle.cpp',
    'nsCSSKeywords.cpp',
    'nsCSSProps.cpp',
    'nsCSSValue.cpp',
    'nsDOMCSSAttrDeclaration.cpp',
    'nsDOMCSSDeclaration.cpp',
    'nsDOMCSSValueList.cpp',
    'nsFontFaceLoader.cpp',
    'nsFontFaceUtils.cpp',
    'nsHTMLCSSStyleSheet.cpp',
    'nsHTMLStyleSheet.cpp',
    'nsICSSDeclaration.cpp',
    'nsMediaFeatures.cpp',
    'nsROCSSPrimitiveValue.cpp',
    'nsStyleCoord.cpp',
    'nsStyleStruct.cpp',
    'nsStyleTransformMatrix.cpp',
    'nsStyleUtil.cpp',
    'nsTransitionManager.cpp',
    'PaintWorkletGlobalScope.cpp',
    'PaintWorkletImpl.cpp',
    'PostTraversalTask.cpp',
    'PreloadedStyleSheet.cpp',
    'Rule.cpp',
    'ServoCSSParser.cpp',
    'ServoCSSRuleList.cpp',
    'ServoElementSnapshot.cpp',
    'ServoStyleSet.cpp',
    'StreamLoader.cpp',
    'StyleAnimationValue.cpp',
    'StyleComplexColor.cpp',
    'StyleSheet.cpp',
    'URLExtraData.cpp',
]

SOURCES += [
    'nsCSSAnonBoxes.cpp',
    'nsCSSPseudoElements.cpp',
    # nsLayoutStylesheetCache.cpp uses nsExceptionHandler.h, which includes
    # windows.h.
    'nsLayoutStylesheetCache.cpp',
]
if CONFIG['CC_TYPE'] == 'msvc':
    # Needed for gCSSAnonBoxAtoms.
    SOURCES['nsCSSAnonBoxes.cpp'].flags += ['-Zc:externConstexpr']
    # Needed for gCSSPseudoElementAtoms.
    SOURCES['nsCSSPseudoElements.cpp'].flags += ['-Zc:externConstexpr']

include('/ipc/chromium/chromium-config.mozbuild')

FINAL_LIBRARY = 'xul'

LOCAL_INCLUDES += [
    '../base',
    '../generic',
    '../svg',
    '../xul',
    '/dom/base',
    '/dom/html',
    '/dom/xbl',
    '/dom/xul',
    '/image',
]

JAR_MANIFESTS += ['jar.mn']

RESOURCE_FILES += [
    'contenteditable.css',
    'designmode.css',
]

CONTENT_ACCESSIBLE_FILES += [
    'ImageDocument.css',
    'res/plaintext.css',
    'res/viewsource.css',
    'TopLevelImageDocument.css',
    'TopLevelVideoDocument.css',
]

GENERATED_FILES += [
    'nsCSSPropertyID.h',
    'ServoCSSPropList.h',
    'ServoCSSPropList.py',
]

prop_id = GENERATED_FILES['nsCSSPropertyID.h']
prop_id.script = 'GenerateCSSPropertyID.py:generate'
prop_id.inputs = [
    'nsCSSPropertyID.h.in',
    '!ServoCSSPropList.py',
]

servo_props = GENERATED_FILES['ServoCSSPropList.h']
servo_props.script = 'GenerateServoCSSPropList.py:generate_header'
servo_props.inputs = [
    '!ServoCSSPropList.py',
]

servo_props = GENERATED_FILES['ServoCSSPropList.py']
servo_props.script = 'GenerateServoCSSPropList.py:generate_data'
servo_props.inputs = [
    'ServoCSSPropList.mako.py',
]

if CONFIG['COMPILE_ENVIRONMENT']:
    GENERATED_FILES += [
        'CompositorAnimatableProperties.h',
        'nsComputedDOMStyleGenerated.cpp',
        'nsCSSPropsGenerated.inc',
        'ServoStyleConsts.h',
    ]

    EXPORTS.mozilla += [
        '!CompositorAnimatableProperties.h',
        '!ServoStyleConsts.h',
    ]

    compositor = GENERATED_FILES['CompositorAnimatableProperties.h']
    compositor.script = 'GenerateCompositorAnimatableProperties.py:generate'
    compositor.inputs = [
        '!ServoCSSPropList.py',
    ]

    computed = GENERATED_FILES['nsComputedDOMStyleGenerated.cpp']
    computed.script = 'GenerateComputedDOMStyleGenerated.py:generate'
    computed.inputs = [
        '!ServoCSSPropList.py',
    ]

    css_props = GENERATED_FILES['nsCSSPropsGenerated.inc']
    css_props.script = 'GenerateCSSPropsGenerated.py:generate'
    css_props.inputs = [
        '!ServoCSSPropList.py',
    ]

    consts = GENERATED_FILES['ServoStyleConsts.h']
    consts.script = 'GenerateServoStyleConsts.py:generate'
    consts.inputs = [
        '/servo/components/style/cbindgen.toml',
    ]

    CONFIGURE_SUBST_FILES += [
        'bindgen.toml',
    ]