--- a/dom/base/nsAttrValue.cpp
+++ b/dom/base/nsAttrValue.cpp
@@ -1734,26 +1734,22 @@ nsAttrValue::ParseStyleAttribute(const n
if (cont) {
// Set our MiscContainer to the cached one.
NS_ADDREF(cont);
SetPtrValueAndType(cont, eOtherBase);
return true;
}
}
- RefPtr<DeclarationBlock> decl;
- if (ownerDoc->GetStyleBackendType() == StyleBackendType::Servo) {
- RefPtr<URLExtraData> data = new URLExtraData(baseURI, docURI,
- principal);
- decl = ServoDeclarationBlock::FromCssText(aString, data,
- ownerDoc->GetCompatibilityMode(),
- ownerDoc->CSSLoader());
- } else {
- MOZ_CRASH("old style system disabled");
- }
+ RefPtr<URLExtraData> data = new URLExtraData(baseURI, docURI,
+ principal);
+ RefPtr<DeclarationBlock> decl = ServoDeclarationBlock::
+ FromCssText(aString, data,
+ ownerDoc->GetCompatibilityMode(),
+ ownerDoc->CSSLoader());
if (!decl) {
return false;
}
decl->SetHTMLCSSStyleSheet(sheet);
SetTo(decl.forget(), &aString);
if (cachingAllowed) {
MiscContainer* cont = GetMiscContainer();
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -5897,17 +5897,17 @@ nsIDocument::AllowUnsafeHTML() const
mAllowUnsafeHTML);
}
void
nsIDocument::ResolveScheduledSVGPresAttrs()
{
for (auto iter = mLazySVGPresElements.Iter(); !iter.Done(); iter.Next()) {
nsSVGElement* svg = iter.Get()->GetKey();
- svg->UpdateContentDeclarationBlock(StyleBackendType::Servo);
+ svg->UpdateContentDeclarationBlock();
}
mLazySVGPresElements.Clear();
}
already_AddRefed<nsSimpleContentList>
nsIDocument::BlockedTrackingNodes() const
{
RefPtr<nsSimpleContentList> list = new nsSimpleContentList(nullptr);
@@ -9565,17 +9565,16 @@ nsIDocument::CreateStaticClone(nsIDocShe
if (IsStaticDocument()) {
clonedDoc->mOriginalDocument = mOriginalDocument;
} else {
clonedDoc->mOriginalDocument = this;
}
clonedDoc->mOriginalDocument->mStaticCloneCount++;
- MOZ_ASSERT(GetStyleBackendType() == clonedDoc->GetStyleBackendType());
size_t sheetsCount = SheetCount();
for (size_t i = 0; i < sheetsCount; ++i) {
RefPtr<StyleSheet> sheet = SheetAt(i);
if (sheet) {
if (sheet->IsApplicable()) {
RefPtr<StyleSheet> clonedSheet =
sheet->Clone(nullptr, nullptr, clonedDoc, nullptr);
NS_WARNING_ASSERTION(clonedSheet,
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -901,23 +901,19 @@ nsFrameLoader::MarginsChanged(uint32_t a
// Set the margins
mDocShell->SetMarginWidth(aMarginWidth);
mDocShell->SetMarginHeight(aMarginHeight);
// There's a cached property declaration block
// that needs to be updated
if (nsIDocument* doc = mDocShell->GetDocument()) {
- // We don't need to do anything for Gecko here because
- // we plan to RebuildAllStyleData anyway.
- if (doc->GetStyleBackendType() == StyleBackendType::Servo) {
- for (nsINode* cur = doc; cur; cur = cur->GetNextNode()) {
- if (cur->IsHTMLElement(nsGkAtoms::body)) {
- static_cast<HTMLBodyElement*>(cur)->ClearMappedServoStyle();
- }
+ for (nsINode* cur = doc; cur; cur = cur->GetNextNode()) {
+ if (cur->IsHTMLElement(nsGkAtoms::body)) {
+ static_cast<HTMLBodyElement*>(cur)->ClearMappedServoStyle();
}
}
}
// Trigger a restyle if there's a prescontext
// FIXME: This could do something much less expensive.
RefPtr<nsPresContext> presContext;
mDocShell->GetPresContext(getter_AddRefs(presContext));
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -45,17 +45,16 @@
#include "nsClassHashtable.h"
#include "mozilla/CORSMode.h"
#include "mozilla/dom/DispatcherTrait.h"
#include "mozilla/dom/DocumentOrShadowRoot.h"
#include "mozilla/LinkedList.h"
#include "mozilla/NotNull.h"
#include "mozilla/SegmentedVector.h"
#include "mozilla/ServoBindingTypes.h"
-#include "mozilla/StyleBackendType.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/UniquePtr.h"
#include <bitset> // for member
// windows.h #defines CreateEvent
#ifdef CreateEvent
#undef CreateEvent
@@ -1593,24 +1592,22 @@ public:
}
~SelectorCache();
private:
nsDataHashtable<nsStringHashKey, SelectorList> mTable;
};
- SelectorCache& GetSelectorCache(mozilla::StyleBackendType aBackendType) {
- mozilla::UniquePtr<SelectorCache>& cache =
- aBackendType == mozilla::StyleBackendType::Servo
- ? mServoSelectorCache : mGeckoSelectorCache;
- if (!cache) {
- cache.reset(new SelectorCache(EventTargetFor(mozilla::TaskCategory::Other)));
+ SelectorCache& GetSelectorCache() {
+ if (!mSelectorCache) {
+ mSelectorCache.reset(new SelectorCache(
+ EventTargetFor(mozilla::TaskCategory::Other)));
}
- return *cache;
+ return *mSelectorCache;
}
// Get the root <html> element, or return null if there isn't one (e.g.
// if the root isn't <html>)
Element* GetHtmlElement() const;
// Returns the first child of GetHtmlContent which has the given tag,
// or nullptr if that doesn't exist.
Element* GetHtmlChildElement(nsAtom* aTag);
// Get the canonical <body> element, or return null if there isn't one (e.g.
@@ -1732,21 +1729,16 @@ public:
/**
* Get this document's CSSLoader. This is guaranteed to not return null.
*/
mozilla::css::Loader* CSSLoader() const {
return mCSSLoader;
}
- mozilla::StyleBackendType GetStyleBackendType() const
- {
- return mozilla::StyleBackendType::Servo;
- }
-
/**
* Get this document's StyleImageLoader. This is guaranteed to not return null.
*/
mozilla::css::ImageLoader* StyleImageLoader() const {
return mStyleImageLoader;
}
/**
@@ -3750,20 +3742,17 @@ protected:
bool aUpdateCSSLoader);
private:
mutable std::bitset<eDeprecatedOperationCount> mDeprecationWarnedAbout;
mutable std::bitset<eDocumentWarningCount> mDocWarningWarnedAbout;
// Lazy-initialization to have mDocGroup initialized in prior to the
// SelectorCaches.
- // FIXME(emilio): We can use a single cache when all CSSOM methods are
- // implemented for the Servo backend.
- mozilla::UniquePtr<SelectorCache> mServoSelectorCache;
- mozilla::UniquePtr<SelectorCache> mGeckoSelectorCache;
+ mozilla::UniquePtr<SelectorCache> mSelectorCache;
protected:
friend class nsDocumentOnStack;
void IncreaseStackRefCnt()
{
++mStackRefCnt;
}
--- a/dom/base/nsINode.cpp
+++ b/dom/base/nsINode.cpp
@@ -2480,18 +2480,17 @@ nsINode::Length() const
const RawServoSelectorList*
nsINode::ParseServoSelectorList(
const nsAString& aSelectorString,
ErrorResult& aRv)
{
nsIDocument* doc = OwnerDoc();
- nsIDocument::SelectorCache& cache =
- doc->GetSelectorCache(mozilla::StyleBackendType::Servo);
+ nsIDocument::SelectorCache& cache = doc->GetSelectorCache();
nsIDocument::SelectorCache::SelectorList* list =
cache.GetList(aSelectorString);
if (list) {
if (!*list) {
// Invalid selector.
aRv.ThrowDOMException(NS_ERROR_DOM_SYNTAX_ERR,
NS_LITERAL_CSTRING("'") + NS_ConvertUTF16toUTF8(aSelectorString) +
NS_LITERAL_CSTRING("' is not a valid selector")
--- a/dom/base/nsStyledElement.cpp
+++ b/dom/base/nsStyledElement.cpp
@@ -157,19 +157,16 @@ nsStyledElement::ReparseStyleAttribute(b
return NS_OK;
}
void
nsStyledElement::NodeInfoChanged(nsIDocument* aOldDoc)
{
nsStyledElementBase::NodeInfoChanged(aOldDoc);
- if (OwnerDoc()->GetStyleBackendType() != aOldDoc->GetStyleBackendType()) {
- ReparseStyleAttribute(false, /* aForceIfAlreadyParsed */ true);
- }
}
nsICSSDeclaration*
nsStyledElement::GetExistingStyle()
{
Element::nsDOMSlots* slots = GetExistingDOMSlots();
if (!slots) {
return nullptr;
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -2292,18 +2292,16 @@ ContentParent::InitInternal(ProcessPrior
// This is only implemented (returns a non-empty list) by MacOSX and Linux
// at present.
nsTArray<SystemFontListEntry> fontList;
gfxPlatform::GetPlatform()->ReadSystemFontList(&fontList);
nsTArray<LookAndFeelInt> lnfCache = LookAndFeel::GetIntCache();
// Content processes have no permission to access profile directory, so we
// send the file URL instead.
- StyleBackendType backendType =
- StyleBackendType::Servo;
StyleSheet* ucs = nsLayoutStylesheetCache::Singleton()->UserContentSheet();
if (ucs) {
SerializeURI(ucs->GetSheetURI(), xpcomInit.userContentSheetURL());
} else {
SerializeURI(nullptr, xpcomInit.userContentSheetURL());
}
// 1. Build ContentDeviceData first, as it may affect some gfxVars.
--- a/dom/smil/nsSMILCSSProperty.cpp
+++ b/dom/smil/nsSMILCSSProperty.cpp
@@ -23,18 +23,17 @@ using namespace mozilla::dom;
// Class Methods
nsSMILCSSProperty::nsSMILCSSProperty(nsCSSPropertyID aPropID,
Element* aElement,
ComputedStyle* aBaseComputedStyle)
: mPropID(aPropID)
, mElement(aElement)
, mBaseComputedStyle(aBaseComputedStyle)
{
- MOZ_ASSERT(IsPropertyAnimatable(mPropID,
- aElement->OwnerDoc()->GetStyleBackendType()),
+ MOZ_ASSERT(IsPropertyAnimatable(mPropID),
"Creating a nsSMILCSSProperty for a property "
"that's not supported for animation");
}
nsSMILValue
nsSMILCSSProperty::GetBaseValue() const
{
// To benefit from Return Value Optimization and avoid copy constructor calls
@@ -81,19 +80,17 @@ nsSMILCSSProperty::GetBaseValue() const
}
nsresult
nsSMILCSSProperty::ValueFromString(const nsAString& aStr,
const SVGAnimationElement* aSrcElement,
nsSMILValue& aValue,
bool& aPreventCachingOfSandwich) const
{
- NS_ENSURE_TRUE(IsPropertyAnimatable(mPropID,
- mElement->OwnerDoc()->GetStyleBackendType()),
- NS_ERROR_FAILURE);
+ NS_ENSURE_TRUE(IsPropertyAnimatable(mPropID), NS_ERROR_FAILURE);
nsSMILCSSValueType::ValueFromString(mPropID, mElement, aStr, aValue,
&aPreventCachingOfSandwich);
if (aValue.IsNull()) {
return NS_ERROR_FAILURE;
}
@@ -104,19 +101,17 @@ nsSMILCSSProperty::ValueFromString(const
aPreventCachingOfSandwich = true;
}
return NS_OK;
}
nsresult
nsSMILCSSProperty::SetAnimValue(const nsSMILValue& aValue)
{
- NS_ENSURE_TRUE(IsPropertyAnimatable(mPropID,
- mElement->OwnerDoc()->GetStyleBackendType()),
- NS_ERROR_FAILURE);
+ NS_ENSURE_TRUE(IsPropertyAnimatable(mPropID), NS_ERROR_FAILURE);
// Convert nsSMILValue to string
nsAutoString valStr;
nsSMILCSSValueType::ValueToString(aValue, valStr);
// Use string value to style the target element
nsDOMCSSAttributeDeclaration* overrideDecl = mElement->GetSMILOverrideStyle();
if (overrideDecl) {
@@ -138,22 +133,20 @@ nsSMILCSSProperty::ClearAnimValue()
if (overrideDecl) {
overrideDecl->SetPropertyValue(mPropID, EmptyString(), nullptr);
}
}
// Based on http://www.w3.org/TR/SVG/propidx.html
// static
bool
-nsSMILCSSProperty::IsPropertyAnimatable(nsCSSPropertyID aPropID,
- StyleBackendType aBackend)
+nsSMILCSSProperty::IsPropertyAnimatable(nsCSSPropertyID aPropID)
{
// Bug 1353918: Drop this check
- if (aBackend == StyleBackendType::Servo &&
- !Servo_Property_IsAnimatable(aPropID)) {
+ if (!Servo_Property_IsAnimatable(aPropID)) {
return false;
}
// NOTE: Right now, Gecko doesn't recognize the following properties from
// the SVG Property Index:
// alignment-baseline
// baseline-shift
// color-profile
--- a/dom/smil/nsSMILCSSProperty.h
+++ b/dom/smil/nsSMILCSSProperty.h
@@ -5,17 +5,16 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* representation of a SMIL-animatable CSS property on an element */
#ifndef NS_SMILCSSPROPERTY_H_
#define NS_SMILCSSPROPERTY_H_
#include "mozilla/Attributes.h"
-#include "mozilla/StyleBackendType.h"
#include "nsISMILAttr.h"
#include "nsAtom.h"
#include "nsCSSPropertyID.h"
#include "nsCSSValue.h"
namespace mozilla {
class ComputedStyle;
namespace dom {
@@ -59,18 +58,17 @@ public:
*
* @param aProperty The property to check for animation support.
* @param aBackend The style backend to check for animation support.
* This is a temporary measure until the Servo backend
* supports all animatable properties (bug 1353918).
* @return true if the given property is supported for SMIL animation, or
* false otherwise
*/
- static bool IsPropertyAnimatable(nsCSSPropertyID aPropID,
- mozilla::StyleBackendType aBackend);
+ static bool IsPropertyAnimatable(nsCSSPropertyID aPropID);
protected:
nsCSSPropertyID mPropID;
// Using non-refcounted pointer for mElement -- we know mElement will stay
// alive for my lifetime because a nsISMILAttr (like me) only lives as long
// as the Compositing step, and DOM elements don't get a chance to die during
// that time.
mozilla::dom::Element* mElement;
--- a/dom/smil/nsSMILCompositor.cpp
+++ b/dom/smil/nsSMILCompositor.cpp
@@ -153,18 +153,17 @@ nsSMILCompositor::GetCSSPropertyToAnimat
if (mKey.mAttributeNamespaceID != kNameSpaceID_None) {
return eCSSProperty_UNKNOWN;
}
nsCSSPropertyID propID =
nsCSSProps::LookupProperty(nsDependentAtomString(mKey.mAttributeName),
CSSEnabledState::eForAllContent);
- if (!nsSMILCSSProperty::IsPropertyAnimatable(propID,
- mKey.mElement->OwnerDoc()->GetStyleBackendType())) {
+ if (!nsSMILCSSProperty::IsPropertyAnimatable(propID)) {
return eCSSProperty_UNKNOWN;
}
// If we are animating the 'width' or 'height' of an outer SVG
// element we should animate it as a CSS property, but for other elements
// (e.g. <rect>) we should animate it as a length attribute.
// The easiest way to test for an outer SVG element, is to see if it is an
// SVG-namespace element mapping its width/height attribute to style.
--- a/dom/svg/nsSVGElement.cpp
+++ b/dom/svg/nsSVGElement.cpp
@@ -299,19 +299,17 @@ nsSVGElement::AfterSetAttr(int32_t aName
"Unexpected use of nsMappedAttributes within SVG");
// If this is an svg presentation attribute we need to map it into
// the content declaration block.
// XXX For some reason incremental mapping doesn't work, so for now
// just delete the style rule and lazily reconstruct it as needed).
if (aNamespaceID == kNameSpaceID_None && IsAttributeMapped(aName)) {
mContentDeclarationBlock = nullptr;
- if (OwnerDoc()->GetStyleBackendType() == StyleBackendType::Servo) {
- OwnerDoc()->ScheduleSVGForPresAttrEvaluation(this);
- }
+ OwnerDoc()->ScheduleSVGForPresAttrEvaluation(this);
}
if (IsEventAttributeName(aName) && aValue) {
MOZ_ASSERT(aValue->Type() == nsAttrValue::eString,
"Expected string value for script body");
nsresult rv = SetEventHandler(GetEventNameForAttr(aName),
aValue->GetStringValue());
NS_ENSURE_SUCCESS(rv, rv);
@@ -1140,18 +1138,17 @@ nsSVGElement::IsFocusableInternal(int32_
namespace {
class MOZ_STACK_CLASS MappedAttrParser {
public:
MappedAttrParser(css::Loader* aLoader,
nsIURI* aDocURI,
already_AddRefed<nsIURI> aBaseURI,
- nsSVGElement* aElement,
- StyleBackendType aBackend);
+ nsSVGElement* aElement);
~MappedAttrParser();
// Parses a mapped attribute value.
void ParseMappedAttrValue(nsAtom* aMappedAttrName,
const nsAString& aMappedAttrValue);
// If we've parsed any values for mapped attributes, this method returns the
// already_AddRefed css::Declaration that incorporates the parsed
@@ -1167,69 +1164,57 @@ private:
nsIURI* mDocURI;
nsCOMPtr<nsIURI> mBaseURI;
// Declaration for storing parsed values (lazily initialized)
RefPtr<DeclarationBlock> mDecl;
// For reporting use counters
nsSVGElement* mElement;
-
- StyleBackendType mBackend;
};
MappedAttrParser::MappedAttrParser(css::Loader* aLoader,
nsIURI* aDocURI,
already_AddRefed<nsIURI> aBaseURI,
- nsSVGElement* aElement,
- StyleBackendType aBackend)
+ nsSVGElement* aElement)
: mLoader(aLoader)
, mDocURI(aDocURI)
, mBaseURI(aBaseURI)
, mElement(aElement)
- , mBackend(aBackend)
{
}
MappedAttrParser::~MappedAttrParser()
{
MOZ_ASSERT(!mDecl,
"If mDecl was initialized, it should have been returned via "
"GetDeclarationBlock (and had its pointer cleared)");
}
void
MappedAttrParser::ParseMappedAttrValue(nsAtom* aMappedAttrName,
const nsAString& aMappedAttrValue)
{
if (!mDecl) {
- if (mBackend == StyleBackendType::Gecko) {
- MOZ_CRASH("old style system disabled");
- } else {
- mDecl = new ServoDeclarationBlock();
- }
+ mDecl = new ServoDeclarationBlock();
}
// Get the nsCSSPropertyID ID for our mapped attribute.
nsCSSPropertyID propertyID =
nsCSSProps::LookupProperty(nsDependentAtomString(aMappedAttrName),
CSSEnabledState::eForAllContent);
if (propertyID != eCSSProperty_UNKNOWN) {
bool changed = false; // outparam for ParseProperty.
- if (mBackend == StyleBackendType::Gecko) {
- MOZ_CRASH("old style system disabled");
- } else {
- NS_ConvertUTF16toUTF8 value(aMappedAttrValue);
- // FIXME (bug 1343964): Figure out a better solution for sending the base uri to servo
- RefPtr<URLExtraData> data = new URLExtraData(mBaseURI, mDocURI,
- mElement->NodePrincipal());
- changed = Servo_DeclarationBlock_SetPropertyById(
- mDecl->AsServo()->Raw(), propertyID, &value, false, data,
- ParsingMode::AllowUnitlessLength, mElement->OwnerDoc()->GetCompatibilityMode(), mLoader);
- }
+ NS_ConvertUTF16toUTF8 value(aMappedAttrValue);
+ // FIXME (bug 1343964): Figure out a better solution for sending the base uri to servo
+ RefPtr<URLExtraData> data = new URLExtraData(mBaseURI, mDocURI,
+ mElement->NodePrincipal());
+ changed = Servo_DeclarationBlock_SetPropertyById(
+ mDecl->AsServo()->Raw(), propertyID, &value, false, data,
+ ParsingMode::AllowUnitlessLength, mElement->OwnerDoc()->GetCompatibilityMode(), mLoader);
if (changed) {
// The normal reporting of use counters by the nsCSSParser won't happen
// since it doesn't have a sheet.
if (nsCSSProps::IsShorthand(propertyID)) {
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(subprop, propertyID,
CSSEnabledState::eForAllContent) {
UseCounter useCounter = nsCSSProps::UseCounterFor(*subprop);
@@ -1246,51 +1231,47 @@ MappedAttrParser::ParseMappedAttrValue(n
}
return;
}
MOZ_ASSERT(aMappedAttrName == nsGkAtoms::lang,
"Only 'lang' should be unrecognized!");
// nsCSSParser doesn't know about 'lang', so we need to handle it specially.
if (aMappedAttrName == nsGkAtoms::lang) {
propertyID = eCSSProperty__x_lang;
- if (mBackend == StyleBackendType::Gecko) {
- MOZ_CRASH("old style system disabled");
- } else {
- RefPtr<nsAtom> atom = NS_Atomize(aMappedAttrValue);
- Servo_DeclarationBlock_SetIdentStringValue(mDecl->AsServo()->Raw(), propertyID, atom);
- }
+ RefPtr<nsAtom> atom = NS_Atomize(aMappedAttrValue);
+ Servo_DeclarationBlock_SetIdentStringValue(mDecl->AsServo()->Raw(), propertyID, atom);
}
}
already_AddRefed<DeclarationBlock>
MappedAttrParser::GetDeclarationBlock()
{
return mDecl.forget();
}
} // namespace
//----------------------------------------------------------------------
// Implementation Helpers:
void
-nsSVGElement::UpdateContentDeclarationBlock(mozilla::StyleBackendType aBackend)
+nsSVGElement::UpdateContentDeclarationBlock()
{
NS_ASSERTION(!mContentDeclarationBlock,
"we already have a content declaration block");
uint32_t attrCount = mAttrsAndChildren.AttrCount();
if (!attrCount) {
// nothing to do
return;
}
nsIDocument* doc = OwnerDoc();
MappedAttrParser mappedAttrParser(doc->CSSLoader(), doc->GetDocumentURI(),
- GetBaseURI(), this, aBackend);
+ GetBaseURI(), this);
for (uint32_t i = 0; i < attrCount; ++i) {
const nsAttrName* attrName = mAttrsAndChildren.AttrNameAt(i);
if (!attrName->IsAtom() || !IsAttributeMapped(attrName->Atom()))
continue;
if (attrName->NamespaceID() != kNameSpaceID_None &&
!attrName->Equals(nsGkAtoms::lang, kNameSpaceID_XML)) {
--- a/dom/svg/nsSVGElement.h
+++ b/dom/svg/nsSVGElement.h
@@ -314,17 +314,17 @@ public:
// WebIDL
mozilla::dom::SVGSVGElement* GetOwnerSVGElement();
nsSVGElement* GetViewportElement();
already_AddRefed<mozilla::dom::SVGAnimatedString> ClassName();
virtual bool IsSVGFocusable(bool* aIsFocusable, int32_t* aTabIndex);
virtual bool IsFocusableInternal(int32_t* aTabIndex, bool aWithMouse) override;
- void UpdateContentDeclarationBlock(mozilla::StyleBackendType aBackend);
+ void UpdateContentDeclarationBlock();
const mozilla::DeclarationBlock* GetContentDeclarationBlock() const;
protected:
virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
// We define BeforeSetAttr here and mark it final to ensure it is NOT used
// by SVG elements.
// This is because we're not currently passing the correct value for aValue to
--- a/dom/xbl/nsXBLResourceLoader.cpp
+++ b/dom/xbl/nsXBLResourceLoader.cpp
@@ -90,20 +90,17 @@ nsXBLResourceLoader::LoadResources(nsICo
mLoadingResources = true;
// Declare our loaders.
nsCOMPtr<nsIDocument> doc = mBinding->XBLDocumentInfo()->GetDocument();
mBoundDocument = aBoundElement->OwnerDoc();
mozilla::css::Loader* cssLoader = doc->CSSLoader();
- MOZ_ASSERT(cssLoader->GetDocument() &&
- cssLoader->GetDocument()->GetStyleBackendType()
- == mBoundDocument->GetStyleBackendType(),
- "The style backends of the loader and bound document are mismatched!");
+ MOZ_ASSERT(cssLoader->GetDocument(), "Loader must have document");
nsIURI *docURL = doc->GetDocumentURI();
nsIPrincipal* docPrincipal = doc->NodePrincipal();
nsCOMPtr<nsIURI> url;
for (nsXBLResource* curr = mResourceList; curr; curr = curr->mNext) {
if (curr->mSrc.IsEmpty())
--- a/gfx/layers/AnimationHelper.cpp
+++ b/gfx/layers/AnimationHelper.cpp
@@ -411,35 +411,34 @@ CreateCSSValueList(const InfallibleTArra
result->mValue.SetNoneValue();
}
return new nsCSSValueSharedList(result.forget());
}
static AnimationValue
ToAnimationValue(const Animatable& aAnimatable)
{
- StyleBackendType backend = StyleBackendType::Servo;
AnimationValue result;
switch (aAnimatable.type()) {
case Animatable::Tnull_t:
break;
case Animatable::TArrayOfTransformFunction: {
const InfallibleTArray<TransformFunction>& transforms =
aAnimatable.get_ArrayOfTransformFunction();
auto listOrError = CreateCSSValueList(transforms);
if (listOrError.isOk()) {
RefPtr<nsCSSValueSharedList> list = listOrError.unwrap();
MOZ_ASSERT(list, "Transform list should be non null");
- result = AnimationValue::Transform(backend, *list);
+ result = AnimationValue::Transform(*list);
}
break;
}
case Animatable::Tfloat:
- result = AnimationValue::Opacity(backend, aAnimatable.get_float());
+ result = AnimationValue::Opacity(aAnimatable.get_float());
break;
default:
MOZ_ASSERT_UNREACHABLE("Unsupported type");
}
return result;
}
void
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -22,17 +22,16 @@
#include "mozilla/Logging.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/Sprintf.h"
#include "mozilla/TextEvents.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/TouchEvents.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/Unused.h"
-#include "mozilla/StyleBackendType.h"
#include <algorithm>
#ifdef XP_WIN
#include "winuser.h"
#endif
#include "gfxContext.h"
#include "gfxPrefs.h"
@@ -952,17 +951,17 @@ PresShell::Init(nsIDocument* aDocument,
mFrameManager = mFrameConstructor;
// The document viewer owns both view manager and pres shell.
mViewManager->SetPresShell(this);
// Bind the context to the presentation shell.
mPresContext = aPresContext;
- mPresContext->AttachShell(this, aStyleSet->BackendType());
+ mPresContext->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
// the PresContext during initialization.
mStyleSet = aStyleSet;
mStyleSet->Init(aPresContext);
// Notify our prescontext that it now has a compatibility mode. Note that
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -28,23 +28,21 @@
#include "SVGTextFrame.h"
#include "ActiveLayerTracker.h"
#include "nsSVGIntegrationUtils.h"
using namespace mozilla::dom;
namespace mozilla {
-RestyleManager::RestyleManager(StyleBackendType aType,
- nsPresContext* aPresContext)
+RestyleManager::RestyleManager(nsPresContext* aPresContext)
: mPresContext(aPresContext)
, mRestyleGeneration(1)
, mUndisplayedRestyleGeneration(1)
, mHoverGeneration(0)
- , mType(aType)
, mInStyleRefresh(false)
, mAnimationGeneration(0)
{
MOZ_ASSERT(mPresContext);
}
void
RestyleManager::ContentInserted(nsINode* aContainer, nsIContent* aChild)
--- a/layout/base/RestyleManager.h
+++ b/layout/base/RestyleManager.h
@@ -208,17 +208,17 @@ public:
void IncrementAnimationGeneration();
static void AddLayerChangesForAnimation(nsIFrame* aFrame,
nsIContent* aContent,
nsStyleChangeList&
aChangeListToProcess);
protected:
- RestyleManager(StyleBackendType aType, nsPresContext* aPresContext);
+ explicit RestyleManager(nsPresContext* aPresContext);
virtual ~RestyleManager()
{
MOZ_ASSERT(!mAnimationsWithDestroyedFrame,
"leaving dangling pointers from AnimationsWithDestroyedFrame");
}
void RestyleForEmptyChange(Element* aContainer);
@@ -268,18 +268,16 @@ private:
uint32_t mHoverGeneration;
// Used to keep track of frames that have been destroyed during
// ProcessRestyledFrames, so we don't try to touch them again even if
// they're referenced again later in the changelist.
mozilla::UniquePtr<nsTHashtable<nsPtrHashKey<const nsIFrame>>> mDestroyedFrames;
protected:
- const StyleBackendType mType;
-
// True if we're in the middle of a nsRefreshDriver refresh
bool mInStyleRefresh;
// The total number of animation flushes by this frame constructor.
// Used to keep the layer and animation manager in sync.
uint64_t mAnimationGeneration;
OverflowChangedTracker mOverflowChangedTracker;
--- a/layout/base/ServoRestyleManager.cpp
+++ b/layout/base/ServoRestyleManager.cpp
@@ -311,17 +311,17 @@ ServoRestyleState::TableAwareParentFor(c
// Must be a caption. In that case we want the table here.
MOZ_ASSERT(aChild->StyleDisplay()->mDisplay == StyleDisplay::TableCaption);
parent = parent->PrincipalChildList().FirstChild();
}
return parent;
}
ServoRestyleManager::ServoRestyleManager(nsPresContext* aPresContext)
- : RestyleManager(StyleBackendType::Servo, aPresContext)
+ : RestyleManager(aPresContext)
, mReentrantChanges(nullptr)
{
}
void
ServoRestyleManager::PostRestyleEvent(Element* aElement,
nsRestyleHint aRestyleHint,
nsChangeHint aMinChangeHint)
@@ -1146,17 +1146,17 @@ ServoRestyleManager::DoProcessPendingRes
if (mRestyleForCSSRuleChanges) {
aFlags |= ServoTraversalFlags::ForCSSRuleChanges;
}
while (styleSet->StyleDocument(aFlags)) {
ClearSnapshots();
- nsStyleChangeList currentChanges(StyleBackendType::Servo);
+ nsStyleChangeList currentChanges;
bool anyStyleChanged = false;
// Recreate styles , and queue up change hints (which also handle lazy frame
// construction).
{
AutoRestyleTimelineMarker marker(presContext->GetDocShell(), false);
DocumentStyleRootIterator iter(doc->GetServoRestyleRoot());
while (Element* root = iter.GetNextStyleRoot()) {
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -2312,24 +2312,17 @@ nsDocumentViewer::RequestWindowClose(boo
StyleSetHandle
nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument)
{
// Make sure this does the same thing as PresShell::AddSheet wrt ordering.
// this should eventually get expanded to allow for creating
// different sets for different media
- StyleBackendType backendType = aDocument->GetStyleBackendType();
-
- StyleSetHandle styleSet;
- if (backendType == StyleBackendType::Gecko) {
- MOZ_CRASH("old style system disabled");
- } else {
- styleSet = new ServoStyleSet();
- }
+ StyleSetHandle styleSet = new ServoStyleSet();
styleSet->BeginUpdate();
// The document will fill in the document sheets when we create the presshell
if (aDocument->IsBeingUsedAsImage()) {
MOZ_ASSERT(aDocument->IsSVGDocument(),
"Do we want to skip most sheets for this new image type?");
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -966,26 +966,22 @@ nsPresContext::Init(nsDeviceContext* aDe
#endif
return NS_OK;
}
// 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;
- if (aBackendType == StyleBackendType::Servo) {
- mRestyleManager = new ServoRestyleManager(this);
- } else {
- MOZ_CRASH("old style system disabled");
- }
+ mRestyleManager = new ServoRestyleManager(this);
// Since CounterStyleManager is also the name of a method of
// nsPresContext, it is necessary to prefix the class with the mozilla
// namespace here.
mCounterStyleManager = new mozilla::CounterStyleManager(this);
nsIDocument *doc = mShell->GetDocument();
NS_ASSERTION(doc, "expect document here");
--- a/layout/base/nsPresContext.h
+++ b/layout/base/nsPresContext.h
@@ -42,17 +42,16 @@
#include "prclist.h"
#include "nsThreadUtils.h"
#include "ScrollbarStyles.h"
#include "nsIMessageManager.h"
#include "mozilla/RestyleLogging.h"
#include "Units.h"
#include "prenv.h"
#include "mozilla/StaticPresData.h"
-#include "mozilla/StyleBackendType.h"
class nsBidi;
class nsIPrintSettings;
class nsDocShell;
class nsIDocShell;
class nsIDocument;
class nsITheme;
class nsIContent;
@@ -155,17 +154,17 @@ public:
* Initialize the presentation context from a particular device.
*/
nsresult Init(nsDeviceContext* aDeviceContext);
/**
* 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();
nsPresContextType Type() const { return mType; }
/**
* Get the PresentationShell that this context is bound to.
*/
--- a/layout/base/nsStyleChangeList.cpp
+++ b/layout/base/nsStyleChangeList.cpp
@@ -40,40 +40,30 @@ nsStyleChangeList::AppendChange(nsIFrame
"doing lazy frame construction");
MOZ_ASSERT(!(aHint & nsChangeHint_AllReflowHints) ||
(aHint & nsChangeHint_NeedReflow),
"Reflow hint bits set without actually asking for a reflow");
if (aHint & nsChangeHint_ReconstructFrame) {
// If Servo fires reconstruct at a node, it is the only change hint fired at
// that node.
- if (IsServo()) {
- // Note: Because we check whether |aHint| is a reconstruct above (which is
- // necessary to avoid debug test timeouts on certain crashtests), this check
- // will not find bugs where we add a non-reconstruct hint for an element after
- // adding a reconstruct. This is ok though, since ProcessRestyledFrames will
- // handle that case via mDestroyedFrames.
+ // Note: Because we check whether |aHint| is a reconstruct above (which is
+ // necessary to avoid debug test timeouts on certain crashtests), this check
+ // will not find bugs where we add a non-reconstruct hint for an element after
+ // adding a reconstruct. This is ok though, since ProcessRestyledFrames will
+ // handle that case via mDestroyedFrames.
#ifdef DEBUG
- for (size_t i = 0; i < Length(); ++i) {
- MOZ_ASSERT(aContent != (*this)[i].mContent ||
- !((*this)[i].mHint & nsChangeHint_ReconstructFrame),
- "Should not append a non-ReconstructFrame hint after \
- appending a ReconstructFrame hint for the same \
- content.");
- }
+ for (size_t i = 0; i < Length(); ++i) {
+ MOZ_ASSERT(aContent != (*this)[i].mContent ||
+ !((*this)[i].mHint & nsChangeHint_ReconstructFrame),
+ "Should not append a non-ReconstructFrame hint after \
+ appending a ReconstructFrame hint for the same \
+ content.");
+ }
#endif
- } else {
- // Filter out all other changes for same content for Gecko (Servo asserts against this
- // case above).
- // NOTE: This is captured by reference to please static analysis.
- // Capturing it by value as a pointer should be fine in this case.
- RemoveElementsBy([&](const nsStyleChangeData& aData) {
- return aData.mContent == aContent;
- });
- }
}
if (!IsEmpty() && aFrame && aFrame == LastElement().mFrame) {
LastElement().mHint |= aHint;
return;
}
AppendElement(nsStyleChangeData { aFrame, aContent, aHint });
--- a/layout/base/nsStyleChangeList.h
+++ b/layout/base/nsStyleChangeList.h
@@ -8,17 +8,16 @@
* a list of the recomputation that needs to be done in response to a
* style change
*/
#ifndef nsStyleChangeList_h___
#define nsStyleChangeList_h___
#include "mozilla/Attributes.h"
-#include "mozilla/StyleBackendType.h"
#include "nsChangeHint.h"
#include "nsCOMPtr.h"
class nsIFrame;
class nsIContent;
struct nsStyleChangeData
@@ -36,30 +35,23 @@ class nsStyleChangeList : private AutoTA
public:
using base_type::begin;
using base_type::end;
using base_type::IsEmpty;
using base_type::Clear;
using base_type::Length;
using base_type::operator[];
- explicit nsStyleChangeList(mozilla::StyleBackendType aType) :
- mType(aType) { MOZ_COUNT_CTOR(nsStyleChangeList); }
+ nsStyleChangeList() { MOZ_COUNT_CTOR(nsStyleChangeList); }
~nsStyleChangeList() { MOZ_COUNT_DTOR(nsStyleChangeList); }
void AppendChange(nsIFrame* aFrame, nsIContent* aContent, nsChangeHint aHint);
// Starting from the end of the list, removes all changes until the list is
// empty or an element with |mContent != aContent| is found.
void PopChangesForContent(nsIContent* aContent)
{
while (!IsEmpty() && LastElement().mContent == aContent) {
RemoveLastElement();
}
}
-
- bool IsGecko() const { return mType == mozilla::StyleBackendType::Gecko; }
- bool IsServo() const { return mType == mozilla::StyleBackendType::Servo; }
-
-private:
- mozilla::StyleBackendType mType;
};
#endif /* nsStyleChangeList_h___ */
--- a/layout/style/CSS.cpp
+++ b/layout/style/CSS.cpp
@@ -20,17 +20,16 @@
namespace mozilla {
namespace dom {
struct SupportsParsingInfo
{
nsIURI* mDocURI;
nsIURI* mBaseURI;
nsIPrincipal* mPrincipal;
- StyleBackendType mStyleBackendType;
};
static nsresult
GetParsingInfo(const GlobalObject& aGlobal,
SupportsParsingInfo& aInfo)
{
nsGlobalWindowInner* win = xpc::WindowOrNull(aGlobal.Get());
if (!win) {
@@ -40,17 +39,16 @@ GetParsingInfo(const GlobalObject& aGlob
nsCOMPtr<nsIDocument> doc = win->GetDoc();
if (!doc) {
return NS_ERROR_FAILURE;
}
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;
}
/* static */ bool
CSS::Supports(const GlobalObject& aGlobal,
const nsAString& aProperty,
const nsAString& aValue,
ErrorResult& aRv)
@@ -58,45 +56,36 @@ CSS::Supports(const GlobalObject& aGloba
SupportsParsingInfo info;
nsresult rv = GetParsingInfo(aGlobal, info);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return false;
}
- if (info.mStyleBackendType == StyleBackendType::Servo) {
- NS_ConvertUTF16toUTF8 property(aProperty);
- NS_ConvertUTF16toUTF8 value(aValue);
- return Servo_CSSSupports2(&property, &value);
- }
-
- MOZ_CRASH("old style system disabled");
+ NS_ConvertUTF16toUTF8 property(aProperty);
+ NS_ConvertUTF16toUTF8 value(aValue);
+ return Servo_CSSSupports2(&property, &value);
}
/* static */ bool
CSS::Supports(const GlobalObject& aGlobal,
const nsAString& aCondition,
ErrorResult& aRv)
{
SupportsParsingInfo info;
nsresult rv = GetParsingInfo(aGlobal, info);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return false;
}
- if (info.mStyleBackendType == StyleBackendType::Servo) {
- NS_ConvertUTF16toUTF8 cond(aCondition);
- return Servo_CSSSupports(&cond);
- }
-
- MOZ_CRASH("old style system disabled");
- return false;
+ NS_ConvertUTF16toUTF8 cond(aCondition);
+ return Servo_CSSSupports(&cond);
}
/* static */ void
CSS::Escape(const GlobalObject& aGlobal,
const nsAString& aIdent,
nsAString& aReturn)
{
nsStyleUtil::AppendEscapedCSSIdent(aIdent, aReturn);
--- a/layout/style/DeclarationBlock.h
+++ b/layout/style/DeclarationBlock.h
@@ -9,17 +9,16 @@
* a style attribute
*/
#ifndef mozilla_DeclarationBlock_h
#define mozilla_DeclarationBlock_h
#include "mozilla/Atomics.h"
#include "mozilla/ServoUtils.h"
-#include "mozilla/StyleBackendType.h"
#include "nsCSSPropertyID.h"
class nsHTMLCSSStyleSheet;
namespace mozilla {
class ServoDeclarationBlock;
@@ -27,26 +26,25 @@ class ServoDeclarationBlock;
namespace css {
class Declaration;
class Rule;
} // namespace css
class DeclarationBlock
{
protected:
- explicit DeclarationBlock(StyleBackendType aType)
+ DeclarationBlock()
: mImmutable(false)
- , mType(aType)
, mIsDirty(false)
{
mContainer.mRaw = 0;
}
DeclarationBlock(const DeclarationBlock& aCopy)
- : DeclarationBlock(aCopy.mType) {}
+ : DeclarationBlock() {}
public:
MOZ_DECL_STYLO_METHODS(css::Declaration, ServoDeclarationBlock)
inline MozExternalRefCountType AddRef();
inline MozExternalRefCountType Release();
inline already_AddRefed<DeclarationBlock> Clone() const;
@@ -153,18 +151,16 @@ private:
// The nsHTMLCSSStyleSheet that is responsible for this declaration.
// Only non-null for style attributes.
nsHTMLCSSStyleSheet* mHTMLCSSStyleSheet;
} mContainer;
// set when declaration put in the rule tree;
bool mImmutable;
- const StyleBackendType mType;
-
// True if this declaration has not been restyled after modified.
//
// Since we can clear this flag from style worker threads, we use an Atomic.
//
// Note that although a single DeclarationBlock can be shared between
// different rule nodes (due to the style="" attribute cache), whenever a
// DeclarationBlock has its mIsDirty flag set to true, we always clone it to
// a unique object first. So when we clear this flag during Servo traversal,
--- a/layout/style/GenericSpecifiedValues.h
+++ b/layout/style/GenericSpecifiedValues.h
@@ -11,35 +11,33 @@
*/
#ifndef mozilla_GenericSpecifiedValues_h
#define mozilla_GenericSpecifiedValues_h
#include "mozilla/ServoUtils.h"
#include "nsCSSProps.h"
#include "nsCSSValue.h"
-#include "StyleBackendType.h"
class nsAttrValue;
struct nsRuleData;
namespace mozilla {
class ServoSpecifiedValues;
// This provides a common interface for attribute mappers
// (MapAttributesIntoRule) to use regardless of the style backend. If the style
// backend is Gecko, this will contain an nsRuleData. If it is Servo, it will be
// a PropertyDeclarationBlock.
class GenericSpecifiedValues
{
protected:
- explicit GenericSpecifiedValues(StyleBackendType aType, nsIDocument* aDoc, uint32_t aSIDs)
- : mType(aType)
- , mDocument(aDoc)
+ explicit GenericSpecifiedValues(nsIDocument* aDoc, uint32_t aSIDs)
+ : mDocument(aDoc)
, mSIDs(aSIDs)
{}
public:
MOZ_DECL_STYLO_METHODS(nsRuleData, ServoSpecifiedValues)
nsIDocument* Document()
{
@@ -117,16 +115,15 @@ public:
inline void SetColorValueIfUnset(nsCSSPropertyID aId, nscolor aValue);
// Set font-family to a string
inline void SetFontFamily(const nsString& aValue);
// Add a quirks-mode override to the decoration color of elements nested in <a>
inline void SetTextDecorationColorOverride();
inline void SetBackgroundImage(nsAttrValue& value);
- const mozilla::StyleBackendType mType;
nsIDocument* const mDocument;
const uint32_t mSIDs;
};
} // namespace mozilla
#endif // mozilla_GenericSpecifiedValues_h
--- a/layout/style/ServoDeclarationBlock.h
+++ b/layout/style/ServoDeclarationBlock.h
@@ -12,17 +12,17 @@
namespace mozilla {
class ServoDeclarationBlock final : public DeclarationBlock
{
public:
explicit ServoDeclarationBlock(
already_AddRefed<RawServoDeclarationBlock> aRaw)
- : DeclarationBlock(StyleBackendType::Servo), mRaw(aRaw) {}
+ : DeclarationBlock(), mRaw(aRaw) {}
ServoDeclarationBlock()
: ServoDeclarationBlock(Servo_DeclarationBlock_CreateEmpty().Consume()) {}
ServoDeclarationBlock(const ServoDeclarationBlock& aCopy)
: DeclarationBlock(aCopy)
, mRaw(Servo_DeclarationBlock_Clone(aCopy.mRaw).Consume()) {}
--- a/layout/style/ServoSpecifiedValues.h
+++ b/layout/style/ServoSpecifiedValues.h
@@ -17,17 +17,17 @@
#include "nsStyleStruct.h"
namespace mozilla {
class ServoSpecifiedValues final : public GenericSpecifiedValues
{
public:
ServoSpecifiedValues(nsIDocument* aDocument, RawServoDeclarationBlock* aDecl)
- : GenericSpecifiedValues(StyleBackendType::Servo, aDocument, NS_STYLE_INHERIT_MASK)
+ : GenericSpecifiedValues(aDocument, NS_STYLE_INHERIT_MASK)
, mDecl(aDecl)
{}
// GenericSpecifiedValues overrides
bool PropertyIsSet(nsCSSPropertyID aId);
void SetIdentStringValue(nsCSSPropertyID aId, const nsString& aValue);
--- a/layout/style/ServoStyleSheet.cpp
+++ b/layout/style/ServoStyleSheet.cpp
@@ -2,17 +2,16 @@
/* 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/. */
#include "mozilla/ServoStyleSheet.h"
#include "mozilla/css/Rule.h"
-#include "mozilla/StyleBackendType.h"
#include "mozilla/ServoBindings.h"
#include "mozilla/ServoCSSRuleList.h"
#include "mozilla/ServoImportRule.h"
#include "mozilla/ServoMediaList.h"
#include "mozilla/ServoStyleSet.h"
#include "mozilla/css/GroupRule.h"
#include "mozilla/dom/CSSRuleList.h"
#include "mozilla/dom/MediaList.h"
@@ -126,17 +125,17 @@ ServoStyleSheetInner::SizeOfIncludingThi
mContents);
return n;
}
ServoStyleSheet::ServoStyleSheet(css::SheetParsingMode aParsingMode,
CORSMode aCORSMode,
net::ReferrerPolicy aReferrerPolicy,
const dom::SRIMetadata& aIntegrity)
- : StyleSheet(StyleBackendType::Servo, aParsingMode)
+ : StyleSheet(aParsingMode)
{
mInner = new ServoStyleSheetInner(
aCORSMode, aReferrerPolicy, aIntegrity, aParsingMode);
mInner->AddSheet(this);
}
ServoStyleSheet::ServoStyleSheet(const ServoStyleSheet& aCopy,
ServoStyleSheet* aParentToUse,
--- a/layout/style/StyleAnimationValue.cpp
+++ b/layout/style/StyleAnimationValue.cpp
@@ -244,49 +244,28 @@ AnimationValue::FromString(nsCSSProperty
result.mServo =
shell->StyleSet()->AsServo()->ComputeAnimationValue(aElement,
declarations,
computedStyle);
return result;
}
/* static */ AnimationValue
-AnimationValue::Opacity(StyleBackendType aBackendType, float aOpacity)
+AnimationValue::Opacity(float aOpacity)
{
AnimationValue result;
-
- switch (aBackendType) {
- case StyleBackendType::Servo:
- result.mServo = Servo_AnimationValue_Opacity(aOpacity).Consume();
- break;
- case StyleBackendType::Gecko:
- MOZ_CRASH("old style system disabled");
- break;
- default:
- MOZ_ASSERT_UNREACHABLE("Unsupported style backend");
- }
+ result.mServo = Servo_AnimationValue_Opacity(aOpacity).Consume();
return result;
}
/* static */ AnimationValue
-AnimationValue::Transform(StyleBackendType aBackendType,
- nsCSSValueSharedList& aList)
+AnimationValue::Transform(nsCSSValueSharedList& aList)
{
AnimationValue result;
-
- switch (aBackendType) {
- case StyleBackendType::Servo:
- result.mServo = Servo_AnimationValue_Transform(aList).Consume();
- break;
- case StyleBackendType::Gecko:
- MOZ_CRASH("old style system disabled");
- break;
- default:
- MOZ_ASSERT_UNREACHABLE("Unsupported style backend");
- }
+ result.mServo = Servo_AnimationValue_Transform(aList).Consume();
return result;
}
/* static */ already_AddRefed<nsCSSValue::Array>
AnimationValue::AppendTransformFunction(nsCSSKeyword aTransformFunction,
nsCSSValueList**& aListTail)
{
RefPtr<nsCSSValue::Array> arr = AppendFunction(aTransformFunction);
--- a/layout/style/StyleAnimationValue.h
+++ b/layout/style/StyleAnimationValue.h
@@ -34,17 +34,16 @@ namespace css {
class StyleRule;
} // namespace css
namespace dom {
class Element;
} // namespace dom
enum class CSSPseudoElementType : uint8_t;
-enum class StyleBackendType : uint8_t;
struct PropertyStyleAnimationValuePair;
struct AnimationValue
{
explicit AnimationValue(const RefPtr<RawServoAnimationValue>& aValue)
: mServo(aValue) { }
AnimationValue() = default;
@@ -105,20 +104,19 @@ struct AnimationValue
// Create an AnimaitonValue from a string. This method flushes style, so we
// should use this carefully. Now, it is only used by
// nsDOMWindowUtils::ComputeAnimationDistance.
static AnimationValue FromString(nsCSSPropertyID aProperty,
const nsAString& aValue,
dom::Element* aElement);
// Create an AnimationValue from an opacity value.
- static AnimationValue Opacity(StyleBackendType aBackendType, float aOpacity);
+ static AnimationValue Opacity(float aOpacity);
// Create an AnimationValue from a transform list.
- static AnimationValue Transform(StyleBackendType aBackendType,
- nsCSSValueSharedList& aList);
+ static AnimationValue Transform(nsCSSValueSharedList& aList);
static already_AddRefed<nsCSSValue::Array>
AppendTransformFunction(nsCSSKeyword aTransformFunction,
nsCSSValueList**& aListTail);
// mGecko and mServo are mutually exclusive: only one or the other should
// ever be set.
// FIXME: After obsoleting StyleAnimationValue, we should remove mGecko, and
deleted file mode 100644
--- a/layout/style/StyleBackendType.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* -*- 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/. */
-
-#ifndef mozilla_StyleBackendType_h
-#define mozilla_StyleBackendType_h
-
-#include <stdint.h>
-
-namespace mozilla {
-
-/**
- * Enumeration that represents one of the two supported style system backends.
- */
-enum class StyleBackendType : uint8_t
-{
- None,
- Gecko,
- Servo
-};
-
-} // namespace mozilla
-
-#endif // mozilla_StyleBackendType_h
--- a/layout/style/StyleSetHandle.h
+++ b/layout/style/StyleSetHandle.h
@@ -8,17 +8,16 @@
#define mozilla_StyleSetHandle_h
#include "mozilla/AtomArray.h"
#include "mozilla/EventStates.h"
#include "mozilla/MediaFeatureChange.h"
#include "mozilla/RefPtr.h"
#include "mozilla/ServoTypes.h"
#include "mozilla/SheetType.h"
-#include "mozilla/StyleBackendType.h"
#include "mozilla/StyleSheet.h"
#include "nsChangeHint.h"
#include "nsCSSPseudoElements.h"
#include "nsTArray.h"
class nsBindingManager;
class nsCSSCounterStyleRule;
struct nsFontFaceRuleContainer;
@@ -67,23 +66,16 @@ public:
}
bool IsServo() const
{
MOZ_ASSERT(mValue, "StyleSetHandle null pointer dereference");
return mValue & SERVO_BIT;
}
- StyleBackendType BackendType() const
- {
- return IsGecko() ? StyleBackendType::Gecko :
- StyleBackendType::Servo;
- }
-
-
ServoStyleSet* AsServo()
{
MOZ_ASSERT(IsServo());
return reinterpret_cast<ServoStyleSet*>(mValue & ~SERVO_BIT);
}
ServoStyleSet* GetAsServo() { return IsServo() ? AsServo() : nullptr; }
--- a/layout/style/StyleSheet.cpp
+++ b/layout/style/StyleSheet.cpp
@@ -20,23 +20,22 @@
#include "mozilla/StyleSetHandleInlines.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozAutoDocUpdate.h"
#include "NullPrincipal.h"
namespace mozilla {
-StyleSheet::StyleSheet(StyleBackendType aType, css::SheetParsingMode aParsingMode)
+StyleSheet::StyleSheet(css::SheetParsingMode aParsingMode)
: mParent(nullptr)
, mDocument(nullptr)
, mOwningNode(nullptr)
, mOwnerRule(nullptr)
, mParsingMode(aParsingMode)
- , mType(aType)
, mDisabled(false)
, mDirtyFlags(0)
, mDocumentAssociationMode(NotOwnedByDocument)
, mInner(nullptr)
{
}
StyleSheet::StyleSheet(const StyleSheet& aCopy,
@@ -45,17 +44,16 @@ StyleSheet::StyleSheet(const StyleSheet&
nsIDocument* aDocumentToUse,
nsINode* aOwningNodeToUse)
: mParent(aParentToUse)
, mTitle(aCopy.mTitle)
, mDocument(aDocumentToUse)
, mOwningNode(aOwningNodeToUse)
, mOwnerRule(aOwnerRuleToUse)
, mParsingMode(aCopy.mParsingMode)
- , mType(aCopy.mType)
, mDisabled(aCopy.mDisabled)
, mDirtyFlags(aCopy.mDirtyFlags)
// 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.
, mDocumentAssociationMode(NotOwnedByDocument)
, mInner(aCopy.mInner) // Shallow copy, but concrete subclasses will fix up.
{
MOZ_ASSERT(mInner, "Should only copy StyleSheets with an mInner.");
--- a/layout/style/StyleSheet.h
+++ b/layout/style/StyleSheet.h
@@ -5,17 +5,16 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_StyleSheet_h
#define mozilla_StyleSheet_h
#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"
#include "nsICSSLoaderObserver.h"
#include "nsWrapperCache.h"
class nsIDocument;
class nsINode;
class nsIPrincipal;
@@ -44,17 +43,17 @@ class Rule;
/**
* Superclass for data common to CSSStyleSheet and ServoStyleSheet.
*/
class StyleSheet : public nsICSSLoaderObserver
, public nsWrapperCache
{
protected:
- StyleSheet(StyleBackendType aType, css::SheetParsingMode aParsingMode);
+ explicit StyleSheet(css::SheetParsingMode aParsingMode);
StyleSheet(const StyleSheet& aCopy,
StyleSheet* aParentToUse,
dom::CSSImportRule* aOwnerRuleToUse,
nsIDocument* aDocumentToUse,
nsINode* aOwningNodeToUse);
virtual ~StyleSheet();
public:
@@ -348,17 +347,16 @@ protected:
RefPtr<StyleSheet> mNext;
// mParsingMode controls access to nonstandard style constructs that
// are not safe for use on the public Web but necessary in UA sheets
// and/or useful in user sheets.
css::SheetParsingMode mParsingMode;
- const StyleBackendType mType;
bool mDisabled;
enum dirtyFlagAttributes {
FORCED_UNIQUE_INNER = 0x1,
MODIFIED_RULES = 0x2,
};
uint8_t mDirtyFlags; // has been modified
--- a/layout/style/moz.build
+++ b/layout/style/moz.build
@@ -106,17 +106,16 @@ EXPORTS.mozilla += [
'ServoStyleSet.h',
'ServoStyleSheet.h',
'ServoSupportsRule.h',
'ServoTraversalStatistics.h',
'ServoTypes.h',
'ServoUtils.h',
'SheetType.h',
'StyleAnimationValue.h',
- 'StyleBackendType.h',
'StyleComplexColor.h',
'StylePrefs.h',
'StyleSetHandle.h',
'StyleSetHandleInlines.h',
'StyleSheet.h',
'StyleSheetInfo.h',
'StyleSheetInlines.h',
'URLExtraData.h',
--- a/servo/components/style/gecko/wrapper.rs
+++ b/servo/components/style/gecko/wrapper.rs
@@ -1171,17 +1171,16 @@ impl<'le> TElement for GeckoElement<'le>
fn smil_override(&self) -> Option<ArcBorrow<Locked<PropertyDeclarationBlock>>> {
unsafe {
let slots = self.extended_slots()?;
let base_declaration: &structs::DeclarationBlock =
slots.mSMILOverrideStyleDeclaration.mRawPtr.as_ref()?;
- assert_eq!(base_declaration.mType, structs::StyleBackendType_Servo);
let declaration: &structs::ServoDeclarationBlock =
mem::transmute(base_declaration);
debug_assert_eq!(
&declaration._base as *const structs::DeclarationBlock,
base_declaration as *const structs::DeclarationBlock
);