diff options
-rw-r--r-- | components/style/binding_tools/check_bindings.py | 37 | ||||
-rw-r--r-- | components/style/gecko_bindings/check_bindings.rs | 60 |
2 files changed, 97 insertions, 0 deletions
diff --git a/components/style/binding_tools/check_bindings.py b/components/style/binding_tools/check_bindings.py new file mode 100644 index 00000000000..67a8f6de175 --- /dev/null +++ b/components/style/binding_tools/check_bindings.py @@ -0,0 +1,37 @@ +# 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/. + +import os +import re + +LICENSE = """\ +/* 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/. */ + +/* automatically generated by check_bindings.py. */ + +""" + +BINDINGS_PATH = os.path.join("..", "gecko_bindings") +INPUT_FILE = os.path.join(BINDINGS_PATH, "bindings.rs") +OUTPUT_FILE = os.path.join(BINDINGS_PATH, "check_bindings.rs") + +TEMPLATE = """\ + [ Servo_{name}, bindings::Servo_{name} ]; +""" + +with open(INPUT_FILE, "r") as bindings, open(OUTPUT_FILE, "w+") as tests: + tests.write(LICENSE) + tests.write("fn assert_types() {\n") + + pattern = re.compile("fn\s*Servo_([_a-zA-Z0-9]+)\s*\(") + + for line in bindings: + match = pattern.search(line) + + if match: + tests.write(TEMPLATE.format(name=match.group(1))) + + tests.write("}\n") diff --git a/components/style/gecko_bindings/check_bindings.rs b/components/style/gecko_bindings/check_bindings.rs new file mode 100644 index 00000000000..72b57dd0922 --- /dev/null +++ b/components/style/gecko_bindings/check_bindings.rs @@ -0,0 +1,60 @@ +/* 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/. */ + +/* automatically generated by check_bindings.py. */ + +fn assert_types() { + [ Servo_Node_ClearNodeData, bindings::Servo_Node_ClearNodeData ]; + [ Servo_StyleSheet_FromUTF8Bytes, bindings::Servo_StyleSheet_FromUTF8Bytes ]; + [ Servo_StyleSheet_AddRef, bindings::Servo_StyleSheet_AddRef ]; + [ Servo_StyleSheet_Release, bindings::Servo_StyleSheet_Release ]; + [ Servo_StyleSheet_HasRules, bindings::Servo_StyleSheet_HasRules ]; + [ Servo_StyleSet_Init, bindings::Servo_StyleSet_Init ]; + [ Servo_StyleSet_Drop, bindings::Servo_StyleSet_Drop ]; + [ Servo_StyleSet_AppendStyleSheet, bindings::Servo_StyleSet_AppendStyleSheet ]; + [ Servo_StyleSet_PrependStyleSheet, bindings::Servo_StyleSet_PrependStyleSheet ]; + [ Servo_StyleSet_RemoveStyleSheet, bindings::Servo_StyleSet_RemoveStyleSheet ]; + [ Servo_StyleSet_InsertStyleSheetBefore, bindings::Servo_StyleSet_InsertStyleSheetBefore ]; + [ Servo_ParseStyleAttribute, bindings::Servo_ParseStyleAttribute ]; + [ Servo_DeclarationBlock_AddRef, bindings::Servo_DeclarationBlock_AddRef ]; + [ Servo_DeclarationBlock_Release, bindings::Servo_DeclarationBlock_Release ]; + [ Servo_DeclarationBlock_GetCache, bindings::Servo_DeclarationBlock_GetCache ]; + [ Servo_DeclarationBlock_SetImmutable, bindings::Servo_DeclarationBlock_SetImmutable ]; + [ Servo_DeclarationBlock_ClearCachePointer, bindings::Servo_DeclarationBlock_ClearCachePointer ]; + [ Servo_CSSSupports, bindings::Servo_CSSSupports ]; + [ Servo_ComputedValues_Get, bindings::Servo_ComputedValues_Get ]; + [ Servo_ComputedValues_GetForAnonymousBox, bindings::Servo_ComputedValues_GetForAnonymousBox ]; + [ Servo_ComputedValues_GetForPseudoElement, bindings::Servo_ComputedValues_GetForPseudoElement ]; + [ Servo_ComputedValues_Inherit, bindings::Servo_ComputedValues_Inherit ]; + [ Servo_ComputedValues_AddRef, bindings::Servo_ComputedValues_AddRef ]; + [ Servo_ComputedValues_Release, bindings::Servo_ComputedValues_Release ]; + [ Servo_Initialize, bindings::Servo_Initialize ]; + [ Servo_Shutdown, bindings::Servo_Shutdown ]; + [ Servo_ComputeRestyleHint, bindings::Servo_ComputeRestyleHint ]; + [ Servo_RestyleSubtree, bindings::Servo_RestyleSubtree ]; + [ Servo_GetStyleFont, bindings::Servo_GetStyleFont ]; + [ Servo_GetStyleColor, bindings::Servo_GetStyleColor ]; + [ Servo_GetStyleList, bindings::Servo_GetStyleList ]; + [ Servo_GetStyleText, bindings::Servo_GetStyleText ]; + [ Servo_GetStyleVisibility, bindings::Servo_GetStyleVisibility ]; + [ Servo_GetStyleUserInterface, bindings::Servo_GetStyleUserInterface ]; + [ Servo_GetStyleTableBorder, bindings::Servo_GetStyleTableBorder ]; + [ Servo_GetStyleSVG, bindings::Servo_GetStyleSVG ]; + [ Servo_GetStyleVariables, bindings::Servo_GetStyleVariables ]; + [ Servo_GetStyleBackground, bindings::Servo_GetStyleBackground ]; + [ Servo_GetStylePosition, bindings::Servo_GetStylePosition ]; + [ Servo_GetStyleTextReset, bindings::Servo_GetStyleTextReset ]; + [ Servo_GetStyleDisplay, bindings::Servo_GetStyleDisplay ]; + [ Servo_GetStyleContent, bindings::Servo_GetStyleContent ]; + [ Servo_GetStyleUIReset, bindings::Servo_GetStyleUIReset ]; + [ Servo_GetStyleTable, bindings::Servo_GetStyleTable ]; + [ Servo_GetStyleMargin, bindings::Servo_GetStyleMargin ]; + [ Servo_GetStylePadding, bindings::Servo_GetStylePadding ]; + [ Servo_GetStyleBorder, bindings::Servo_GetStyleBorder ]; + [ Servo_GetStyleOutline, bindings::Servo_GetStyleOutline ]; + [ Servo_GetStyleXUL, bindings::Servo_GetStyleXUL ]; + [ Servo_GetStyleSVGReset, bindings::Servo_GetStyleSVGReset ]; + [ Servo_GetStyleColumn, bindings::Servo_GetStyleColumn ]; + [ Servo_GetStyleEffects, bindings::Servo_GetStyleEffects ]; +} |