mirror of
https://github.com/roytam1/UXP.git
synced 2026-05-26 13:58:49 +00:00
Issue #2112 - Part 9: Remove handling for multiple style backends
This commit is contained in:
@@ -318,7 +318,7 @@ public:
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
inline bool
|
||||
IsInvalidValuePair(const PropertyValuePair& aPair, StyleBackendType aBackend)
|
||||
IsInvalidValuePair(const PropertyValuePair& aPair)
|
||||
{
|
||||
// There are three types of values we store as token streams:
|
||||
//
|
||||
@@ -595,8 +595,6 @@ KeyframeUtils::GetComputedKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
|
||||
MOZ_ASSERT(aStyleContext);
|
||||
MOZ_ASSERT(aElement);
|
||||
|
||||
StyleBackendType styleBackend = aElement->OwnerDoc()->GetStyleBackendType();
|
||||
|
||||
const size_t len = aKeyframes.Length();
|
||||
nsTArray<ComputedKeyframeValues> result(len);
|
||||
|
||||
@@ -605,7 +603,7 @@ KeyframeUtils::GetComputedKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
|
||||
ComputedKeyframeValues* computedValues = result.AppendElement();
|
||||
for (const PropertyValuePair& pair :
|
||||
PropertyPriorityIterator(frame.mPropertyValues)) {
|
||||
if (IsInvalidValuePair(pair, styleBackend)) {
|
||||
if (IsInvalidValuePair(pair)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1363,8 +1361,6 @@ HasImplicitKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
|
||||
}
|
||||
};
|
||||
|
||||
StyleBackendType styleBackend = aDocument->GetStyleBackendType();
|
||||
|
||||
for (size_t i = 0, len = aKeyframes.Length(); i < len; i++) {
|
||||
const Keyframe& frame = aKeyframes[i];
|
||||
|
||||
@@ -1380,7 +1376,7 @@ HasImplicitKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
|
||||
: computedOffset;
|
||||
|
||||
for (const PropertyValuePair& pair : frame.mPropertyValues) {
|
||||
if (IsInvalidValuePair(pair, styleBackend)) {
|
||||
if (IsInvalidValuePair(pair)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
+4
-19
@@ -2108,21 +2108,16 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
|
||||
mozAutoDocUpdate upd(this, UPDATE_STYLE, true);
|
||||
if (mStyleSetFilled) {
|
||||
// Skip removing style sheets from the style set if we know we haven't
|
||||
// filled the style set. (This allows us to avoid calling
|
||||
// GetStyleBackendType() too early.)
|
||||
// filled the style set.
|
||||
RemoveDocStyleSheetsFromStyleSets();
|
||||
RemoveStyleSheetsFromStyleSets(mOnDemandBuiltInUASheets, SheetType::Agent);
|
||||
RemoveStyleSheetsFromStyleSets(mAdditionalSheets[eAgentSheet], SheetType::Agent);
|
||||
RemoveStyleSheetsFromStyleSets(mAdditionalSheets[eUserSheet], SheetType::User);
|
||||
RemoveStyleSheetsFromStyleSets(mAdditionalSheets[eAuthorSheet], SheetType::Doc);
|
||||
|
||||
if (GetStyleBackendType() == StyleBackendType::Gecko) {
|
||||
nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance();
|
||||
if (sheetService) {
|
||||
RemoveStyleSheetsFromStyleSets(*sheetService->AuthorStyleSheets(), SheetType::Doc);
|
||||
}
|
||||
} else {
|
||||
NS_ERROR("stylo: nsStyleSheetService doesn't handle ServoStyleSheets yet");
|
||||
nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance();
|
||||
if (sheetService) {
|
||||
RemoveStyleSheetsFromStyleSets(*sheetService->AuthorStyleSheets(), SheetType::Doc);
|
||||
}
|
||||
|
||||
mStyleSetFilled = false;
|
||||
@@ -12248,16 +12243,6 @@ nsIDocument::ReportHasScrollLinkedEffect()
|
||||
"ScrollLinkedEffectFound2");
|
||||
}
|
||||
|
||||
void
|
||||
nsIDocument::UpdateStyleBackendType()
|
||||
{
|
||||
MOZ_ASSERT(mStyleBackendType == StyleBackendType(0),
|
||||
"no need to call UpdateStyleBackendType now");
|
||||
|
||||
// Assume Gecko by default.
|
||||
mStyleBackendType = StyleBackendType::Gecko;
|
||||
}
|
||||
|
||||
Selection*
|
||||
nsIDocument::GetSelection(ErrorResult& aRv)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "mozilla/CORSMode.h"
|
||||
#include "mozilla/dom/DocumentOrShadowRoot.h"
|
||||
#include "mozilla/LinkedList.h"
|
||||
#include "mozilla/StyleBackendType.h"
|
||||
#include "mozilla/StyleSheet.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include <bitset> // for member
|
||||
@@ -1148,16 +1147,6 @@ public:
|
||||
return mCSSLoader;
|
||||
}
|
||||
|
||||
mozilla::StyleBackendType GetStyleBackendType() const {
|
||||
if (mStyleBackendType == mozilla::StyleBackendType(0)) {
|
||||
const_cast<nsIDocument*>(this)->UpdateStyleBackendType();
|
||||
}
|
||||
MOZ_ASSERT(mStyleBackendType != mozilla::StyleBackendType(0));
|
||||
return mStyleBackendType;
|
||||
}
|
||||
|
||||
void UpdateStyleBackendType();
|
||||
|
||||
/**
|
||||
* Get this document's StyleImageLoader. This is guaranteed to not return null.
|
||||
*/
|
||||
@@ -2974,10 +2963,6 @@ protected:
|
||||
uint32_t mDummy;
|
||||
#endif
|
||||
|
||||
// Whether this document has (or will have, once we have a pres shell) a
|
||||
// Gecko- or Servo-backed style system.
|
||||
mozilla::StyleBackendType mStyleBackendType;
|
||||
|
||||
// True if BIDI is enabled.
|
||||
bool mBidiEnabled : 1;
|
||||
// True if a MathML element has ever been owned by this document.
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
protected:
|
||||
explicit ServoDeclarationBlock(
|
||||
already_AddRefed<RawServoDeclarationBlock> aRaw)
|
||||
: DeclarationBlock(StyleBackendType::Servo), mRaw(aRaw) {}
|
||||
: DeclarationBlock(), mRaw(aRaw) {}
|
||||
|
||||
private:
|
||||
~ServoDeclarationBlock() {}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -98,7 +98,6 @@ EXPORTS.mozilla += [
|
||||
'ServoUtils.h',
|
||||
'SheetType.h',
|
||||
'StyleAnimationValue.h',
|
||||
'StyleBackendType.h',
|
||||
'StyleComplexColor.h',
|
||||
'StyleContextSource.h',
|
||||
'StyleSetHandle.h',
|
||||
|
||||
Reference in New Issue
Block a user