mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-29 11:57:32 +09:00
Issue #58 - Follow-up: Remove Rust binding leftovers
This commit is contained in:
parent
0b3da59bc3
commit
6d154eee11
6 changed files with 2 additions and 166 deletions
|
|
@ -14,16 +14,12 @@
|
||||||
/* Define to 1 if SpiderMonkey is in debug mode. */
|
/* Define to 1 if SpiderMonkey is in debug mode. */
|
||||||
#undef JS_DEBUG
|
#undef JS_DEBUG
|
||||||
|
|
||||||
/*
|
|
||||||
* NB: We have a special case for rust-bindgen, which wants to be able to
|
|
||||||
* generate both debug and release bindings on a single objdir.
|
|
||||||
*/
|
|
||||||
#ifdef JS_DEBUG
|
#ifdef JS_DEBUG
|
||||||
#if !defined(DEBUG) && !defined(RUST_BINDGEN)
|
# ifndef DEBUG
|
||||||
# error "SpiderMonkey was configured with --enable-debug, so DEBUG must be defined when including this header"
|
# error "SpiderMonkey was configured with --enable-debug, so DEBUG must be defined when including this header"
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# if defined(DEBUG) && !defined(RUST_BINDGEN)
|
# ifdef DEBUG
|
||||||
# error "SpiderMonkey was configured with --disable-debug, so DEBUG must be not defined when including this header"
|
# error "SpiderMonkey was configured with --disable-debug, so DEBUG must be not defined when including this header"
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,6 @@ typedef union {
|
||||||
* the unit is a must before asking for the value in any particular
|
* the unit is a must before asking for the value in any particular
|
||||||
* form.
|
* form.
|
||||||
*/
|
*/
|
||||||
/** <div rustbindgen private accessor="unsafe"></div> */
|
|
||||||
class nsStyleCoord {
|
class nsStyleCoord {
|
||||||
public:
|
public:
|
||||||
// Non-reference counted calc() value. See nsStyleStruct.h for some uses
|
// Non-reference counted calc() value. See nsStyleStruct.h for some uses
|
||||||
|
|
@ -263,7 +262,6 @@ private:
|
||||||
* This is commonly used to hold the widths of the borders, margins,
|
* This is commonly used to hold the widths of the borders, margins,
|
||||||
* or paddings of a box.
|
* or paddings of a box.
|
||||||
*/
|
*/
|
||||||
/** <div rustbindgen private accessor="unsafe"></div> */
|
|
||||||
class nsStyleSides {
|
class nsStyleSides {
|
||||||
public:
|
public:
|
||||||
nsStyleSides();
|
nsStyleSides();
|
||||||
|
|
@ -342,7 +340,6 @@ protected:
|
||||||
* nsStyleCoord pairs. This is used to hold the dimensions of the
|
* nsStyleCoord pairs. This is used to hold the dimensions of the
|
||||||
* corners of a box (for, e.g., border-radius and outline-radius).
|
* corners of a box (for, e.g., border-radius and outline-radius).
|
||||||
*/
|
*/
|
||||||
/** <div rustbindgen private accessor="unsafe"></div> */
|
|
||||||
class nsStyleCorners {
|
class nsStyleCorners {
|
||||||
public:
|
public:
|
||||||
nsStyleCorners();
|
nsStyleCorners();
|
||||||
|
|
|
||||||
|
|
@ -3831,100 +3831,4 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleEffects
|
||||||
uint8_t mMixBlendMode; // [reset] see nsStyleConsts.h
|
uint8_t mMixBlendMode; // [reset] see nsStyleConsts.h
|
||||||
};
|
};
|
||||||
|
|
||||||
#define STATIC_ASSERT_TYPE_LAYOUTS_MATCH(T1, T2) \
|
|
||||||
static_assert(sizeof(T1) == sizeof(T2), \
|
|
||||||
"Size mismatch between " #T1 " and " #T2); \
|
|
||||||
static_assert(alignof(T1) == alignof(T2), \
|
|
||||||
"Align mismatch between " #T1 " and " #T2); \
|
|
||||||
|
|
||||||
#define STATIC_ASSERT_FIELD_OFFSET_MATCHES(T1, T2, field) \
|
|
||||||
static_assert(offsetof(T1, field) == offsetof(T2, field), \
|
|
||||||
"Field offset mismatch of " #field " between " #T1 " and " #T2); \
|
|
||||||
|
|
||||||
/**
|
|
||||||
* These *_Simple types are used to map Gecko types to layout-equivalent but
|
|
||||||
* simpler Rust types, to aid Rust binding generation.
|
|
||||||
*
|
|
||||||
* If something in this types or the assertions below needs to change, ask
|
|
||||||
* bholley, heycam or emilio before!
|
|
||||||
*
|
|
||||||
* <div rustbindgen="true" replaces="nsPoint">
|
|
||||||
*/
|
|
||||||
struct nsPoint_Simple {
|
|
||||||
nscoord x, y;
|
|
||||||
};
|
|
||||||
|
|
||||||
STATIC_ASSERT_TYPE_LAYOUTS_MATCH(nsPoint, nsPoint_Simple);
|
|
||||||
STATIC_ASSERT_FIELD_OFFSET_MATCHES(nsPoint, nsPoint_Simple, x);
|
|
||||||
STATIC_ASSERT_FIELD_OFFSET_MATCHES(nsPoint, nsPoint_Simple, y);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <div rustbindgen="true" replaces="nsMargin">
|
|
||||||
*/
|
|
||||||
struct nsMargin_Simple {
|
|
||||||
nscoord top, right, bottom, left;
|
|
||||||
};
|
|
||||||
|
|
||||||
STATIC_ASSERT_TYPE_LAYOUTS_MATCH(nsMargin, nsMargin_Simple);
|
|
||||||
STATIC_ASSERT_FIELD_OFFSET_MATCHES(nsMargin, nsMargin_Simple, top);
|
|
||||||
STATIC_ASSERT_FIELD_OFFSET_MATCHES(nsMargin, nsMargin_Simple, right);
|
|
||||||
STATIC_ASSERT_FIELD_OFFSET_MATCHES(nsMargin, nsMargin_Simple, bottom);
|
|
||||||
STATIC_ASSERT_FIELD_OFFSET_MATCHES(nsMargin, nsMargin_Simple, left);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <div rustbindgen="true" replaces="nsRect">
|
|
||||||
*/
|
|
||||||
struct nsRect_Simple {
|
|
||||||
nscoord x, y, width, height;
|
|
||||||
};
|
|
||||||
|
|
||||||
STATIC_ASSERT_TYPE_LAYOUTS_MATCH(nsRect, nsRect_Simple);
|
|
||||||
STATIC_ASSERT_FIELD_OFFSET_MATCHES(nsRect, nsRect_Simple, x);
|
|
||||||
STATIC_ASSERT_FIELD_OFFSET_MATCHES(nsRect, nsRect_Simple, y);
|
|
||||||
STATIC_ASSERT_FIELD_OFFSET_MATCHES(nsRect, nsRect_Simple, width);
|
|
||||||
STATIC_ASSERT_FIELD_OFFSET_MATCHES(nsRect, nsRect_Simple, height);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <div rustbindgen="true" replaces="nsSize">
|
|
||||||
*/
|
|
||||||
struct nsSize_Simple {
|
|
||||||
nscoord width, height;
|
|
||||||
};
|
|
||||||
|
|
||||||
STATIC_ASSERT_TYPE_LAYOUTS_MATCH(nsSize, nsSize_Simple);
|
|
||||||
STATIC_ASSERT_FIELD_OFFSET_MATCHES(nsSize, nsSize_Simple, width);
|
|
||||||
STATIC_ASSERT_FIELD_OFFSET_MATCHES(nsSize, nsSize_Simple, height);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <div rustbindgen="true" replaces="UniquePtr">
|
|
||||||
*
|
|
||||||
* TODO(Emilio): This is a workaround and we should be able to get rid of this
|
|
||||||
* one.
|
|
||||||
*/
|
|
||||||
template<typename T, typename Deleter = mozilla::DefaultDelete<T>>
|
|
||||||
struct UniquePtr_Simple {
|
|
||||||
T* mPtr;
|
|
||||||
};
|
|
||||||
|
|
||||||
STATIC_ASSERT_TYPE_LAYOUTS_MATCH(mozilla::UniquePtr<int>, UniquePtr_Simple<int>);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <div rustbindgen replaces="nsTArray"></div>
|
|
||||||
*/
|
|
||||||
template<typename T>
|
|
||||||
class nsTArray_Simple {
|
|
||||||
T* mBuffer;
|
|
||||||
public:
|
|
||||||
// The existence of a destructor here prevents bindgen from deriving the Clone
|
|
||||||
// trait via a simple memory copy.
|
|
||||||
~nsTArray_Simple() {};
|
|
||||||
};
|
|
||||||
|
|
||||||
STATIC_ASSERT_TYPE_LAYOUTS_MATCH(nsTArray<nsStyleImageLayers::Layer>,
|
|
||||||
nsTArray_Simple<nsStyleImageLayers::Layer>);
|
|
||||||
STATIC_ASSERT_TYPE_LAYOUTS_MATCH(nsTArray<mozilla::StyleTransition>,
|
|
||||||
nsTArray_Simple<mozilla::StyleTransition>);
|
|
||||||
STATIC_ASSERT_TYPE_LAYOUTS_MATCH(nsTArray<mozilla::StyleAnimation>,
|
|
||||||
nsTArray_Simple<mozilla::StyleAnimation>);
|
|
||||||
|
|
||||||
#endif /* nsStyleStruct_h___ */
|
#endif /* nsStyleStruct_h___ */
|
||||||
|
|
|
||||||
|
|
@ -357,14 +357,6 @@ struct nsTArray_SafeElementAtHelper<mozilla::OwningNonNull<E>, Derived>
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Servo bindings.
|
|
||||||
extern "C" void Gecko_EnsureTArrayCapacity(void* aArray,
|
|
||||||
size_t aCapacity,
|
|
||||||
size_t aElementSize);
|
|
||||||
extern "C" void Gecko_ClearPODTArray(void* aArray,
|
|
||||||
size_t aElementSize,
|
|
||||||
size_t aElementAlign);
|
|
||||||
|
|
||||||
MOZ_NORETURN MOZ_COLD void
|
MOZ_NORETURN MOZ_COLD void
|
||||||
InvalidArrayIndex_CRASH(size_t aIndex, size_t aLength);
|
InvalidArrayIndex_CRASH(size_t aIndex, size_t aLength);
|
||||||
|
|
||||||
|
|
@ -381,10 +373,6 @@ class nsTArray_base
|
||||||
// the same free().
|
// the same free().
|
||||||
template<class Allocator, class Copier>
|
template<class Allocator, class Copier>
|
||||||
friend class nsTArray_base;
|
friend class nsTArray_base;
|
||||||
friend void Gecko_EnsureTArrayCapacity(void* aArray, size_t aCapacity,
|
|
||||||
size_t aElemSize);
|
|
||||||
friend void Gecko_ClearPODTArray(void* aTArray, size_t aElementSize,
|
|
||||||
size_t aElementAlign);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef nsTArrayHeader Header;
|
typedef nsTArrayHeader Header;
|
||||||
|
|
|
||||||
|
|
@ -1366,17 +1366,3 @@ AppendUCS4ToUTF16(const uint32_t aSource, nsAString& aDest)
|
||||||
aDest.Append(L_SURROGATE(aSource));
|
aDest.Append(L_SURROGATE(aSource));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
|
|
||||||
void Gecko_AppendUTF16toCString(nsACString* aThis, const nsAString* aOther)
|
|
||||||
{
|
|
||||||
AppendUTF16toUTF8(*aOther, *aThis);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Gecko_AppendUTF8toString(nsAString* aThis, const nsACString* aOther)
|
|
||||||
{
|
|
||||||
AppendUTF8toUTF16(*aOther, *aThis);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -350,38 +350,3 @@ nsStringBuffer::SizeOfIncludingThisEvenIfShared(mozilla::MallocSizeOf aMallocSiz
|
||||||
|
|
||||||
static_assert(sizeof(nsStringContainer_base) == sizeof(nsSubstring),
|
static_assert(sizeof(nsStringContainer_base) == sizeof(nsSubstring),
|
||||||
"internal and external strings must have the same size");
|
"internal and external strings must have the same size");
|
||||||
|
|
||||||
// Provide rust bindings to the nsA[C]String types
|
|
||||||
extern "C" {
|
|
||||||
|
|
||||||
void Gecko_FinalizeCString(nsACString* aThis)
|
|
||||||
{
|
|
||||||
aThis->~nsACString();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Gecko_AssignCString(nsACString* aThis, const nsACString* aOther)
|
|
||||||
{
|
|
||||||
aThis->Assign(*aOther);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Gecko_AppendCString(nsACString* aThis, const nsACString* aOther)
|
|
||||||
{
|
|
||||||
aThis->Append(*aOther);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Gecko_FinalizeString(nsAString* aThis)
|
|
||||||
{
|
|
||||||
aThis->~nsAString();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Gecko_AssignString(nsAString* aThis, const nsAString* aOther)
|
|
||||||
{
|
|
||||||
aThis->Assign(*aOther);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Gecko_AppendString(nsAString* aThis, const nsAString* aOther)
|
|
||||||
{
|
|
||||||
aThis->Append(*aOther);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // extern "C"
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue