2016-08-19 14:44:43 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* 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/. */
|
|
|
|
|
|
|
|
/* a list of all Servo binding functions */
|
|
|
|
|
|
|
|
/* This file contains the list of all Servo binding functions. Each
|
|
|
|
* entry is defined as a SERVO_BINDING_FUNC macro with the following
|
|
|
|
* parameters:
|
|
|
|
* - 'name_' the name of the binding function
|
|
|
|
* - 'return_' the return type of the binding function
|
|
|
|
* and the parameter list of the function.
|
|
|
|
*
|
|
|
|
* Users of this list should define a macro
|
|
|
|
* SERVO_BINDING_FUNC(name_, return_, ...)
|
|
|
|
* before including this file.
|
|
|
|
*/
|
|
|
|
|
2016-11-02 09:11:24 +03:00
|
|
|
// Element data
|
|
|
|
SERVO_BINDING_FUNC(Servo_Element_ClearData, void, RawGeckoElementBorrowed node)
|
2016-12-02 11:54:43 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_Element_ShouldTraverse, bool, RawGeckoElementBorrowed node)
|
2016-08-19 14:44:43 +03:00
|
|
|
|
|
|
|
// Styleset and Stylesheet management
|
2016-10-25 20:15:38 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_StyleSheet_Empty, RawServoStyleSheetStrong,
|
|
|
|
mozilla::css::SheetParsingMode parsing_mode)
|
2016-08-23 06:14:27 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_StyleSheet_FromUTF8Bytes, RawServoStyleSheetStrong,
|
2016-12-17 12:58:56 +03:00
|
|
|
mozilla::css::Loader* loader,
|
|
|
|
mozilla::ServoStyleSheet* gecko_stylesheet,
|
2016-10-25 02:19:45 +03:00
|
|
|
const nsACString* data,
|
2016-08-19 14:44:43 +03:00
|
|
|
mozilla::css::SheetParsingMode parsing_mode,
|
2016-10-25 02:19:45 +03:00
|
|
|
const nsACString* base_url,
|
2016-08-19 14:44:43 +03:00
|
|
|
ThreadSafeURIHolder* base,
|
|
|
|
ThreadSafeURIHolder* referrer,
|
|
|
|
ThreadSafePrincipalHolder* principal)
|
2016-12-17 12:58:56 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_ImportRule_GetSheet,
|
|
|
|
RawServoStyleSheetStrong,
|
|
|
|
const RawServoImportRuleBorrowed import_rule)
|
|
|
|
SERVO_BINDING_FUNC(Servo_StyleSheet_ClearAndUpdate,
|
|
|
|
void,
|
|
|
|
RawServoStyleSheetBorrowed stylesheet,
|
|
|
|
mozilla::css::Loader* loader,
|
|
|
|
mozilla::ServoStyleSheet* gecko_stylesheet,
|
|
|
|
const nsACString* data,
|
|
|
|
ThreadSafeURIHolder* base,
|
|
|
|
ThreadSafeURIHolder* referrer,
|
|
|
|
ThreadSafePrincipalHolder* principal)
|
2016-08-23 06:14:27 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_StyleSheet_HasRules, bool,
|
2016-08-19 14:44:43 +03:00
|
|
|
RawServoStyleSheetBorrowed sheet)
|
2016-11-23 02:26:20 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_StyleSheet_GetRules, ServoCssRulesStrong,
|
|
|
|
RawServoStyleSheetBorrowed sheet)
|
2017-01-15 01:34:49 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_StyleSet_Init, RawServoStyleSetOwned, RawGeckoPresContextOwned pres_context)
|
|
|
|
SERVO_BINDING_FUNC(Servo_StyleSet_RebuildData, void,
|
|
|
|
RawServoStyleSetBorrowed set)
|
2016-08-23 16:11:02 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_StyleSet_Drop, void, RawServoStyleSetOwned set)
|
2016-08-23 06:10:49 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_StyleSet_AppendStyleSheet, void,
|
2016-12-22 02:33:24 +03:00
|
|
|
RawServoStyleSetBorrowed set, RawServoStyleSheetBorrowed sheet, bool flush)
|
2016-08-23 06:10:49 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_StyleSet_PrependStyleSheet, void,
|
2016-12-22 02:33:24 +03:00
|
|
|
RawServoStyleSetBorrowed set, RawServoStyleSheetBorrowed sheet, bool flush)
|
2016-08-23 06:10:49 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_StyleSet_RemoveStyleSheet, void,
|
2016-12-22 02:33:24 +03:00
|
|
|
RawServoStyleSetBorrowed set, RawServoStyleSheetBorrowed sheet, bool flush)
|
2016-08-23 06:10:49 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_StyleSet_InsertStyleSheetBefore, void,
|
2016-10-11 04:51:46 +03:00
|
|
|
RawServoStyleSetBorrowed set, RawServoStyleSheetBorrowed sheet,
|
2016-12-22 02:33:24 +03:00
|
|
|
RawServoStyleSheetBorrowed reference, bool flush)
|
|
|
|
SERVO_BINDING_FUNC(Servo_StyleSet_FlushStyleSheets, void, RawServoStyleSetBorrowed set)
|
2016-12-19 09:30:14 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_StyleSet_NoteStyleSheetsChanged, void,
|
|
|
|
RawServoStyleSetBorrowed set)
|
2016-08-19 14:44:43 +03:00
|
|
|
|
2016-11-23 02:26:20 +03:00
|
|
|
// CSSRuleList
|
|
|
|
SERVO_BINDING_FUNC(Servo_CssRules_ListTypes, void,
|
|
|
|
ServoCssRulesBorrowed rules,
|
|
|
|
nsTArrayBorrowed_uintptr_t result)
|
2016-11-23 02:26:20 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_CssRules_GetStyleRuleAt, RawServoStyleRuleStrong,
|
|
|
|
ServoCssRulesBorrowed rules, uint32_t index)
|
2016-11-29 14:59:55 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_CssRules_InsertRule, nsresult,
|
|
|
|
ServoCssRulesBorrowed rules,
|
|
|
|
RawServoStyleSheetBorrowed sheet, const nsACString* rule,
|
|
|
|
uint32_t index, bool nested, uint16_t* rule_type)
|
|
|
|
SERVO_BINDING_FUNC(Servo_CssRules_DeleteRule, nsresult,
|
|
|
|
ServoCssRulesBorrowed rules, uint32_t index)
|
2016-11-23 02:26:20 +03:00
|
|
|
|
2016-11-23 02:26:20 +03:00
|
|
|
// CSS Rules
|
2016-11-23 02:26:20 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_StyleRule_Debug, void,
|
|
|
|
RawServoStyleRuleBorrowed rule, nsACString* result)
|
2016-11-23 02:26:20 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_StyleRule_GetStyle, RawServoDeclarationBlockStrong,
|
|
|
|
RawServoStyleRuleBorrowed rule)
|
|
|
|
SERVO_BINDING_FUNC(Servo_StyleRule_SetStyle, void,
|
|
|
|
RawServoStyleRuleBorrowed rule,
|
|
|
|
RawServoDeclarationBlockBorrowed declarations)
|
2016-11-23 02:26:20 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_StyleRule_GetCssText, void,
|
|
|
|
RawServoStyleRuleBorrowed rule, nsAString* result)
|
|
|
|
SERVO_BINDING_FUNC(Servo_StyleRule_GetSelectorText, void,
|
|
|
|
RawServoStyleRuleBorrowed rule, nsAString* result)
|
|
|
|
|
2016-09-16 04:24:05 +03:00
|
|
|
// Animations API
|
|
|
|
SERVO_BINDING_FUNC(Servo_ParseProperty,
|
2016-10-18 07:29:03 +03:00
|
|
|
RawServoDeclarationBlockStrong,
|
2016-10-25 02:19:45 +03:00
|
|
|
const nsACString* property, const nsACString* value,
|
|
|
|
const nsACString* base_url, ThreadSafeURIHolder* base,
|
2016-09-16 04:24:05 +03:00
|
|
|
ThreadSafeURIHolder* referrer,
|
|
|
|
ThreadSafePrincipalHolder* principal)
|
2016-09-16 05:08:44 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_RestyleWithAddedDeclaration,
|
|
|
|
ServoComputedValuesStrong,
|
2017-01-04 22:52:27 +03:00
|
|
|
RawServoStyleSetBorrowed set,
|
2016-10-18 07:29:03 +03:00
|
|
|
RawServoDeclarationBlockBorrowed declarations,
|
2016-09-16 05:08:44 +03:00
|
|
|
ServoComputedValuesBorrowed previous_style)
|
2016-09-16 04:24:05 +03:00
|
|
|
|
2016-12-01 04:34:54 +03:00
|
|
|
// AnimationValues handling
|
|
|
|
SERVO_BINDING_FUNC(Servo_AnimationValues_Populate, void,
|
|
|
|
RawGeckoAnimationValueListBorrowedMut,
|
|
|
|
RawServoDeclarationBlockBorrowed,
|
|
|
|
ServoComputedValuesBorrowed,
|
|
|
|
ServoComputedValuesBorrowedOrNull,
|
|
|
|
RawGeckoPresContextBorrowed)
|
|
|
|
|
2016-08-19 14:44:43 +03:00
|
|
|
// Style attribute
|
2016-10-18 07:29:03 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_ParseStyleAttribute, RawServoDeclarationBlockStrong,
|
2016-10-25 02:19:45 +03:00
|
|
|
const nsACString* data)
|
2016-11-03 06:41:02 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_DeclarationBlock_CreateEmpty,
|
|
|
|
RawServoDeclarationBlockStrong)
|
2016-11-03 06:41:02 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_DeclarationBlock_Clone, RawServoDeclarationBlockStrong,
|
|
|
|
RawServoDeclarationBlockBorrowed declarations)
|
2016-09-15 10:26:07 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_DeclarationBlock_Equals, bool,
|
2016-10-18 07:29:03 +03:00
|
|
|
RawServoDeclarationBlockBorrowed a,
|
|
|
|
RawServoDeclarationBlockBorrowed b)
|
2016-11-03 06:41:02 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_DeclarationBlock_GetCssText, void,
|
|
|
|
RawServoDeclarationBlockBorrowed declarations,
|
|
|
|
nsAString* result)
|
2016-09-16 03:26:48 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_DeclarationBlock_SerializeOneValue, void,
|
2016-10-18 07:29:03 +03:00
|
|
|
RawServoDeclarationBlockBorrowed declarations,
|
2016-12-16 02:02:48 +03:00
|
|
|
nsCSSPropertyID property, nsAString* buffer)
|
2016-11-03 06:41:02 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_DeclarationBlock_Count, uint32_t,
|
|
|
|
RawServoDeclarationBlockBorrowed declarations)
|
|
|
|
SERVO_BINDING_FUNC(Servo_DeclarationBlock_GetNthProperty, bool,
|
|
|
|
RawServoDeclarationBlockBorrowed declarations,
|
|
|
|
uint32_t index, nsAString* result)
|
2016-11-03 06:41:02 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_DeclarationBlock_GetPropertyValue, void,
|
|
|
|
RawServoDeclarationBlockBorrowed declarations,
|
2016-12-16 02:02:48 +03:00
|
|
|
const nsACString* property, nsAString* value)
|
|
|
|
SERVO_BINDING_FUNC(Servo_DeclarationBlock_GetPropertyValueById, void,
|
|
|
|
RawServoDeclarationBlockBorrowed declarations,
|
|
|
|
nsCSSPropertyID property, nsAString* value)
|
2016-11-03 06:41:02 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_DeclarationBlock_GetPropertyIsImportant, bool,
|
|
|
|
RawServoDeclarationBlockBorrowed declarations,
|
2016-12-16 02:02:48 +03:00
|
|
|
const nsACString* property)
|
2016-11-03 06:41:02 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_DeclarationBlock_SetProperty, bool,
|
|
|
|
RawServoDeclarationBlockBorrowed declarations,
|
2016-12-16 02:02:48 +03:00
|
|
|
const nsACString* property,
|
|
|
|
nsACString* value, bool is_important)
|
|
|
|
SERVO_BINDING_FUNC(Servo_DeclarationBlock_SetPropertyById, bool,
|
|
|
|
RawServoDeclarationBlockBorrowed declarations,
|
|
|
|
nsCSSPropertyID property,
|
2016-11-03 06:41:02 +03:00
|
|
|
nsACString* value, bool is_important)
|
2016-11-03 06:41:02 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_DeclarationBlock_RemoveProperty, void,
|
|
|
|
RawServoDeclarationBlockBorrowed declarations,
|
2016-12-16 02:02:48 +03:00
|
|
|
const nsACString* property)
|
|
|
|
SERVO_BINDING_FUNC(Servo_DeclarationBlock_RemovePropertyById, void,
|
|
|
|
RawServoDeclarationBlockBorrowed declarations,
|
|
|
|
nsCSSPropertyID property)
|
2016-08-19 14:44:43 +03:00
|
|
|
|
|
|
|
// CSS supports()
|
2017-01-16 10:09:42 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_CSSSupports2, bool,
|
2016-10-25 02:19:45 +03:00
|
|
|
const nsACString* name, const nsACString* value)
|
2017-01-16 10:09:42 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_CSSSupports, bool,
|
|
|
|
const nsACString* cond)
|
2016-08-19 14:44:43 +03:00
|
|
|
|
|
|
|
// Computed style data
|
2016-08-23 06:14:27 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_ComputedValues_GetForAnonymousBox,
|
2016-08-19 14:44:43 +03:00
|
|
|
ServoComputedValuesStrong,
|
2016-08-23 16:11:02 +03:00
|
|
|
ServoComputedValuesBorrowedOrNull parent_style_or_null,
|
2016-10-11 04:51:46 +03:00
|
|
|
nsIAtom* pseudoTag, RawServoStyleSetBorrowed set)
|
2016-08-23 06:14:27 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_ComputedValues_Inherit, ServoComputedValuesStrong,
|
2017-01-04 22:52:27 +03:00
|
|
|
RawServoStyleSetBorrowed set,
|
2016-08-23 16:11:02 +03:00
|
|
|
ServoComputedValuesBorrowedOrNull parent_style)
|
2016-08-19 14:44:43 +03:00
|
|
|
|
|
|
|
// Initialize Servo components. Should be called exactly once at startup.
|
|
|
|
SERVO_BINDING_FUNC(Servo_Initialize, void)
|
|
|
|
// Shut down Servo components. Should be called exactly once at shutdown.
|
|
|
|
SERVO_BINDING_FUNC(Servo_Shutdown, void)
|
|
|
|
|
2016-11-02 09:11:24 +03:00
|
|
|
// Gets the snapshot for the element. This will return null if the element
|
|
|
|
// has never been styled, since snapshotting in that case is wasted work.
|
|
|
|
SERVO_BINDING_FUNC(Servo_Element_GetSnapshot, ServoElementSnapshot*,
|
|
|
|
RawGeckoElementBorrowed element)
|
|
|
|
|
|
|
|
// Restyle and change hints.
|
|
|
|
SERVO_BINDING_FUNC(Servo_NoteExplicitHints, void, RawGeckoElementBorrowed element,
|
|
|
|
nsRestyleHint restyle_hint, nsChangeHint change_hint)
|
2017-01-06 00:12:53 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_TakeChangeHint, nsChangeHint, RawGeckoElementBorrowed element)
|
2016-11-02 09:11:24 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_ResolveStyle, ServoComputedValuesStrong,
|
2017-01-04 22:52:27 +03:00
|
|
|
RawGeckoElementBorrowed element,
|
2017-01-06 00:12:53 +03:00
|
|
|
RawServoStyleSetBorrowed set)
|
2016-12-22 04:58:38 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_ResolvePseudoStyle, ServoComputedValuesStrong,
|
|
|
|
RawGeckoElementBorrowed element, nsIAtom* pseudo_tag,
|
|
|
|
bool is_probe, RawServoStyleSetBorrowed set)
|
2016-08-19 14:44:43 +03:00
|
|
|
|
2016-12-28 10:49:12 +03:00
|
|
|
// Resolves style for an element or pseudo-element without processing pending
|
|
|
|
// restyles first. The Element and its ancestors may be unstyled, have pending
|
|
|
|
// restyles, or be in a display:none subtree. Styles are cached when possible,
|
|
|
|
// though caching is not possible within display:none subtrees, and the styles
|
|
|
|
// may be invalidated by already-scheduled restyles.
|
|
|
|
//
|
|
|
|
// The tree must be in a consistent state such that a normal traversal could be
|
|
|
|
// performed, and this function maintains that invariant.
|
|
|
|
SERVO_BINDING_FUNC(Servo_ResolveStyleLazily, ServoComputedValuesStrong,
|
|
|
|
RawGeckoElementBorrowed element, nsIAtom* pseudo_tag,
|
|
|
|
RawServoStyleSetBorrowed set)
|
|
|
|
|
2016-09-22 08:39:04 +03:00
|
|
|
// Restyle the given subtree.
|
2016-11-02 09:11:24 +03:00
|
|
|
SERVO_BINDING_FUNC(Servo_TraverseSubtree, void,
|
|
|
|
RawGeckoElementBorrowed root, RawServoStyleSetBorrowed set,
|
2016-12-11 09:11:36 +03:00
|
|
|
mozilla::TraversalRootBehavior root_behavior)
|
2016-11-02 09:11:24 +03:00
|
|
|
|
|
|
|
// Assert that the tree has no pending or unconsumed restyles.
|
|
|
|
SERVO_BINDING_FUNC(Servo_AssertTreeIsClean, void, RawGeckoElementBorrowed root)
|
2016-08-19 14:44:43 +03:00
|
|
|
|
|
|
|
// Style-struct management.
|
|
|
|
#define STYLE_STRUCT(name, checkdata_cb) \
|
|
|
|
struct nsStyle##name; \
|
|
|
|
SERVO_BINDING_FUNC(Servo_GetStyle##name, const nsStyle##name*, \
|
2016-10-06 18:28:01 +03:00
|
|
|
ServoComputedValuesBorrowedOrNull computed_values)
|
2016-08-19 14:44:43 +03:00
|
|
|
#include "nsStyleStructList.h"
|
|
|
|
#undef STYLE_STRUCT
|
2016-11-23 03:35:55 +03:00
|
|
|
|
|
|
|
// AddRef / Release functions
|
|
|
|
#define SERVO_ARC_TYPE(name_, type_) \
|
|
|
|
SERVO_BINDING_FUNC(Servo_##name_##_AddRef, void, type_##Borrowed) \
|
|
|
|
SERVO_BINDING_FUNC(Servo_##name_##_Release, void, type_##Borrowed)
|
|
|
|
#include "mozilla/ServoArcTypeList.h"
|
|
|
|
#undef SERVO_ARC_TYPE
|