1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 
7 /* a list of all Servo binding functions */
8 
9 /* This file contains the list of all Servo binding functions. Each
10  * entry is defined as a SERVO_BINDING_FUNC macro with the following
11  * parameters:
12  * - 'name_' the name of the binding function
13  * - 'return_' the return type of the binding function
14  * and the parameter list of the function.
15  *
16  * Users of this list should define a macro
17  * SERVO_BINDING_FUNC(name_, return_, ...)
18  * before including this file.
19  */
20 
21 // Node data
22 SERVO_BINDING_FUNC(Servo_Node_ClearNodeData, void, RawGeckoNodeBorrowed node)
23 
24 // Styleset and Stylesheet management
25 SERVO_BINDING_FUNC(Servo_StyleSheet_Empty, RawServoStyleSheetStrong,
26                    mozilla::css::SheetParsingMode parsing_mode)
27 SERVO_BINDING_FUNC(Servo_StyleSheet_FromUTF8Bytes, RawServoStyleSheetStrong,
28                    const nsACString* data,
29                    mozilla::css::SheetParsingMode parsing_mode,
30                    const nsACString* base_url,
31                    ThreadSafeURIHolder* base,
32                    ThreadSafeURIHolder* referrer,
33                    ThreadSafePrincipalHolder* principal)
34 SERVO_BINDING_FUNC(Servo_StyleSheet_AddRef, void,
35                    RawServoStyleSheetBorrowed sheet)
36 SERVO_BINDING_FUNC(Servo_StyleSheet_Release, void,
37                    RawServoStyleSheetBorrowed sheet)
38 SERVO_BINDING_FUNC(Servo_StyleSheet_HasRules, bool,
39                    RawServoStyleSheetBorrowed sheet)
40 SERVO_BINDING_FUNC(Servo_StyleSet_Init, RawServoStyleSetOwned)
41 SERVO_BINDING_FUNC(Servo_StyleSet_Drop, void, RawServoStyleSetOwned set)
42 SERVO_BINDING_FUNC(Servo_StyleSet_AppendStyleSheet, void,
43                    RawServoStyleSetBorrowed set, RawServoStyleSheetBorrowed sheet)
44 SERVO_BINDING_FUNC(Servo_StyleSet_PrependStyleSheet, void,
45                    RawServoStyleSetBorrowed set, RawServoStyleSheetBorrowed sheet)
46 SERVO_BINDING_FUNC(Servo_StyleSet_RemoveStyleSheet, void,
47                    RawServoStyleSetBorrowed set, RawServoStyleSheetBorrowed sheet)
48 SERVO_BINDING_FUNC(Servo_StyleSet_InsertStyleSheetBefore, void,
49                    RawServoStyleSetBorrowed set, RawServoStyleSheetBorrowed sheet,
50                    RawServoStyleSheetBorrowed reference)
51 
52 // Animations API
53 SERVO_BINDING_FUNC(Servo_ParseProperty,
54                    RawServoDeclarationBlockStrong,
55                    const nsACString* property, const nsACString* value,
56                    const nsACString* base_url, ThreadSafeURIHolder* base,
57                    ThreadSafeURIHolder* referrer,
58                    ThreadSafePrincipalHolder* principal)
59 SERVO_BINDING_FUNC(Servo_RestyleWithAddedDeclaration,
60                    ServoComputedValuesStrong,
61                    RawServoDeclarationBlockBorrowed declarations,
62                    ServoComputedValuesBorrowed previous_style)
63 
64 // Style attribute
65 SERVO_BINDING_FUNC(Servo_ParseStyleAttribute, RawServoDeclarationBlockStrong,
66                    const nsACString* data)
67 SERVO_BINDING_FUNC(Servo_DeclarationBlock_CreateEmpty,
68                    RawServoDeclarationBlockStrong)
69 SERVO_BINDING_FUNC(Servo_DeclarationBlock_Clone, RawServoDeclarationBlockStrong,
70                    RawServoDeclarationBlockBorrowed declarations)
71 SERVO_BINDING_FUNC(Servo_DeclarationBlock_AddRef, void,
72                    RawServoDeclarationBlockBorrowed declarations)
73 SERVO_BINDING_FUNC(Servo_DeclarationBlock_Release, void,
74                    RawServoDeclarationBlockBorrowed declarations)
75 SERVO_BINDING_FUNC(Servo_DeclarationBlock_Equals, bool,
76                    RawServoDeclarationBlockBorrowed a,
77                    RawServoDeclarationBlockBorrowed b)
78 SERVO_BINDING_FUNC(Servo_DeclarationBlock_GetCssText, void,
79                    RawServoDeclarationBlockBorrowed declarations,
80                    nsAString* result)
81 SERVO_BINDING_FUNC(Servo_DeclarationBlock_SerializeOneValue, void,
82                    RawServoDeclarationBlockBorrowed declarations,
83                    nsString* buffer)
84 SERVO_BINDING_FUNC(Servo_DeclarationBlock_Count, uint32_t,
85                    RawServoDeclarationBlockBorrowed declarations)
86 SERVO_BINDING_FUNC(Servo_DeclarationBlock_GetNthProperty, bool,
87                    RawServoDeclarationBlockBorrowed declarations,
88                    uint32_t index, nsAString* result)
89 SERVO_BINDING_FUNC(Servo_DeclarationBlock_GetPropertyValue, void,
90                    RawServoDeclarationBlockBorrowed declarations,
91                    nsIAtom* property, bool is_custom, nsAString* value)
92 SERVO_BINDING_FUNC(Servo_DeclarationBlock_GetPropertyIsImportant, bool,
93                    RawServoDeclarationBlockBorrowed declarations,
94                    nsIAtom* property, bool is_custom)
95 SERVO_BINDING_FUNC(Servo_DeclarationBlock_SetProperty, bool,
96                    RawServoDeclarationBlockBorrowed declarations,
97                    nsIAtom* property, bool is_custom,
98                    nsACString* value, bool is_important)
99 SERVO_BINDING_FUNC(Servo_DeclarationBlock_RemoveProperty, void,
100                    RawServoDeclarationBlockBorrowed declarations,
101                    nsIAtom* property, bool is_custom)
102 
103 // CSS supports()
104 SERVO_BINDING_FUNC(Servo_CSSSupports, bool,
105                    const nsACString* name, const nsACString* value)
106 
107 // Computed style data
108 SERVO_BINDING_FUNC(Servo_ComputedValues_Get, ServoComputedValuesStrong,
109                    RawGeckoNodeBorrowed node)
110 SERVO_BINDING_FUNC(Servo_ComputedValues_GetForAnonymousBox,
111                    ServoComputedValuesStrong,
112                    ServoComputedValuesBorrowedOrNull parent_style_or_null,
113                    nsIAtom* pseudoTag, RawServoStyleSetBorrowed set)
114 SERVO_BINDING_FUNC(Servo_ComputedValues_GetForPseudoElement,
115                    ServoComputedValuesStrong,
116                    ServoComputedValuesBorrowed parent_style,
117                    RawGeckoElementBorrowed match_element, nsIAtom* pseudo_tag,
118                    RawServoStyleSetBorrowed set, bool is_probe)
119 SERVO_BINDING_FUNC(Servo_ComputedValues_Inherit, ServoComputedValuesStrong,
120                    ServoComputedValuesBorrowedOrNull parent_style)
121 SERVO_BINDING_FUNC(Servo_ComputedValues_AddRef, void,
122                    ServoComputedValuesBorrowed computed_values)
123 SERVO_BINDING_FUNC(Servo_ComputedValues_Release, void,
124                    ServoComputedValuesBorrowed computed_values)
125 
126 // Initialize Servo components. Should be called exactly once at startup.
127 SERVO_BINDING_FUNC(Servo_Initialize, void)
128 // Shut down Servo components. Should be called exactly once at shutdown.
129 SERVO_BINDING_FUNC(Servo_Shutdown, void)
130 
131 // Restyle hints
132 SERVO_BINDING_FUNC(Servo_ComputeRestyleHint, nsRestyleHint,
133                    RawGeckoElementBorrowed element, ServoElementSnapshot* snapshot,
134                    RawServoStyleSetBorrowed set)
135 
136 // Restyle the given subtree.
137 SERVO_BINDING_FUNC(Servo_RestyleSubtree, void,
138                    RawGeckoNodeBorrowed node, RawServoStyleSetBorrowed set)
139 
140 // Style-struct management.
141 #define STYLE_STRUCT(name, checkdata_cb)                            \
142   struct nsStyle##name;                                             \
143   SERVO_BINDING_FUNC(Servo_GetStyle##name, const nsStyle##name*,  \
144                      ServoComputedValuesBorrowedOrNull computed_values)
145 #include "nsStyleStructList.h"
146 #undef STYLE_STRUCT
147