Bug 1498755 - Part 6: Move some C++ types from ServoBindingTypes.h to ServoTypes.h r=emilio

Depends on D8647

Differential Revision: https://phabricator.services.mozilla.com/D8648

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Cameron McCormack 2018-10-14 00:05:56 +00:00
parent cb8e3bb881
commit f804c8ca6b
9 changed files with 80 additions and 72 deletions

View File

@ -37,7 +37,6 @@ namespace mozilla {
enum class UpdateAnimationsTasks : uint8_t;
struct FontFamilyName;
struct Keyframe;
struct LangGroupFontPrefs;
namespace css {
class LoaderReusableStyleSheets;
@ -83,18 +82,6 @@ public:
mozilla::URLExtraData* mExtraData;
};
struct FontSizePrefs
{
void CopyFrom(const mozilla::LangGroupFontPrefs&);
nscoord mDefaultVariableSize;
nscoord mDefaultFixedSize;
nscoord mDefaultSerifSize;
nscoord mDefaultSansSerifSize;
nscoord mDefaultMonospaceSize;
nscoord mDefaultCursiveSize;
nscoord mDefaultFantasySize;
};
// Debugging stuff.
void Gecko_Element_DebugListAttributes(RawGeckoElementBorrowed, nsCString*);
void Gecko_Snapshot_DebugListAttributes(const mozilla::ServoElementSnapshot*, nsCString*);
@ -576,7 +563,7 @@ void Gecko_nsStyleFont_PrefillDefaultForGeneric(nsStyleFont* font,
uint8_t generic_id);
void Gecko_nsStyleFont_FixupMinFontSize(nsStyleFont* font,
RawGeckoPresContextBorrowed pres_context);
FontSizePrefs Gecko_GetBaseSize(nsAtom* lang);
mozilla::FontSizePrefs Gecko_GetBaseSize(nsAtom* lang);
// XBL related functions.
RawGeckoElementBorrowedOrNull Gecko_GetBindingParent(RawGeckoElementBorrowed aElement);

View File

@ -10,7 +10,6 @@
#include "mozilla/RefPtr.h"
#include "mozilla/ServoComputedData.h"
#include "mozilla/ServoTypes.h"
#include "mozilla/SheetType.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/gfx/Types.h"
#include "nsCSSPropertyID.h"
@ -84,15 +83,6 @@ typedef nsTArray<nsCSSPropertyID> RawGeckoCSSPropertyIDList;
typedef mozilla::gfx::Float RawGeckoGfxMatrix4x4[16];
typedef mozilla::dom::StyleChildrenIterator RawGeckoStyleChildrenIterator;
// A callback that can be sent via FFI which will be invoked _right before_
// being mutated, and at most once.
struct DeclarationBlockMutationClosure
{
// The callback function. The argument is `data`.
void (*function)(void*) = nullptr;
void* data = nullptr;
};
// We have these helper types so that we can directly generate
// things like &T or Borrowed<T> on the Rust side in the function, providing
// additional safety benefits.
@ -253,13 +243,6 @@ DEFINE_BOXED_TYPE(UseCounters, StyleUseCounters);
#undef DEFINE_BOXED_TYPE
// used for associating sheet type with specific @font-face rules
struct nsFontFaceRuleContainer
{
RefPtr<RawServoFontFaceRule> mRule;
mozilla::SheetType mSheetType;
};
#define DEFINE_ARRAY_TYPE_FOR(type_) \
struct nsTArrayBorrowed_##type_ { \
nsTArray<type_>* mArray; \
@ -269,10 +252,4 @@ struct nsFontFaceRuleContainer
DEFINE_ARRAY_TYPE_FOR(uintptr_t);
#undef DEFINE_ARRAY_TYPE_FOR
struct MediumFeaturesChangedResult {
bool mAffectsDocumentRules;
bool mAffectsNonDocumentRules;
bool mUsesViewportUnits;
};
#endif // mozilla_ServoBindingTypes_h

View File

@ -140,7 +140,7 @@ void Servo_StyleSet_RebuildCachedData(RawServoStyleSetBorrowed set);
// We'd like to return `OriginFlags` here, but bindgen bitfield enums don't
// work as return values with the Linux 32-bit ABI at the moment because
// they wrap the value in a struct.
MediumFeaturesChangedResult Servo_StyleSet_MediumFeaturesChanged(
mozilla::MediumFeaturesChangedResult Servo_StyleSet_MediumFeaturesChanged(
RawServoStyleSetBorrowed document_set,
nsTArray<RawServoAuthorStylesBorrowedMut>* non_document_sets,
bool may_affect_default_style);
@ -749,7 +749,7 @@ bool Servo_DeclarationBlock_SetProperty(
mozilla::ParsingMode parsing_mode,
nsCompatibility quirks_mode,
mozilla::css::Loader* loader,
DeclarationBlockMutationClosure);
mozilla::DeclarationBlockMutationClosure);
bool Servo_DeclarationBlock_SetPropertyToAnimationValue(
RawServoDeclarationBlockBorrowed declarations,
@ -764,17 +764,17 @@ bool Servo_DeclarationBlock_SetPropertyById(
mozilla::ParsingMode parsing_mode,
nsCompatibility quirks_mode,
mozilla::css::Loader* loader,
DeclarationBlockMutationClosure);
mozilla::DeclarationBlockMutationClosure);
bool Servo_DeclarationBlock_RemoveProperty(
RawServoDeclarationBlockBorrowed declarations,
const nsACString* property,
DeclarationBlockMutationClosure);
mozilla::DeclarationBlockMutationClosure);
bool Servo_DeclarationBlock_RemovePropertyById(
RawServoDeclarationBlockBorrowed declarations,
nsCSSPropertyID property,
DeclarationBlockMutationClosure);
mozilla::DeclarationBlockMutationClosure);
bool Servo_DeclarationBlock_HasCSSWideKeyword(
RawServoDeclarationBlockBorrowed declarations,

View File

@ -227,7 +227,7 @@ whitelist-vars = [
]
whitelist-types = [
"RawGecko.*",
"DeclarationBlockMutationClosure",
"mozilla::DeclarationBlockMutationClosure",
"mozilla::AnimationPropertySegment",
"mozilla::AnonymousCounterStyle",
"mozilla::AtomArray",
@ -281,7 +281,7 @@ whitelist-types = [
"Element",
"FontFamilyList",
"FontFamilyName",
"FontSizePrefs",
"mozilla::FontSizePrefs",
"FragmentOrURL",
"FrameRequestCallback",
"GeckoParserExtraData",
@ -293,7 +293,7 @@ whitelist-types = [
"Image",
"ImageURL",
"Keyframe",
"MediumFeaturesChangedResult",
"mozilla::MediumFeaturesChangedResult",
"nsAttrName",
"nsAttrValue",
"nscolor",
@ -508,14 +508,14 @@ structs-types = [
"gfxFontFeature",
"mozilla::gfx::FontVariation",
"ServoRawOffsetArc",
"DeclarationBlockMutationClosure",
"mozilla::DeclarationBlockMutationClosure",
"nsAttrValue",
"nsIContent",
"nsINode",
"nsIDocument",
"nsIDocument_DocumentTheme",
"nsSimpleContentList",
"MediumFeaturesChangedResult",
"mozilla::MediumFeaturesChangedResult",
"RawGeckoAnimationPropertySegment",
"RawGeckoComputedTiming",
"RawGeckoCSSPropertyIDList",
@ -551,7 +551,7 @@ structs-types = [
"ComputedTimingFunction_BeforeFlag",
"CounterStylePtr",
"FontFamilyType",
"FontSizePrefs",
"mozilla::FontSizePrefs",
"GeckoFontMetrics",
"IterationCompositeOperation",
"Keyframe",

View File

@ -7,8 +7,6 @@
#ifndef mozilla_ServoComputedData_h
#define mozilla_ServoComputedData_h
#include "mozilla/ServoTypes.h"
class nsWindowSizes;
/*
@ -21,29 +19,41 @@ class nsWindowSizes;
namespace mozilla {
struct ServoWritingMode {
template<typename T>
struct ServoRawOffsetArc
{
// This is a pointer to a T that lives inside a servo_arc::Arc<T>, and
// which already has had its reference count incremented.
T* mPtr;
};
struct ServoWritingMode
{
uint8_t mBits;
};
struct ServoCustomPropertiesMap {
struct ServoCustomPropertiesMap
{
uintptr_t mPtr;
};
struct ServoRuleNode {
struct ServoRuleNode
{
uintptr_t mPtr;
};
class ComputedStyle;
struct ServoVisitedStyle {
// This is actually a strong reference
// but ServoComputedData's destructor is
// managed by the Rust code so we just use a
// regular pointer
struct ServoVisitedStyle
{
// This is actually a strong reference but ServoComputedData's
// destructor is managed by the Rust code so we just use a regular
// pointer
ComputedStyle* mPtr;
};
struct ServoComputedValueFlags {
struct ServoComputedValueFlags
{
uint16_t mFlags;
};

View File

@ -4,15 +4,28 @@
* 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/. */
/* types defined to pass values through Gecko_* and Servo_* FFI functions */
#ifndef mozilla_ServoTypes_h
#define mozilla_ServoTypes_h
#include "mozilla/RefPtr.h"
#include "mozilla/SheetType.h"
#include "mozilla/TypedEnumBits.h"
#include "nsCoord.h"
/*
* Type definitions used to interact with Servo. This gets included by nsINode,
* so don't add significant include dependencies to this file.
*/
struct RawServoFontFaceRule;
namespace mozilla {
struct LangGroupFontPrefs;
}
// used for associating sheet type with specific @font-face rules
struct nsFontFaceRuleContainer
{
RefPtr<RawServoFontFaceRule> mRule;
mozilla::SheetType mSheetType;
};
namespace mozilla {
@ -134,11 +147,32 @@ public:
{}
};
template <typename T>
struct ServoRawOffsetArc {
// Again, a strong reference, but
// managed by the Rust code
T* mPtr;
// A callback that can be sent via FFI which will be invoked _right before_
// being mutated, and at most once.
struct DeclarationBlockMutationClosure
{
// The callback function. The argument is `data`.
void (*function)(void*) = nullptr;
void* data = nullptr;
};
struct MediumFeaturesChangedResult
{
bool mAffectsDocumentRules;
bool mAffectsNonDocumentRules;
bool mUsesViewportUnits;
};
struct FontSizePrefs
{
void CopyFrom(const mozilla::LangGroupFontPrefs&);
nscoord mDefaultVariableSize;
nscoord mDefaultFixedSize;
nscoord mDefaultSerifSize;
nscoord mDefaultSansSerifSize;
nscoord mDefaultMonospaceSize;
nscoord mDefaultCursiveSize;
nscoord mDefaultFantasySize;
};
} // namespace mozilla

View File

@ -13,7 +13,7 @@
#include "mozilla/CORSMode.h"
#include "mozilla/FontPropertyTypes.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/ServoTypes.h"
#include "mozilla/ServoBindingTypes.h"
#include "mozilla/SheetType.h"
#include "mozilla/URLExtraData.h"
#include "mozilla/UniquePtr.h"

View File

@ -58,7 +58,7 @@ public:
static void MutationClosureFunction(void* aData);
void
GetPropertyChangeClosure(DeclarationBlockMutationClosure* aClosure,
GetPropertyChangeClosure(mozilla::DeclarationBlockMutationClosure* aClosure,
mozilla::MutationClosureData* aClosureData) final
{
if (!mIsSMILOverride) {

View File

@ -23,10 +23,10 @@ class nsIPrincipal;
class nsIDocument;
struct JSContext;
class JSObject;
struct DeclarationBlockMutationClosure;
namespace mozilla {
class DeclarationBlock;
struct DeclarationBlockMutationClosure;
namespace css {
class Loader;
class Rule;
@ -219,7 +219,7 @@ protected:
nsresult RemovePropertyInternal(const nsAString& aProperty);
virtual void
GetPropertyChangeClosure(DeclarationBlockMutationClosure* aClosure,
GetPropertyChangeClosure(mozilla::DeclarationBlockMutationClosure* aClosure,
mozilla::MutationClosureData* aClosureData)
{
}