/work/obj-fuzz/dist/include/mozilla/ServoBindings.h
Line | Count | Source (jump to first uncovered line) |
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 | | #ifndef mozilla_ServoBindings_h |
8 | | #define mozilla_ServoBindings_h |
9 | | |
10 | | #include <stdint.h> |
11 | | |
12 | | #include "mozilla/AtomArray.h" |
13 | | #include "mozilla/ServoTypes.h" |
14 | | #include "mozilla/ServoBindingTypes.h" |
15 | | #include "mozilla/ServoComputedDataInlines.h" |
16 | | #include "mozilla/ServoElementSnapshot.h" |
17 | | #include "mozilla/css/DocumentMatchingFunction.h" |
18 | | #include "mozilla/css/SheetLoadData.h" |
19 | | #include "mozilla/css/SheetParsingMode.h" |
20 | | #include "mozilla/EffectCompositor.h" |
21 | | #include "mozilla/ComputedTimingFunction.h" |
22 | | #include "nsChangeHint.h" |
23 | | #include "nsIDocument.h" |
24 | | |
25 | | /* |
26 | | * API for Servo to access Gecko data structures. |
27 | | * |
28 | | * Functions beginning with Gecko_ are implemented in Gecko and invoked from Servo. |
29 | | * Functions beginning with Servo_ are implemented in Servo and invoked from Gecko. |
30 | | */ |
31 | | |
32 | | class nsAtom; |
33 | | class nsIPrincipal; |
34 | | class nsIURI; |
35 | | struct nsFont; |
36 | | namespace mozilla { |
37 | | class FontFamilyList; |
38 | | struct FontFamilyName; |
39 | | enum FontFamilyType : uint8_t; |
40 | | class SharedFontList; |
41 | | enum class CSSPseudoElementType : uint8_t; |
42 | | struct Keyframe; |
43 | | struct StyleTransition; |
44 | | namespace css { |
45 | | class ErrorReporter; |
46 | | struct URLValue; |
47 | | struct ImageValue; |
48 | | class LoaderReusableStyleSheets; |
49 | | }; |
50 | | namespace dom { |
51 | | enum class IterationCompositeOperation : uint8_t; |
52 | | }; |
53 | | enum class UpdateAnimationsTasks : uint8_t; |
54 | | struct LangGroupFontPrefs; |
55 | | class SeenPtrs; |
56 | | class ComputedStyle; |
57 | | class StyleSheet; |
58 | | class ServoElementSnapshotTable; |
59 | | enum class PointerCapabilities : uint8_t; |
60 | | } |
61 | | using mozilla::FontFamilyList; |
62 | | using mozilla::FontFamilyName; |
63 | | using mozilla::FontFamilyType; |
64 | | using mozilla::ServoElementSnapshot; |
65 | | using mozilla::SharedFontList; |
66 | | struct nsMediaFeature; |
67 | | class nsSimpleContentList; |
68 | | struct nsStyleList; |
69 | | struct nsStyleImage; |
70 | | struct nsStyleGradientStop; |
71 | | class nsStyleGradient; |
72 | | class nsStyleCoord; |
73 | | struct nsStyleDisplay; |
74 | | class nsXBLBinding; |
75 | | |
76 | | #ifdef NIGHTLY_BUILD |
77 | | const bool GECKO_IS_NIGHTLY = true; |
78 | | #else |
79 | | const bool GECKO_IS_NIGHTLY = false; |
80 | | #endif |
81 | | |
82 | | #define NS_DECL_THREADSAFE_FFI_REFCOUNTING(class_, name_) \ |
83 | | void Gecko_AddRef##name_##ArbitraryThread(class_* aPtr); \ |
84 | | void Gecko_Release##name_##ArbitraryThread(class_* aPtr); |
85 | | #define NS_IMPL_THREADSAFE_FFI_REFCOUNTING(class_, name_) \ |
86 | | static_assert(class_::HasThreadSafeRefCnt::value, \ |
87 | | "NS_DECL_THREADSAFE_FFI_REFCOUNTING can only be used with " \ |
88 | | "classes that have thread-safe refcounting"); \ |
89 | | void Gecko_AddRef##name_##ArbitraryThread(class_* aPtr) \ |
90 | 0 | { NS_ADDREF(aPtr); } \ Unexecuted instantiation: Gecko_AddRefSharedFontListArbitraryThread Unexecuted instantiation: Gecko_AddRefImageValueArbitraryThread Unexecuted instantiation: Gecko_AddRefGridTemplateAreasValueArbitraryThread Unexecuted instantiation: Gecko_AddRefCSSURLValueArbitraryThread Unexecuted instantiation: Gecko_AddRefURLExtraDataArbitraryThread Unexecuted instantiation: Gecko_AddRefCalcArbitraryThread Unexecuted instantiation: Gecko_AddRefCSSShadowArrayArbitraryThread Unexecuted instantiation: Gecko_AddRefQuoteValuesArbitraryThread Unexecuted instantiation: Gecko_AddRefSheetLoadDataHolderArbitraryThread Unexecuted instantiation: Gecko_AddRefCSSValueSharedListArbitraryThread |
91 | | void Gecko_Release##name_##ArbitraryThread(class_* aPtr) \ |
92 | 0 | { NS_RELEASE(aPtr); } Unexecuted instantiation: Gecko_ReleaseSharedFontListArbitraryThread Unexecuted instantiation: Gecko_ReleaseImageValueArbitraryThread Unexecuted instantiation: Gecko_ReleaseGridTemplateAreasValueArbitraryThread Unexecuted instantiation: Gecko_ReleaseCSSURLValueArbitraryThread Unexecuted instantiation: Gecko_ReleaseURLExtraDataArbitraryThread Unexecuted instantiation: Gecko_ReleaseCalcArbitraryThread Unexecuted instantiation: Gecko_ReleaseCSSShadowArrayArbitraryThread Unexecuted instantiation: Gecko_ReleaseQuoteValuesArbitraryThread Unexecuted instantiation: Gecko_ReleaseSheetLoadDataHolderArbitraryThread Unexecuted instantiation: Gecko_ReleaseCSSValueSharedListArbitraryThread |
93 | | |
94 | | #define NS_DECL_FFI_REFCOUNTING(class_, name_) \ |
95 | | void Gecko_##name_##_AddRef(class_* aPtr); \ |
96 | | void Gecko_##name_##_Release(class_* aPtr); |
97 | | #define NS_IMPL_FFI_REFCOUNTING(class_, name_) \ |
98 | | void Gecko_##name_##_AddRef(class_* aPtr) \ |
99 | | { MOZ_ASSERT(NS_IsMainThread()); NS_ADDREF(aPtr); } \ |
100 | | void Gecko_##name_##_Release(class_* aPtr) \ |
101 | | { MOZ_ASSERT(NS_IsMainThread()); NS_RELEASE(aPtr); } |
102 | | |
103 | | #define DEFINE_ARRAY_TYPE_FOR(type_) \ |
104 | | struct nsTArrayBorrowed_##type_ { \ |
105 | | nsTArray<type_>* mArray; \ |
106 | | MOZ_IMPLICIT nsTArrayBorrowed_##type_(nsTArray<type_>* aArray) \ |
107 | 0 | : mArray(aArray) {} \ |
108 | | } |
109 | | DEFINE_ARRAY_TYPE_FOR(uintptr_t); |
110 | | #undef DEFINE_ARRAY_TYPE_FOR |
111 | | |
112 | | extern "C" { |
113 | | |
114 | | class ServoBundledURI |
115 | | { |
116 | | public: |
117 | | // NOTE(emilio): Not calling IntoCssUrl or IntoCssImage will cause to leak the |
118 | | // string, so don't do that :) |
119 | | already_AddRefed<mozilla::css::URLValue> IntoCssUrl(); |
120 | | already_AddRefed<mozilla::css::ImageValue> IntoCssImage(mozilla::CORSMode); |
121 | | mozilla::ServoRawOffsetArc<RustString> mURLString; |
122 | | mozilla::URLExtraData* mExtraData; |
123 | | }; |
124 | | |
125 | | struct FontSizePrefs |
126 | | { |
127 | | void CopyFrom(const mozilla::LangGroupFontPrefs&); |
128 | | nscoord mDefaultVariableSize; |
129 | | nscoord mDefaultFixedSize; |
130 | | nscoord mDefaultSerifSize; |
131 | | nscoord mDefaultSansSerifSize; |
132 | | nscoord mDefaultMonospaceSize; |
133 | | nscoord mDefaultCursiveSize; |
134 | | nscoord mDefaultFantasySize; |
135 | | }; |
136 | | |
137 | | struct MediumFeaturesChangedResult { |
138 | | bool mAffectsDocumentRules; |
139 | | bool mAffectsNonDocumentRules; |
140 | | bool mUsesViewportUnits; |
141 | | }; |
142 | | |
143 | | // Debugging stuff. |
144 | | void Gecko_Element_DebugListAttributes(RawGeckoElementBorrowed, nsCString*); |
145 | | void Gecko_Snapshot_DebugListAttributes(const ServoElementSnapshot*, nsCString*); |
146 | | |
147 | | bool Gecko_IsSignificantChild(RawGeckoNodeBorrowed node, bool whitespace_is_significant); |
148 | | RawGeckoNodeBorrowedOrNull Gecko_GetLastChild(RawGeckoNodeBorrowed node); |
149 | | RawGeckoNodeBorrowedOrNull Gecko_GetPreviousSibling(RawGeckoNodeBorrowed node); |
150 | | RawGeckoNodeBorrowedOrNull Gecko_GetFlattenedTreeParentNode(RawGeckoNodeBorrowed node); |
151 | | RawGeckoElementBorrowedOrNull Gecko_GetBeforeOrAfterPseudo(RawGeckoElementBorrowed element, bool is_before); |
152 | | nsTArray<nsIContent*>* Gecko_GetAnonymousContentForElement(RawGeckoElementBorrowed element); |
153 | | const nsTArray<RefPtr<nsINode>>* Gecko_GetAssignedNodes(RawGeckoElementBorrowed element); |
154 | | void Gecko_DestroyAnonymousContentList(nsTArray<nsIContent*>* anon_content); |
155 | | |
156 | | void Gecko_ComputedStyle_Init(mozilla::ComputedStyle* context, |
157 | | RawGeckoPresContextBorrowed pres_context, |
158 | | ServoComputedDataBorrowed values, |
159 | | mozilla::CSSPseudoElementType pseudo_type, |
160 | | nsAtom* pseudo_tag); |
161 | | void Gecko_ComputedStyle_Destroy(mozilla::ComputedStyle* context); |
162 | | |
163 | | // By default, Servo walks the DOM by traversing the siblings of the DOM-view |
164 | | // first child. This generally works, but misses anonymous children, which we |
165 | | // want to traverse during styling. To support these cases, we create an |
166 | | // optional stack-allocated iterator in aIterator for nodes that need it. |
167 | | void Gecko_ConstructStyleChildrenIterator(RawGeckoElementBorrowed aElement, |
168 | | RawGeckoStyleChildrenIteratorBorrowedMut aIterator); |
169 | | void Gecko_DestroyStyleChildrenIterator(RawGeckoStyleChildrenIteratorBorrowedMut aIterator); |
170 | | RawGeckoNodeBorrowedOrNull Gecko_GetNextStyleChild(RawGeckoStyleChildrenIteratorBorrowedMut it); |
171 | | |
172 | | NS_DECL_THREADSAFE_FFI_REFCOUNTING(mozilla::css::SheetLoadDataHolder, SheetLoadDataHolder); |
173 | | |
174 | | void Gecko_StyleSheet_FinishAsyncParse(mozilla::css::SheetLoadDataHolder* data, |
175 | | RawServoStyleSheetContentsStrong sheet_contents, |
176 | | StyleUseCountersOwnedOrNull use_counters); |
177 | | |
178 | | mozilla::StyleSheet* |
179 | | Gecko_LoadStyleSheet(mozilla::css::Loader* loader, |
180 | | mozilla::StyleSheet* parent, |
181 | | mozilla::css::SheetLoadData* parent_load_data, |
182 | | mozilla::css::LoaderReusableStyleSheets* reusable_sheets, |
183 | | ServoBundledURI url, |
184 | | RawServoMediaListStrong media_list); |
185 | | |
186 | | void |
187 | | Gecko_LoadStyleSheetAsync(mozilla::css::SheetLoadDataHolder* parent_data, |
188 | | ServoBundledURI url, |
189 | | RawServoMediaListStrong media_list, |
190 | | RawServoImportRuleStrong import_rule); |
191 | | |
192 | | // Selector Matching. |
193 | | uint64_t Gecko_ElementState(RawGeckoElementBorrowed element); |
194 | | bool Gecko_IsRootElement(RawGeckoElementBorrowed element); |
195 | | bool Gecko_MatchLang(RawGeckoElementBorrowed element, |
196 | | nsAtom* override_lang, bool has_override_lang, |
197 | | const char16_t* value); |
198 | | nsAtom* Gecko_GetXMLLangValue(RawGeckoElementBorrowed element); |
199 | | nsIDocument::DocumentTheme Gecko_GetDocumentLWTheme(const nsIDocument* aDocument); |
200 | | bool Gecko_IsTableBorderNonzero(RawGeckoElementBorrowed element); |
201 | | bool Gecko_IsBrowserFrame(RawGeckoElementBorrowed element); |
202 | | |
203 | | // Attributes. |
204 | | #define SERVO_DECLARE_ELEMENT_ATTR_MATCHING_FUNCTIONS(prefix_, implementor_) \ |
205 | | nsAtom* prefix_##LangValue(implementor_ element); \ |
206 | | bool prefix_##HasAttr(implementor_ element, nsAtom* ns, nsAtom* name); \ |
207 | | bool prefix_##AttrEquals(implementor_ element, nsAtom* ns, nsAtom* name, \ |
208 | | nsAtom* str, bool ignoreCase); \ |
209 | | bool prefix_##AttrDashEquals(implementor_ element, nsAtom* ns, \ |
210 | | nsAtom* name, nsAtom* str, bool ignore_case); \ |
211 | | bool prefix_##AttrIncludes(implementor_ element, nsAtom* ns, \ |
212 | | nsAtom* name, nsAtom* str, bool ignore_case); \ |
213 | | bool prefix_##AttrHasSubstring(implementor_ element, nsAtom* ns, \ |
214 | | nsAtom* name, nsAtom* str, \ |
215 | | bool ignore_case); \ |
216 | | bool prefix_##AttrHasPrefix(implementor_ element, nsAtom* ns, \ |
217 | | nsAtom* name, nsAtom* str, bool ignore_case); \ |
218 | | bool prefix_##AttrHasSuffix(implementor_ element, nsAtom* ns, \ |
219 | | nsAtom* name, nsAtom* str, bool ignore_case); |
220 | | |
221 | | bool Gecko_AssertClassAttrValueIsSane(const nsAttrValue*); |
222 | | const nsAttrValue* Gecko_GetSVGAnimatedClass(RawGeckoElementBorrowed); |
223 | | |
224 | | |
225 | | SERVO_DECLARE_ELEMENT_ATTR_MATCHING_FUNCTIONS(Gecko_, RawGeckoElementBorrowed) |
226 | | SERVO_DECLARE_ELEMENT_ATTR_MATCHING_FUNCTIONS(Gecko_Snapshot, |
227 | | const ServoElementSnapshot*) |
228 | | |
229 | | #undef SERVO_DECLARE_ELEMENT_ATTR_MATCHING_FUNCTIONS |
230 | | |
231 | | // Style attributes. |
232 | | RawServoDeclarationBlockStrongBorrowedOrNull |
233 | | Gecko_GetStyleAttrDeclarationBlock(RawGeckoElementBorrowed element); |
234 | | void Gecko_UnsetDirtyStyleAttr(RawGeckoElementBorrowed element); |
235 | | RawServoDeclarationBlockStrongBorrowedOrNull |
236 | | Gecko_GetHTMLPresentationAttrDeclarationBlock(RawGeckoElementBorrowed element); |
237 | | RawServoDeclarationBlockStrongBorrowedOrNull |
238 | | Gecko_GetExtraContentStyleDeclarations(RawGeckoElementBorrowed element); |
239 | | RawServoDeclarationBlockStrongBorrowedOrNull |
240 | | Gecko_GetUnvisitedLinkAttrDeclarationBlock(RawGeckoElementBorrowed element); |
241 | | RawServoDeclarationBlockStrongBorrowedOrNull |
242 | | Gecko_GetVisitedLinkAttrDeclarationBlock(RawGeckoElementBorrowed element); |
243 | | RawServoDeclarationBlockStrongBorrowedOrNull |
244 | | Gecko_GetActiveLinkAttrDeclarationBlock(RawGeckoElementBorrowed element); |
245 | | |
246 | | // Visited handling. |
247 | | |
248 | | // Returns whether visited styles are enabled for a given document. |
249 | | bool Gecko_VisitedStylesEnabled(const nsIDocument*); |
250 | | |
251 | | // Animations |
252 | | bool |
253 | | Gecko_GetAnimationRule(RawGeckoElementBorrowed aElementOrPseudo, |
254 | | mozilla::EffectCompositor::CascadeLevel aCascadeLevel, |
255 | | RawServoAnimationValueMapBorrowedMut aAnimationValues); |
256 | | bool Gecko_StyleAnimationsEquals(RawGeckoStyleAnimationListBorrowed, |
257 | | RawGeckoStyleAnimationListBorrowed); |
258 | | void Gecko_CopyAnimationNames(RawGeckoStyleAnimationListBorrowedMut aDest, |
259 | | RawGeckoStyleAnimationListBorrowed aSrc); |
260 | | // This function takes an already addrefed nsAtom |
261 | | void Gecko_SetAnimationName(mozilla::StyleAnimation* aStyleAnimation, |
262 | | nsAtom* aAtom); |
263 | | void Gecko_UpdateAnimations(RawGeckoElementBorrowed aElementOrPseudo, |
264 | | ComputedStyleBorrowedOrNull aOldComputedValues, |
265 | | ComputedStyleBorrowedOrNull aComputedValues, |
266 | | mozilla::UpdateAnimationsTasks aTasks); |
267 | | size_t Gecko_GetAnimationEffectCount(RawGeckoElementBorrowed aElementOrPseudo); |
268 | | bool Gecko_ElementHasAnimations(RawGeckoElementBorrowed aElementOrPseudo); |
269 | | bool Gecko_ElementHasCSSAnimations(RawGeckoElementBorrowed aElementOrPseudo); |
270 | | bool Gecko_ElementHasCSSTransitions(RawGeckoElementBorrowed aElementOrPseudo); |
271 | | size_t Gecko_ElementTransitions_Length(RawGeckoElementBorrowed aElementOrPseudo); |
272 | | nsCSSPropertyID Gecko_ElementTransitions_PropertyAt( |
273 | | RawGeckoElementBorrowed aElementOrPseudo, |
274 | | size_t aIndex); |
275 | | RawServoAnimationValueBorrowedOrNull Gecko_ElementTransitions_EndValueAt( |
276 | | RawGeckoElementBorrowed aElementOrPseudo, |
277 | | size_t aIndex); |
278 | | double Gecko_GetProgressFromComputedTiming(RawGeckoComputedTimingBorrowed aComputedTiming); |
279 | | double Gecko_GetPositionInSegment( |
280 | | RawGeckoAnimationPropertySegmentBorrowed aSegment, |
281 | | double aProgress, |
282 | | mozilla::ComputedTimingFunction::BeforeFlag aBeforeFlag); |
283 | | // Get servo's AnimationValue for |aProperty| from the cached base style |
284 | | // |aBaseStyles|. |
285 | | // |aBaseStyles| is nsRefPtrHashtable<nsUint32HashKey, RawServoAnimationValue>. |
286 | | // We use RawServoAnimationValueTableBorrowed to avoid exposing nsRefPtrHashtable in FFI. |
287 | | RawServoAnimationValueBorrowedOrNull Gecko_AnimationGetBaseStyle( |
288 | | RawServoAnimationValueTableBorrowed aBaseStyles, |
289 | | nsCSSPropertyID aProperty); |
290 | | void Gecko_StyleTransition_SetUnsupportedProperty( |
291 | | mozilla::StyleTransition* aTransition, |
292 | | nsAtom* aAtom); |
293 | | |
294 | | // Atoms. |
295 | | nsAtom* Gecko_Atomize(const char* aString, uint32_t aLength); |
296 | | nsAtom* Gecko_Atomize16(const nsAString* aString); |
297 | | void Gecko_AddRefAtom(nsAtom* aAtom); |
298 | | void Gecko_ReleaseAtom(nsAtom* aAtom); |
299 | | |
300 | | // Font style |
301 | | void Gecko_CopyFontFamilyFrom(nsFont* dst, const nsFont* src); |
302 | | void Gecko_nsTArray_FontFamilyName_AppendNamed(nsTArray<FontFamilyName>* aNames, nsAtom* aName, bool aQuoted); |
303 | | void Gecko_nsTArray_FontFamilyName_AppendGeneric(nsTArray<FontFamilyName>* aNames, FontFamilyType aType); |
304 | | // Returns an already-AddRefed SharedFontList with an empty mNames array. |
305 | | SharedFontList* Gecko_SharedFontList_Create(); |
306 | | size_t Gecko_SharedFontList_SizeOfIncludingThis(SharedFontList* fontlist); |
307 | | size_t Gecko_SharedFontList_SizeOfIncludingThisIfUnshared(SharedFontList* fontlist); |
308 | | NS_DECL_THREADSAFE_FFI_REFCOUNTING(mozilla::SharedFontList, SharedFontList); |
309 | | // will not run destructors on dst, give it uninitialized memory |
310 | | // font_id is LookAndFeel::FontID |
311 | | void Gecko_nsFont_InitSystem(nsFont* dst, int32_t font_id, |
312 | | const nsStyleFont* font, RawGeckoPresContextBorrowed pres_context); |
313 | | void Gecko_nsFont_Destroy(nsFont* dst); |
314 | | |
315 | | // The gfxFontFeatureValueSet returned from this function has zero reference. |
316 | | gfxFontFeatureValueSet* Gecko_ConstructFontFeatureValueSet(); |
317 | | nsTArray<unsigned int>* Gecko_AppendFeatureValueHashEntry( |
318 | | gfxFontFeatureValueSet* value_set, nsAtom* family, uint32_t alternate, nsAtom* name); |
319 | | void Gecko_nsFont_SetFontFeatureValuesLookup(nsFont* font, |
320 | | const RawGeckoPresContext* pres_context); |
321 | | void Gecko_nsFont_ResetFontFeatureValuesLookup(nsFont* font); |
322 | | |
323 | | // Font variant alternates |
324 | | void Gecko_ClearAlternateValues(nsFont* font, size_t length); |
325 | | void Gecko_AppendAlternateValues(nsFont* font, uint32_t alternate_name, nsAtom* atom); |
326 | | void Gecko_CopyAlternateValuesFrom(nsFont* dest, const nsFont* src); |
327 | | |
328 | | // Visibility style |
329 | | void Gecko_SetImageOrientation(nsStyleVisibility* aVisibility, |
330 | | uint8_t aOrientation, |
331 | | bool aFlip); |
332 | | void Gecko_SetImageOrientationAsFromImage(nsStyleVisibility* aVisibility); |
333 | | void Gecko_CopyImageOrientationFrom(nsStyleVisibility* aDst, |
334 | | const nsStyleVisibility* aSrc); |
335 | | |
336 | | // Counter style. |
337 | | // This function takes an already addrefed nsAtom |
338 | | void Gecko_SetCounterStyleToName(mozilla::CounterStylePtr* ptr, nsAtom* name, |
339 | | RawGeckoPresContextBorrowed pres_context); |
340 | | void Gecko_SetCounterStyleToSymbols(mozilla::CounterStylePtr* ptr, |
341 | | uint8_t symbols_type, |
342 | | nsACString const* const* symbols, |
343 | | uint32_t symbols_count); |
344 | | void Gecko_SetCounterStyleToString(mozilla::CounterStylePtr* ptr, |
345 | | const nsACString* symbol); |
346 | | void Gecko_CopyCounterStyle(mozilla::CounterStylePtr* dst, |
347 | | const mozilla::CounterStylePtr* src); |
348 | | nsAtom* Gecko_CounterStyle_GetName(const mozilla::CounterStylePtr* ptr); |
349 | | const mozilla::AnonymousCounterStyle* |
350 | | Gecko_CounterStyle_GetAnonymous(const mozilla::CounterStylePtr* ptr); |
351 | | |
352 | | // background-image style. |
353 | | void Gecko_SetNullImageValue(nsStyleImage* image); |
354 | | void Gecko_SetGradientImageValue(nsStyleImage* image, nsStyleGradient* gradient); |
355 | | NS_DECL_THREADSAFE_FFI_REFCOUNTING(mozilla::css::ImageValue, ImageValue); |
356 | | mozilla::css::ImageValue* Gecko_ImageValue_Create(ServoBundledURI aURI, |
357 | | mozilla::CORSMode aCORSMode); |
358 | | size_t Gecko_ImageValue_SizeOfIncludingThis(mozilla::css::ImageValue* aImageValue); |
359 | | void Gecko_SetLayerImageImageValue(nsStyleImage* image, |
360 | | mozilla::css::ImageValue* aImageValue); |
361 | | |
362 | | void Gecko_SetImageElement(nsStyleImage* image, nsAtom* atom); |
363 | | void Gecko_CopyImageValueFrom(nsStyleImage* image, const nsStyleImage* other); |
364 | | void Gecko_InitializeImageCropRect(nsStyleImage* image); |
365 | | |
366 | | nsStyleGradient* Gecko_CreateGradient(uint8_t shape, |
367 | | uint8_t size, |
368 | | bool repeating, |
369 | | bool legacy_syntax, |
370 | | bool moz_legacy_syntax, |
371 | | uint32_t stops); |
372 | | |
373 | | const nsStyleImageRequest* Gecko_GetImageRequest(const nsStyleImage* image); |
374 | | nsAtom* Gecko_GetImageElement(const nsStyleImage* image); |
375 | | const nsStyleGradient* Gecko_GetGradientImageValue(const nsStyleImage* image); |
376 | | |
377 | | // list-style-image style. |
378 | | void Gecko_SetListStyleImageNone(nsStyleList* style_struct); |
379 | | void Gecko_SetListStyleImageImageValue(nsStyleList* style_struct, |
380 | | mozilla::css::ImageValue* aImageValue); |
381 | | void Gecko_CopyListStyleImageFrom(nsStyleList* dest, const nsStyleList* src); |
382 | | |
383 | | // cursor style. |
384 | | void Gecko_SetCursorArrayLength(nsStyleUI* ui, size_t len); |
385 | | void Gecko_SetCursorImageValue(nsCursorImage* aCursor, |
386 | | mozilla::css::ImageValue* aImageValue); |
387 | | void Gecko_CopyCursorArrayFrom(nsStyleUI* dest, const nsStyleUI* src); |
388 | | |
389 | | void Gecko_SetContentDataImageValue(nsStyleContentData* aList, |
390 | | mozilla::css::ImageValue* aImageValue); |
391 | | nsStyleContentData::CounterFunction* Gecko_SetCounterFunction( |
392 | | nsStyleContentData* content_data, mozilla::StyleContentType); |
393 | | |
394 | | // Dirtiness tracking. |
395 | | void Gecko_SetNodeFlags(RawGeckoNodeBorrowed node, uint32_t flags); |
396 | | void Gecko_UnsetNodeFlags(RawGeckoNodeBorrowed node, uint32_t flags); |
397 | | void Gecko_NoteDirtyElement(RawGeckoElementBorrowed element); |
398 | | void Gecko_NoteDirtySubtreeForInvalidation(RawGeckoElementBorrowed element); |
399 | | void Gecko_NoteAnimationOnlyDirtyElement(RawGeckoElementBorrowed element); |
400 | | |
401 | | bool Gecko_AnimationNameMayBeReferencedFromStyle( |
402 | | RawGeckoPresContextBorrowed pres_context, |
403 | | nsAtom* name); |
404 | | |
405 | | // Incremental restyle. |
406 | | mozilla::CSSPseudoElementType Gecko_GetImplementedPseudo(RawGeckoElementBorrowed element); |
407 | | // We'd like to return `nsChangeHint` here, but bindgen bitfield enums don't |
408 | | // work as return values with the Linux 32-bit ABI at the moment because |
409 | | // they wrap the value in a struct. |
410 | | uint32_t Gecko_CalcStyleDifference(ComputedStyleBorrowed old_style, |
411 | | ComputedStyleBorrowed new_style, |
412 | | bool* any_style_struct_changed, |
413 | | bool* reset_only_changed); |
414 | | |
415 | | // Get an element snapshot for a given element from the table. |
416 | | const ServoElementSnapshot* |
417 | | Gecko_GetElementSnapshot(const mozilla::ServoElementSnapshotTable* table, |
418 | | RawGeckoElementBorrowed element); |
419 | | |
420 | | // Have we seen this pointer before? |
421 | | bool |
422 | | Gecko_HaveSeenPtr(mozilla::SeenPtrs* table, const void* ptr); |
423 | | |
424 | | // `array` must be an nsTArray |
425 | | // If changing this signature, please update the |
426 | | // friend function declaration in nsTArray.h |
427 | | void Gecko_EnsureTArrayCapacity(void* array, size_t capacity, size_t elem_size); |
428 | | |
429 | | // Same here, `array` must be an nsTArray<T>, for some T. |
430 | | // |
431 | | // Important note: Only valid for POD types, since destructors won't be run |
432 | | // otherwise. This is ensured with rust traits for the relevant structs. |
433 | | void Gecko_ClearPODTArray(void* array, size_t elem_size, size_t elem_align); |
434 | | |
435 | | void Gecko_ResizeTArrayForStrings(nsTArray<nsString>* array, uint32_t length); |
436 | | |
437 | | void Gecko_SetStyleGridTemplate(mozilla::UniquePtr<nsStyleGridTemplate>* grid_template, |
438 | | nsStyleGridTemplate* value); |
439 | | |
440 | | nsStyleGridTemplate* Gecko_CreateStyleGridTemplate(uint32_t track_sizes, |
441 | | uint32_t name_size); |
442 | | |
443 | | void Gecko_CopyStyleGridTemplateValues(mozilla::UniquePtr<nsStyleGridTemplate>* grid_template, |
444 | | const nsStyleGridTemplate* other); |
445 | | |
446 | | mozilla::css::GridTemplateAreasValue* Gecko_NewGridTemplateAreasValue(uint32_t areas, |
447 | | uint32_t templates, |
448 | | uint32_t columns); |
449 | | NS_DECL_THREADSAFE_FFI_REFCOUNTING(mozilla::css::GridTemplateAreasValue, GridTemplateAreasValue); |
450 | | |
451 | | // Clear the mContents, mCounterIncrements, or mCounterResets field in nsStyleContent. This is |
452 | | // needed to run the destructors, otherwise we'd leak the images, strings, and whatnot. |
453 | | void Gecko_ClearAndResizeStyleContents(nsStyleContent* content, |
454 | | uint32_t how_many); |
455 | | void Gecko_ClearAndResizeCounterIncrements(nsStyleContent* content, |
456 | | uint32_t how_many); |
457 | | void Gecko_ClearAndResizeCounterResets(nsStyleContent* content, |
458 | | uint32_t how_many); |
459 | | void Gecko_CopyStyleContentsFrom(nsStyleContent* content, const nsStyleContent* other); |
460 | | void Gecko_CopyCounterResetsFrom(nsStyleContent* content, const nsStyleContent* other); |
461 | | void Gecko_CopyCounterIncrementsFrom(nsStyleContent* content, const nsStyleContent* other); |
462 | | |
463 | | void Gecko_EnsureImageLayersLength(nsStyleImageLayers* layers, size_t len, |
464 | | nsStyleImageLayers::LayerType layer_type); |
465 | | |
466 | | void Gecko_EnsureStyleAnimationArrayLength(void* array, size_t len); |
467 | | void Gecko_EnsureStyleTransitionArrayLength(void* array, size_t len); |
468 | | |
469 | | void Gecko_ClearWillChange(nsStyleDisplay* display, size_t length); |
470 | | void Gecko_AppendWillChange(nsStyleDisplay* display, nsAtom* atom); |
471 | | void Gecko_CopyWillChangeFrom(nsStyleDisplay* dest, nsStyleDisplay* src); |
472 | | |
473 | | // Searches from the beginning of |keyframes| for a Keyframe object with the |
474 | | // specified offset and timing function. If none is found, a new Keyframe object |
475 | | // with the specified |offset| and |timingFunction| will be prepended to |
476 | | // |keyframes|. |
477 | | // |
478 | | // @param keyframes An array of Keyframe objects, sorted by offset. |
479 | | // The first Keyframe in the array, if any, MUST have an |
480 | | // offset greater than or equal to |offset|. |
481 | | // @param offset The offset to search for, or, if no suitable Keyframe is |
482 | | // found, the offset to use for the created Keyframe. |
483 | | // Must be a floating point number in the range [0.0, 1.0]. |
484 | | // @param timingFunction The timing function to match, or, if no suitable |
485 | | // Keyframe is found, to set on the created Keyframe. |
486 | | // |
487 | | // @returns The matching or created Keyframe. |
488 | | mozilla::Keyframe* Gecko_GetOrCreateKeyframeAtStart( |
489 | | RawGeckoKeyframeListBorrowedMut keyframes, |
490 | | float offset, |
491 | | const nsTimingFunction* timingFunction); |
492 | | |
493 | | // As with Gecko_GetOrCreateKeyframeAtStart except that this method will search |
494 | | // from the beginning of |keyframes| for a Keyframe with matching timing |
495 | | // function and an offset of 0.0. |
496 | | // Furthermore, if a matching Keyframe is not found, a new Keyframe will be |
497 | | // inserted after the *last* Keyframe in |keyframes| with offset 0.0. |
498 | | mozilla::Keyframe* Gecko_GetOrCreateInitialKeyframe( |
499 | | RawGeckoKeyframeListBorrowedMut keyframes, |
500 | | const nsTimingFunction* timingFunction); |
501 | | |
502 | | // As with Gecko_GetOrCreateKeyframeAtStart except that this method will search |
503 | | // from the *end* of |keyframes| for a Keyframe with matching timing function |
504 | | // and an offset of 1.0. If a matching Keyframe is not found, a new Keyframe |
505 | | // will be appended to the end of |keyframes|. |
506 | | mozilla::Keyframe* Gecko_GetOrCreateFinalKeyframe( |
507 | | RawGeckoKeyframeListBorrowedMut keyframes, |
508 | | const nsTimingFunction* timingFunction); |
509 | | |
510 | | // Appends and returns a new PropertyValuePair to |aProperties| initialized with |
511 | | // its mProperty member set to |aProperty| and all other members initialized to |
512 | | // their default values. |
513 | | mozilla::PropertyValuePair* Gecko_AppendPropertyValuePair( |
514 | | RawGeckoPropertyValuePairListBorrowedMut aProperties, |
515 | | nsCSSPropertyID aProperty); |
516 | | |
517 | | // Clean up pointer-based coordinates |
518 | | void Gecko_ResetStyleCoord(nsStyleUnit* unit, nsStyleUnion* value); |
519 | | |
520 | | // Set an nsStyleCoord to a computed `calc()` value |
521 | | void Gecko_SetStyleCoordCalcValue(nsStyleUnit* unit, nsStyleUnion* value, nsStyleCoord::CalcValue calc); |
522 | | |
523 | | void Gecko_CopyShapeSourceFrom(mozilla::StyleShapeSource* dst, const mozilla::StyleShapeSource* src); |
524 | | |
525 | | void Gecko_DestroyShapeSource(mozilla::StyleShapeSource* shape); |
526 | | void Gecko_NewBasicShape(mozilla::StyleShapeSource* shape, |
527 | | mozilla::StyleBasicShapeType type); |
528 | | void Gecko_NewShapeImage(mozilla::StyleShapeSource* shape); |
529 | | void Gecko_StyleShapeSource_SetURLValue(mozilla::StyleShapeSource* shape, mozilla::css::URLValue* uri); |
530 | | void Gecko_NewStyleSVGPath(mozilla::StyleShapeSource* shape); |
531 | | void Gecko_SetStyleMotion(mozilla::UniquePtr<mozilla::StyleMotion>* aMotion, |
532 | | mozilla::StyleMotion* aValue); |
533 | | mozilla::StyleMotion* Gecko_NewStyleMotion(); |
534 | | void Gecko_CopyStyleMotions(mozilla::UniquePtr<mozilla::StyleMotion>* motion, |
535 | | const mozilla::StyleMotion* other); |
536 | | |
537 | | void Gecko_ResetFilters(nsStyleEffects* effects, size_t new_len); |
538 | | void Gecko_CopyFiltersFrom(nsStyleEffects* aSrc, nsStyleEffects* aDest); |
539 | | void Gecko_nsStyleFilter_SetURLValue(nsStyleFilter* effects, mozilla::css::URLValue* uri); |
540 | | |
541 | | void Gecko_nsStyleSVGPaint_CopyFrom(nsStyleSVGPaint* dest, const nsStyleSVGPaint* src); |
542 | | void Gecko_nsStyleSVGPaint_SetURLValue(nsStyleSVGPaint* paint, mozilla::css::URLValue* uri); |
543 | | void Gecko_nsStyleSVGPaint_Reset(nsStyleSVGPaint* paint); |
544 | | |
545 | | void Gecko_nsStyleSVG_SetDashArrayLength(nsStyleSVG* svg, uint32_t len); |
546 | | void Gecko_nsStyleSVG_CopyDashArray(nsStyleSVG* dst, const nsStyleSVG* src); |
547 | | void Gecko_nsStyleSVG_SetContextPropertiesLength(nsStyleSVG* svg, uint32_t len); |
548 | | void Gecko_nsStyleSVG_CopyContextProperties(nsStyleSVG* dst, const nsStyleSVG* src); |
549 | | |
550 | | mozilla::css::URLValue* Gecko_NewURLValue(ServoBundledURI uri); |
551 | | size_t Gecko_URLValue_SizeOfIncludingThis(mozilla::css::URLValue* url); |
552 | | void Gecko_GetComputedURLSpec(const mozilla::css::URLValueData* url, nsCString* spec); |
553 | | void Gecko_nsIURI_Debug(nsIURI*, nsCString* spec); |
554 | | |
555 | | NS_DECL_THREADSAFE_FFI_REFCOUNTING(mozilla::css::URLValue, CSSURLValue); |
556 | | NS_DECL_THREADSAFE_FFI_REFCOUNTING(RawGeckoURLExtraData, URLExtraData); |
557 | | |
558 | | void Gecko_FillAllImageLayers(nsStyleImageLayers* layers, uint32_t max_len); |
559 | | NS_DECL_THREADSAFE_FFI_REFCOUNTING(nsStyleCoord::Calc, Calc); |
560 | | |
561 | | nsCSSShadowArray* Gecko_NewCSSShadowArray(uint32_t len); |
562 | | NS_DECL_THREADSAFE_FFI_REFCOUNTING(nsCSSShadowArray, CSSShadowArray); |
563 | | |
564 | | nsStyleQuoteValues* Gecko_NewStyleQuoteValues(uint32_t len); |
565 | | NS_DECL_THREADSAFE_FFI_REFCOUNTING(nsStyleQuoteValues, QuoteValues); |
566 | | |
567 | | nsCSSValueSharedList* Gecko_NewCSSValueSharedList(uint32_t len); |
568 | | nsCSSValueSharedList* Gecko_NewNoneTransform(); |
569 | | |
570 | | // Getter for nsCSSValue |
571 | | nsCSSValueBorrowedMut Gecko_CSSValue_GetArrayItem(nsCSSValueBorrowedMut css_value, int32_t index); |
572 | | // const version of the above function. |
573 | | nsCSSValueBorrowed Gecko_CSSValue_GetArrayItemConst(nsCSSValueBorrowed css_value, int32_t index); |
574 | | nsCSSKeyword Gecko_CSSValue_GetKeyword(nsCSSValueBorrowed aCSSValue); |
575 | | float Gecko_CSSValue_GetNumber(nsCSSValueBorrowed css_value); |
576 | | float Gecko_CSSValue_GetPercentage(nsCSSValueBorrowed css_value); |
577 | | nsStyleCoord::CalcValue Gecko_CSSValue_GetCalc(nsCSSValueBorrowed aCSSValue); |
578 | | |
579 | | void Gecko_CSSValue_SetNumber(nsCSSValueBorrowedMut css_value, float number); |
580 | | void Gecko_CSSValue_SetKeyword(nsCSSValueBorrowedMut css_value, nsCSSKeyword keyword); |
581 | | void Gecko_CSSValue_SetPercentage(nsCSSValueBorrowedMut css_value, float percent); |
582 | | void Gecko_CSSValue_SetPixelLength(nsCSSValueBorrowedMut aCSSValue, float aLen); |
583 | | void Gecko_CSSValue_SetCalc(nsCSSValueBorrowedMut css_value, nsStyleCoord::CalcValue calc); |
584 | | void Gecko_CSSValue_SetFontStretch(nsCSSValueBorrowedMut css_value, float stretch); |
585 | | void Gecko_CSSValue_SetFontSlantStyle(nsCSSValueBorrowedMut css_value, float style); |
586 | | void Gecko_CSSValue_SetFontWeight(nsCSSValueBorrowedMut css_value, float weight); |
587 | | void Gecko_CSSValue_SetFunction(nsCSSValueBorrowedMut css_value, int32_t len); |
588 | | void Gecko_CSSValue_SetString(nsCSSValueBorrowedMut css_value, |
589 | | const uint8_t* string, uint32_t len, nsCSSUnit unit); |
590 | | void Gecko_CSSValue_SetStringFromAtom(nsCSSValueBorrowedMut css_value, |
591 | | nsAtom* atom, nsCSSUnit unit); |
592 | | // Take an addrefed nsAtom and set it to the nsCSSValue |
593 | | void Gecko_CSSValue_SetAtomIdent(nsCSSValueBorrowedMut css_value, nsAtom* atom); |
594 | | void Gecko_CSSValue_SetArray(nsCSSValueBorrowedMut css_value, int32_t len); |
595 | | void Gecko_CSSValue_SetURL(nsCSSValueBorrowedMut css_value, mozilla::css::URLValue* uri); |
596 | | void Gecko_CSSValue_SetInt(nsCSSValueBorrowedMut css_value, int32_t integer, nsCSSUnit unit); |
597 | | void Gecko_CSSValue_SetFloat(nsCSSValueBorrowedMut css_value, float value, nsCSSUnit unit); |
598 | | void Gecko_CSSValue_SetPair(nsCSSValueBorrowedMut css_value, |
599 | | nsCSSValueBorrowed xvalue, nsCSSValueBorrowed yvalue); |
600 | | void Gecko_CSSValue_SetList(nsCSSValueBorrowedMut css_value, uint32_t len); |
601 | | void Gecko_CSSValue_SetPairList(nsCSSValueBorrowedMut css_value, uint32_t len); |
602 | | void Gecko_CSSValue_InitSharedList(nsCSSValueBorrowedMut css_value, uint32_t len); |
603 | | void Gecko_CSSValue_Drop(nsCSSValueBorrowedMut css_value); |
604 | | NS_DECL_THREADSAFE_FFI_REFCOUNTING(nsCSSValueSharedList, CSSValueSharedList); |
605 | | |
606 | | float Gecko_FontStretch_ToFloat(mozilla::FontStretch aStretch); |
607 | | void Gecko_FontStretch_SetFloat(mozilla::FontStretch* aStretch, |
608 | | float aFloatValue); |
609 | | float Gecko_FontSlantStyle_ToFloat(mozilla::FontSlantStyle aStyle); |
610 | | void Gecko_FontSlantStyle_SetNormal(mozilla::FontSlantStyle*); |
611 | | void Gecko_FontSlantStyle_SetItalic(mozilla::FontSlantStyle*); |
612 | | void Gecko_FontSlantStyle_SetOblique(mozilla::FontSlantStyle*, float angle_degrees); |
613 | | void Gecko_FontSlantStyle_Get(mozilla::FontSlantStyle, |
614 | | bool* normal, |
615 | | bool* italic, |
616 | | float* oblique_angle); |
617 | | |
618 | | float Gecko_FontWeight_ToFloat(mozilla::FontWeight aWeight); |
619 | | void Gecko_FontWeight_SetFloat(mozilla::FontWeight* aWeight, |
620 | | float aFloatValue); |
621 | | |
622 | | void Gecko_nsStyleFont_SetLang(nsStyleFont* font, nsAtom* atom); |
623 | | void Gecko_nsStyleFont_CopyLangFrom(nsStyleFont* aFont, const nsStyleFont* aSource); |
624 | | void Gecko_nsStyleFont_FixupNoneGeneric(nsStyleFont* font, |
625 | | RawGeckoPresContextBorrowed pres_context); |
626 | | void Gecko_nsStyleFont_PrefillDefaultForGeneric(nsStyleFont* font, |
627 | | RawGeckoPresContextBorrowed pres_context, |
628 | | uint8_t generic_id); |
629 | | void Gecko_nsStyleFont_FixupMinFontSize(nsStyleFont* font, |
630 | | RawGeckoPresContextBorrowed pres_context); |
631 | | FontSizePrefs Gecko_GetBaseSize(nsAtom* lang); |
632 | | |
633 | | // XBL related functions. |
634 | | RawGeckoElementBorrowedOrNull Gecko_GetBindingParent(RawGeckoElementBorrowed aElement); |
635 | | RawServoAuthorStylesBorrowedOrNull Gecko_XBLBinding_GetRawServoStyles(RawGeckoXBLBindingBorrowed aXBLBinding); |
636 | | bool Gecko_XBLBinding_InheritsStyle(RawGeckoXBLBindingBorrowed aXBLBinding); |
637 | | |
638 | | struct GeckoFontMetrics |
639 | | { |
640 | | nscoord mChSize; |
641 | | nscoord mXSize; |
642 | | }; |
643 | | |
644 | | GeckoFontMetrics Gecko_GetFontMetrics(RawGeckoPresContextBorrowed pres_context, |
645 | | bool is_vertical, |
646 | | const nsStyleFont* font, |
647 | | nscoord font_size, |
648 | | bool use_user_font_set); |
649 | | int32_t Gecko_GetAppUnitsPerPhysicalInch(RawGeckoPresContextBorrowed pres_context); |
650 | | void InitializeServo(); |
651 | | void ShutdownServo(); |
652 | | void AssertIsMainThreadOrServoLangFontPrefsCacheLocked(); |
653 | | |
654 | | mozilla::StyleSheet* Gecko_StyleSheet_Clone( |
655 | | const mozilla::StyleSheet* aSheet, |
656 | | const mozilla::StyleSheet* aNewParentSheet); |
657 | | void Gecko_StyleSheet_AddRef(const mozilla::StyleSheet* aSheet); |
658 | | void Gecko_StyleSheet_Release(const mozilla::StyleSheet* aSheet); |
659 | | |
660 | | nsCSSKeyword Gecko_LookupCSSKeyword(const uint8_t* string, uint32_t len); |
661 | | const char* Gecko_CSSKeywordString(nsCSSKeyword keyword, uint32_t* len); |
662 | | |
663 | | bool Gecko_IsDocumentBody(RawGeckoElementBorrowed element); |
664 | | // We use an int32_t here instead of a LookAndFeel::ColorID |
665 | | // because forward-declaring a nested enum/struct is impossible |
666 | | nscolor Gecko_GetLookAndFeelSystemColor(int32_t color_id, |
667 | | RawGeckoPresContextBorrowed pres_context); |
668 | | |
669 | | void Gecko_AddPropertyToSet(nsCSSPropertyIDSetBorrowedMut, nsCSSPropertyID); |
670 | | |
671 | | // Style-struct management. |
672 | | #define STYLE_STRUCT(name) \ |
673 | | void Gecko_Construct_Default_nsStyle##name( \ |
674 | | nsStyle##name* ptr, \ |
675 | | RawGeckoPresContextBorrowed pres_context); \ |
676 | | void Gecko_CopyConstruct_nsStyle##name(nsStyle##name* ptr, \ |
677 | | const nsStyle##name* other); \ |
678 | | void Gecko_Destroy_nsStyle##name(nsStyle##name* ptr); |
679 | | #include "nsStyleStructList.h" |
680 | | #undef STYLE_STRUCT |
681 | | |
682 | | void Gecko_RegisterProfilerThread(const char* name); |
683 | | void Gecko_UnregisterProfilerThread(); |
684 | | |
685 | | bool Gecko_DocumentRule_UseForPresentation(RawGeckoPresContextBorrowed, |
686 | | const nsACString* aPattern, |
687 | | mozilla::css::DocumentMatchingFunction); |
688 | | |
689 | | // Allocator hinting. |
690 | | void Gecko_SetJemallocThreadLocalArena(bool enabled); |
691 | | |
692 | | void Gecko_AddBufferToCrashReport(const void* addr, size_t len); |
693 | | void Gecko_AnnotateCrashReport(uint32_t key, const char* value_str); |
694 | | |
695 | | // Pseudo-element flags. |
696 | | #define CSS_PSEUDO_ELEMENT(name_, value_, flags_) \ |
697 | | const uint32_t SERVO_CSS_PSEUDO_ELEMENT_FLAGS_##name_ = flags_; |
698 | | #include "nsCSSPseudoElementList.h" |
699 | | #undef CSS_PSEUDO_ELEMENT |
700 | | |
701 | | #define SERVO_BINDING_FUNC(name_, return_, ...) return_ name_(__VA_ARGS__); |
702 | | #include "mozilla/ServoBindingList.h" |
703 | | #undef SERVO_BINDING_FUNC |
704 | | |
705 | | bool Gecko_ErrorReportingEnabled(const mozilla::StyleSheet* sheet, |
706 | | const mozilla::css::Loader* loader); |
707 | | void Gecko_ReportUnexpectedCSSError(const mozilla::StyleSheet* sheet, |
708 | | const mozilla::css::Loader* loader, |
709 | | nsIURI* uri, |
710 | | const char* message, |
711 | | const char* param, |
712 | | uint32_t paramLen, |
713 | | const char* prefix, |
714 | | const char* prefixParam, |
715 | | uint32_t prefixParamLen, |
716 | | const char* suffix, |
717 | | const char* source, |
718 | | uint32_t sourceLen, |
719 | | uint32_t lineNumber, |
720 | | uint32_t colNumber); |
721 | | |
722 | | // DOM APIs. |
723 | | void Gecko_ContentList_AppendAll(nsSimpleContentList* aContentList, |
724 | | const RawGeckoElement** aElements, |
725 | | size_t aLength); |
726 | | |
727 | | // FIXME(emilio): These two below should be a single function that takes a |
728 | | // `const DocumentOrShadowRoot*`, but that doesn't make MSVC builds happy for a |
729 | | // reason I haven't really dug into. |
730 | | const nsTArray<mozilla::dom::Element*>* Gecko_Document_GetElementsWithId( |
731 | | const nsIDocument* aDocument, |
732 | | nsAtom* aId); |
733 | | |
734 | | const nsTArray<mozilla::dom::Element*>* Gecko_ShadowRoot_GetElementsWithId( |
735 | | const mozilla::dom::ShadowRoot* aDocument, |
736 | | nsAtom* aId); |
737 | | |
738 | | // Check the value of the given bool preference. The pref name needs to |
739 | | // be null-terminated. |
740 | | bool Gecko_GetBoolPrefValue(const char* pref_name); |
741 | | |
742 | | // Returns true if we're currently performing the servo traversal. |
743 | | bool Gecko_IsInServoTraversal(); |
744 | | |
745 | | // Returns true if we're currently on the main thread. |
746 | | bool Gecko_IsMainThread(); |
747 | | |
748 | | // Media feature helpers. |
749 | | mozilla::StyleDisplayMode Gecko_MediaFeatures_GetDisplayMode(nsIDocument*); |
750 | | uint32_t Gecko_MediaFeatures_GetColorDepth(nsIDocument*); |
751 | | void Gecko_MediaFeatures_GetDeviceSize(nsIDocument*, nscoord* width, nscoord* height); |
752 | | float Gecko_MediaFeatures_GetResolution(nsIDocument*); |
753 | | bool Gecko_MediaFeatures_PrefersReducedMotion(nsIDocument*); |
754 | | mozilla::PointerCapabilities Gecko_MediaFeatures_PrimaryPointerCapabilities(nsIDocument*); |
755 | | mozilla::PointerCapabilities Gecko_MediaFeatures_AllPointerCapabilities(nsIDocument*); |
756 | | float Gecko_MediaFeatures_GetDevicePixelRatio(nsIDocument*); |
757 | | bool Gecko_MediaFeatures_HasSystemMetric(nsIDocument*, |
758 | | nsAtom* metric, |
759 | | bool is_accessible_from_content); |
760 | | bool Gecko_MediaFeatures_IsResourceDocument(nsIDocument*); |
761 | | nsAtom* Gecko_MediaFeatures_GetOperatingSystemVersion(nsIDocument*); |
762 | | |
763 | | } // extern "C" |
764 | | |
765 | | #endif // mozilla_ServoBindings_h |