summaryrefslogtreecommitdiffstats
path: root/layout/style/ServoStyleConstsForwards.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /layout/style/ServoStyleConstsForwards.h
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/style/ServoStyleConstsForwards.h')
-rw-r--r--layout/style/ServoStyleConstsForwards.h220
1 files changed, 220 insertions, 0 deletions
diff --git a/layout/style/ServoStyleConstsForwards.h b/layout/style/ServoStyleConstsForwards.h
new file mode 100644
index 0000000000..58720ffb6b
--- /dev/null
+++ b/layout/style/ServoStyleConstsForwards.h
@@ -0,0 +1,220 @@
+/* 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 https://mozilla.org/MPL/2.0/. */
+
+/*
+ * This file contains forward declarations and typedefs for types that cbindgen
+ * cannot understand but renames / prefixes, and includes for some of the types
+ * it needs.
+ */
+
+#ifndef mozilla_ServoStyleConsts_h
+# error "This file is only meant to be included from ServoStyleConsts.h"
+#endif
+
+#ifndef mozilla_ServoStyleConstsForwards_h
+# define mozilla_ServoStyleConstsForwards_h
+
+# include "nsColor.h"
+# include "nsCoord.h"
+# include "mozilla/AtomArray.h"
+# include "mozilla/IntegerRange.h"
+# include "mozilla/Span.h"
+# include "Units.h"
+# include "mozilla/gfx/Types.h"
+# include "mozilla/CORSMode.h"
+# include "mozilla/MemoryReporting.h"
+# include "mozilla/ServoTypes.h"
+# include "mozilla/ServoBindingTypes.h"
+# include "mozilla/Vector.h"
+# include "nsCSSPropertyID.h"
+# include "nsCompatibility.h"
+# include "nsIURI.h"
+# include <atomic>
+
+struct RawServoAnimationValueTable;
+struct RawServoAnimationValueMap;
+
+class nsAtom;
+class nsIFrame;
+class nsINode;
+class nsIContent;
+class nsCSSPropertyIDSet;
+class nsPresContext;
+class nsSimpleContentList;
+class imgRequestProxy;
+struct nsCSSValueSharedList;
+struct nsTimingFunction;
+
+class gfxFontFeatureValueSet;
+struct gfxFontFeature;
+namespace mozilla {
+namespace gfx {
+struct FontVariation;
+} // namespace gfx
+} // namespace mozilla
+typedef mozilla::gfx::FontVariation gfxFontVariation;
+
+enum nsCSSUnit : uint32_t;
+enum nsChangeHint : uint32_t;
+
+namespace nsStyleTransformMatrix {
+enum class MatrixTransformOperator : uint8_t;
+}
+
+template <typename T>
+class nsMainThreadPtrHolder;
+
+namespace mozilla {
+
+class ComputedStyle;
+
+using Matrix4x4Components = float[16];
+using StyleMatrix4x4Components = Matrix4x4Components;
+
+// This is sound because std::num::NonZeroUsize is repr(transparent).
+//
+// It is just the case that cbindgen doesn't understand it natively.
+using StyleNonZeroUsize = uintptr_t;
+
+struct Keyframe;
+struct PropertyStyleAnimationValuePair;
+
+using ComputedKeyframeValues = nsTArray<PropertyStyleAnimationValuePair>;
+
+class ComputedStyle;
+enum LogicalAxis : uint8_t;
+class SeenPtrs;
+class SharedFontList;
+class StyleSheet;
+class WritingMode;
+class ServoElementSnapshotTable;
+
+template <typename T>
+struct StyleForgottenArcSlicePtr;
+
+struct AnimationPropertySegment;
+struct AspectRatio;
+struct ComputedTiming;
+struct URLExtraData;
+
+enum HalfCorner : uint8_t;
+enum LogicalSide : uint8_t;
+enum class PseudoStyleType : uint8_t;
+enum class OriginFlags : uint8_t;
+enum class UseBoxSizing : uint8_t;
+
+namespace css {
+class Loader;
+class LoaderReusableStyleSheets;
+class SheetLoadData;
+using SheetLoadDataHolder = nsMainThreadPtrHolder<SheetLoadData>;
+enum SheetParsingMode : uint8_t;
+} // namespace css
+
+namespace dom {
+enum class IterationCompositeOperation : uint8_t;
+enum class CallerType : uint32_t;
+
+class Element;
+class Document;
+class ImageTracker;
+
+} // namespace dom
+
+namespace ipc {
+class ByteBuf;
+} // namespace ipc
+
+// Replacement for a Rust Box<T> for a non-dynamically-sized-type.
+//
+// TODO(emilio): If this was some sort of nullable box then this could be made
+// to work with moves, and also reduce memory layout size of stuff, potentially.
+template <typename T>
+struct StyleBox {
+ explicit StyleBox(UniquePtr<T> aPtr) : mRaw(aPtr.release()) {
+ MOZ_DIAGNOSTIC_ASSERT(mRaw);
+ }
+
+ ~StyleBox() {
+ MOZ_DIAGNOSTIC_ASSERT(mRaw);
+ delete mRaw;
+ }
+
+ StyleBox(const StyleBox& aOther) : StyleBox(MakeUnique<T>(*aOther)) {}
+
+ StyleBox& operator=(const StyleBox& aOther) const {
+ delete mRaw;
+ mRaw = MakeUnique<T>(*aOther).release();
+ return *this;
+ }
+
+ const T* operator->() const {
+ MOZ_DIAGNOSTIC_ASSERT(mRaw);
+ return mRaw;
+ }
+
+ const T& operator*() const {
+ MOZ_DIAGNOSTIC_ASSERT(mRaw);
+ return *mRaw;
+ }
+
+ T* operator->() {
+ MOZ_DIAGNOSTIC_ASSERT(mRaw);
+ return mRaw;
+ }
+
+ T& operator*() {
+ MOZ_DIAGNOSTIC_ASSERT(mRaw);
+ return *mRaw;
+ }
+
+ bool operator==(const StyleBox& aOther) const { return *(*this) == *aOther; }
+
+ bool operator!=(const StyleBox& aOther) const { return *(*this) != *aOther; }
+
+ private:
+ T* mRaw;
+};
+
+// Work-around weird cbindgen renaming / avoiding moving stuff outside its
+// namespace.
+
+using StyleImageTracker = dom::ImageTracker;
+using StyleLoader = css::Loader;
+using StyleLoaderReusableStyleSheets = css::LoaderReusableStyleSheets;
+using StyleCallerType = dom::CallerType;
+using StyleSheetParsingMode = css::SheetParsingMode;
+using StyleSheetLoadData = css::SheetLoadData;
+using StyleSheetLoadDataHolder = css::SheetLoadDataHolder;
+using StyleGeckoMallocSizeOf = MallocSizeOf;
+using StyleDomStyleSheet = StyleSheet;
+
+using StyleRawGeckoNode = nsINode;
+using StyleRawGeckoElement = dom::Element;
+using StyleDocument = dom::Document;
+using StyleComputedValues = ComputedStyle;
+using StyleIterationCompositeOperation = dom::IterationCompositeOperation;
+
+using StyleMatrixTransformOperator =
+ nsStyleTransformMatrix::MatrixTransformOperator;
+
+# define SERVO_ARC_TYPE(name_, type_) using Style##type_ = type_;
+# include "mozilla/ServoArcTypeList.h"
+# undef SERVO_ARC_TYPE
+
+# define SERVO_BOXED_TYPE(name_, type_) using Style##type_ = type_;
+# include "mozilla/ServoBoxedTypeList.h"
+# undef SERVO_BOXED_TYPE
+
+using StyleAtomicUsize = std::atomic<size_t>;
+
+} // namespace mozilla
+
+# ifndef HAVE_64BIT_BUILD
+static_assert(sizeof(void*) == 4, "");
+# define SERVO_32_BITS 1
+# endif
+# define CBINDGEN_IS_GECKO
+
+#endif