Bug 1436059: Make XBL / Shadow DOM use AuthorStyles. r=xidorn

It's just a struct aggregating stylesheets + CascadeData, with a quirks_mode
parameter because XBL sucks so bad.

MozReview-Commit-ID: 7q99tSNXo0K
This commit is contained in:
Emilio Cobos Álvarez 2018-02-12 13:57:26 +01:00
parent 946bc4825a
commit d39c5388fc
19 changed files with 148 additions and 131 deletions

View File

@ -787,24 +787,6 @@ nsBindingManager::MediumFeaturesChanged(nsPresContext* aPresContext,
#endif
}
void
nsBindingManager::UpdateBoundContentBindingsForServo(nsPresContext* aPresContext)
{
MOZ_ASSERT(mDocument->IsStyledByServo(),
"This should be called only by servo-backend!");
RefPtr<nsPresContext> presContext = aPresContext;
EnumerateBoundContentBindings([=](nsXBLBinding* aBinding) {
nsXBLPrototypeBinding* protoBinding = aBinding->PrototypeBinding();
ServoStyleSet* styleSet = protoBinding->GetServoStyleSet();
if (styleSet && styleSet->StyleSheetsHaveChanged()) {
protoBinding->ComputeServoStyleSet(presContext);
}
return true;
});
}
void
nsBindingManager::AppendAllSheets(nsTArray<StyleSheet*>& aArray)
{

View File

@ -142,10 +142,6 @@ public:
bool MediumFeaturesChanged(nsPresContext* aPresContext,
mozilla::MediaFeatureChangeReason);
// Update the content bindings in mBoundContentSet due to medium features
// changed.
void UpdateBoundContentBindingsForServo(nsPresContext* aPresContext);
void AppendAllSheets(nsTArray<mozilla::StyleSheet*>& aArray);
void Traverse(nsIContent *aContent,

View File

@ -838,10 +838,10 @@ nsXBLBinding::WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc, void* aData)
}
#endif
ServoStyleSet*
nsXBLBinding::GetServoStyleSet() const
const RawServoAuthorStyles*
nsXBLBinding::GetServoStyles() const
{
return mPrototypeBinding->GetServoStyleSet();
return mPrototypeBinding->GetServoStyles();
}
// Internal helper methods ////////////////////////////////////////////////////////////////

View File

@ -23,9 +23,9 @@ class nsXBLPrototypeBinding;
class nsIContent;
class nsAtom;
class nsIDocument;
struct RawServoAuthorStyles;
namespace mozilla {
class ServoStyleSet;
namespace dom {
class ShadowRoot;
@ -135,7 +135,7 @@ public:
void WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc, void* aData);
#endif
mozilla::ServoStyleSet* GetServoStyleSet() const;
const RawServoAuthorStyles* GetServoStyles() const;
static nsresult DoInitJSClass(JSContext *cx, JS::Handle<JSObject*> obj,
const nsString& aClassName,

View File

@ -578,20 +578,6 @@ nsXBLPrototypeBinding::GetRuleProcessor()
}
#endif
void
nsXBLPrototypeBinding::ComputeServoStyleSet(nsPresContext* aPresContext)
{
if (mResources) {
mResources->ComputeServoStyleSet(aPresContext);
}
}
ServoStyleSet*
nsXBLPrototypeBinding::GetServoStyleSet() const
{
return mResources ? mResources->GetServoStyleSet() : nullptr;
}
void
nsXBLPrototypeBinding::EnsureAttributeTable()
{

View File

@ -135,8 +135,21 @@ public:
#ifdef MOZ_OLD_STYLE
nsIStyleRuleProcessor* GetRuleProcessor();
#endif
void ComputeServoStyleSet(nsPresContext* aPresContext);
mozilla::ServoStyleSet* GetServoStyleSet() const;
const RawServoAuthorStyles* GetServoStyles() const
{
return mResources ? mResources->GetServoStyles() : nullptr;
}
RawServoAuthorStyles* GetServoStyles()
{
return mResources
? const_cast<RawServoAuthorStyles*>(mResources->GetServoStyles())
: nullptr;
}
mozilla::ServoStyleRuleMap* GetServoStyleRuleMap()
{
return mResources ? mResources->GetServoStyleRuleMap() : nullptr;
}
nsresult FlushSkinSheets();

View File

@ -42,9 +42,6 @@ nsXBLPrototypeResources::~nsXBLPrototypeResources()
if (mLoader) {
mLoader->mResources = nullptr;
}
if (mServoStyleSet) {
mServoStyleSet->Shutdown();
}
}
void
@ -122,7 +119,7 @@ nsXBLPrototypeResources::FlushSkinSheets()
// Though during unlink is fine I guess...
if (auto* shell = doc->GetShell()) {
MOZ_ASSERT(shell->GetPresContext());
ComputeServoStyleSet(shell->GetPresContext());
ComputeServoStyles(*shell->StyleSet()->AsServo());
}
} else {
#ifdef MOZ_OLD_STYLE
@ -190,16 +187,29 @@ nsXBLPrototypeResources::GatherRuleProcessor()
#endif
void
nsXBLPrototypeResources::ComputeServoStyleSet(nsPresContext* aPresContext)
nsXBLPrototypeResources::ComputeServoStyles(const ServoStyleSet& aMasterStyleSet)
{
nsTArray<RefPtr<ServoStyleSheet>> sheets(mStyleSheetList.Length());
for (StyleSheet* sheet : mStyleSheetList) {
MOZ_ASSERT(sheet->IsServo(),
"This should only be called with Servo-flavored style backend!");
sheets.AppendElement(sheet->AsServo());
mStyleRuleMap.reset(nullptr);
mServoStyles.reset(Servo_AuthorStyles_Create());
for (auto& sheet : mStyleSheetList) {
Servo_AuthorStyles_AppendStyleSheet(mServoStyles.get(), sheet->AsServo());
}
Servo_AuthorStyles_Flush(mServoStyles.get(), aMasterStyleSet.RawSet());
}
ServoStyleRuleMap*
nsXBLPrototypeResources::GetServoStyleRuleMap()
{
if (!HasStyleSheets() || !mServoStyles) {
return nullptr;
}
mServoStyleSet = ServoStyleSet::CreateXBLServoStyleSet(aPresContext, sheets);
if (!mStyleRuleMap) {
mStyleRuleMap = MakeUnique<ServoStyleRuleMap>();
}
mStyleRuleMap->EnsureTable(*this);
return mStyleRuleMap.get();
}
void
@ -220,24 +230,6 @@ nsXBLPrototypeResources::InsertStyleSheetAt(size_t aIndex, StyleSheet* aSheet)
mStyleSheetList.InsertElementAt(aIndex, aSheet);
}
StyleSheet*
nsXBLPrototypeResources::StyleSheetAt(size_t aIndex) const
{
return mStyleSheetList[aIndex];
}
size_t
nsXBLPrototypeResources::SheetCount() const
{
return mStyleSheetList.Length();
}
bool
nsXBLPrototypeResources::HasStyleSheets() const
{
return !mStyleSheetList.IsEmpty();
}
void
nsXBLPrototypeResources::AppendStyleSheetsTo(
nsTArray<StyleSheet*>& aResult) const

View File

@ -8,6 +8,7 @@
#define nsXBLPrototypeResources_h__
#include "mozilla/StyleSheet.h"
#include "mozilla/ServoStyleRuleMap.h"
#include "nsICSSLoaderObserver.h"
class nsCSSRuleProcessor;
@ -15,10 +16,12 @@ class nsAtom;
class nsIContent;
class nsXBLPrototypeBinding;
class nsXBLResourceLoader;
struct RawServoAuthorStyles;
namespace mozilla {
class CSSStyleSheet;
class ServoStyleSet;
class ServoStyleRuleMap;
} // namespace mozilla
// *********************************************************************/
@ -45,9 +48,22 @@ public:
void AppendStyleSheet(mozilla::StyleSheet* aSheet);
void RemoveStyleSheet(mozilla::StyleSheet* aSheet);
void InsertStyleSheetAt(size_t aIndex, mozilla::StyleSheet* aSheet);
mozilla::StyleSheet* StyleSheetAt(size_t aIndex) const;
size_t SheetCount() const;
bool HasStyleSheets() const;
mozilla::StyleSheet* StyleSheetAt(size_t aIndex) const
{
return mStyleSheetList[aIndex];
}
size_t SheetCount() const
{
return mStyleSheetList.Length();
}
bool HasStyleSheets() const
{
return !mStyleSheetList.IsEmpty();
}
void AppendStyleSheetsTo(nsTArray<mozilla::StyleSheet*>& aResult) const;
#ifdef MOZ_OLD_STYLE
@ -61,18 +77,26 @@ public:
nsCSSRuleProcessor* GetRuleProcessor() const { return mRuleProcessor; }
#endif
const RawServoAuthorStyles* GetServoStyles() const
{
return mServoStyles.get();
}
mozilla::ServoStyleRuleMap* GetServoStyleRuleMap();
// Updates the ServoStyleSet object that holds the result of cascading the
// sheets in mStyleSheetList. Equivalent to GatherRuleProcessor(), but for
// the Servo style backend.
void ComputeServoStyleSet(nsPresContext* aPresContext);
mozilla::ServoStyleSet* GetServoStyleSet() const { return mServoStyleSet.get(); }
void ComputeServoStyles(const mozilla::ServoStyleSet& aMasterStyleSet);
private:
// A loader object. Exists only long enough to load resources, and then it dies.
RefPtr<nsXBLResourceLoader> mLoader;
// A list of loaded stylesheets for this binding.
//
// FIXME(emilio): Remove when the old style system is gone, defer to
// mServoStyles.
nsTArray<RefPtr<mozilla::StyleSheet>> mStyleSheetList;
#ifdef MOZ_OLD_STYLE
@ -82,9 +106,8 @@ private:
// The result of cascading the XBL style sheets like mRuleProcessor, but
// for the Servo style backend.
// XXX: We might want to design a better representation for the result of
// cascading the XBL style sheets, like a collection of SelectorMaps.
mozilla::UniquePtr<mozilla::ServoStyleSet> mServoStyleSet;
mozilla::UniquePtr<RawServoAuthorStyles> mServoStyles;
mozilla::UniquePtr<mozilla::ServoStyleRuleMap> mStyleRuleMap;
};
#endif

View File

@ -198,8 +198,8 @@ nsXBLResourceLoader::StyleSheetLoaded(StyleSheet* aSheet,
MOZ_CRASH("old style system disabled");
#endif
} else {
mResources->ComputeServoStyleSet(
mBoundDocument->GetShell()->GetPresContext());
mResources->ComputeServoStyles(
*mBoundDocument->GetShell()->StyleSet()->AsServo());
}
// XXX Check for mPendingScripts when scripts also come online.

View File

@ -230,7 +230,6 @@ InspectorUtils::GetCSSStyleRules(GlobalObject& aGlobalObject,
{
ServoStyleSet* styleSet = shell->StyleSet()->AsServo();
ServoStyleRuleMap* map = styleSet->StyleRuleMap();
map->EnsureTable();
maps.AppendElement(map);
}
@ -239,9 +238,10 @@ InspectorUtils::GetCSSStyleRules(GlobalObject& aGlobalObject,
bindingContent = bindingContent->GetBindingParent()) {
for (nsXBLBinding* binding = bindingContent->GetXBLBinding();
binding; binding = binding->GetBaseBinding()) {
if (ServoStyleSet* styleSet = binding->GetServoStyleSet()) {
ServoStyleRuleMap* map = styleSet->StyleRuleMap();
map->EnsureTable();
// TODO(emilio): We're going to need to figure out something for Shadow
// DOM and inspector, since those rules can definitely mutate and
// such...
if (auto* map = binding->PrototypeBinding()->GetServoStyleRuleMap()) {
maps.AppendElement(map);
}
}

View File

@ -18,22 +18,13 @@
namespace mozilla {
ServoStyleRuleMap::ServoStyleRuleMap(ServoStyleSet* aStyleSet)
: mStyleSet(aStyleSet)
{
}
ServoStyleRuleMap::~ServoStyleRuleMap()
{
}
void
ServoStyleRuleMap::EnsureTable()
ServoStyleRuleMap::EnsureTable(ServoStyleSet& aStyleSet)
{
if (!IsEmpty()) {
return;
}
mStyleSet->EnumerateStyleSheetArrays(
aStyleSet.EnumerateStyleSheetArrays(
[this](const nsTArray<RefPtr<ServoStyleSheet>>& aArray) {
for (auto& sheet : aArray) {
FillTableFromStyleSheet(*sheet);
@ -41,6 +32,17 @@ ServoStyleRuleMap::EnsureTable()
});
}
void
ServoStyleRuleMap::EnsureTable(nsXBLPrototypeResources& aXBLResources)
{
if (!IsEmpty() || !aXBLResources.GetServoStyles()) {
return;
}
for (auto index : IntegerRange(aXBLResources.SheetCount())) {
FillTableFromStyleSheet(*aXBLResources.StyleSheetAt(index)->AsServo());
}
}
void
ServoStyleRuleMap::SheetAdded(ServoStyleSheet& aStyleSheet)
{

View File

@ -12,6 +12,7 @@
#include "nsDataHashtable.h"
struct RawServoStyleRule;
class nsXBLPrototypeResources;
namespace mozilla {
class ServoCSSRuleList;
@ -23,22 +24,24 @@ class Rule;
class ServoStyleRuleMap
{
public:
explicit ServoStyleRuleMap(ServoStyleSet* aStyleSet);
ServoStyleRuleMap() = default;
void EnsureTable();
ServoStyleRule* Lookup(const RawServoStyleRule* aRawRule) const {
void EnsureTable(ServoStyleSet&);
void EnsureTable(nsXBLPrototypeResources&);
ServoStyleRule* Lookup(const RawServoStyleRule* aRawRule) const
{
return mTable.Get(aRawRule);
}
void SheetAdded(ServoStyleSheet& aStyleSheet);
void SheetRemoved(ServoStyleSheet& aStyleSheet);
void SheetAdded(ServoStyleSheet&);
void SheetRemoved(ServoStyleSheet&);
void RuleAdded(ServoStyleSheet& aStyleSheet, css::Rule&);
void RuleRemoved(ServoStyleSheet& aStyleSheet, css::Rule& aStyleRule);
void RuleRemoved(ServoStyleSheet& aStyleSheet, css::Rule&);
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
~ServoStyleRuleMap();
~ServoStyleRuleMap() = default;
private:
// Since we would never have a document which contains no style rule,
@ -53,7 +56,6 @@ private:
typedef nsDataHashtable<nsPtrHashKey<const RawServoStyleRule>,
WeakPtr<ServoStyleRule>> Hashtable;
Hashtable mTable;
ServoStyleSet* mStyleSet;
};
} // namespace mozilla

View File

@ -43,7 +43,8 @@ SERVO_BINDING_FUNC(Servo_Element_IsPrimaryStyleReusedViaRuleNode,
SERVO_BINDING_FUNC(Servo_InvalidateStyleForDocStateChanges,
void,
RawGeckoElementBorrowed root,
const nsTArray<RawServoStyleSetBorrowed>* sets,
RawServoStyleSetBorrowed doc_styles,
const nsTArray<RawServoAuthorStylesBorrowed>* non_document_styles,
uint64_t aStatesChanged)
// Styleset and Stylesheet management
@ -83,13 +84,14 @@ SERVO_BINDING_FUNC(Servo_StyleSheet_GetOrigin, uint8_t,
SERVO_BINDING_FUNC(Servo_StyleSet_Init, RawServoStyleSet*, RawGeckoPresContextOwned pres_context)
SERVO_BINDING_FUNC(Servo_StyleSet_RebuildCachedData, void,
RawServoStyleSetBorrowed set)
// We'd like to return `OriginFlags` here, but bindgen bitfield enums don't
// work as return values with the Linux 32-bit ABI at the moment because
// they wrap the value in a struct.
SERVO_BINDING_FUNC(Servo_StyleSet_MediumFeaturesChanged,
MediumFeaturesChangedResult,
RawServoStyleSetBorrowed document_set,
const nsTArray<mozilla::ServoStyleSet*>* non_document_sets,
nsTArray<RawServoAuthorStylesBorrowedMut>* non_document_sets,
bool may_affect_default_style)
// We'd like to return `OriginFlags` here, but bindgen bitfield enums don't
// work as return values with the Linux 32-bit ABI at the moment because
@ -173,6 +175,20 @@ SERVO_BINDING_FUNC(Servo_UACache_AddSizeOf, void,
mozilla::MallocSizeOf malloc_size_of,
mozilla::MallocSizeOf malloc_enclosing_size_of,
mozilla::ServoStyleSetSizes* sizes)
// AuthorStyles
SERVO_BINDING_FUNC(Servo_AuthorStyles_Create, RawServoAuthorStyles*)
// TODO(emilio): This will need to take an optional master style set to
// implement invalidation for Shadow DOM.
SERVO_BINDING_FUNC(Servo_AuthorStyles_AppendStyleSheet, void,
RawServoAuthorStylesBorrowedMut self,
const mozilla::ServoStyleSheet* gecko_sheet)
// TODO(emilio): This will need to take an element to implement invalidation for
// Shadow DOM.
SERVO_BINDING_FUNC(Servo_AuthorStyles_Flush, void,
RawServoAuthorStylesBorrowedMut self,
RawServoStyleSetBorrowed document_styles)
SERVO_BINDING_FUNC(Servo_StyleContext_AddRef, void, ServoStyleContextBorrowed ctx);
SERVO_BINDING_FUNC(Servo_StyleContext_Release, void, ServoStyleContextBorrowed ctx);

View File

@ -15,6 +15,7 @@
#include "nsStyleAutoArray.h"
#include "nsTArray.h"
struct RawServoAuthorStyles;
struct RawServoStyleSet;
struct RawServoSelectorList;
struct RawServoSourceSizeList;
@ -135,7 +136,8 @@ struct MOZ_MUST_USE_TYPE ServoStyleContextStrong
// This is a reference to a reference of RawServoDeclarationBlock, which
// corresponds to Option<&Arc<RawServoDeclarationBlock>> in Servo side.
DECL_NULLABLE_BORROWED_REF_TYPE_FOR(RawServoDeclarationBlockStrong)
DECL_OWNED_REF_TYPE_FOR(RawServoAuthorStyles)
DECL_NULLABLE_BORROWED_REF_TYPE_FOR(RawServoAuthorStyles)
DECL_OWNED_REF_TYPE_FOR(RawServoStyleSet)
DECL_NULLABLE_BORROWED_REF_TYPE_FOR(RawServoStyleSet)
DECL_NULLABLE_OWNED_REF_TYPE_FOR(StyleChildrenIterator)
@ -228,6 +230,7 @@ DECL_NULLABLE_BORROWED_REF_TYPE_FOR(RawServoSourceSizeList)
}
DEFINE_BOXED_TYPE(StyleSet, RawServoStyleSet);
DEFINE_BOXED_TYPE(AuthorStyles, RawServoAuthorStyles);
DEFINE_BOXED_TYPE(SelectorList, RawServoSelectorList);
DEFINE_BOXED_TYPE(SourceSizeList, RawServoSourceSizeList);

View File

@ -2434,11 +2434,10 @@ Gecko_GetXBLBinding(RawGeckoElementBorrowed aElement)
return aElement->GetXBLBinding();
}
RawServoStyleSetBorrowedOrNull
Gecko_XBLBinding_GetRawServoStyleSet(RawGeckoXBLBindingBorrowed aXBLBinding)
RawServoAuthorStylesBorrowedOrNull
Gecko_XBLBinding_GetRawServoStyles(RawGeckoXBLBindingBorrowed aXBLBinding)
{
const ServoStyleSet* set = aXBLBinding->GetServoStyleSet();
return set ? set->RawSet() : nullptr;
return aXBLBinding->GetServoStyles();
}
bool

View File

@ -607,7 +607,7 @@ FontSizePrefs Gecko_GetBaseSize(nsAtom* lang);
// XBL related functions.
RawGeckoElementBorrowedOrNull Gecko_GetBindingParent(RawGeckoElementBorrowed aElement);
RawGeckoXBLBindingBorrowedOrNull Gecko_GetXBLBinding(RawGeckoElementBorrowed aElement);
RawServoStyleSetBorrowedOrNull Gecko_XBLBinding_GetRawServoStyleSet(RawGeckoXBLBindingBorrowed aXBLBinding);
RawServoAuthorStylesBorrowedOrNull Gecko_XBLBinding_GetRawServoStyles(RawGeckoXBLBindingBorrowed aXBLBinding);
bool Gecko_XBLBinding_InheritsStyle(RawGeckoXBLBindingBorrowed aXBLBinding);
struct GeckoFontMetrics

View File

@ -470,7 +470,6 @@ structs-types = [
"mozilla::AnonymousCounterStyle",
"mozilla::AtomArray",
"mozilla::MallocSizeOf",
"mozilla::ServoStyleSet",
"mozilla::OriginFlags",
"mozilla::UniquePtr",
"ServoRawOffsetArc",
@ -619,6 +618,7 @@ array-types = [
]
servo-owned-types = [
{ name = "RawServoStyleSet", opaque = true },
{ name = "RawServoAuthorStyles", opaque = true },
{ name = "RawServoSelectorList", opaque = false },
{ name = "RawServoSourceSizeList", opaque = false },
{ name = "ServoElementSnapshot", opaque = false },

View File

@ -232,20 +232,19 @@ ServoStyleSet::InvalidateStyleForDocumentStateChanges(EventStates aStatesChanged
// for XBL sheets / shadow DOM. Consider just enumerating bound content
// instead and run invalidation individually, passing mRawSet for the UA /
// User sheets.
AutoTArray<RawServoStyleSetBorrowed, 20> styleSets;
styleSets.AppendElement(mRawSet.get());
AutoTArray<RawServoAuthorStylesBorrowed, 20> xblStyles;
// FIXME(emilio): When bug 1425759 is fixed we need to enumerate ShadowRoots
// too.
mDocument->BindingManager()->EnumerateBoundContentBindings(
[&](nsXBLBinding* aBinding) {
if (ServoStyleSet* set = aBinding->PrototypeBinding()->GetServoStyleSet()) {
styleSets.AppendElement(set->RawSet());
if (auto* authorStyles = aBinding->PrototypeBinding()->GetServoStyles()) {
xblStyles.AppendElement(authorStyles);
}
return true;
});
Servo_InvalidateStyleForDocStateChanges(
root, &styleSets, aStatesChanged.ServoValue());
root, mRawSet.get(), &xblStyles, aStatesChanged.ServoValue());
}
static const MediaFeatureChangeReason kMediaFeaturesAffectingDefaultStyle =
@ -263,15 +262,15 @@ static const MediaFeatureChangeReason kMediaFeaturesAffectingDefaultStyle =
nsRestyleHint
ServoStyleSet::MediumFeaturesChanged(MediaFeatureChangeReason aReason)
{
AutoTArray<ServoStyleSet*, 20> nonDocumentStyleSets;
AutoTArray<RawServoAuthorStylesBorrowedMut, 20> nonDocumentStyles;
// FIXME(emilio): When bug 1425759 is fixed we need to enumerate ShadowRoots
// too.
//
// FIXME(emilio): This is broken for XBL. See bug 1406875.
mDocument->BindingManager()->EnumerateBoundContentBindings(
[&](nsXBLBinding* aBinding) {
if (ServoStyleSet* set = aBinding->PrototypeBinding()->GetServoStyleSet()) {
nonDocumentStyleSets.AppendElement(set);
if (auto* authorStyles = aBinding->PrototypeBinding()->GetServoStyles()) {
nonDocumentStyles.AppendElement(authorStyles);
}
return true;
});
@ -281,7 +280,7 @@ ServoStyleSet::MediumFeaturesChanged(MediaFeatureChangeReason aReason)
const MediumFeaturesChangedResult result =
Servo_StyleSet_MediumFeaturesChanged(
mRawSet.get(), &nonDocumentStyleSets, mayAffectDefaultStyle);
mRawSet.get(), &nonDocumentStyles, mayAffectDefaultStyle);
const bool rulesChanged =
result.mAffectsDocumentRules || result.mAffectsNonDocumentRules;
@ -1461,10 +1460,13 @@ ServoStyleSet::UpdateStylist()
if (MOZ_UNLIKELY(mStylistState & StylistState::XBLStyleSheetsDirty)) {
MOZ_ASSERT(IsMaster(), "Only master styleset can mark XBL stylesets dirty!");
MOZ_ASSERT(GetPresContext(), "How did they get dirty?");
// NOTE(emilio): This right now rebuilds the stylist in the prototype
// binding. That is fine, and if we wanted to be more incremental, which we
// probably should, we need to move away from using a StyleSet for XBL.
mDocument->BindingManager()->UpdateBoundContentBindingsForServo(GetPresContext());
mDocument->BindingManager()->EnumerateBoundContentBindings(
[&](nsXBLBinding* aBinding) {
if (auto* authorStyles = aBinding->PrototypeBinding()->GetServoStyles()) {
Servo_AuthorStyles_Flush(authorStyles, mRawSet.get());
}
return true;
});
}
mStylistState = StylistState::NotDirty;
@ -1568,8 +1570,9 @@ ServoStyleRuleMap*
ServoStyleSet::StyleRuleMap()
{
if (!mStyleRuleMap) {
mStyleRuleMap = MakeUnique<ServoStyleRuleMap>(this);
mStyleRuleMap = MakeUnique<ServoStyleRuleMap>();
}
mStyleRuleMap->EnsureTable(*this);
return mStyleRuleMap.get();
}

View File

@ -118,8 +118,8 @@ public:
NS_IMETHOD StyleSheetLoaded(StyleSheet* aSheet, bool aWasAlternate,
nsresult aStatus) final override;
// Internal GetCssRules method which do not have security check and
// completelness check.
// Internal GetCssRules methods which do not have security check and
// completeness check.
ServoCSSRuleList* GetCssRulesInternal();
// Returns the stylesheet's Servo origin as an OriginFlags value.