Issue #2112 - Part 3: Remove --enable-stylo config and conditionals

This commit is contained in:
FranklinDM 2022-05-23 23:05:22 +08:00 committed by roytam1
commit e777ae5a3c
21 changed files with 0 additions and 254 deletions

View file

@ -1908,10 +1908,6 @@ Element::UnbindFromTree(bool aDeep, bool aNullParent)
// recomputed it anyway if we ever insert the nodes back into a document.
if (IsStyledByServo()) {
ClearServoData();
} else {
#ifdef MOZ_STYLO
MOZ_ASSERT(!HasServoData());
#endif
}
// Editable descendant count only counts descendants that

View file

@ -12302,21 +12302,6 @@ nsIDocument::UpdateStyleBackendType()
// Assume Gecko by default.
mStyleBackendType = StyleBackendType::Gecko;
#ifdef MOZ_STYLO
// XXX For now we use a Servo-backed style set only for (X)HTML documents
// in content docshells. This should let us avoid implementing XUL-specific
// CSS features. And apart from not supporting SVG properties in Servo
// yet, the root SVG element likes to create a style sheet for an SVG
// document before we have a pres shell (i.e. before we make the decision
// here about whether to use a Gecko- or Servo-backed style system), so
// we avoid Servo-backed style sets for SVG documents.
if (!mDocumentContainer) {
NS_WARNING("stylo: No docshell yet, assuming Gecko style system");
} else if (nsLayoutUtils::SupportsServoStyleBackend(this)) {
mStyleBackendType = StyleBackendType::Servo;
}
#endif
}
Selection*

View file

@ -602,10 +602,6 @@ nsGenericDOMDataNode::UnbindFromTree(bool aDeep, bool aNullParent)
// recomputed it anyway if we ever insert the nodes back into a document.
if (IsStyledByServo()) {
ClearServoData();
} else {
#ifdef MOZ_STYLO
MOZ_ASSERT(!HasServoData());
#endif
}
if (aNullParent || !mParent->IsInShadowTree()) {

View file

@ -152,9 +152,6 @@ nsINode::~nsINode()
{
MOZ_ASSERT(!HasSlots(), "nsNodeUtils::LastRelease was not called?");
MOZ_ASSERT(mSubtreeRoot == this, "Didn't restore state properly?");
#ifdef MOZ_STYLO
ClearServoData();
#endif
}
void*
@ -1445,11 +1442,7 @@ nsINode::UnoptimizableCCNode() const
void
nsINode::ClearServoData() {
#ifdef MOZ_STYLO
Servo_Node_ClearNodeData(this);
#else
MOZ_CRASH("Accessing servo node data in non-stylo build");
#endif
}
/* static */
@ -3193,14 +3186,6 @@ nsINode::IsNodeApzAwareInternal() const
return EventTarget::IsApzAware();
}
#ifdef MOZ_STYLO
bool
nsINode::IsStyledByServo() const
{
return OwnerDoc()->IsStyledByServo();
}
#endif
DocGroup*
nsINode::GetDocGroup() const
{

View file

@ -1022,11 +1022,7 @@ public:
* Returns true if this is a node belonging to a document that uses the Servo
* style system.
*/
#ifdef MOZ_STYLO
bool IsStyledByServo() const;
#else
bool IsStyledByServo() const { return false; }
#endif
bool IsDirtyForServo() const
{
@ -2139,11 +2135,7 @@ public:
#undef EVENT
bool HasServoData() {
#ifdef MOZ_STYLO
return !!mServoData.Get();
#else
MOZ_CRASH("Accessing servo node data in non-stylo build");
#endif
}
void ClearServoData();
@ -2185,11 +2177,6 @@ protected:
// Storage for more members that are usually not needed; allocated lazily.
nsSlots* mSlots;
#ifdef MOZ_STYLO
// Per-node data managed by Servo.
mozilla::ServoCell<ServoNodeData*> mServoData;
#endif
};
inline nsIDOMNode* GetAsDOMNode(nsINode* aNode)

View file

@ -120,11 +120,7 @@ protected:
}
inline bool IsServo() const {
#ifdef MOZ_STYLO
return PresContext()->StyleSet()->IsServo();
#else
return false;
#endif
}
private:

View file

@ -52,11 +52,7 @@ public:
bool IsServo() const
{
MOZ_ASSERT(mValue, "RestyleManagerHandle null pointer dereference");
#ifdef MOZ_STYLO
return mValue & SERVO_BIT;
#else
return false;
#endif
}
StyleBackendType BackendType() const
@ -186,16 +182,8 @@ public:
RestyleManagerHandle& operator=(ServoRestyleManager* aManager)
{
#ifdef MOZ_STYLO
MOZ_ASSERT(!(reinterpret_cast<uintptr_t>(aManager) & SERVO_BIT),
"least significant bit shouldn't be set; we use it for state");
mPtr.mValue =
aManager ? (reinterpret_cast<uintptr_t>(aManager) | SERVO_BIT) : 0;
return *this;
#else
MOZ_CRASH("should not have a ServoRestyleManager object when MOZ_STYLO is "
"disabled");
#endif
}
// Make RestyleManagerHandle usable in boolean contexts.

View file

@ -181,9 +181,6 @@ typedef nsStyleTransformMatrix::TransformReferenceBox TransformReferenceBox;
/* static */ bool nsLayoutUtils::sInterruptibleReflowEnabled;
/* static */ bool nsLayoutUtils::sSVGTransformBoxEnabled;
/* static */ bool nsLayoutUtils::sTextCombineUprightDigitsEnabled;
#ifdef MOZ_STYLO
/* static */ bool nsLayoutUtils::sStyloEnabled;
#endif
/* static */ uint32_t nsLayoutUtils::sIdlePeriodDeadlineLimit;
/* static */ uint32_t nsLayoutUtils::sQuiescentFramesBeforeIdlePeriod;
@ -7632,10 +7629,6 @@ nsLayoutUtils::Initialize()
"svg.transform-box.enabled");
Preferences::AddBoolVarCache(&sTextCombineUprightDigitsEnabled,
"layout.css.text-combine-upright-digits.enabled");
#ifdef MOZ_STYLO
Preferences::AddBoolVarCache(&sStyloEnabled,
"layout.css.servo.enabled");
#endif
Preferences::AddUintVarCache(&sIdlePeriodDeadlineLimit,
"layout.idle_period.time_limit",
DEFAULT_IDLE_PERIOD_TIME_LIMIT);

View file

@ -2383,11 +2383,7 @@ public:
// or disabled at compile-time. However, we provide the additional capability
// to disable it dynamically in stylo-enabled builds via a pref.
static bool StyloEnabled() {
#ifdef MOZ_STYLO
return sStyloEnabled;
#else
return false;
#endif
}
static uint32_t IdlePeriodDeadlineLimit() {
@ -2910,9 +2906,6 @@ private:
static bool sInterruptibleReflowEnabled;
static bool sSVGTransformBoxEnabled;
static bool sTextCombineUprightDigitsEnabled;
#ifdef MOZ_STYLO
static bool sStyloEnabled;
#endif
static uint32_t sIdlePeriodDeadlineLimit;
static uint32_t sQuiescentFramesBeforeIdlePeriod;

View file

@ -695,23 +695,9 @@ Gecko_Destroy_nsStyle##name(nsStyle##name* ptr) \
#undef STYLE_STRUCT
#ifndef MOZ_STYLO
#define SERVO_BINDING_FUNC(name_, return_, ...) \
return_ name_(__VA_ARGS__) { \
MOZ_CRASH("stylo: shouldn't be calling " #name_ "in a non-stylo build"); \
}
#include "ServoBindingList.h"
#undef SERVO_BINDING_FUNC
#endif
#ifdef MOZ_STYLO
const nsStyleVariables*
Servo_GetStyleVariables(ServoComputedValuesBorrowed aComputedValues)
{
// Servo can't provide us with Variables structs yet, so instead of linking
// to a Servo_GetStyleVariables defined in Servo we define one here that
// always returns the same, empty struct.
static nsStyleVariables variables(StyleStructContext::ServoContext());
return &variables;
}
#endif

View file

@ -10,15 +10,9 @@
#include "mozilla/TypeTraits.h"
#ifdef MOZ_STYLO
# define MOZ_DECL_STYLO_CHECK_METHODS \
bool IsGecko() const { return !IsServo(); } \
bool IsServo() const { return mType == StyleBackendType::Servo; }
#else
# define MOZ_DECL_STYLO_CHECK_METHODS \
bool IsGecko() const { return true; } \
bool IsServo() const { return false; }
#endif
/**
* Macro used in a base class of |geckotype_| and |servotype_|.

View file

@ -53,11 +53,7 @@ struct NonOwningStyleContextSource
bool IsNull() const { return !mBits; }
bool IsGeckoRuleNodeOrNull() const { return !IsServoComputedValues(); }
bool IsServoComputedValues() const {
#ifdef MOZ_STYLO
return mBits & 1;
#else
return false;
#endif
}
nsRuleNode* AsGeckoRuleNode() const {

View file

@ -54,11 +54,7 @@ public:
bool IsServo() const
{
MOZ_ASSERT(mValue, "StyleSetHandle null pointer dereference");
#ifdef MOZ_STYLO
return mValue & SERVO_BIT;
#else
return false;
#endif
}
StyleBackendType BackendType() const
@ -187,16 +183,8 @@ public:
StyleSetHandle& operator=(ServoStyleSet* aStyleSet)
{
#ifdef MOZ_STYLO
MOZ_ASSERT(!(reinterpret_cast<uintptr_t>(aStyleSet) & SERVO_BIT),
"least significant bit shouldn't be set; we use it for state");
mPtr.mValue =
aStyleSet ? (reinterpret_cast<uintptr_t>(aStyleSet) | SERVO_BIT) : 0;
return *this;
#else
MOZ_CRASH("should not have a ServoStyleSet object when MOZ_STYLO is "
"disabled");
#endif
}
// Make StyleSetHandle usable in boolean contexts.

View file

@ -35,11 +35,7 @@ class nsDeviceContext;
* We don't put the type in namespace mozilla, since we expect it to be
* temporary, and the namespacing would clutter up nsStyleStruct.h.
*/
#ifdef MOZ_STYLO
#define SERVO_DEFAULT(default_val) { if (!mPresContext) { return default_val; } }
#else
#define SERVO_DEFAULT(default_val) { MOZ_ASSERT(mPresContext); }
#endif
class StyleStructContext {
public:
MOZ_IMPLICIT StyleStructContext(nsPresContext* aPresContext)

View file

@ -10507,13 +10507,6 @@ nsRuleNode::HasAuthorSpecifiedRules(nsStyleContext* aStyleContext,
uint32_t ruleTypeMask,
bool aAuthorColorsAllowed)
{
#ifdef MOZ_STYLO
if (aStyleContext->StyleSource().IsServoComputedValues()) {
NS_WARNING("stylo: nsRuleNode::HasAuthorSpecifiedRules not implemented");
return true;
}
#endif
uint32_t inheritBits = 0;
if (ruleTypeMask & NS_AUTHOR_SPECIFIED_BACKGROUND) {
inheritBits |= NS_STYLE_INHERIT_BIT(Background);

View file

@ -88,18 +88,9 @@ nsStyleContext::nsStyleContext(nsStyleContext* aParent,
, mEmptyChild(nullptr)
, mPseudoTag(aPseudoTag)
, mSource(Move(aSource))
#ifdef MOZ_STYLO
, mPresContext(nullptr)
#endif
, mCachedResetData(nullptr)
, mBits(((uint64_t)aPseudoType) << NS_STYLE_CONTEXT_TYPE_SHIFT)
, mRefCnt(0)
#ifdef MOZ_STYLO
, mStoredChangeHint(nsChangeHint(0))
#ifdef DEBUG
, mConsumedChangeHint(false)
#endif
#endif
#ifdef DEBUG
, mFrameRefCnt(0)
, mComputingStruct(nsStyleStructID_None)
@ -116,10 +107,6 @@ nsStyleContext::nsStyleContext(nsStyleContext* aParent,
: nsStyleContext(aParent, OwningStyleContextSource(Move(aRuleNode)),
aPseudoTag, aPseudoType)
{
#ifdef MOZ_STYLO
mPresContext = mSource.AsGeckoRuleNode()->PresContext();
#endif
if (aParent) {
#ifdef DEBUG
nsRuleNode *r1 = mParent->RuleNode(), *r2 = mSource.AsGeckoRuleNode();
@ -146,10 +133,6 @@ nsStyleContext::nsStyleContext(nsStyleContext* aParent,
: nsStyleContext(aParent, OwningStyleContextSource(Move(aComputedValues)),
aPseudoTag, aPseudoType)
{
#ifdef MOZ_STYLO
mPresContext = aPresContext;
#endif
FinishConstruction(aSkipParentDisplayBasedStyleFixup);
}

View file

@ -154,11 +154,7 @@ public:
}
nsPresContext* PresContext() const {
#ifdef MOZ_STYLO
return mPresContext;
#else
return mSource.AsGeckoRuleNode()->PresContext();
#endif
}
nsStyleContext* GetParent() const { return mParent; }
@ -512,45 +508,6 @@ public:
mozilla::NonOwningStyleContextSource StyleSource() const { return mSource.AsRaw(); }
#ifdef MOZ_STYLO
// NOTE: It'd be great to assert here that the previous change hint is always
// consumed.
//
// This is not the case right now, since the changes of childs of frames that
// go through frame construction are not consumed.
void StoreChangeHint(nsChangeHint aHint)
{
MOZ_ASSERT(!IsShared());
mStoredChangeHint = aHint;
#ifdef DEBUG
mConsumedChangeHint = false;
#endif
}
nsChangeHint ConsumeStoredChangeHint()
{
MOZ_ASSERT(!mConsumedChangeHint, "Re-consuming the same change hint!");
nsChangeHint result = mStoredChangeHint;
mStoredChangeHint = nsChangeHint(0);
#ifdef DEBUG
mConsumedChangeHint = true;
#endif
return result;
}
#else
void StoreChangeHint(nsChangeHint aHint)
{
MOZ_CRASH("stylo: Called nsStyleContext::StoreChangeHint in a non MOZ_STYLO "
"build.");
}
nsChangeHint ConsumeStoredChangeHint()
{
MOZ_CRASH("stylo: Called nsStyleContext::ComsumeStoredChangeHint in a non "
"MOZ_STYLO build.");
}
#endif
private:
// Private destructor, to discourage deletion outside of Release():
~nsStyleContext();
@ -781,12 +738,6 @@ private:
// when it's released and nulled out during teardown.
const mozilla::OwningStyleContextSource mSource;
#ifdef MOZ_STYLO
// In Gecko, we can get this off the rule node. We make this conditional
// on stylo builds to avoid the memory bloat on release.
nsPresContext* mPresContext;
#endif
// mCachedInheritedData and mCachedResetData point to both structs that
// are owned by this style context and structs that are owned by one of
// this style context's ancestors (which are indirectly owned since this
@ -809,15 +760,6 @@ private:
uint32_t mRefCnt;
// For now we store change hints on the style context during parallel traversal.
// We should improve this - see bug 1289861.
#ifdef MOZ_STYLO
nsChangeHint mStoredChangeHint;
#ifdef DEBUG
bool mConsumedChangeHint;
#endif
#endif
#ifdef DEBUG
uint32_t mFrameRefCnt; // number of frames that use this
// as their style context

View file

@ -5258,11 +5258,6 @@ pref("dom.webkitBlink.filesystem.enabled", true);
pref("media.block-autoplay-until-in-foreground", true);
#ifdef MOZ_STYLO
// Is the Servo-backed style system enabled?
pref("layout.css.servo.enabled", true);
#endif
// Block toplevel data: URI navigations
// If true, all toplevel data: URI navigations will be blocked.
// Please note that manually entering a data: URI in the

View file

@ -185,12 +185,6 @@ if CONFIG['OS_ARCH'] == 'Linux':
OS_LIBS += CONFIG['MOZ_CAIRO_OSLIBS']
OS_LIBS += CONFIG['MOZ_WEBRTC_X11_LIBS']
if CONFIG['SERVO_TARGET_DIR']:
if CONFIG['_MSC_VER']:
OS_LIBS += ['%s/geckoservo' % CONFIG['SERVO_TARGET_DIR']]
else:
OS_LIBS += ['-L%s' % CONFIG['SERVO_TARGET_DIR'], '-lgeckoservo']
if CONFIG['MOZ_SYSTEM_JPEG']:
OS_LIBS += CONFIG['MOZ_JPEG_LIBS']

View file

@ -387,31 +387,6 @@ id_and_secret_keyfile('Bing API')
simple_keyfile('Adjust SDK')
# Servo integration
# ==============================================================
option('--enable-stylo', env='STYLO_ENABLED', nargs=0,
help='Enables experimental integration with the servo style system. '
'This requires either building servo within Gecko\'s cargo phase '
'or passing --with-servo')
@depends('--enable-stylo')
def stylo(value):
if value:
return True
set_define('MOZ_STYLO', stylo)
imply_option('--enable-jemalloc', depends_if('--enable-stylo')(lambda _: 'moz'))
option('--with-servo', env='SERVO_TARGET_DIR', nargs=1,
help='Absolute path of the target directory where libgeckoservo can '
'be found. This is generally servo_src_dir/target/release.')
@depends_if('--with-servo')
def servo_target_dir(value):
return value[0]
set_config('SERVO_TARGET_DIR', servo_target_dir)
# Gecko integrated IPC fuzzer
# ==============================================================
option('--enable-ipc-fuzzer', env='MOZ_FAULTY',

View file

@ -3767,15 +3767,6 @@ XREMain::XRE_mainRun()
rv = appStartup->CreateHiddenWindow();
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
#ifdef MOZ_STYLO
// We initialize Servo here so that the hidden DOM window is available,
// since initializing Servo calls style struct constructors, and the
// HackilyFindDeviceContext stuff we have right now depends on the hidden
// DOM window. When we fix that, this should move back to
// nsLayoutStatics.cpp
Servo_Initialize();
#endif
#if defined(HAVE_DESKTOP_STARTUP_ID) && defined(MOZ_WIDGET_GTK)
nsGTKToolkit* toolkit = nsGTKToolkit::GetToolkit();
if (toolkit && !mDesktopStartupID.IsEmpty()) {
@ -3848,12 +3839,6 @@ XREMain::XRE_mainRun()
}
}
#ifdef MOZ_STYLO
// This, along with the call to Servo_Initialize, should eventually move back
// to nsLayoutStatics.cpp.
Servo_Shutdown();
#endif
return rv;
}