2015-11-25 04:14:39 +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/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_ServoBindings_h
|
|
|
|
#define mozilla_ServoBindings_h
|
|
|
|
|
2016-10-24 12:16:46 +03:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2016-09-22 01:42:45 +03:00
|
|
|
#include "mozilla/ServoTypes.h"
|
2016-10-24 12:16:46 +03:00
|
|
|
#include "mozilla/ServoBindingTypes.h"
|
2016-07-19 04:02:55 +03:00
|
|
|
#include "mozilla/ServoElementSnapshot.h"
|
2016-04-28 02:15:56 +03:00
|
|
|
#include "mozilla/css/SheetParsingMode.h"
|
2017-01-24 10:33:10 +03:00
|
|
|
#include "mozilla/EffectCompositor.h"
|
2017-04-06 04:34:51 +03:00
|
|
|
#include "mozilla/ComputedTimingFunction.h"
|
2016-07-19 04:02:55 +03:00
|
|
|
#include "nsChangeHint.h"
|
2017-01-06 13:12:08 +03:00
|
|
|
#include "nsCSSPseudoClasses.h"
|
2016-07-19 04:02:55 +03:00
|
|
|
#include "nsStyleStruct.h"
|
2015-11-25 04:14:39 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* API for Servo to access Gecko data structures. This file must compile as valid
|
|
|
|
* C code in order for the binding generator to parse it.
|
|
|
|
*
|
|
|
|
* Functions beginning with Gecko_ are implemented in Gecko and invoked from Servo.
|
|
|
|
* Functions beginning with Servo_ are implemented in Servo and invoked from Gecko.
|
|
|
|
*/
|
|
|
|
|
2016-03-18 23:14:07 +03:00
|
|
|
class nsIAtom;
|
2016-05-21 03:02:54 +03:00
|
|
|
class nsIPrincipal;
|
|
|
|
class nsIURI;
|
2016-06-07 22:13:24 +03:00
|
|
|
struct nsFont;
|
|
|
|
namespace mozilla {
|
2016-12-17 12:58:56 +03:00
|
|
|
class ServoStyleSheet;
|
2016-06-07 22:13:24 +03:00
|
|
|
class FontFamilyList;
|
|
|
|
enum FontFamilyType : uint32_t;
|
2017-01-29 06:58:39 +03:00
|
|
|
struct Keyframe;
|
2017-02-10 04:43:52 +03:00
|
|
|
namespace css {
|
|
|
|
struct URLValue;
|
|
|
|
};
|
2017-03-27 13:43:16 +03:00
|
|
|
enum class UpdateAnimationsTasks : uint8_t;
|
2017-04-04 21:11:27 +03:00
|
|
|
struct LangGroupFontPrefs;
|
2016-06-07 22:13:24 +03:00
|
|
|
}
|
|
|
|
using mozilla::FontFamilyList;
|
|
|
|
using mozilla::FontFamilyType;
|
2016-07-19 04:02:55 +03:00
|
|
|
using mozilla::ServoElementSnapshot;
|
2017-03-24 06:42:18 +03:00
|
|
|
class nsCSSFontFaceRule;
|
2017-01-15 01:33:40 +03:00
|
|
|
struct nsMediaFeature;
|
2016-05-27 01:18:09 +03:00
|
|
|
struct nsStyleList;
|
|
|
|
struct nsStyleImage;
|
|
|
|
struct nsStyleGradientStop;
|
|
|
|
class nsStyleGradient;
|
|
|
|
class nsStyleCoord;
|
|
|
|
struct nsStyleDisplay;
|
2016-08-23 03:32:20 +03:00
|
|
|
|
2016-05-21 03:02:54 +03:00
|
|
|
#define NS_DECL_THREADSAFE_FFI_REFCOUNTING(class_, name_) \
|
|
|
|
void Gecko_AddRef##name_##ArbitraryThread(class_* aPtr); \
|
|
|
|
void Gecko_Release##name_##ArbitraryThread(class_* aPtr);
|
|
|
|
#define NS_IMPL_THREADSAFE_FFI_REFCOUNTING(class_, name_) \
|
2016-06-22 02:57:43 +03:00
|
|
|
static_assert(class_::HasThreadSafeRefCnt::value, \
|
|
|
|
"NS_DECL_THREADSAFE_FFI_REFCOUNTING can only be used with " \
|
|
|
|
"classes that have thread-safe refcounting"); \
|
2016-05-21 03:02:54 +03:00
|
|
|
void Gecko_AddRef##name_##ArbitraryThread(class_* aPtr) \
|
|
|
|
{ NS_ADDREF(aPtr); } \
|
|
|
|
void Gecko_Release##name_##ArbitraryThread(class_* aPtr) \
|
|
|
|
{ NS_RELEASE(aPtr); }
|
|
|
|
|
2017-03-24 06:42:18 +03:00
|
|
|
#define NS_DECL_FFI_REFCOUNTING(class_, name_) \
|
|
|
|
void Gecko_##name_##_AddRef(class_* aPtr); \
|
|
|
|
void Gecko_##name_##_Release(class_* aPtr);
|
|
|
|
#define NS_IMPL_FFI_REFCOUNTING(class_, name_) \
|
2017-04-07 04:07:04 +03:00
|
|
|
void Gecko_##name_##_AddRef(class_* aPtr) \
|
|
|
|
{ MOZ_ASSERT(NS_IsMainThread()); NS_ADDREF(aPtr); } \
|
|
|
|
void Gecko_##name_##_Release(class_* aPtr) \
|
|
|
|
{ MOZ_ASSERT(NS_IsMainThread()); NS_RELEASE(aPtr); }
|
2017-03-24 06:42:18 +03:00
|
|
|
|
2016-11-23 02:26:20 +03:00
|
|
|
#define DEFINE_ARRAY_TYPE_FOR(type_) \
|
|
|
|
struct nsTArrayBorrowed_##type_ { \
|
|
|
|
nsTArray<type_>* mArray; \
|
|
|
|
MOZ_IMPLICIT nsTArrayBorrowed_##type_(nsTArray<type_>* aArray) \
|
|
|
|
: mArray(aArray) {} \
|
|
|
|
}
|
|
|
|
DEFINE_ARRAY_TYPE_FOR(uintptr_t);
|
|
|
|
#undef DEFINE_ARRAY_TYPE_FOR
|
|
|
|
|
2015-11-25 04:14:39 +03:00
|
|
|
extern "C" {
|
|
|
|
|
2017-02-10 04:43:52 +03:00
|
|
|
class ServoBundledURI
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
already_AddRefed<mozilla::css::URLValue> IntoCssUrl();
|
|
|
|
const uint8_t* mURLString;
|
|
|
|
uint32_t mURLStringLength;
|
2017-04-04 03:04:13 +03:00
|
|
|
mozilla::URLExtraData* mExtraData;
|
2017-02-23 04:19:04 +03:00
|
|
|
};
|
|
|
|
|
2017-04-04 21:11:27 +03:00
|
|
|
struct FontSizePrefs
|
|
|
|
{
|
|
|
|
void CopyFrom(const mozilla::LangGroupFontPrefs&);
|
|
|
|
nscoord mDefaultVariableSize;
|
|
|
|
nscoord mDefaultFixedSize;
|
|
|
|
nscoord mDefaultSerifSize;
|
|
|
|
nscoord mDefaultSansSerifSize;
|
|
|
|
nscoord mDefaultMonospaceSize;
|
|
|
|
nscoord mDefaultCursiveSize;
|
|
|
|
nscoord mDefaultFantasySize;
|
|
|
|
};
|
|
|
|
|
2015-11-25 04:14:39 +03:00
|
|
|
// DOM Traversal.
|
2016-08-23 16:11:02 +03:00
|
|
|
uint32_t Gecko_ChildrenCount(RawGeckoNodeBorrowed node);
|
|
|
|
bool Gecko_NodeIsElement(RawGeckoNodeBorrowed node);
|
2016-12-29 10:04:32 +03:00
|
|
|
bool Gecko_IsInDocument(RawGeckoNodeBorrowed node);
|
2017-02-01 23:37:00 +03:00
|
|
|
bool Gecko_FlattenedTreeParentIsParent(RawGeckoNodeBorrowed node);
|
2017-03-22 19:18:34 +03:00
|
|
|
bool Gecko_IsSignificantChild(RawGeckoNodeBorrowed node,
|
|
|
|
bool text_is_significant,
|
|
|
|
bool whitespace_is_significant);
|
2016-08-23 16:11:02 +03:00
|
|
|
RawGeckoNodeBorrowedOrNull Gecko_GetParentNode(RawGeckoNodeBorrowed node);
|
|
|
|
RawGeckoNodeBorrowedOrNull Gecko_GetFirstChild(RawGeckoNodeBorrowed node);
|
|
|
|
RawGeckoNodeBorrowedOrNull Gecko_GetLastChild(RawGeckoNodeBorrowed node);
|
|
|
|
RawGeckoNodeBorrowedOrNull Gecko_GetPrevSibling(RawGeckoNodeBorrowed node);
|
|
|
|
RawGeckoNodeBorrowedOrNull Gecko_GetNextSibling(RawGeckoNodeBorrowed node);
|
|
|
|
RawGeckoElementBorrowedOrNull Gecko_GetFirstChildElement(RawGeckoElementBorrowed element);
|
|
|
|
RawGeckoElementBorrowedOrNull Gecko_GetLastChildElement(RawGeckoElementBorrowed element);
|
|
|
|
RawGeckoElementBorrowedOrNull Gecko_GetPrevSiblingElement(RawGeckoElementBorrowed element);
|
|
|
|
RawGeckoElementBorrowedOrNull Gecko_GetNextSiblingElement(RawGeckoElementBorrowed element);
|
|
|
|
RawGeckoElementBorrowedOrNull Gecko_GetDocumentElement(RawGeckoDocumentBorrowed document);
|
2016-12-17 12:58:56 +03:00
|
|
|
void Gecko_LoadStyleSheet(mozilla::css::Loader* loader,
|
|
|
|
mozilla::ServoStyleSheet* parent,
|
2017-04-03 09:18:49 +03:00
|
|
|
RawServoStyleSheetBorrowed child_sheet,
|
2017-03-30 10:54:48 +03:00
|
|
|
RawGeckoURLExtraData* base_url_data,
|
2016-12-17 12:58:56 +03:00
|
|
|
const uint8_t* url_bytes,
|
|
|
|
uint32_t url_length,
|
2017-04-10 06:17:51 +03:00
|
|
|
RawServoMediaListStrong media_list);
|
2015-11-25 04:14:39 +03:00
|
|
|
|
2016-08-11 02:56:33 +03:00
|
|
|
// By default, Servo walks the DOM by traversing the siblings of the DOM-view
|
|
|
|
// first child. This generally works, but misses anonymous children, which we
|
|
|
|
// want to traverse during styling. To support these cases, we create an
|
|
|
|
// optional heap-allocated iterator for nodes that need it. If the creation
|
|
|
|
// method returns null, Servo falls back to the aforementioned simpler (and
|
|
|
|
// faster) sibling traversal.
|
2016-08-23 16:11:02 +03:00
|
|
|
StyleChildrenIteratorOwnedOrNull Gecko_MaybeCreateStyleChildrenIterator(RawGeckoNodeBorrowed node);
|
|
|
|
void Gecko_DropStyleChildrenIterator(StyleChildrenIteratorOwned it);
|
2016-10-18 07:29:03 +03:00
|
|
|
RawGeckoNodeBorrowedOrNull Gecko_GetNextStyleChild(StyleChildrenIteratorBorrowedMut it);
|
2016-08-11 02:56:33 +03:00
|
|
|
|
2015-11-25 04:14:39 +03:00
|
|
|
// Selector Matching.
|
2017-03-20 18:54:54 +03:00
|
|
|
uint64_t Gecko_ElementState(RawGeckoElementBorrowed element);
|
2016-08-23 16:11:02 +03:00
|
|
|
bool Gecko_IsTextNode(RawGeckoNodeBorrowed node);
|
|
|
|
bool Gecko_IsRootElement(RawGeckoElementBorrowed element);
|
2017-01-06 13:12:08 +03:00
|
|
|
bool Gecko_MatchesElement(mozilla::CSSPseudoClassType type, RawGeckoElementBorrowed element);
|
2016-08-23 16:11:02 +03:00
|
|
|
nsIAtom* Gecko_LocalName(RawGeckoElementBorrowed element);
|
|
|
|
nsIAtom* Gecko_Namespace(RawGeckoElementBorrowed element);
|
|
|
|
nsIAtom* Gecko_GetElementId(RawGeckoElementBorrowed element);
|
2016-05-25 21:16:26 +03:00
|
|
|
|
2017-03-26 23:53:34 +03:00
|
|
|
nsIAtom* Gecko_GetXMLLangValue(RawGeckoElementBorrowed element);
|
|
|
|
|
2016-06-30 23:37:52 +03:00
|
|
|
// Attributes.
|
2016-08-23 16:11:02 +03:00
|
|
|
#define SERVO_DECLARE_ELEMENT_ATTR_MATCHING_FUNCTIONS(prefix_, implementor_) \
|
|
|
|
nsIAtom* prefix_##AtomAttrValue(implementor_ element, nsIAtom* attribute); \
|
|
|
|
bool prefix_##HasAttr(implementor_ element, nsIAtom* ns, nsIAtom* name); \
|
|
|
|
bool prefix_##AttrEquals(implementor_ element, nsIAtom* ns, nsIAtom* name, \
|
|
|
|
nsIAtom* str, bool ignoreCase); \
|
|
|
|
bool prefix_##AttrDashEquals(implementor_ element, nsIAtom* ns, \
|
|
|
|
nsIAtom* name, nsIAtom* str); \
|
|
|
|
bool prefix_##AttrIncludes(implementor_ element, nsIAtom* ns, \
|
|
|
|
nsIAtom* name, nsIAtom* str); \
|
|
|
|
bool prefix_##AttrHasSubstring(implementor_ element, nsIAtom* ns, \
|
|
|
|
nsIAtom* name, nsIAtom* str); \
|
|
|
|
bool prefix_##AttrHasPrefix(implementor_ element, nsIAtom* ns, \
|
|
|
|
nsIAtom* name, nsIAtom* str); \
|
|
|
|
bool prefix_##AttrHasSuffix(implementor_ element, nsIAtom* ns, \
|
|
|
|
nsIAtom* name, nsIAtom* str); \
|
|
|
|
uint32_t prefix_##ClassOrClassList(implementor_ element, nsIAtom** class_, \
|
2016-07-19 04:02:55 +03:00
|
|
|
nsIAtom*** classList);
|
|
|
|
|
2016-08-23 16:11:02 +03:00
|
|
|
SERVO_DECLARE_ELEMENT_ATTR_MATCHING_FUNCTIONS(Gecko_, RawGeckoElementBorrowed)
|
2016-07-19 04:02:55 +03:00
|
|
|
SERVO_DECLARE_ELEMENT_ATTR_MATCHING_FUNCTIONS(Gecko_Snapshot,
|
2016-11-02 09:11:24 +03:00
|
|
|
const ServoElementSnapshot*)
|
2016-07-19 04:02:55 +03:00
|
|
|
|
|
|
|
#undef SERVO_DECLARE_ELEMENT_ATTR_MATCHING_FUNCTIONS
|
2015-11-25 04:14:39 +03:00
|
|
|
|
2016-06-24 06:35:12 +03:00
|
|
|
// Style attributes.
|
2016-10-18 07:29:03 +03:00
|
|
|
RawServoDeclarationBlockStrongBorrowedOrNull
|
2017-01-20 02:56:53 +03:00
|
|
|
Gecko_GetStyleAttrDeclarationBlock(RawGeckoElementBorrowed element);
|
|
|
|
RawServoDeclarationBlockStrongBorrowedOrNull
|
|
|
|
Gecko_GetHTMLPresentationAttrDeclarationBlock(RawGeckoElementBorrowed element);
|
2017-03-26 23:53:34 +03:00
|
|
|
RawServoDeclarationBlockStrongBorrowedOrNull
|
|
|
|
Gecko_GetExtraContentStyleDeclarations(RawGeckoElementBorrowed element);
|
2016-06-24 06:35:12 +03:00
|
|
|
|
2017-01-24 10:27:56 +03:00
|
|
|
// Animations
|
2017-03-17 07:23:21 +03:00
|
|
|
bool
|
2017-01-24 10:27:56 +03:00
|
|
|
Gecko_GetAnimationRule(RawGeckoElementBorrowed aElement,
|
2017-01-24 10:33:10 +03:00
|
|
|
nsIAtom* aPseudoTag,
|
2017-03-17 07:23:21 +03:00
|
|
|
mozilla::EffectCompositor::CascadeLevel aCascadeLevel,
|
|
|
|
RawServoAnimationValueMapBorrowed aAnimationValues);
|
2017-03-10 05:53:17 +03:00
|
|
|
bool Gecko_StyleAnimationsEquals(RawGeckoStyleAnimationListBorrowed,
|
|
|
|
RawGeckoStyleAnimationListBorrowed);
|
2017-03-10 05:53:19 +03:00
|
|
|
void Gecko_UpdateAnimations(RawGeckoElementBorrowed aElement,
|
|
|
|
nsIAtom* aPseudoTagOrNull,
|
2017-04-12 11:33:44 +03:00
|
|
|
ServoComputedValuesBorrowedOrNull aOldComputedValues,
|
2017-03-10 05:53:19 +03:00
|
|
|
ServoComputedValuesBorrowedOrNull aComputedValues,
|
2017-03-27 13:43:16 +03:00
|
|
|
ServoComputedValuesBorrowedOrNull aParentComputedValues,
|
|
|
|
mozilla::UpdateAnimationsTasks aTaskBits);
|
2017-03-27 13:42:59 +03:00
|
|
|
bool Gecko_ElementHasAnimations(RawGeckoElementBorrowed aElement,
|
|
|
|
nsIAtom* aPseudoTagOrNull);
|
2017-03-10 05:53:19 +03:00
|
|
|
bool Gecko_ElementHasCSSAnimations(RawGeckoElementBorrowed aElement,
|
|
|
|
nsIAtom* aPseudoTagOrNull);
|
2017-04-06 04:34:51 +03:00
|
|
|
double Gecko_GetProgressFromComputedTiming(RawGeckoComputedTimingBorrowed aComputedTiming);
|
|
|
|
double Gecko_GetPositionInSegment(
|
|
|
|
RawGeckoAnimationPropertySegmentBorrowed aSegment,
|
|
|
|
double aProgress,
|
|
|
|
mozilla::ComputedTimingFunction::BeforeFlag aBeforeFlag);
|
2017-04-06 04:34:51 +03:00
|
|
|
// Get servo's AnimationValue for |aProperty| from the cached base style
|
|
|
|
// |aBaseStyles|.
|
|
|
|
// |aBaseStyles| is nsRefPtrHashtable<nsUint32HashKey, RawServoAnimationValue>.
|
|
|
|
// We use void* to avoid exposing nsRefPtrHashtable in FFI.
|
|
|
|
RawServoAnimationValueBorrowedOrNull Gecko_AnimationGetBaseStyle(
|
|
|
|
void* aBaseStyles,
|
|
|
|
nsCSSPropertyID aProperty);
|
2017-01-24 10:27:56 +03:00
|
|
|
|
2016-05-18 22:05:36 +03:00
|
|
|
// Atoms.
|
|
|
|
nsIAtom* Gecko_Atomize(const char* aString, uint32_t aLength);
|
|
|
|
void Gecko_AddRefAtom(nsIAtom* aAtom);
|
|
|
|
void Gecko_ReleaseAtom(nsIAtom* aAtom);
|
|
|
|
const uint16_t* Gecko_GetAtomAsUTF16(nsIAtom* aAtom, uint32_t* aLength);
|
|
|
|
bool Gecko_AtomEqualsUTF8(nsIAtom* aAtom, const char* aString, uint32_t aLength);
|
|
|
|
bool Gecko_AtomEqualsUTF8IgnoreCase(nsIAtom* aAtom, const char* aString, uint32_t aLength);
|
|
|
|
|
2016-06-07 22:13:24 +03:00
|
|
|
// Font style
|
|
|
|
void Gecko_FontFamilyList_Clear(FontFamilyList* aList);
|
2017-03-30 21:15:57 +03:00
|
|
|
void Gecko_FontFamilyList_AppendNamed(FontFamilyList* aList, nsIAtom* aName, bool aQuoted);
|
2016-06-07 22:13:24 +03:00
|
|
|
void Gecko_FontFamilyList_AppendGeneric(FontFamilyList* list, FontFamilyType familyType);
|
|
|
|
void Gecko_CopyFontFamilyFrom(nsFont* dst, const nsFont* src);
|
|
|
|
|
2017-04-11 11:32:20 +03:00
|
|
|
// Visibility style
|
|
|
|
void Gecko_SetImageOrientation(nsStyleVisibility* aVisibility,
|
|
|
|
double aRadians,
|
|
|
|
bool aFlip);
|
|
|
|
void Gecko_SetImageOrientationAsFromImage(nsStyleVisibility* aVisibility);
|
|
|
|
void Gecko_CopyImageOrientationFrom(nsStyleVisibility* aDst,
|
|
|
|
const nsStyleVisibility* aSrc);
|
|
|
|
|
2016-05-04 03:42:40 +03:00
|
|
|
// Counter style.
|
|
|
|
void Gecko_SetListStyleType(nsStyleList* style_struct, uint32_t type);
|
|
|
|
void Gecko_CopyListStyleTypeFrom(nsStyleList* dst, const nsStyleList* src);
|
|
|
|
|
2016-05-27 01:18:09 +03:00
|
|
|
// background-image style.
|
|
|
|
void Gecko_SetNullImageValue(nsStyleImage* image);
|
|
|
|
void Gecko_SetGradientImageValue(nsStyleImage* image, nsStyleGradient* gradient);
|
2016-11-02 11:58:32 +03:00
|
|
|
void Gecko_SetUrlImageValue(nsStyleImage* image,
|
2017-03-13 07:08:29 +03:00
|
|
|
ServoBundledURI uri);
|
2017-04-09 17:02:35 +03:00
|
|
|
void Gecko_SetImageElement(nsStyleImage* image, nsIAtom* atom);
|
2016-05-27 01:18:09 +03:00
|
|
|
void Gecko_CopyImageValueFrom(nsStyleImage* image, const nsStyleImage* other);
|
2017-03-25 21:48:47 +03:00
|
|
|
void Gecko_InitializeImageCropRect(nsStyleImage* image);
|
2016-05-27 01:18:09 +03:00
|
|
|
|
|
|
|
nsStyleGradient* Gecko_CreateGradient(uint8_t shape,
|
|
|
|
uint8_t size,
|
|
|
|
bool repeating,
|
|
|
|
bool legacy_syntax,
|
|
|
|
uint32_t stops);
|
|
|
|
|
2016-11-03 04:40:53 +03:00
|
|
|
// list-style-image style.
|
|
|
|
void Gecko_SetListStyleImageNone(nsStyleList* style_struct);
|
|
|
|
void Gecko_SetListStyleImage(nsStyleList* style_struct,
|
2017-02-10 04:43:52 +03:00
|
|
|
ServoBundledURI uri);
|
2016-11-03 04:40:53 +03:00
|
|
|
void Gecko_CopyListStyleImageFrom(nsStyleList* dest, const nsStyleList* src);
|
|
|
|
|
2016-11-21 09:34:17 +03:00
|
|
|
// cursor style.
|
|
|
|
void Gecko_SetCursorArrayLength(nsStyleUserInterface* ui, size_t len);
|
|
|
|
void Gecko_SetCursorImage(nsCursorImage* cursor,
|
2017-03-13 07:08:29 +03:00
|
|
|
ServoBundledURI uri);
|
2016-11-21 09:34:17 +03:00
|
|
|
void Gecko_CopyCursorArrayFrom(nsStyleUserInterface* dest,
|
|
|
|
const nsStyleUserInterface* src);
|
|
|
|
|
2017-03-12 09:40:54 +03:00
|
|
|
void Gecko_SetContentDataImage(nsStyleContentData* content_data, ServoBundledURI uri);
|
|
|
|
void Gecko_SetContentDataArray(nsStyleContentData* content_data, nsStyleContentType type, uint32_t len);
|
|
|
|
|
2016-07-08 10:07:06 +03:00
|
|
|
// Dirtiness tracking.
|
2016-08-23 16:11:02 +03:00
|
|
|
uint32_t Gecko_GetNodeFlags(RawGeckoNodeBorrowed node);
|
|
|
|
void Gecko_SetNodeFlags(RawGeckoNodeBorrowed node, uint32_t flags);
|
|
|
|
void Gecko_UnsetNodeFlags(RawGeckoNodeBorrowed node, uint32_t flags);
|
2017-02-10 05:42:29 +03:00
|
|
|
void Gecko_SetOwnerDocumentNeedsStyleFlush(RawGeckoElementBorrowed element);
|
2016-07-08 10:07:06 +03:00
|
|
|
|
2016-07-27 00:22:57 +03:00
|
|
|
// Incremental restyle.
|
2016-07-29 05:20:45 +03:00
|
|
|
// Also, we might want a ComputedValues to ComputedValues API for animations?
|
|
|
|
// Not if we do them in Gecko...
|
2016-08-23 16:11:02 +03:00
|
|
|
nsStyleContext* Gecko_GetStyleContext(RawGeckoNodeBorrowed node,
|
2016-08-12 05:01:52 +03:00
|
|
|
nsIAtom* aPseudoTagOrNull);
|
2016-07-29 05:20:45 +03:00
|
|
|
nsChangeHint Gecko_CalcStyleDifference(nsStyleContext* oldstyle,
|
2016-08-16 08:10:05 +03:00
|
|
|
ServoComputedValuesBorrowed newstyle);
|
2017-02-16 06:36:57 +03:00
|
|
|
nsChangeHint Gecko_HintsHandledForDescendants(nsChangeHint aHint);
|
2016-11-02 09:11:24 +03:00
|
|
|
|
|
|
|
// Element snapshot.
|
|
|
|
ServoElementSnapshotOwned Gecko_CreateElementSnapshot(RawGeckoElementBorrowed element);
|
|
|
|
void Gecko_DropElementSnapshot(ServoElementSnapshotOwned snapshot);
|
2016-07-27 00:22:57 +03:00
|
|
|
|
2016-07-14 11:59:37 +03:00
|
|
|
// `array` must be an nsTArray
|
|
|
|
// If changing this signature, please update the
|
|
|
|
// friend function declaration in nsTArray.h
|
|
|
|
void Gecko_EnsureTArrayCapacity(void* array, size_t capacity, size_t elem_size);
|
|
|
|
|
2016-08-12 07:54:14 +03:00
|
|
|
// Same here, `array` must be an nsTArray<T>, for some T.
|
|
|
|
//
|
|
|
|
// Important note: Only valid for POD types, since destructors won't be run
|
|
|
|
// otherwise. This is ensured with rust traits for the relevant structs.
|
|
|
|
void Gecko_ClearPODTArray(void* array, size_t elem_size, size_t elem_align);
|
2016-07-14 11:59:48 +03:00
|
|
|
|
2017-04-08 10:17:34 +03:00
|
|
|
void Gecko_CopyStyleGridTemplateValues(nsStyleGridTemplate* grid_template,
|
|
|
|
const nsStyleGridTemplate* other);
|
|
|
|
|
2017-03-13 07:11:52 +03:00
|
|
|
// Clear the mContents, mCounterIncrements, or mCounterResets field in nsStyleContent. This is
|
|
|
|
// needed to run the destructors, otherwise we'd leak the images, strings, and whatnot.
|
2017-01-28 02:05:16 +03:00
|
|
|
void Gecko_ClearAndResizeStyleContents(nsStyleContent* content,
|
|
|
|
uint32_t how_many);
|
2017-03-13 07:11:52 +03:00
|
|
|
void Gecko_ClearAndResizeCounterIncrements(nsStyleContent* content,
|
|
|
|
uint32_t how_many);
|
|
|
|
void Gecko_ClearAndResizeCounterResets(nsStyleContent* content,
|
|
|
|
uint32_t how_many);
|
2016-08-16 22:07:17 +03:00
|
|
|
void Gecko_CopyStyleContentsFrom(nsStyleContent* content, const nsStyleContent* other);
|
2017-03-13 07:11:52 +03:00
|
|
|
void Gecko_CopyCounterResetsFrom(nsStyleContent* content, const nsStyleContent* other);
|
|
|
|
void Gecko_CopyCounterIncrementsFrom(nsStyleContent* content, const nsStyleContent* other);
|
2016-08-16 22:07:17 +03:00
|
|
|
|
2016-10-11 12:55:15 +03:00
|
|
|
void Gecko_EnsureImageLayersLength(nsStyleImageLayers* layers, size_t len,
|
|
|
|
nsStyleImageLayers::LayerType layer_type);
|
2016-07-12 11:10:39 +03:00
|
|
|
|
2017-01-06 15:45:16 +03:00
|
|
|
void Gecko_EnsureStyleAnimationArrayLength(void* array, size_t len);
|
2017-03-03 02:35:33 +03:00
|
|
|
void Gecko_EnsureStyleTransitionArrayLength(void* array, size_t len);
|
2017-01-06 15:45:16 +03:00
|
|
|
|
2017-03-19 15:36:16 +03:00
|
|
|
void Gecko_ClearWillChange(nsStyleDisplay* display, size_t length);
|
|
|
|
void Gecko_AppendWillChange(nsStyleDisplay* display, nsIAtom* atom);
|
|
|
|
void Gecko_CopyWillChangeFrom(nsStyleDisplay* dest, nsStyleDisplay* src);
|
|
|
|
|
2017-01-29 06:58:39 +03:00
|
|
|
mozilla::Keyframe* Gecko_AnimationAppendKeyframe(RawGeckoKeyframeListBorrowedMut keyframes,
|
|
|
|
float offset,
|
|
|
|
const nsTimingFunction* timingFunction);
|
|
|
|
|
2016-07-15 18:26:48 +03:00
|
|
|
// Clean up pointer-based coordinates
|
|
|
|
void Gecko_ResetStyleCoord(nsStyleUnit* unit, nsStyleUnion* value);
|
|
|
|
|
|
|
|
// Set an nsStyleCoord to a computed `calc()` value
|
|
|
|
void Gecko_SetStyleCoordCalcValue(nsStyleUnit* unit, nsStyleUnion* value, nsStyleCoord::CalcValue calc);
|
|
|
|
|
2017-04-12 15:52:38 +03:00
|
|
|
void Gecko_CopyShapeSourceFrom(mozilla::StyleShapeSource* dst, const mozilla::StyleShapeSource* src);
|
2016-08-15 18:48:11 +03:00
|
|
|
|
2017-04-12 15:52:38 +03:00
|
|
|
void Gecko_DestroyShapeSource(mozilla::StyleShapeSource* shape);
|
2016-08-15 18:48:11 +03:00
|
|
|
mozilla::StyleBasicShape* Gecko_NewBasicShape(mozilla::StyleBasicShapeType type);
|
2017-04-12 15:52:38 +03:00
|
|
|
void Gecko_StyleShapeSource_SetURLValue(mozilla::StyleShapeSource* shape, ServoBundledURI uri);
|
2016-08-15 18:48:11 +03:00
|
|
|
|
2016-10-17 09:16:16 +03:00
|
|
|
void Gecko_ResetFilters(nsStyleEffects* effects, size_t new_len);
|
|
|
|
void Gecko_CopyFiltersFrom(nsStyleEffects* aSrc, nsStyleEffects* aDest);
|
2017-02-10 04:43:52 +03:00
|
|
|
void Gecko_nsStyleFilter_SetURLValue(nsStyleFilter* effects, ServoBundledURI uri);
|
2016-10-17 09:16:16 +03:00
|
|
|
|
2017-02-10 04:43:52 +03:00
|
|
|
void Gecko_nsStyleSVGPaint_CopyFrom(nsStyleSVGPaint* dest, const nsStyleSVGPaint* src);
|
|
|
|
void Gecko_nsStyleSVGPaint_SetURLValue(nsStyleSVGPaint* paint, ServoBundledURI uri);
|
|
|
|
void Gecko_nsStyleSVGPaint_Reset(nsStyleSVGPaint* paint);
|
|
|
|
|
2017-02-10 04:43:52 +03:00
|
|
|
void Gecko_nsStyleSVG_SetDashArrayLength(nsStyleSVG* svg, uint32_t len);
|
|
|
|
void Gecko_nsStyleSVG_CopyDashArray(nsStyleSVG* dst, const nsStyleSVG* src);
|
|
|
|
|
2017-02-10 04:43:52 +03:00
|
|
|
mozilla::css::URLValue* Gecko_NewURLValue(ServoBundledURI uri);
|
|
|
|
NS_DECL_THREADSAFE_FFI_REFCOUNTING(mozilla::css::URLValue, CSSURLValue);
|
2017-03-30 10:54:48 +03:00
|
|
|
NS_DECL_THREADSAFE_FFI_REFCOUNTING(RawGeckoURLExtraData, URLExtraData);
|
2017-02-10 04:43:52 +03:00
|
|
|
|
2016-08-22 16:01:41 +03:00
|
|
|
void Gecko_FillAllBackgroundLists(nsStyleImageLayers* layers, uint32_t max_len);
|
2016-09-06 13:20:30 +03:00
|
|
|
void Gecko_FillAllMaskLists(nsStyleImageLayers* layers, uint32_t max_len);
|
2016-07-15 18:26:48 +03:00
|
|
|
NS_DECL_THREADSAFE_FFI_REFCOUNTING(nsStyleCoord::Calc, Calc);
|
|
|
|
|
2016-08-28 07:41:17 +03:00
|
|
|
nsCSSShadowArray* Gecko_NewCSSShadowArray(uint32_t len);
|
|
|
|
NS_DECL_THREADSAFE_FFI_REFCOUNTING(nsCSSShadowArray, CSSShadowArray);
|
|
|
|
|
2016-10-13 14:45:01 +03:00
|
|
|
nsStyleQuoteValues* Gecko_NewStyleQuoteValues(uint32_t len);
|
|
|
|
NS_DECL_THREADSAFE_FFI_REFCOUNTING(nsStyleQuoteValues, QuoteValues);
|
|
|
|
|
2016-11-01 02:30:43 +03:00
|
|
|
nsCSSValueSharedList* Gecko_NewCSSValueSharedList(uint32_t len);
|
2017-02-03 08:41:29 +03:00
|
|
|
|
|
|
|
// Getter for nsCSSValue
|
|
|
|
nsCSSValueBorrowedMut Gecko_CSSValue_GetArrayItem(nsCSSValueBorrowedMut css_value, int32_t index);
|
|
|
|
// const version of the above function.
|
|
|
|
nsCSSValueBorrowed Gecko_CSSValue_GetArrayItemConst(nsCSSValueBorrowed css_value, int32_t index);
|
|
|
|
nscoord Gecko_CSSValue_GetAbsoluteLength(nsCSSValueBorrowed css_value);
|
|
|
|
float Gecko_CSSValue_GetAngle(nsCSSValueBorrowed css_value);
|
|
|
|
nsCSSKeyword Gecko_CSSValue_GetKeyword(nsCSSValueBorrowed aCSSValue);
|
|
|
|
float Gecko_CSSValue_GetNumber(nsCSSValueBorrowed css_value);
|
|
|
|
float Gecko_CSSValue_GetPercentage(nsCSSValueBorrowed css_value);
|
|
|
|
nsStyleCoord::CalcValue Gecko_CSSValue_GetCalc(nsCSSValueBorrowed aCSSValue);
|
|
|
|
|
2016-11-01 02:30:43 +03:00
|
|
|
void Gecko_CSSValue_SetAbsoluteLength(nsCSSValueBorrowedMut css_value, nscoord len);
|
2017-03-28 03:52:14 +03:00
|
|
|
void Gecko_CSSValue_SetNormal(nsCSSValueBorrowedMut css_value);
|
2016-11-01 02:30:43 +03:00
|
|
|
void Gecko_CSSValue_SetNumber(nsCSSValueBorrowedMut css_value, float number);
|
|
|
|
void Gecko_CSSValue_SetKeyword(nsCSSValueBorrowedMut css_value, nsCSSKeyword keyword);
|
|
|
|
void Gecko_CSSValue_SetPercentage(nsCSSValueBorrowedMut css_value, float percent);
|
|
|
|
void Gecko_CSSValue_SetAngle(nsCSSValueBorrowedMut css_value, float radians);
|
|
|
|
void Gecko_CSSValue_SetCalc(nsCSSValueBorrowedMut css_value, nsStyleCoord::CalcValue calc);
|
|
|
|
void Gecko_CSSValue_SetFunction(nsCSSValueBorrowedMut css_value, int32_t len);
|
2017-03-28 03:52:14 +03:00
|
|
|
void Gecko_CSSValue_SetString(nsCSSValueBorrowedMut css_value,
|
|
|
|
const uint8_t* string, uint32_t len, nsCSSUnit unit);
|
|
|
|
void Gecko_CSSValue_SetStringFromAtom(nsCSSValueBorrowedMut css_value,
|
|
|
|
nsIAtom* atom, nsCSSUnit unit);
|
2017-02-18 02:15:55 +03:00
|
|
|
void Gecko_CSSValue_SetArray(nsCSSValueBorrowedMut css_value, int32_t len);
|
|
|
|
void Gecko_CSSValue_SetURL(nsCSSValueBorrowedMut css_value, ServoBundledURI uri);
|
2017-03-28 03:52:14 +03:00
|
|
|
void Gecko_CSSValue_SetInt(nsCSSValueBorrowedMut css_value, int32_t integer, nsCSSUnit unit);
|
2017-01-15 19:07:38 +03:00
|
|
|
void Gecko_CSSValue_Drop(nsCSSValueBorrowedMut css_value);
|
2016-11-01 02:30:43 +03:00
|
|
|
NS_DECL_THREADSAFE_FFI_REFCOUNTING(nsCSSValueSharedList, CSSValueSharedList);
|
2017-01-10 03:05:18 +03:00
|
|
|
bool Gecko_PropertyId_IsPrefEnabled(nsCSSPropertyID id);
|
2016-11-01 02:30:43 +03:00
|
|
|
|
2017-02-13 03:02:29 +03:00
|
|
|
void Gecko_nsStyleFont_SetLang(nsStyleFont* font, nsIAtom* atom);
|
|
|
|
void Gecko_nsStyleFont_CopyLangFrom(nsStyleFont* aFont, const nsStyleFont* aSource);
|
2017-04-04 21:11:27 +03:00
|
|
|
FontSizePrefs Gecko_GetBaseSize(nsIAtom* lang);
|
2017-02-13 03:02:29 +03:00
|
|
|
|
2017-04-08 01:49:44 +03:00
|
|
|
struct GeckoFontMetrics
|
|
|
|
{
|
|
|
|
nscoord mChSize;
|
|
|
|
nscoord mXSize;
|
|
|
|
};
|
|
|
|
|
|
|
|
GeckoFontMetrics Gecko_GetFontMetrics(RawGeckoPresContextBorrowed pres_context,
|
|
|
|
bool is_vertical,
|
|
|
|
const nsStyleFont* font,
|
|
|
|
nscoord font_size,
|
|
|
|
bool use_user_font_set);
|
|
|
|
void InitializeServo();
|
|
|
|
void ShutdownServo();
|
|
|
|
|
2017-01-15 01:33:40 +03:00
|
|
|
const nsMediaFeature* Gecko_GetMediaFeatures();
|
2017-04-13 07:24:02 +03:00
|
|
|
nsCSSKeyword Gecko_LookupCSSKeyword(const uint8_t* string, uint32_t len);
|
|
|
|
const char* Gecko_CSSKeywordString(nsCSSKeyword keyword, uint32_t* len);
|
2017-01-15 01:33:40 +03:00
|
|
|
|
2017-03-24 06:42:18 +03:00
|
|
|
// Font face rule
|
|
|
|
// Creates and returns a new (already-addrefed) nsCSSFontFaceRule object.
|
|
|
|
nsCSSFontFaceRule* Gecko_CSSFontFaceRule_Create();
|
|
|
|
void Gecko_CSSFontFaceRule_GetCssText(const nsCSSFontFaceRule* rule, nsAString* result);
|
|
|
|
NS_DECL_FFI_REFCOUNTING(nsCSSFontFaceRule, CSSFontFaceRule);
|
|
|
|
|
2017-03-26 23:53:34 +03:00
|
|
|
RawGeckoElementBorrowedOrNull Gecko_GetBody(RawGeckoPresContextBorrowed pres_context);
|
|
|
|
|
2017-03-16 00:49:35 +03:00
|
|
|
// We use an int32_t here instead of a LookAndFeel::ColorID
|
|
|
|
// because forward-declaring a nested enum/struct is impossible
|
|
|
|
nscolor Gecko_GetLookAndFeelSystemColor(int32_t color_id,
|
|
|
|
RawGeckoPresContextBorrowed pres_context);
|
|
|
|
|
2017-03-17 00:10:22 +03:00
|
|
|
bool Gecko_MatchStringArgPseudo(RawGeckoElementBorrowed element,
|
|
|
|
mozilla::CSSPseudoClassType type,
|
|
|
|
const char16_t* ident,
|
|
|
|
bool* set_slow_selector);
|
|
|
|
|
2016-04-02 03:04:59 +03:00
|
|
|
// Style-struct management.
|
2016-07-19 04:02:55 +03:00
|
|
|
#define STYLE_STRUCT(name, checkdata_cb) \
|
2017-01-04 22:52:26 +03:00
|
|
|
void Gecko_Construct_Default_nsStyle##name( \
|
|
|
|
nsStyle##name* ptr, \
|
|
|
|
RawGeckoPresContextBorrowed pres_context); \
|
2016-07-19 04:02:55 +03:00
|
|
|
void Gecko_CopyConstruct_nsStyle##name(nsStyle##name* ptr, \
|
|
|
|
const nsStyle##name* other); \
|
2016-08-19 14:44:43 +03:00
|
|
|
void Gecko_Destroy_nsStyle##name(nsStyle##name* ptr);
|
2016-04-02 03:04:59 +03:00
|
|
|
#include "nsStyleStructList.h"
|
|
|
|
#undef STYLE_STRUCT
|
|
|
|
|
2017-01-04 22:52:27 +03:00
|
|
|
void Gecko_Construct_nsStyleVariables(nsStyleVariables* ptr);
|
|
|
|
|
2017-04-07 17:44:41 +03:00
|
|
|
void Gecko_RegisterProfilerThread(const char* name);
|
|
|
|
void Gecko_UnregisterProfilerThread();
|
|
|
|
|
2016-08-19 14:44:43 +03:00
|
|
|
#define SERVO_BINDING_FUNC(name_, return_, ...) return_ name_(__VA_ARGS__);
|
|
|
|
#include "mozilla/ServoBindingList.h"
|
|
|
|
#undef SERVO_BINDING_FUNC
|
|
|
|
|
2015-11-25 04:14:39 +03:00
|
|
|
} // extern "C"
|
|
|
|
|
|
|
|
#endif // mozilla_ServoBindings_h
|