2019-03-30 23:18:33 +03:00
|
|
|
/* 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"
|
2019-05-09 14:24:57 +03:00
|
|
|
# include "mozilla/IntegerRange.h"
|
|
|
|
# include "mozilla/Span.h"
|
2019-03-30 23:18:33 +03:00
|
|
|
# include "Units.h"
|
|
|
|
# include "mozilla/gfx/Types.h"
|
Bug 1552708 - Use cbindgen for URIs. r=heycam
This doesn't clean up as much as a whole, but it's a step in the right
direction. In particular, it allows us to start using simple bindings for:
* Filters
* Shapes and images, almost. Need to:
* Get rid of the complex -moz- gradient parsing (let
layout.css.simple-moz-gradient.enabled get to release).
* Counters, almost. Need to:
* Share the Attr representation with Gecko, by not using Option<>.
* Just another variant should be enough (ContentItem::{Attr,Prefixedattr},
maybe).
Which in turn allows us to remove a whole lot of bindings in followups to this.
The setup changes a bit. This also removes the double pointer I complained about
while reviewing the shared UA sheet patches. The old setup is:
```
SpecifiedUrl
* CssUrl
* Arc<CssUrlData>
* String
* UrlExtraData
* UrlValueSource
* Arc<CssUrlData>
* load id
* resolved uri
* CORS mode.
* ...
```
The new one removes the double reference to the url data via URLValue, and looks
like:
```
SpecifiedUrl
* CssUrl
* Arc<CssUrlData>
* String
* UrlExtraData
* CorsMode
* LoadData
* load id
* resolved URI
```
The LoadData is the only mutable bit that C++ can change, and is not used from
Rust. Ideally, in the future, we could just use rust-url to resolve the URL
after parsing or something, and make it all immutable. Maybe.
I've verified that this approach still works with the UA sheet patches (via the
LoadDataSource::Lazy).
The reordering of mWillChange is to avoid nsStyleDisplay from going over the
size limit. We want to split it up anyway in bug 1552587, but mBinding gains a
tag member, which means that we were having a bit of extra padding.
One thing I want to explore is to see if we can abuse rustc's non-zero
optimizations to predict the layout from C++, but that's something to explore at
some other point in time and with a lot of care and help from Michael (who sits
next to me and works on rustc ;)).
Differential Revision: https://phabricator.services.mozilla.com/D31742
2019-05-27 14:45:12 +03:00
|
|
|
# include "mozilla/CORSMode.h"
|
2019-03-30 23:18:33 +03:00
|
|
|
# include "mozilla/MemoryReporting.h"
|
|
|
|
# include "mozilla/ServoTypes.h"
|
|
|
|
# include "mozilla/ServoBindingTypes.h"
|
2020-01-22 23:20:38 +03:00
|
|
|
# include "mozilla/Vector.h"
|
2019-03-30 23:18:33 +03:00
|
|
|
# include "nsCSSPropertyID.h"
|
|
|
|
# include "nsCompatibility.h"
|
Bug 1552708 - Use cbindgen for URIs. r=heycam
This doesn't clean up as much as a whole, but it's a step in the right
direction. In particular, it allows us to start using simple bindings for:
* Filters
* Shapes and images, almost. Need to:
* Get rid of the complex -moz- gradient parsing (let
layout.css.simple-moz-gradient.enabled get to release).
* Counters, almost. Need to:
* Share the Attr representation with Gecko, by not using Option<>.
* Just another variant should be enough (ContentItem::{Attr,Prefixedattr},
maybe).
Which in turn allows us to remove a whole lot of bindings in followups to this.
The setup changes a bit. This also removes the double pointer I complained about
while reviewing the shared UA sheet patches. The old setup is:
```
SpecifiedUrl
* CssUrl
* Arc<CssUrlData>
* String
* UrlExtraData
* UrlValueSource
* Arc<CssUrlData>
* load id
* resolved uri
* CORS mode.
* ...
```
The new one removes the double reference to the url data via URLValue, and looks
like:
```
SpecifiedUrl
* CssUrl
* Arc<CssUrlData>
* String
* UrlExtraData
* CorsMode
* LoadData
* load id
* resolved URI
```
The LoadData is the only mutable bit that C++ can change, and is not used from
Rust. Ideally, in the future, we could just use rust-url to resolve the URL
after parsing or something, and make it all immutable. Maybe.
I've verified that this approach still works with the UA sheet patches (via the
LoadDataSource::Lazy).
The reordering of mWillChange is to avoid nsStyleDisplay from going over the
size limit. We want to split it up anyway in bug 1552587, but mBinding gains a
tag member, which means that we were having a bit of extra padding.
One thing I want to explore is to see if we can abuse rustc's non-zero
optimizations to predict the layout from C++, but that's something to explore at
some other point in time and with a lot of care and help from Michael (who sits
next to me and works on rustc ;)).
Differential Revision: https://phabricator.services.mozilla.com/D31742
2019-05-27 14:45:12 +03:00
|
|
|
# include "nsIURI.h"
|
2019-05-09 15:43:19 +03:00
|
|
|
# include <atomic>
|
2019-03-30 23:18:33 +03:00
|
|
|
|
|
|
|
struct RawServoAnimationValueTable;
|
|
|
|
struct RawServoAnimationValueMap;
|
|
|
|
|
|
|
|
class nsAtom;
|
2019-04-04 14:35:16 +03:00
|
|
|
class nsIFrame;
|
2019-03-30 23:18:33 +03:00
|
|
|
class nsINode;
|
Bug 1552708 - Use cbindgen for URIs. r=heycam
This doesn't clean up as much as a whole, but it's a step in the right
direction. In particular, it allows us to start using simple bindings for:
* Filters
* Shapes and images, almost. Need to:
* Get rid of the complex -moz- gradient parsing (let
layout.css.simple-moz-gradient.enabled get to release).
* Counters, almost. Need to:
* Share the Attr representation with Gecko, by not using Option<>.
* Just another variant should be enough (ContentItem::{Attr,Prefixedattr},
maybe).
Which in turn allows us to remove a whole lot of bindings in followups to this.
The setup changes a bit. This also removes the double pointer I complained about
while reviewing the shared UA sheet patches. The old setup is:
```
SpecifiedUrl
* CssUrl
* Arc<CssUrlData>
* String
* UrlExtraData
* UrlValueSource
* Arc<CssUrlData>
* load id
* resolved uri
* CORS mode.
* ...
```
The new one removes the double reference to the url data via URLValue, and looks
like:
```
SpecifiedUrl
* CssUrl
* Arc<CssUrlData>
* String
* UrlExtraData
* CorsMode
* LoadData
* load id
* resolved URI
```
The LoadData is the only mutable bit that C++ can change, and is not used from
Rust. Ideally, in the future, we could just use rust-url to resolve the URL
after parsing or something, and make it all immutable. Maybe.
I've verified that this approach still works with the UA sheet patches (via the
LoadDataSource::Lazy).
The reordering of mWillChange is to avoid nsStyleDisplay from going over the
size limit. We want to split it up anyway in bug 1552587, but mBinding gains a
tag member, which means that we were having a bit of extra padding.
One thing I want to explore is to see if we can abuse rustc's non-zero
optimizations to predict the layout from C++, but that's something to explore at
some other point in time and with a lot of care and help from Michael (who sits
next to me and works on rustc ;)).
Differential Revision: https://phabricator.services.mozilla.com/D31742
2019-05-27 14:45:12 +03:00
|
|
|
class nsIContent;
|
2019-03-30 23:18:33 +03:00
|
|
|
class nsCSSPropertyIDSet;
|
|
|
|
class nsPresContext;
|
|
|
|
class nsSimpleContentList;
|
Bug 1552708 - Use cbindgen for URIs. r=heycam
This doesn't clean up as much as a whole, but it's a step in the right
direction. In particular, it allows us to start using simple bindings for:
* Filters
* Shapes and images, almost. Need to:
* Get rid of the complex -moz- gradient parsing (let
layout.css.simple-moz-gradient.enabled get to release).
* Counters, almost. Need to:
* Share the Attr representation with Gecko, by not using Option<>.
* Just another variant should be enough (ContentItem::{Attr,Prefixedattr},
maybe).
Which in turn allows us to remove a whole lot of bindings in followups to this.
The setup changes a bit. This also removes the double pointer I complained about
while reviewing the shared UA sheet patches. The old setup is:
```
SpecifiedUrl
* CssUrl
* Arc<CssUrlData>
* String
* UrlExtraData
* UrlValueSource
* Arc<CssUrlData>
* load id
* resolved uri
* CORS mode.
* ...
```
The new one removes the double reference to the url data via URLValue, and looks
like:
```
SpecifiedUrl
* CssUrl
* Arc<CssUrlData>
* String
* UrlExtraData
* CorsMode
* LoadData
* load id
* resolved URI
```
The LoadData is the only mutable bit that C++ can change, and is not used from
Rust. Ideally, in the future, we could just use rust-url to resolve the URL
after parsing or something, and make it all immutable. Maybe.
I've verified that this approach still works with the UA sheet patches (via the
LoadDataSource::Lazy).
The reordering of mWillChange is to avoid nsStyleDisplay from going over the
size limit. We want to split it up anyway in bug 1552587, but mBinding gains a
tag member, which means that we were having a bit of extra padding.
One thing I want to explore is to see if we can abuse rustc's non-zero
optimizations to predict the layout from C++, but that's something to explore at
some other point in time and with a lot of care and help from Michael (who sits
next to me and works on rustc ;)).
Differential Revision: https://phabricator.services.mozilla.com/D31742
2019-05-27 14:45:12 +03:00
|
|
|
class imgRequestProxy;
|
2019-03-30 23:18:33 +03:00
|
|
|
struct nsCSSValueSharedList;
|
|
|
|
struct nsTimingFunction;
|
|
|
|
|
|
|
|
class gfxFontFeatureValueSet;
|
|
|
|
struct gfxFontFeature;
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gfx {
|
|
|
|
struct FontVariation;
|
2020-01-22 23:18:40 +03:00
|
|
|
} // namespace gfx
|
2019-03-30 23:18:33 +03:00
|
|
|
} // 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 {
|
|
|
|
|
2019-04-04 14:35:16 +03:00
|
|
|
class ComputedStyle;
|
|
|
|
|
2019-03-30 23:18:33 +03:00
|
|
|
using Matrix4x4Components = float[16];
|
|
|
|
using StyleMatrix4x4Components = Matrix4x4Components;
|
|
|
|
|
2019-11-20 08:46:56 +03:00
|
|
|
// 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;
|
|
|
|
|
2019-03-30 23:18:33 +03:00
|
|
|
struct Keyframe;
|
|
|
|
struct PropertyStyleAnimationValuePair;
|
|
|
|
|
|
|
|
using ComputedKeyframeValues = nsTArray<PropertyStyleAnimationValuePair>;
|
|
|
|
|
|
|
|
class ComputedStyle;
|
2020-04-28 04:18:44 +03:00
|
|
|
enum LogicalAxis : uint8_t;
|
2019-03-30 23:18:33 +03:00
|
|
|
class SeenPtrs;
|
|
|
|
class SharedFontList;
|
|
|
|
class StyleSheet;
|
|
|
|
class WritingMode;
|
|
|
|
class ServoElementSnapshotTable;
|
|
|
|
|
2019-05-24 14:26:01 +03:00
|
|
|
template <typename T>
|
2019-05-09 15:43:19 +03:00
|
|
|
struct StyleForgottenArcSlicePtr;
|
|
|
|
|
2019-03-30 23:18:33 +03:00
|
|
|
struct AnimationPropertySegment;
|
2020-05-21 09:45:10 +03:00
|
|
|
struct AspectRatio;
|
2019-03-30 23:18:33 +03:00
|
|
|
struct ComputedTiming;
|
|
|
|
struct URLExtraData;
|
|
|
|
|
|
|
|
enum HalfCorner : uint8_t;
|
|
|
|
enum LogicalSide : uint8_t;
|
|
|
|
enum class PseudoStyleType : uint8_t;
|
|
|
|
enum class OriginFlags : uint8_t;
|
2020-12-24 01:42:55 +03:00
|
|
|
enum class UseBoxSizing : uint8_t;
|
2019-03-30 23:18:33 +03:00
|
|
|
|
|
|
|
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;
|
2020-02-07 23:36:34 +03:00
|
|
|
class ImageTracker;
|
|
|
|
|
2019-03-30 23:18:33 +03:00
|
|
|
} // namespace dom
|
|
|
|
|
2020-01-22 23:18:40 +03:00
|
|
|
namespace ipc {
|
|
|
|
class ByteBuf;
|
|
|
|
} // namespace ipc
|
|
|
|
|
2019-07-02 02:35:50 +03:00
|
|
|
// 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;
|
|
|
|
}
|
|
|
|
|
2019-12-17 08:10:15 +03:00
|
|
|
StyleBox(const StyleBox& aOther) : StyleBox(MakeUnique<T>(*aOther)) {}
|
|
|
|
|
|
|
|
StyleBox& operator=(const StyleBox& aOther) const {
|
|
|
|
delete mRaw;
|
|
|
|
mRaw = MakeUnique<T>(*aOther).release();
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2019-07-02 02:35:50 +03:00
|
|
|
const T* operator->() const {
|
|
|
|
MOZ_DIAGNOSTIC_ASSERT(mRaw);
|
|
|
|
return mRaw;
|
|
|
|
}
|
|
|
|
|
|
|
|
const T& operator*() const {
|
|
|
|
MOZ_DIAGNOSTIC_ASSERT(mRaw);
|
|
|
|
return *mRaw;
|
|
|
|
}
|
|
|
|
|
2019-12-17 08:10:15 +03:00
|
|
|
T* operator->() {
|
|
|
|
MOZ_DIAGNOSTIC_ASSERT(mRaw);
|
|
|
|
return mRaw;
|
|
|
|
}
|
|
|
|
|
|
|
|
T& operator*() {
|
|
|
|
MOZ_DIAGNOSTIC_ASSERT(mRaw);
|
|
|
|
return *mRaw;
|
2019-07-02 02:35:50 +03:00
|
|
|
}
|
|
|
|
|
2019-12-17 08:10:15 +03:00
|
|
|
bool operator==(const StyleBox& aOther) const { return *(*this) == *aOther; }
|
|
|
|
|
|
|
|
bool operator!=(const StyleBox& aOther) const { return *(*this) != *aOther; }
|
2019-07-02 02:35:50 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
T* mRaw;
|
|
|
|
};
|
|
|
|
|
2019-03-30 23:18:33 +03:00
|
|
|
// Work-around weird cbindgen renaming / avoiding moving stuff outside its
|
|
|
|
// namespace.
|
|
|
|
|
2020-02-07 23:36:34 +03:00
|
|
|
using StyleImageTracker = dom::ImageTracker;
|
2019-03-30 23:18:33 +03:00
|
|
|
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
|
|
|
|
|
2019-05-09 15:43:19 +03:00
|
|
|
using StyleAtomicUsize = std::atomic<size_t>;
|
|
|
|
|
2019-03-30 23:18:33 +03:00
|
|
|
} // namespace mozilla
|
|
|
|
|
2020-01-13 16:23:22 +03:00
|
|
|
# ifndef HAVE_64BIT_BUILD
|
|
|
|
static_assert(sizeof(void*) == 4, "");
|
|
|
|
# define SERVO_32_BITS 1
|
|
|
|
# endif
|
2020-02-10 23:02:31 +03:00
|
|
|
# define CBINDGEN_IS_GECKO
|
2020-01-13 16:23:22 +03:00
|
|
|
|
2019-03-30 23:18:33 +03:00
|
|
|
#endif
|