Bug 1375536 - Remove nsStyleVariables. r?xidorn,emilio
MozReview-Commit-ID: BqyhXc4W4Aq
--- a/dom/base/nsWindowMemoryReporter.cpp
+++ b/dom/base/nsWindowMemoryReporter.cpp
@@ -486,20 +486,18 @@ CollectWindowReports(nsGlobalWindowInner
styleSundriesSize += size; \
} else { \
REPORT_SUM_SIZE( \
"/layout/style-structs/" # name_, size, \
"Memory used by the " #name_ " style structs within a window."); \
} \
aWindowTotalSizes->mStyleSizes.NS_STYLE_SIZES_FIELD(name_) += size; \
}
-#define STYLE_STRUCT_LIST_IGNORE_VARIABLES
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
-#undef STYLE_STRUCT_LIST_IGNORE_VARIABLES
if (styleSundriesSize > 0) {
REPORT_SUM_SIZE(
"/layout/style-structs/sundries", styleSundriesSize,
"The sum of all memory used by style structs which were too "
"small to be shown individually.");
}
@@ -685,20 +683,18 @@ nsWindowMemoryReporter::CollectReports(n
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_) \
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,
"Memory used for style structs within windows. This is the sum of "
"all windows' 'layout/style-structs/' numbers.");
#undef REPORT
return NS_OK;
--- a/dom/base/nsWindowSizes.h
+++ b/dom/base/nsWindowSizes.h
@@ -49,54 +49,46 @@ public:
#define NS_STYLE_SIZES_FIELD(name_) mStyle##name_
struct nsStyleSizes
{
nsStyleSizes()
:
#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_) \
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_) \
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_) \
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;
};
#define NS_ARENA_SIZES_FIELD(classname) mArena##classname
struct nsArenaSizes {
--- a/layout/style/ComputedStyle.cpp
+++ b/layout/style/ComputedStyle.cpp
@@ -108,18 +108,17 @@ ComputedStyle::CalcStyleDifference(Compu
// style change, the PeekStyleData doesn't return null (implying that
// nobody ever looked at that struct's data). In other words, we
// can't skip later structs if we get a big change up front, because
// we could later get a small change in one of those structs that we
// don't want to miss.
DebugOnly<uint32_t> structsFound = 0;
- *aEqualStructs |= NS_STYLE_INHERIT_BIT(Variables);
- DebugOnly<int> styleStructCount = 1; // count Variables already
+ DebugOnly<int> styleStructCount = 0;
// Servo's optimization to stop the cascade when there are no style changes
// that children need to be recascade for relies on comparing all of the
// structs, not just those that are returned from PeekStyleData, although
// if PeekStyleData does return null we could avoid to accumulate any change
// hints for those structs.
//
// FIXME(emilio): Reintroduce that optimization either for all kind of structs
@@ -187,25 +186,23 @@ ComputedStyle::CalcStyleDifference(Compu
#undef DO_STRUCT_DIFFERENCE
#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_) \
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
// Note that we do not check whether this->RelevantLinkVisited() !=
// aNewContext->RelevantLinkVisited(); we don't need to since
// nsCSSFrameConstructor::DoContentStateChanged always adds
// nsChangeHint_RepaintFrame for NS_EVENT_STATE_VISITED changes (and
// needs to, since HasStateDependentStyle probably doesn't work right
// for NS_EVENT_STATE_VISITED). Hopefully this doesn't actually
--- a/layout/style/ComputedStyle.h
+++ b/layout/style/ComputedStyle.h
@@ -20,27 +20,28 @@
#include "nsCSSAnonBoxes.h"
#include "nsCSSPseudoElements.h"
// Includes nsStyleStructID.
#include "nsStyleStructFwd.h"
// Bits for each struct.
// NS_STYLE_INHERIT_BIT defined in nsStyleStructFwd.h
-#define NS_STYLE_INHERIT_MASK 0x000ffffff
+#define NS_STYLE_INHERIT_MASK 0x0007fffff
// Bits for inherited structs.
#define NS_STYLE_INHERITED_STRUCT_MASK \
((nsStyleStructID_size_t(1) << nsStyleStructID_Inherited_Count) - 1)
// Bits for reset structs.
#define NS_STYLE_RESET_STRUCT_MASK \
(((nsStyleStructID_size_t(1) << nsStyleStructID_Reset_Count) - 1) \
<< nsStyleStructID_Inherited_Count)
// Additional bits for ComputedStyle's mBits:
+// (free bit) 0x000800000
// See ComputedStyle::HasTextDecorationLines
#define NS_STYLE_HAS_TEXT_DECORATION_LINES 0x001000000
// See ComputedStyle::HasPseudoElementData.
#define NS_STYLE_HAS_PSEUDO_ELEMENT_DATA 0x002000000
// See ComputedStyle::RelevantLinkIsVisited
#define NS_STYLE_RELEVANT_LINK_VISITED 0x004000000
// See ComputedStyle::IsStyleIfVisited
#define NS_STYLE_IS_STYLE_IF_VISITED 0x008000000
@@ -346,18 +347,17 @@ public:
* hints apply to the frame and its later continuations or ib-split
* siblings. Most (all of those except the "NotHandledForDescendants"
* hints) also apply to all descendants.
*
* aEqualStructs must not be null. Into it will be stored a bitfield
* representing which structs were compared to be non-equal.
*
* CSS Variables are not compared here. Instead, the caller is responsible for
- * that when needed (basically only for elements). The Variables bit in
- * aEqualStructs is always set.
+ * that when needed (basically only for elements).
*/
nsChangeHint CalcStyleDifference(ComputedStyle* aNewContext,
uint32_t* aEqualStructs);
public:
/**
* Get a color that depends on link-visitedness using this and
* this->GetStyleIfVisited().
@@ -429,19 +429,18 @@ protected:
#undef STYLE_STRUCT_RESET
#undef STYLE_STRUCT_INHERITED
// If this ComputedStyle is for a pseudo-element or anonymous box,
// the relevant atom.
RefPtr<nsAtom> mPseudoTag;
// mBits stores a number of things:
- // - It records (using the style struct bits) which structs are
- // inherited from the parent context or owned by the rule node (i.e.,
- // not owned by the ComputedStyle).
+ // - It records (using the style struct bits) which structs have
+ // been requested on this ComputedStyle.
// - It also stores the additional bits listed at the top of
// nsStyleStruct.h.
uint64_t mBits;
};
} // namespace mozilla
#endif
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -198,23 +198,16 @@ Gecko_ComputedStyle_Init(
}
ServoComputedData::ServoComputedData(
const ServoComputedDataForgotten aValue)
{
PodAssign(this, aValue.mPtr);
}
-const nsStyleVariables*
-ServoComputedData::GetStyleVariables() const
-{
- MOZ_CRASH("ServoComputedData::GetStyleVariables should never need to be "
- "called");
-}
-
MOZ_DEFINE_MALLOC_ENCLOSING_SIZE_OF(ServoStyleStructsMallocEnclosingSizeOf)
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
@@ -223,20 +216,18 @@ ServoComputedData::AddSizeOfExcludingThi
#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
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
-#undef STYLE_STRUCT_LIST_IGNORE_VARIABLES
if (visited_style.mPtr && !aSizes.mState.HaveSeenPtr(visited_style.mPtr)) {
visited_style.mPtr->AddSizeOfIncludingThis(
aSizes, &aSizes.mLayoutComputedValuesVisited);
}
// Measurement of the following members may be added later if DMD finds it is
// worthwhile:
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -81,20 +81,18 @@ const bool GECKO_IS_NIGHTLY = false;
namespace mozilla {
#define STYLE_STRUCT(name_) struct Gecko##name_ {nsStyle##name_ gecko;};
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
}
#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); \
void Gecko_Release##name_##ArbitraryThread(class_* aPtr);
#define NS_IMPL_THREADSAFE_FFI_REFCOUNTING(class_, name_) \
static_assert(class_::HasThreadSafeRefCnt::value, \
"NS_DECL_THREADSAFE_FFI_REFCOUNTING can only be used with " \
"classes that have thread-safe refcounting"); \
--- a/layout/style/ServoBindings.toml
+++ b/layout/style/ServoBindings.toml
@@ -336,17 +336,16 @@ whitelist-types = [
"nsStyleTable",
"nsStyleTableBorder",
"nsStyleText",
"nsStyleTextReset",
"nsStyleUIReset",
"nsStyleUnion",
"nsStyleUnit",
"nsStyleUserInterface",
- "nsStyleVariables",
"nsStyleVisibility",
"nsStyleXUL",
"nsTArrayHeader",
"Position",
"PropertyValuePair",
"Runnable",
"ServoAttrSnapshot",
"ServoBundledURI",
@@ -578,17 +577,16 @@ structs-types = [
"nsStyleTable",
"nsStyleTableBorder",
"nsStyleText",
"nsStyleTextReset",
"nsStyleUIReset",
"nsStyleUnion",
"nsStyleUnit",
"nsStyleUserInterface",
- "nsStyleVariables",
"nsStyleVisibility",
"nsStyleXUL",
"nsTimingFunction",
"nscolor",
"nscoord",
"nsresult",
"Loader",
"LoaderReusableStyleSheets",
--- a/layout/style/ServoTypes.h
+++ b/layout/style/ServoTypes.h
@@ -159,20 +159,18 @@ struct ServoRawOffsetArc {
T* mPtr;
};
struct ServoComputedValueFlags {
uint16_t mFlags;
};
#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
{
public:
size_t mRuleTree; // Stylist-only
size_t mPrecomputedPseudos; // UA cache-only
@@ -214,21 +212,18 @@ class ServoComputedData
public:
// Constructs via memcpy. Will not move out of aValue.
explicit ServoComputedData(const ServoComputedDataForgotten aValue);
#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;
void AddSizeOfExcludingThis(nsWindowSizes& aSizes) const;
private:
mozilla::ServoCustomPropertiesMap custom_properties;
mozilla::ServoWritingMode writing_mode;
mozilla::ServoComputedValueFlags flags;
/// The rule node representing the ordered list of rules matched for this
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -4778,46 +4778,16 @@ nsStyleUIReset::CalcDifference(const nsS
mIMEMode != aNewData.mIMEMode) {
hint |= nsChangeHint_NeutralChange;
}
return hint;
}
//-----------------------
-// nsStyleVariables
-//
-
-nsStyleVariables::nsStyleVariables()
-{
- MOZ_COUNT_CTOR(nsStyleVariables);
-}
-
-nsStyleVariables::nsStyleVariables(const nsPresContext* aContext)
-{
- MOZ_COUNT_CTOR(nsStyleVariables);
-}
-
-nsStyleVariables::nsStyleVariables(const nsStyleVariables& aSource)
-{
- MOZ_COUNT_CTOR(nsStyleVariables);
-}
-
-nsStyleVariables::~nsStyleVariables()
-{
- MOZ_COUNT_DTOR(nsStyleVariables);
-}
-
-nsChangeHint
-nsStyleVariables::CalcDifference(const nsStyleVariables& aNewData) const
-{
- return nsChangeHint(0);
-}
-
-//-----------------------
// nsStyleEffects
//
nsStyleEffects::nsStyleEffects(const nsPresContext* aContext)
: mBoxShadow(nullptr)
, mClip(0, 0, 0, 0)
, mOpacity(1.0f)
, mClipFlags(NS_STYLE_CLIP_AUTO)
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -3249,30 +3249,16 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
float mStopOpacity; // [reset]
float mFloodOpacity; // [reset]
uint8_t mDominantBaseline; // [reset] see nsStyleConsts.h
uint8_t mVectorEffect; // [reset] see nsStyleConsts.h
uint8_t mMaskType; // [reset] see nsStyleConsts.h
};
-// XXX This can be removed once the old style system is gone.
-struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleVariables
-{
- nsStyleVariables();
- explicit nsStyleVariables(const nsPresContext* aContext);
- nsStyleVariables(const nsStyleVariables& aSource);
- ~nsStyleVariables();
- void FinishStyle(nsPresContext*, const nsStyleVariables*) {}
- const static bool kHasFinishStyle = false;
-
- nsChangeHint CalcDifference(const nsStyleVariables& aNewData) const;
-
-};
-
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleEffects
{
explicit nsStyleEffects(const nsPresContext* aContext);
nsStyleEffects(const nsStyleEffects& aSource);
~nsStyleEffects();
void FinishStyle(nsPresContext*, const nsStyleEffects*) {}
const static bool kHasFinishStyle = false;
--- a/layout/style/nsStyleStructList.h
+++ b/layout/style/nsStyleStructList.h
@@ -35,19 +35,16 @@
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)