Issue #2112 - Part 9: Remove handling for multiple style backends

This commit is contained in:
FranklinDM 2024-03-25 17:49:09 +08:00 committed by roytam1
commit b96b733bfa
20 changed files with 20 additions and 125 deletions

View file

@ -10,7 +10,6 @@
#include "mozilla/EventStates.h"
#include "mozilla/HandleRefPtr.h"
#include "mozilla/RefCountType.h"
#include "mozilla/StyleBackendType.h"
#include "nsChangeHint.h"
namespace mozilla {
@ -48,11 +47,6 @@ public:
public:
friend class ::mozilla::RestyleManagerHandle;
StyleBackendType BackendType() const
{
return StyleBackendType::Gecko;
}
RestyleManager* AsGecko()
{
return reinterpret_cast<RestyleManager*>(mValue);

View file

@ -9127,14 +9127,6 @@ nsLayoutUtils::GetCumulativeApzCallbackTransform(nsIFrame* aFrame)
return delta;
}
/* static */ bool
nsLayoutUtils::SupportsServoStyleBackend(nsIDocument* aDocument)
{
return StyloEnabled() &&
aDocument->IsHTMLOrXHTML() &&
static_cast<nsDocument*>(aDocument)->IsContentDocument();
}
static
bool
LineHasNonEmptyContentWorker(nsIFrame* aFrame)

View file

@ -2379,13 +2379,6 @@ public:
return sTextCombineUprightDigitsEnabled;
}
// Stylo (the Servo backend for Gecko's style system) is generally enabled
// 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() {
return false;
}
static uint32_t IdlePeriodDeadlineLimit() {
return sIdlePeriodDeadlineLimit;
}
@ -2813,14 +2806,6 @@ public:
*/
static CSSPoint GetCumulativeApzCallbackTransform(nsIFrame* aFrame);
/*
* Returns whether the given document supports being rendered with a
* Servo-backed style system. This checks whether Stylo is enabled
* globally, that the document is an HTML document, and that it is
* being presented in a content docshell.
*/
static bool SupportsServoStyleBackend(nsIDocument* aDocument);
/*
* Checks whether a node is an invisible break.
* If not, returns the first frame on the next line if such a next line exists.

View file

@ -889,7 +889,7 @@ nsPresContext::Init(nsDeviceContext* aDeviceContext)
// Note: We don't hold a reference on the shell; it has a reference to
// us
void
nsPresContext::AttachShell(nsIPresShell* aShell, StyleBackendType aBackendType)
nsPresContext::AttachShell(nsIPresShell* aShell)
{
MOZ_ASSERT(!mShell);
mShell = aShell;

View file

@ -42,7 +42,6 @@
#include "mozilla/RestyleManagerHandle.h"
#include "prenv.h"
#include "mozilla/StaticPresData.h"
#include "mozilla/StyleBackendType.h"
class nsAString;
class nsIPrintSettings;
@ -167,7 +166,7 @@ public:
* Set and detach presentation shell that this context is bound to.
* A presentation context may only be bound to a single shell.
*/
void AttachShell(nsIPresShell* aShell, mozilla::StyleBackendType aBackendType);
void AttachShell(nsIPresShell* aShell);
void DetachShell();

View file

@ -34,7 +34,6 @@
#include "mozilla/TouchEvents.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/Unused.h"
#include "mozilla/StyleBackendType.h"
#include <algorithm>
#ifdef XP_WIN
@ -889,8 +888,7 @@ PresShell::Init(nsIDocument* aDocument,
// Bind the context to the presentation shell.
mPresContext = aPresContext;
StyleBackendType backend = StyleBackendType::Gecko;
aPresContext->AttachShell(this, backend);
aPresContext->AttachShell(this);
// Now we can initialize the style set. Make sure to set the member before
// calling Init, since various subroutines need to find the style set off

View file

@ -24,7 +24,6 @@ struct SupportsParsingInfo
nsIURI* mDocURI;
nsIURI* mBaseURI;
nsIPrincipal* mPrincipal;
StyleBackendType mStyleBackendType;
};
static nsresult
@ -44,7 +43,6 @@ GetParsingInfo(const GlobalObject& aGlobal,
aInfo.mDocURI = nsCOMPtr<nsIURI>(doc->GetDocumentURI()).get();
aInfo.mBaseURI = nsCOMPtr<nsIURI>(doc->GetBaseURI()).get();
aInfo.mPrincipal = win->GetPrincipal();
aInfo.mStyleBackendType = doc->GetStyleBackendType();
return NS_OK;
}

View file

@ -1083,7 +1083,7 @@ CSSStyleSheetInner::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
CSSStyleSheet::CSSStyleSheet(css::SheetParsingMode aParsingMode,
CORSMode aCORSMode, ReferrerPolicy aReferrerPolicy)
: StyleSheet(StyleBackendType::Gecko, aParsingMode),
: StyleSheet(aParsingMode),
mParent(nullptr),
mOwnerRule(nullptr),
mDirty(false),
@ -1099,7 +1099,7 @@ CSSStyleSheet::CSSStyleSheet(css::SheetParsingMode aParsingMode,
CORSMode aCORSMode,
ReferrerPolicy aReferrerPolicy,
const SRIMetadata& aIntegrity)
: StyleSheet(StyleBackendType::Gecko, aParsingMode),
: StyleSheet(aParsingMode),
mParent(nullptr),
mOwnerRule(nullptr),
mDirty(false),

View file

@ -92,7 +92,7 @@ public:
* |mData|) and cannot be used until its |CompressFrom| method or
* |InitializeEmpty| method is called.
*/
Declaration() : DeclarationBlock(StyleBackendType::Gecko) {}
Declaration() : DeclarationBlock() {}
Declaration(const Declaration& aCopy);

View file

@ -12,7 +12,6 @@
#define mozilla_DeclarationBlock_h
#include "mozilla/ServoUtils.h"
#include "mozilla/StyleBackendType.h"
#include "nsCSSPropertyID.h"
@ -30,11 +29,11 @@ class Rule;
class DeclarationBlock
{
protected:
explicit DeclarationBlock(StyleBackendType aType)
: mImmutable(false), mType(aType) { mContainer.mRaw = 0; }
explicit DeclarationBlock()
: mImmutable(false) { mContainer.mRaw = 0; }
DeclarationBlock(const DeclarationBlock& aCopy)
: DeclarationBlock(aCopy.mType) {}
: DeclarationBlock() {}
public:
MOZ_DECL_STYLO_METHODS(css::Declaration)
@ -136,8 +135,6 @@ private:
// set when declaration put in the rule tree;
// also by ToString (hence the 'mutable').
mutable bool mImmutable;
const StyleBackendType mType;
};
} // namespace mozilla

View file

@ -59,7 +59,7 @@ public:
protected:
explicit ServoDeclarationBlock(
already_AddRefed<RawServoDeclarationBlock> aRaw)
: DeclarationBlock(StyleBackendType::Servo), mRaw(aRaw) {}
: DeclarationBlock(), mRaw(aRaw) {}
private:
~ServoDeclarationBlock() {}

View file

@ -5,7 +5,6 @@
#include "ServoBindings.h"
#include "mozilla/ServoStyleSheet.h"
#include "mozilla/StyleBackendType.h"
#include "CSSRuleList.h"
using namespace mozilla::dom;
@ -16,7 +15,7 @@ ServoStyleSheet::ServoStyleSheet(css::SheetParsingMode aParsingMode,
CORSMode aCORSMode,
net::ReferrerPolicy aReferrerPolicy,
const dom::SRIMetadata& aIntegrity)
: StyleSheet(StyleBackendType::Servo, aParsingMode)
: StyleSheet(aParsingMode)
, mSheetInfo(aCORSMode, aReferrerPolicy, aIntegrity)
{
}

View file

@ -1,22 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
#ifndef mozilla_StyleBackendType_h
#define mozilla_StyleBackendType_h
namespace mozilla {
/**
* Enumeration that represents one of the two supported style system backends.
*/
enum class StyleBackendType : uint8_t
{
Gecko = 1,
Servo
};
} // namespace mozilla
#endif // mozilla_StyleBackendType_h

View file

@ -9,7 +9,6 @@
#include "mozilla/EventStates.h"
#include "mozilla/RefPtr.h"
#include "mozilla/SheetType.h"
#include "mozilla/StyleBackendType.h"
#include "mozilla/StyleSheet.h"
#include "nsChangeHint.h"
#include "nsCSSPseudoElements.h"
@ -46,11 +45,6 @@ public:
public:
friend class ::mozilla::StyleSetHandle;
StyleBackendType BackendType() const
{
return StyleBackendType::Gecko;
}
nsStyleSet* AsGecko()
{
return reinterpret_cast<nsStyleSet*>(mValue);

View file

@ -20,11 +20,10 @@ using namespace mozilla::dom;
namespace mozilla {
StyleSheet::StyleSheet(StyleBackendType aType, css::SheetParsingMode aParsingMode)
StyleSheet::StyleSheet(css::SheetParsingMode aParsingMode)
: mDocument(nullptr)
, mOwningNode(nullptr)
, mParsingMode(aParsingMode)
, mType(aType)
, mDisabled(false)
, mDocumentAssociationMode(NotOwnedByDocument)
{
@ -37,7 +36,6 @@ StyleSheet::StyleSheet(const StyleSheet& aCopy,
, mDocument(aDocumentToUse)
, mOwningNode(aOwningNodeToUse)
, mParsingMode(aCopy.mParsingMode)
, mType(aCopy.mType)
, mDisabled(aCopy.mDisabled)
// We only use this constructor during cloning. It's the cloner's
// responsibility to notify us if we end up being owned by a document.

View file

@ -9,7 +9,6 @@
#include "mozilla/css/SheetParsingMode.h"
#include "mozilla/dom/CSSStyleSheetBinding.h"
#include "mozilla/net/ReferrerPolicy.h"
#include "mozilla/StyleBackendType.h"
#include "mozilla/CORSMode.h"
#include "mozilla/ServoUtils.h"
@ -39,7 +38,7 @@ class StyleSheet : public nsIDOMCSSStyleSheet
, public nsWrapperCache
{
protected:
StyleSheet(StyleBackendType aType, css::SheetParsingMode aParsingMode);
StyleSheet(css::SheetParsingMode aParsingMode);
StyleSheet(const StyleSheet& aCopy,
nsIDocument* aDocumentToUse,
nsINode* aOwningNodeToUse);
@ -218,7 +217,6 @@ protected:
// and/or useful in user sheets.
css::SheetParsingMode mParsingMode;
const StyleBackendType mType;
bool mDisabled;
// mDocumentAssociationMode determines whether mDocument directly owns us (in

View file

@ -98,7 +98,6 @@ EXPORTS.mozilla += [
'ServoUtils.h',
'SheetType.h',
'StyleAnimationValue.h',
'StyleBackendType.h',
'StyleComplexColor.h',
'StyleContextSource.h',
'StyleSetHandle.h',