--- a/dom/base/nsWindowMemoryReporter.cpp
+++ b/dom/base/nsWindowMemoryReporter.cpp
@@ -474,17 +474,17 @@ CollectWindowReports(nsGlobalWindowInner
REPORT_SUM_SIZE(
"/layout/frames/sundries", frameSundriesSize,
"The sum of all memory used by frames which were too small to be shown "
"individually.");
}
// This is the style structs.
size_t styleSundriesSize = 0;
-#define STYLE_STRUCT(name_, cb_) \
+#define STYLE_STRUCT(name_) \
{ \
size_t size = windowSizes.mStyleSizes.NS_STYLE_SIZES_FIELD(name_); \
if (size < STYLE_SUNDRIES_THRESHOLD) { \
styleSundriesSize += size; \
} else { \
REPORT_SUM_SIZE( \
"/layout/style-structs/" # name_, size, \
"Memory used by the " #name_ " style structs within a window."); \
@@ -682,17 +682,17 @@ nsWindowMemoryReporter::CollectReports(n
#undef FRAME_ID
#undef ABSTRACT_FRAME_ID
REPORT("window-objects/layout/frames", frameTotal,
"Memory used for layout frames within windows. "
"This is the sum of all windows' 'layout/frames/' numbers.");
size_t styleTotal = 0;
-#define STYLE_STRUCT(name_, cb_) \
+#define STYLE_STRUCT(name_) \
styleTotal += \
windowTotalSizes.mStyleSizes.NS_STYLE_SIZES_FIELD(name_);
#define STYLE_STRUCT_LIST_IGNORE_VARIABLES
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
#undef STYLE_STRUCT_LIST_IGNORE_VARIABLES
REPORT("window-objects/layout/style-structs", styleTotal,
--- a/dom/base/nsWindowSizes.h
+++ b/dom/base/nsWindowSizes.h
@@ -47,51 +47,51 @@ public:
#define DECL_SIZE(kind, mSize) size_t mSize;
#define NS_STYLE_SIZES_FIELD(name_) mStyle##name_
struct nsStyleSizes
{
nsStyleSizes()
:
- #define STYLE_STRUCT(name_, cb_) \
+ #define STYLE_STRUCT(name_) \
NS_STYLE_SIZES_FIELD(name_)(0),
#define STYLE_STRUCT_LIST_IGNORE_VARIABLES
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
#undef STYLE_STRUCT_LIST_IGNORE_VARIABLES
dummy()
{}
void addToTabSizes(nsTabSizes* aSizes) const
{
- #define STYLE_STRUCT(name_, cb_) \
+ #define STYLE_STRUCT(name_) \
aSizes->add(nsTabSizes::Style, NS_STYLE_SIZES_FIELD(name_));
#define STYLE_STRUCT_LIST_IGNORE_VARIABLES
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
#undef STYLE_STRUCT_LIST_IGNORE_VARIABLES
}
size_t getTotalSize() const
{
size_t total = 0;
- #define STYLE_STRUCT(name_, cb_) \
+ #define STYLE_STRUCT(name_) \
total += NS_STYLE_SIZES_FIELD(name_);
#define STYLE_STRUCT_LIST_IGNORE_VARIABLES
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
#undef STYLE_STRUCT_LIST_IGNORE_VARIABLES
return total;
}
- #define STYLE_STRUCT(name_, cb_) \
+ #define STYLE_STRUCT(name_) \
size_t NS_STYLE_SIZES_FIELD(name_);
#define STYLE_STRUCT_LIST_IGNORE_VARIABLES
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
#undef STYLE_STRUCT_LIST_IGNORE_VARIABLES
// Present just to absorb the trailing comma in the constructor.
int dummy;
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -827,29 +827,28 @@ public:
* const nsStyleColor* StyleColor();
*
* Callers outside of libxul should use nsIDOMWindow::GetComputedStyle()
* instead of these accessors.
*
* Callers can use Style*WithOptionalParam if they're in a function that
* accepts an *optional* pointer the style struct.
*/
- #define STYLE_STRUCT(name_, checkdata_cb_) \
- const nsStyle##name_ * Style##name_ () const MOZ_NONNULL_RETURN { \
- NS_ASSERTION(mComputedStyle, "No style found!"); \
- return mComputedStyle->Style##name_ (); \
- } \
- const nsStyle##name_ * Style##name_##WithOptionalParam( \
- const nsStyle##name_ * aStyleStruct) const \
- MOZ_NONNULL_RETURN { \
- if (aStyleStruct) { \
- MOZ_ASSERT(aStyleStruct == Style##name_()); \
- return aStyleStruct; \
- } \
- return Style##name_(); \
+ #define STYLE_STRUCT(name_) \
+ const nsStyle##name_ * Style##name_ () const MOZ_NONNULL_RETURN { \
+ NS_ASSERTION(mComputedStyle, "No style found!"); \
+ return mComputedStyle->Style##name_ (); \
+ } \
+ const nsStyle##name_ * Style##name_##WithOptionalParam( \
+ const nsStyle##name_ * aStyleStruct) const MOZ_NONNULL_RETURN { \
+ if (aStyleStruct) { \
+ MOZ_ASSERT(aStyleStruct == Style##name_()); \
+ return aStyleStruct; \
+ } \
+ return Style##name_(); \
}
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
/** Also forward GetVisitedDependentColor to the style */
template<typename T, typename S>
nscolor GetVisitedDependentColor(T S::* aField)
{ return mComputedStyle->GetVisitedDependentColor(aField); }
--- a/layout/style/ComputedStyle.cpp
+++ b/layout/style/ComputedStyle.cpp
@@ -46,24 +46,24 @@ namespace mozilla {
//----------------------------------------------------------------------
#ifdef DEBUG
// Check that the style struct IDs are in the same order as they are
// in nsStyleStructList.h, since when we set up the IDs, we include
// the inherited and reset structs spearately from nsStyleStructList.h
enum DebugStyleStruct {
-#define STYLE_STRUCT(name, checkdata_cb) eDebugStyleStruct_##name,
+#define STYLE_STRUCT(name) eDebugStyleStruct_##name,
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
};
-#define STYLE_STRUCT(name, checkdata_cb) \
+#define STYLE_STRUCT(name) \
static_assert(static_cast<int>(eDebugStyleStruct_##name) == \
- static_cast<int>(eStyleStruct_##name), \
+ static_cast<int>(eStyleStruct_##name), \
"Style struct IDs are not declared in order?");
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
#endif
ComputedStyle::ComputedStyle(nsPresContext* aPresContext,
@@ -205,20 +205,20 @@ ComputedStyle::CalcStyleDifference(Compu
#undef DO_STRUCT_DIFFERENCE_WITH_ARGS
#undef EXPAND
MOZ_ASSERT(styleStructCount == nsStyleStructID_Length,
"missing a call to DO_STRUCT_DIFFERENCE");
#ifdef DEBUG
#define STYLE_STRUCT_LIST_IGNORE_VARIABLES
- #define STYLE_STRUCT(name_, callback_) \
- MOZ_ASSERT(!!(structsFound & NS_STYLE_INHERIT_BIT(name_)) == \
- (PEEK(name_) != nullptr), \
- "PeekStyleData results must not change in the middle of " \
+ #define STYLE_STRUCT(name_) \
+ MOZ_ASSERT(!!(structsFound & NS_STYLE_INHERIT_BIT(name_)) == \
+ (PEEK(name_) != nullptr), \
+ "PeekStyleData results must not change in the middle of " \
"difference calculation.");
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
#undef STYLE_STRUCT_LIST_IGNORE_VARIABLES
#endif
// We check for struct pointer equality here rather than as part of the
// DO_STRUCT_DIFFERENCE calls, since those calls can result in structs
@@ -226,22 +226,22 @@ ComputedStyle::CalcStyleDifference(Compu
// getting computed by later DO_STRUCT_DIFFERENCE calls (which can
// happen when the nsRuleNode::ComputeXXXData method looks up another
// struct.) This is important for callers in RestyleManager that
// need to know the equality or not of the final set of cached struct
// pointers.
*aSamePointerStructs = 0;
#define STYLE_STRUCT_LIST_IGNORE_VARIABLES
-#define STYLE_STRUCT(name_, callback_) \
- { \
- const nsStyle##name_* data = PEEK(name_); \
- if (!data || data == aNewContext->ThreadsafeStyle##name_()) { \
- *aSamePointerStructs |= NS_STYLE_INHERIT_BIT(name_); \
- } \
+#define STYLE_STRUCT(name_) \
+ { \
+ const nsStyle##name_* data = PEEK(name_); \
+ if (!data || data == aNewContext->ThreadsafeStyle##name_()) { \
+ *aSamePointerStructs |= NS_STYLE_INHERIT_BIT(name_); \
+ } \
}
#include "nsStyleStructList.h"
#undef STYLE_STRUCT_LIST_IGNORE_VARIABLES
#undef STYLE_STRUCT
// Note that we do not check whether this->RelevantLinkVisited() !=
// aNewContext->RelevantLinkVisited(); we don't need to since
// nsCSSFrameConstructor::DoContentStateChanged always adds
@@ -434,33 +434,33 @@ ComputedStyle::CombineVisitedColors(nsco
NS_GET_B(colorColor), NS_GET_A(alphaColor));
}
#ifdef DEBUG
/* static */ const char*
ComputedStyle::StructName(nsStyleStructID aSID)
{
switch (aSID) {
-#define STYLE_STRUCT(name_, checkdata_cb) \
- case eStyleStruct_##name_: \
+#define STYLE_STRUCT(name_) \
+ case eStyleStruct_##name_: \
return #name_;
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
default:
return "Unknown";
}
}
/* static */ bool
ComputedStyle::LookupStruct(const nsACString& aName, nsStyleStructID& aResult)
{
if (false)
;
-#define STYLE_STRUCT(name_, checkdata_cb_) \
- else if (aName.EqualsLiteral(#name_)) \
+#define STYLE_STRUCT(name_) \
+ else if (aName.EqualsLiteral(#name_)) \
aResult = eStyleStruct_##name_;
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
else
return false;
return true;
}
#endif // DEBUG
--- a/layout/style/ComputedStyle.h
+++ b/layout/style/ComputedStyle.h
@@ -242,42 +242,42 @@ public:
/**
* Define typesafe getter functions for each style struct by
* preprocessing the list of style structs. These functions are the
* preferred way to get style data. The macro creates functions like:
* const nsStyleBorder* StyleBorder();
* const nsStyleColor* StyleColor();
*/
- #define STYLE_STRUCT(name_, checkdata_cb_) \
+ #define STYLE_STRUCT(name_) \
inline const nsStyle##name_ * Style##name_() MOZ_NONNULL_RETURN;
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
/**
* Equivalent to StyleFoo(), except that we skip the cache write during the
* servo traversal. This can cause incorrect behavior if used improperly,
* since we won't record that layout potentially depends on the values in
* this style struct. Use with care.
*/
- #define STYLE_STRUCT(name_, checkdata_cb_) \
+ #define STYLE_STRUCT(name_) \
inline const nsStyle##name_ * ThreadsafeStyle##name_();
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
/**
* PeekStyle* is like Style* but doesn't trigger style
* computation if the data is not cached on either the style context
* or the rule node.
*
* Perhaps this shouldn't be a public ComputedStyle API.
*/
- #define STYLE_STRUCT(name_, checkdata_cb_) \
+ #define STYLE_STRUCT(name_) \
inline const nsStyle##name_ * PeekStyle##name_();
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
/**
* Compute the style changes needed during restyling when this style
* context is being replaced by aNewContext. (This is nonsymmetric since
* we optimize by skipping comparison for styles that have never been
@@ -360,21 +360,21 @@ protected:
nsPresContext* mPresContext;
ServoComputedData mSource;
// A cache of anonymous box and lazy pseudo styles inheriting from this style.
CachedInheritingStyles mCachedInheritingStyles;
// Helper functions for GetStyle* and PeekStyle*
- #define STYLE_STRUCT_INHERITED(name_, checkdata_cb_) \
- template<bool aComputeData> \
+ #define STYLE_STRUCT_INHERITED(name_) \
+ template<bool aComputeData> \
const nsStyle##name_ * DoGetStyle##name_();
- #define STYLE_STRUCT_RESET(name_, checkdata_cb_) \
- template<bool aComputeData> \
+ #define STYLE_STRUCT_RESET(name_) \
+ template<bool aComputeData> \
const nsStyle##name_ * DoGetStyle##name_();
#include "nsStyleStructList.h"
#undef STYLE_STRUCT_RESET
#undef STYLE_STRUCT_INHERITED
// If this style context is for a pseudo-element or anonymous box,
// the relevant atom.
--- a/layout/style/ComputedStyleInlines.h
+++ b/layout/style/ComputedStyleInlines.h
@@ -16,71 +16,71 @@
#include "mozilla/ComputedStyle.h"
#include "mozilla/ComputedStyle.h"
#include "mozilla/ServoUtils.h"
#include "mozilla/ServoBindings.h"
namespace mozilla {
-#define STYLE_STRUCT(name_, checkdata_cb_) \
-const nsStyle##name_ * \
-ComputedStyle::Style##name_() { \
- return DoGetStyle##name_<true>(); \
-} \
-const nsStyle##name_ * \
-ComputedStyle::ThreadsafeStyle##name_() { \
- if (mozilla::ServoStyleSet::IsInServoTraversal()) { \
- return ComputedData()->GetStyle##name_(); \
- } \
- return Style##name_(); \
-} \
-const nsStyle##name_ * ComputedStyle::PeekStyle##name_() { \
- return DoGetStyle##name_<false>(); \
+#define STYLE_STRUCT(name_) \
+const nsStyle##name_ * \
+ComputedStyle::Style##name_() { \
+ return DoGetStyle##name_<true>(); \
+} \
+const nsStyle##name_ * \
+ComputedStyle::ThreadsafeStyle##name_() { \
+ if (mozilla::ServoStyleSet::IsInServoTraversal()) { \
+ return ComputedData()->GetStyle##name_(); \
+ } \
+ return Style##name_(); \
+} \
+const nsStyle##name_ * ComputedStyle::PeekStyle##name_() { \
+ return DoGetStyle##name_<false>(); \
}
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
// Helper functions for GetStyle* and PeekStyle*
-#define STYLE_STRUCT_INHERITED(name_, checkdata_cb_) \
-template<bool aComputeData> \
+#define STYLE_STRUCT_INHERITED(name_) \
+template<bool aComputeData> \
const nsStyle##name_ * ComputedStyle::DoGetStyle##name_() { \
- const bool needToCompute = !(mBits & NS_STYLE_INHERIT_BIT(name_)); \
- if (!aComputeData && needToCompute) { \
- return nullptr; \
- } \
- \
- const nsStyle##name_* data = ComputedData()->GetStyle##name_(); \
- \
- /* perform any remaining main thread work on the struct */ \
- if (needToCompute) { \
- MOZ_ASSERT(NS_IsMainThread()); \
- MOZ_ASSERT(!mozilla::ServoStyleSet::IsInServoTraversal()); \
- const_cast<nsStyle##name_*>(data)->FinishStyle(PresContext(), nullptr); \
- /* the ComputedStyle owns the struct */ \
- AddStyleBit(NS_STYLE_INHERIT_BIT(name_)); \
- } \
- return data; \
+ const bool needToCompute = !(mBits & NS_STYLE_INHERIT_BIT(name_)); \
+ if (!aComputeData && needToCompute) { \
+ return nullptr; \
+ } \
+ \
+ const nsStyle##name_* data = ComputedData()->GetStyle##name_(); \
+ \
+ /* perform any remaining main thread work on the struct */ \
+ if (needToCompute) { \
+ MOZ_ASSERT(NS_IsMainThread()); \
+ MOZ_ASSERT(!mozilla::ServoStyleSet::IsInServoTraversal()); \
+ const_cast<nsStyle##name_*>(data)->FinishStyle(PresContext(), nullptr); \
+ /* the ComputedStyle owns the struct */ \
+ AddStyleBit(NS_STYLE_INHERIT_BIT(name_)); \
+ } \
+ return data; \
}
-#define STYLE_STRUCT_RESET(name_, checkdata_cb_) \
-template<bool aComputeData> \
-const nsStyle##name_ * ComputedStyle::DoGetStyle##name_() { \
- const bool needToCompute = !(mBits & NS_STYLE_INHERIT_BIT(name_)); \
- if (!aComputeData && needToCompute) { \
- return nullptr; \
- } \
- const nsStyle##name_* data = ComputedData()->GetStyle##name_(); \
- /* perform any remaining main thread work on the struct */ \
- if (needToCompute) { \
- const_cast<nsStyle##name_*>(data)->FinishStyle(PresContext(), nullptr); \
- /* the ComputedStyle owns the struct */ \
- AddStyleBit(NS_STYLE_INHERIT_BIT(name_)); \
- } \
- return data; \
+#define STYLE_STRUCT_RESET(name_) \
+template<bool aComputeData> \
+const nsStyle##name_ * ComputedStyle::DoGetStyle##name_() { \
+ const bool needToCompute = !(mBits & NS_STYLE_INHERIT_BIT(name_)); \
+ if (!aComputeData && needToCompute) { \
+ return nullptr; \
+ } \
+ const nsStyle##name_* data = ComputedData()->GetStyle##name_(); \
+ /* perform any remaining main thread work on the struct */ \
+ if (needToCompute) { \
+ const_cast<nsStyle##name_*>(data)->FinishStyle(PresContext(), nullptr); \
+ /* the ComputedStyle owns the struct */ \
+ AddStyleBit(NS_STYLE_INHERIT_BIT(name_)); \
+ } \
+ return data; \
}
#include "nsStyleStructList.h"
#undef STYLE_STRUCT_RESET
#undef STYLE_STRUCT_INHERITED
void
ComputedStyle::StartBackgroundImageLoads()
{
@@ -91,17 +91,17 @@ ComputedStyle::StartBackgroundImageLoads
void
ComputedStyle::ResolveSameStructsAs(const ComputedStyle* aOther)
{
// Only resolve structs that are not already resolved in this struct.
uint64_t ourBits = mBits & NS_STYLE_INHERIT_MASK;
uint64_t otherBits = aOther->mBits & NS_STYLE_INHERIT_MASK;
uint64_t newBits = otherBits & ~ourBits & NS_STYLE_INHERIT_MASK;
-#define STYLE_STRUCT(name_, checkdata_cb) \
+#define STYLE_STRUCT(name_) \
if (nsStyle##name_::kHasFinishStyle && \
(newBits & NS_STYLE_INHERIT_BIT(name_))) { \
const nsStyle##name_* data = ComputedData()->GetStyle##name_(); \
const nsStyle##name_* oldData = aOther->ComputedData()->GetStyle##name_(); \
const_cast<nsStyle##name_*>(data)->FinishStyle(mPresContext, oldData); \
}
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -216,17 +216,17 @@ MOZ_DEFINE_MALLOC_ENCLOSING_SIZE_OF(Serv
void
ServoComputedData::AddSizeOfExcludingThis(nsWindowSizes& aSizes) const
{
// Note: GetStyleFoo() returns a pointer to an nsStyleFoo that sits within a
// servo_arc::Arc, i.e. it is preceded by a word-sized refcount. So we need
// to measure it with a function that can handle an interior pointer. We use
// ServoStyleStructsEnclosingMallocSizeOf to clearly identify in DMD's
// output the memory measured here.
-#define STYLE_STRUCT(name_, cb_) \
+#define STYLE_STRUCT(name_) \
static_assert(alignof(nsStyle##name_) <= sizeof(size_t), \
"alignment will break AddSizeOfExcludingThis()"); \
const void* p##name_ = GetStyle##name_(); \
if (!aSizes.mState.HaveSeenPtr(p##name_)) { \
aSizes.mStyleSizes.NS_STYLE_SIZES_FIELD(name_) += \
ServoStyleStructsMallocEnclosingSizeOf(p##name_); \
}
#define STYLE_STRUCT_LIST_IGNORE_VARIABLES
@@ -2629,17 +2629,17 @@ Gecko_CSSCounterStyle_GetCssText(const n
MOZ_ASSERT(NS_IsMainThread());
aRule->GetCssText(*aResult);
}
NS_IMPL_FFI_REFCOUNTING(nsCSSCounterStyleRule, CSSCounterStyleRule);
NS_IMPL_THREADSAFE_FFI_REFCOUNTING(nsCSSValueSharedList, CSSValueSharedList);
-#define STYLE_STRUCT(name, checkdata_cb) \
+#define STYLE_STRUCT(name) \
\
void \
Gecko_Construct_Default_nsStyle##name(nsStyle##name* ptr, \
const nsPresContext* pres_context) \
{ \
new (ptr) nsStyle##name(pres_context); \
} \
\
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -77,22 +77,22 @@ class nsXBLBinding;
#ifdef NIGHTLY_BUILD
const bool GECKO_IS_NIGHTLY = true;
#else
const bool GECKO_IS_NIGHTLY = false;
#endif
namespace mozilla {
- #define STYLE_STRUCT(name_, checkdata_cb_) struct Gecko##name_ {nsStyle##name_ gecko;};
+ #define STYLE_STRUCT(name_) struct Gecko##name_ {nsStyle##name_ gecko;};
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
}
-#define STYLE_STRUCT(name_, checkdata_cb_) \
+#define STYLE_STRUCT(name_) \
const nsStyle##name_* ServoComputedData::GetStyle##name_() const { return &name_.mPtr->gecko; }
#define STYLE_STRUCT_LIST_IGNORE_VARIABLES
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
#undef STYLE_STRUCT_LIST_IGNORE_VARIABLES
#define NS_DECL_THREADSAFE_FFI_REFCOUNTING(class_, name_) \
void Gecko_AddRef##name_##ArbitraryThread(class_* aPtr); \
@@ -652,22 +652,22 @@ nscolor Gecko_GetLookAndFeelSystemColor(
void Gecko_AddPropertyToSet(nsCSSPropertyIDSetBorrowedMut, nsCSSPropertyID);
// Register a namespace and get a namespace id.
// Returns -1 on error (OOM)
int32_t Gecko_RegisterNamespace(nsAtom* ns);
// Style-struct management.
-#define STYLE_STRUCT(name, checkdata_cb) \
- void Gecko_Construct_Default_nsStyle##name( \
- nsStyle##name* ptr, \
- RawGeckoPresContextBorrowed pres_context); \
- void Gecko_CopyConstruct_nsStyle##name(nsStyle##name* ptr, \
- const nsStyle##name* other); \
+#define STYLE_STRUCT(name) \
+ void Gecko_Construct_Default_nsStyle##name( \
+ nsStyle##name* ptr, \
+ RawGeckoPresContextBorrowed pres_context); \
+ void Gecko_CopyConstruct_nsStyle##name(nsStyle##name* ptr, \
+ const nsStyle##name* other); \
void Gecko_Destroy_nsStyle##name(nsStyle##name* ptr);
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
void Gecko_RegisterProfilerThread(const char* name);
void Gecko_UnregisterProfilerThread();
bool Gecko_DocumentRule_UseForPresentation(RawGeckoPresContextBorrowed,
--- a/layout/style/ServoTypes.h
+++ b/layout/style/ServoTypes.h
@@ -4,17 +4,17 @@
* 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_ServoTypes_h
#define mozilla_ServoTypes_h
#include "mozilla/TypedEnumBits.h"
-#define STYLE_STRUCT(name_, checkdata_cb_) struct nsStyle##name_;
+#define STYLE_STRUCT(name_) struct nsStyle##name_;
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
/*
* Type definitions used to interact with Servo. This gets included by nsINode,
* so don't add significant include dependencies to this file.
*/
@@ -158,17 +158,17 @@ struct ServoRawOffsetArc {
// managed by the Rust code
T* mPtr;
};
struct ServoComputedValueFlags {
uint16_t mFlags;
};
-#define STYLE_STRUCT(name_, checkdata_cb_) struct Gecko##name_;
+#define STYLE_STRUCT(name_) struct Gecko##name_;
#define STYLE_STRUCT_LIST_IGNORE_VARIABLES
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
#undef STYLE_STRUCT_LIST_IGNORE_VARIABLES
// These measurements are obtained for both the UA cache and the Stylist, but
// not all the fields are used in both cases.
class ServoStyleSetSizes
@@ -211,17 +211,17 @@ struct ServoComputedDataForgotten
class ServoComputedData
{
friend class mozilla::ComputedStyle;
public:
// Constructs via memcpy. Will not move out of aValue.
explicit ServoComputedData(const ServoComputedDataForgotten aValue);
-#define STYLE_STRUCT(name_, checkdata_cb_) \
+#define STYLE_STRUCT(name_) \
mozilla::ServoRawOffsetArc<mozilla::Gecko##name_> name_; \
inline const nsStyle##name_* GetStyle##name_() const;
#define STYLE_STRUCT_LIST_IGNORE_VARIABLES
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
#undef STYLE_STRUCT_LIST_IGNORE_VARIABLES
const nsStyleVariables* GetStyleVariables() const;
deleted file mode 100755
--- a/layout/style/generate-stylestructlist.py
+++ /dev/null
@@ -1,169 +0,0 @@
-#!/usr/bin/env python
-
-# 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/.
-
-# This script generates nsStyleStructList.h, which contains macro invocations
-# that can be used for three things:
-#
-# 1. To generate code for each inherited style struct.
-# 2. To generate code for each reset style struct.
-# 3. To generate the dependency of each style struct.
-
-from __future__ import print_function
-
-import math
-
-NORMAL_DEP = ["Variables"]
-COLOR_DEP = ["Color"]
-LENGTH_DEP = ["Font", "Visibility"]
-
-# List of style structs and their corresponding Check callback functions,
-# if any.
-STYLE_STRUCTS = [("INHERITED",) + x for x in [
- # Inherited style structs.
- ("Font", "CheckFontCallback", NORMAL_DEP + ["Visibility"]),
- ("Color", "CheckColorCallback", NORMAL_DEP),
- ("List", "nullptr", NORMAL_DEP + LENGTH_DEP),
- ("Text", "CheckTextCallback", NORMAL_DEP + LENGTH_DEP + COLOR_DEP),
- ("Visibility", "nullptr", NORMAL_DEP),
- ("UserInterface", "nullptr", NORMAL_DEP),
- ("TableBorder", "nullptr", NORMAL_DEP + LENGTH_DEP),
- ("SVG", "nullptr", NORMAL_DEP + LENGTH_DEP + COLOR_DEP),
- ("Variables", "CheckVariablesCallback",[]),
-]] + [("RESET",) + x for x in [
- # Reset style structs.
- ("Background", "nullptr", NORMAL_DEP + LENGTH_DEP + COLOR_DEP),
- ("Position", "nullptr", NORMAL_DEP + LENGTH_DEP),
- ("TextReset", "nullptr", NORMAL_DEP + LENGTH_DEP + COLOR_DEP),
- ("Display", "nullptr", NORMAL_DEP + LENGTH_DEP),
- ("Content", "nullptr", NORMAL_DEP + LENGTH_DEP),
- ("UIReset", "nullptr", NORMAL_DEP + LENGTH_DEP),
- ("Table", "nullptr", NORMAL_DEP),
- ("Margin", "nullptr", NORMAL_DEP + LENGTH_DEP),
- ("Padding", "nullptr", NORMAL_DEP + LENGTH_DEP),
- ("Border", "nullptr", NORMAL_DEP + LENGTH_DEP + COLOR_DEP),
- ("Outline", "nullptr", NORMAL_DEP + LENGTH_DEP + COLOR_DEP),
- ("XUL", "nullptr", NORMAL_DEP),
- ("SVGReset", "nullptr", NORMAL_DEP + LENGTH_DEP + COLOR_DEP),
- ("Column", "nullptr", NORMAL_DEP + LENGTH_DEP + COLOR_DEP),
- ("Effects", "nullptr", NORMAL_DEP + LENGTH_DEP + COLOR_DEP),
-]]
-
-
-# ---- Generate nsStyleStructList.h ----
-
-count = len(STYLE_STRUCTS)
-
-# Check for problems with style struct dependencies
-resolved_items = []
-# This whole loop tries to sort the style structs in topological order
-# according to the dependencies. A topological order exists iff there
-# are no cyclic dependencies between the style structs. It resolves one
-# struct each iteration, and append the resolved one to |resolved_items|.
-for i in range(count):
- # This inner loop picks one style struct which does not have
- # unsolved dependencies. If nothing can be picked, then we
- # must have some cyclic dependencies.
- for j in range(count):
- _, name, _, dependencies = STYLE_STRUCTS[j]
- if name in resolved_items:
- continue
- # Check whether all dependencies of this item have been placed
- for dep in dependencies:
- if dep not in resolved_items:
- break
- else:
- resolved_items.append(name)
- break
- else:
- import sys
- print("ERROR: Cannot resolve style struct dependencies", file=sys.stderr)
- print("Resolved items:", " ".join(resolved_items), file=sys.stderr)
- unsolved_items = [name for _, name, _, _ in STYLE_STRUCTS
- if name not in resolved_items]
- print("There exist cyclic dependencies between " +
- "the following structs:", " ".join(unsolved_items), file=sys.stderr)
- exit(1)
-
-def printEntry(header, i):
- if STYLE_STRUCTS[i][1] == "Variables":
- print("#ifndef STYLE_STRUCT_LIST_IGNORE_VARIABLES", file=header)
- print("STYLE_STRUCT_%s(%s, %s)" % STYLE_STRUCTS[i][:3], file=header)
- for dep in STYLE_STRUCTS[i][3]:
- print("STYLE_STRUCT_DEP(%s)" % (dep,), file=header)
- print("STYLE_STRUCT_END()", file=header)
- if STYLE_STRUCTS[i][1] == "Variables":
- print("#endif", file=header)
-
-HEADER = """/* THIS FILE IS AUTOGENERATED BY generate-stylestructlist.py - DO NOT EDIT */
-
-// IWYU pragma: private, include "nsStyleStructFwd.h"
-
-/*
- * list of structs that contain the data provided by ComputedStyle, the
- * internal API for computed style data for an element
- */
-
-/*
- * This file is intended to be used by different parts of the code, with
- * the STYLE_STRUCT macro (or the STYLE_STRUCT_INHERITED and
- * STYLE_STRUCT_RESET pair of macros) defined in different ways.
- */
-
-#ifndef STYLE_STRUCT_INHERITED
-#define STYLE_STRUCT_INHERITED(name, checkdata_cb) \\
- STYLE_STRUCT(name, checkdata_cb)
-#define UNDEF_STYLE_STRUCT_INHERITED
-#endif
-
-#ifndef STYLE_STRUCT_RESET
-#define STYLE_STRUCT_RESET(name, checkdata_cb) \\
- STYLE_STRUCT(name, checkdata_cb)
-#define UNDEF_STYLE_STRUCT_RESET
-#endif
-
-#ifndef STYLE_STRUCT_DEP
-#define STYLE_STRUCT_DEP(dep)
-#define UNDEF_STYLE_STRUCT_DEP
-#endif
-
-#ifndef STYLE_STRUCT_END
-#define STYLE_STRUCT_END()
-#define UNDEF_STYLE_STRUCT_END
-#endif
-
-// The inherited structs are listed before the Reset structs.
-// nsStyleStructID assumes this is the case, and callers other than
-// nsStyleStructFwd.h that want the structs in id-order just define
-// STYLE_STRUCT rather than including the file twice.
-
-"""
-FOOTER = """
-#ifdef UNDEF_STYLE_STRUCT_INHERITED
-#undef STYLE_STRUCT_INHERITED
-#undef UNDEF_STYLE_STRUCT_INHERITED
-#endif
-
-#ifdef UNDEF_STYLE_STRUCT_RESET
-#undef STYLE_STRUCT_RESET
-#undef UNDEF_STYLE_STRUCT_RESET
-#endif
-
-#ifdef UNDEF_STYLE_STRUCT_DEP
-#undef STYLE_STRUCT_DEP
-#undef UNDEF_STYLE_STRUCT_DEP
-#endif
-
-#ifdef UNDEF_STYLE_STRUCT_END
-#undef STYLE_STRUCT_END
-#undef UNDEF_STYLE_STRUCT_END
-#endif
-"""
-
-def main(header):
- print(HEADER, file=header)
- for i in range(count):
- printEntry(header, i)
- print(FOOTER, file=header)
--- a/layout/style/moz.build
+++ b/layout/style/moz.build
@@ -18,17 +18,16 @@ with Files('CSSRuleList.*'):
with Files('nsDOM*'):
BUG_COMPONENT = ('Core', 'DOM: CSS Object Model')
DIRS += ['xbl-marquee']
TEST_DIRS += ['test']
EXPORTS += [
- '!nsStyleStructList.h',
'AnimationCommon.h',
'CounterStyleManager.h',
'nsAnimationManager.h',
'nsComputedDOMStylePropertyList.h',
'nsCSSAnonBoxes.h',
'nsCSSAnonBoxList.h',
'nsCSSCounterDescList.h',
'nsCSSCounterStyleRule.h',
@@ -57,16 +56,17 @@ EXPORTS += [
'nsLayoutStylesheetCache.h',
'nsMediaFeatures.h',
'nsStyleAutoArray.h',
'nsStyleConsts.h',
'nsStyleCoord.h',
'nsStyleStruct.h',
'nsStyleStructFwd.h',
'nsStyleStructInlines.h',
+ 'nsStyleStructList.h',
'nsStyleTransformMatrix.h',
'nsStyleUtil.h',
'nsTimingFunction.h',
]
EXPORTS.mozilla += [
'AnimationCollection.h',
'BindingStyleRule.h',
@@ -275,23 +275,16 @@ RESOURCE_FILES += [
CONTENT_ACCESSIBLE_FILES += [
'ImageDocument.css',
'res/plaintext.css',
'res/viewsource.css',
'TopLevelImageDocument.css',
'TopLevelVideoDocument.css',
]
-GENERATED_FILES += [
- 'nsStyleStructList.h',
-]
-
-style_struct_list = GENERATED_FILES['nsStyleStructList.h']
-style_struct_list.script = 'generate-stylestructlist.py'
-
if CONFIG['COMPILE_ENVIRONMENT']:
GENERATED_FILES += [
'nsCSSPropsGenerated.inc',
]
css_props = GENERATED_FILES['nsCSSPropsGenerated.inc']
css_props.script = 'GenerateCSSPropsGenerated.py:generate'
css_props.inputs = [
'nsCSSPropsGenerated.inc.in',
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -3282,18 +3282,17 @@ enum EffectsCheckCounter {
#undef CSS_PROP_EFFECTS
ePropertyCount_for_Effects
};
#undef ENUM_DATA_FOR_PROPERTY
/* static */ const size_t
nsCSSProps::gPropertyCountInStruct[nsStyleStructID_Length] = {
- #define STYLE_STRUCT(name, checkdata_cb) \
- ePropertyCount_for_##name,
+ #define STYLE_STRUCT(name) ePropertyCount_for_##name,
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
};
/* static */ const size_t
nsCSSProps::gPropertyIndexInStruct[eCSSProperty_COUNT_no_shorthands] = {
#define CSS_PROP_LOGICAL(name_, id_, method_, flags_, pref_, parsevariant_, \
--- a/layout/style/nsComputedDOMStyle.h
+++ b/layout/style/nsComputedDOMStyle.h
@@ -184,19 +184,19 @@ private:
static already_AddRefed<mozilla::ComputedStyle>
DoGetComputedStyleNoFlush(mozilla::dom::Element* aElement,
nsAtom* aPseudo,
nsIPresShell* aPresShell,
StyleType aStyleType,
AnimationFlag aAnimationFlag);
-#define STYLE_STRUCT(name_, checkdata_cb_) \
- const nsStyle##name_ * Style##name_() { \
- return mComputedStyle->Style##name_(); \
+#define STYLE_STRUCT(name_) \
+ const nsStyle##name_ * Style##name_() { \
+ return mComputedStyle->Style##name_(); \
}
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
already_AddRefed<CSSValue> GetEllipseRadii(const nsStyleCorners& aRadius,
mozilla::Corner aFullCorner);
already_AddRefed<CSSValue> GetOffsetWidthFor(mozilla::Side aSide);
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -52,17 +52,17 @@ static_assert((((1 << nsStyleStructID_Le
/* static */ const int32_t nsStyleGridLine::kMinLine;
/* static */ const int32_t nsStyleGridLine::kMaxLine;
// We set the size limit of style structs to 504 bytes so that when they
// are allocated by Servo side with Arc, the total size doesn't exceed
// 512 bytes, which minimizes allocator slop.
static constexpr size_t kStyleStructSizeLimit = 504;
-#define STYLE_STRUCT(name_, checkdata_cb_) \
+#define STYLE_STRUCT(name_) \
static_assert(sizeof(nsStyle##name_) <= kStyleStructSizeLimit, \
"nsStyle" #name_ " became larger than the size limit");
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
static bool
DefinitelyEqualURIs(css::URLValueData* aURI1,
css::URLValueData* aURI2)
--- a/layout/style/nsStyleStructFwd.h
+++ b/layout/style/nsStyleStructFwd.h
@@ -24,30 +24,28 @@ enum nsStyleStructID {
* one type or the other.
*/
nsStyleStructID_None = -1,
nsStyleStructID_Inherited_Start = 0,
// a dummy value so the value after it is the same as ..._Inherited_Start
nsStyleStructID_DUMMY1 = nsStyleStructID_Inherited_Start - 1,
-#define STYLE_STRUCT_INHERITED(name, checkdata_cb) \
- eStyleStruct_##name,
-#define STYLE_STRUCT_RESET(name, checkdata_cb)
+#define STYLE_STRUCT_INHERITED(name) eStyleStruct_##name,
+#define STYLE_STRUCT_RESET(name)
#include "nsStyleStructList.h"
#undef STYLE_STRUCT_INHERITED
#undef STYLE_STRUCT_RESET
nsStyleStructID_Reset_Start,
// a dummy value so the value after it is the same as ..._Reset_Start
nsStyleStructID_DUMMY2 = nsStyleStructID_Reset_Start - 1,
-#define STYLE_STRUCT_RESET(name, checkdata_cb) \
- eStyleStruct_##name,
-#define STYLE_STRUCT_INHERITED(name, checkdata_cb)
+#define STYLE_STRUCT_RESET(name) eStyleStruct_##name,
+#define STYLE_STRUCT_INHERITED(name)
#include "nsStyleStructList.h"
#undef STYLE_STRUCT_INHERITED
#undef STYLE_STRUCT_RESET
// one past the end; length of 0-based list
nsStyleStructID_Length,
nsStyleStructID_Inherited_Count =
new file mode 100644
--- /dev/null
+++ b/layout/style/nsStyleStructList.h
@@ -0,0 +1,71 @@
+/* -*- 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/. */
+
+// IWYU pragma: private, include "nsStyleStructFwd.h"
+
+/*
+ * list of structs that contain the data provided by ComputedStyle, the
+ * internal API for computed style data for an element
+ */
+
+/*
+ * This file is intended to be used by different parts of the code, with
+ * the STYLE_STRUCT macro (or the STYLE_STRUCT_INHERITED and
+ * STYLE_STRUCT_RESET pair of macros) defined in different ways.
+ */
+
+#ifndef STYLE_STRUCT_INHERITED
+#define STYLE_STRUCT_INHERITED(name) STYLE_STRUCT(name)
+#define UNDEF_STYLE_STRUCT_INHERITED
+#endif
+
+#ifndef STYLE_STRUCT_RESET
+#define STYLE_STRUCT_RESET(name) STYLE_STRUCT(name)
+#define UNDEF_STYLE_STRUCT_RESET
+#endif
+
+// The inherited structs are listed before the Reset structs.
+// nsStyleStructID assumes this is the case, and callers other than
+// nsStyleStructFwd.h that want the structs in id-order just define
+// STYLE_STRUCT rather than including the file twice.
+
+STYLE_STRUCT_INHERITED(Font)
+STYLE_STRUCT_INHERITED(Color)
+STYLE_STRUCT_INHERITED(List)
+STYLE_STRUCT_INHERITED(Text)
+STYLE_STRUCT_INHERITED(Visibility)
+STYLE_STRUCT_INHERITED(UserInterface)
+STYLE_STRUCT_INHERITED(TableBorder)
+STYLE_STRUCT_INHERITED(SVG)
+#ifndef STYLE_STRUCT_LIST_IGNORE_VARIABLES
+STYLE_STRUCT_INHERITED(Variables)
+#endif
+
+STYLE_STRUCT_RESET(Background)
+STYLE_STRUCT_RESET(Position)
+STYLE_STRUCT_RESET(TextReset)
+STYLE_STRUCT_RESET(Display)
+STYLE_STRUCT_RESET(Content)
+STYLE_STRUCT_RESET(UIReset)
+STYLE_STRUCT_RESET(Table)
+STYLE_STRUCT_RESET(Margin)
+STYLE_STRUCT_RESET(Padding)
+STYLE_STRUCT_RESET(Border)
+STYLE_STRUCT_RESET(Outline)
+STYLE_STRUCT_RESET(XUL)
+STYLE_STRUCT_RESET(SVGReset)
+STYLE_STRUCT_RESET(Column)
+STYLE_STRUCT_RESET(Effects)
+
+#ifdef UNDEF_STYLE_STRUCT_INHERITED
+#undef STYLE_STRUCT_INHERITED
+#undef UNDEF_STYLE_STRUCT_INHERITED
+#endif
+
+#ifdef UNDEF_STYLE_STRUCT_RESET
+#undef STYLE_STRUCT_RESET
+#undef UNDEF_STYLE_STRUCT_RESET
+#endif