Bug 1216043 - Rename nsStyleSheet::sheetType and make it an enum class. r=dbaron
The only substantive change here, apart from a few variables changing in size from uint16_t to uint8_t, is FontFaceSet's use of SheetType::Unknown (0xFF) instead of 0 for FontFaceRecords for script-created FontFaces.
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/CSSStyleSheet.h"
|
||||
#include "mozilla/EnumeratedRange.h"
|
||||
#include "mozilla/EventStates.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/RuleProcessorCache.h"
|
||||
@@ -143,18 +144,18 @@ nsDisableTextZoomStyleRule::List(FILE* out, int32_t aIndent) const
|
||||
}
|
||||
#endif
|
||||
|
||||
static const nsStyleSet::sheetType gCSSSheetTypes[] = {
|
||||
static const SheetType gCSSSheetTypes[] = {
|
||||
// From lowest to highest in cascading order.
|
||||
nsStyleSet::eAgentSheet,
|
||||
nsStyleSet::eUserSheet,
|
||||
nsStyleSet::eDocSheet,
|
||||
nsStyleSet::eScopedDocSheet,
|
||||
nsStyleSet::eOverrideSheet
|
||||
SheetType::Agent,
|
||||
SheetType::User,
|
||||
SheetType::Doc,
|
||||
SheetType::ScopedDoc,
|
||||
SheetType::Override
|
||||
};
|
||||
|
||||
static bool IsCSSSheetType(nsStyleSet::sheetType aSheetType)
|
||||
static bool IsCSSSheetType(SheetType aSheetType)
|
||||
{
|
||||
for (nsStyleSet::sheetType type : gCSSSheetTypes) {
|
||||
for (SheetType type : gCSSSheetTypes) {
|
||||
if (type == aSheetType) {
|
||||
return true;
|
||||
}
|
||||
@@ -177,7 +178,7 @@ nsStyleSet::nsStyleSet()
|
||||
|
||||
nsStyleSet::~nsStyleSet()
|
||||
{
|
||||
for (sheetType type : gCSSSheetTypes) {
|
||||
for (SheetType type : gCSSSheetTypes) {
|
||||
for (uint32_t i = 0, n = mSheets[type].Length(); i < n; i++) {
|
||||
static_cast<CSSStyleSheet*>(mSheets[type][i])->DropStyleSet(this);
|
||||
}
|
||||
@@ -185,12 +186,12 @@ nsStyleSet::~nsStyleSet()
|
||||
|
||||
// drop reference to cached rule processors
|
||||
nsCSSRuleProcessor* rp;
|
||||
rp = static_cast<nsCSSRuleProcessor*>(mRuleProcessors[eAgentSheet].get());
|
||||
rp = static_cast<nsCSSRuleProcessor*>(mRuleProcessors[SheetType::Agent].get());
|
||||
if (rp) {
|
||||
MOZ_ASSERT(rp->IsShared());
|
||||
rp->ReleaseStyleSetRef();
|
||||
}
|
||||
rp = static_cast<nsCSSRuleProcessor*>(mRuleProcessors[eUserSheet].get());
|
||||
rp = static_cast<nsCSSRuleProcessor*>(mRuleProcessors[SheetType::User].get());
|
||||
if (rp) {
|
||||
MOZ_ASSERT(rp->IsShared());
|
||||
rp->ReleaseStyleSetRef();
|
||||
@@ -202,17 +203,17 @@ nsStyleSet::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
size_t n = aMallocSizeOf(this);
|
||||
|
||||
for (int i = 0; i < eSheetTypeCount; i++) {
|
||||
if (mRuleProcessors[i]) {
|
||||
for (SheetType type : MakeEnumeratedRange(SheetType::Count)) {
|
||||
if (mRuleProcessors[type]) {
|
||||
bool shared = false;
|
||||
if (i == eAgentSheet || i == eUserSheet) {
|
||||
if (type == SheetType::Agent || type == SheetType::User) {
|
||||
// The only two origins we consider caching rule processors for.
|
||||
nsCSSRuleProcessor* rp =
|
||||
static_cast<nsCSSRuleProcessor*>(mRuleProcessors[i].get());
|
||||
static_cast<nsCSSRuleProcessor*>(mRuleProcessors[type].get());
|
||||
shared = rp->IsShared();
|
||||
}
|
||||
if (!shared) {
|
||||
n += mRuleProcessors[i]->SizeOfIncludingThis(aMallocSizeOf);
|
||||
n += mRuleProcessors[type]->SizeOfIncludingThis(aMallocSizeOf);
|
||||
}
|
||||
}
|
||||
// mSheets is a C-style array of nsCOMArrays. We do not own the sheets in
|
||||
@@ -220,7 +221,7 @@ nsStyleSet::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
// document owns them) so we do not count the sheets here (we pass nullptr
|
||||
// as the aSizeOfElementIncludingThis argument). All we're doing here is
|
||||
// counting the size of the nsCOMArrays' buffers.
|
||||
n += mSheets[i].SizeOfExcludingThis(nullptr, aMallocSizeOf);
|
||||
n += mSheets[type].SizeOfExcludingThis(nullptr, aMallocSizeOf);
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < mScopedDocSheetRuleProcessors.Length(); i++) {
|
||||
@@ -247,11 +248,11 @@ nsStyleSet::Init(nsPresContext *aPresContext)
|
||||
// Make an explicit GatherRuleProcessors call for the levels that
|
||||
// don't have style sheets. The other levels will have their calls
|
||||
// triggered by DirtyRuleProcessors. (We should probably convert the
|
||||
// ePresHintSheet and eStyleAttrSheet levels to work like this as
|
||||
// well, and not implement nsIStyleSheet.)
|
||||
GatherRuleProcessors(eAnimationSheet);
|
||||
GatherRuleProcessors(eTransitionSheet);
|
||||
GatherRuleProcessors(eSVGAttrAnimationSheet);
|
||||
// SheetType::PresHint and SheetType::StyleAttr levels to work like
|
||||
// this as well, and not implement nsIStyleSheet.)
|
||||
GatherRuleProcessors(SheetType::Animation);
|
||||
GatherRuleProcessors(SheetType::Transition);
|
||||
GatherRuleProcessors(SheetType::SVGAttrAnimation);
|
||||
}
|
||||
|
||||
nsresult
|
||||
@@ -387,7 +388,7 @@ SortStyleSheetsByScope(nsTArray<CSSStyleSheet*>& aSheets)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsStyleSet::GatherRuleProcessors(sheetType aType)
|
||||
nsStyleSet::GatherRuleProcessors(SheetType aType)
|
||||
{
|
||||
NS_ENSURE_FALSE(mInShutdown, NS_ERROR_FAILURE);
|
||||
|
||||
@@ -401,7 +402,7 @@ nsStyleSet::GatherRuleProcessors(sheetType aType)
|
||||
}
|
||||
nsCOMPtr<nsIStyleRuleProcessor> oldRuleProcessor(mRuleProcessors[aType]);
|
||||
nsTArray<nsCOMPtr<nsIStyleRuleProcessor>> oldScopedDocRuleProcessors;
|
||||
if (aType == eAgentSheet || aType == eUserSheet) {
|
||||
if (aType == SheetType::Agent || aType == SheetType::User) {
|
||||
// drop reference to cached rule processor
|
||||
nsCSSRuleProcessor* rp =
|
||||
static_cast<nsCSSRuleProcessor*>(mRuleProcessors[aType].get());
|
||||
@@ -411,7 +412,7 @@ nsStyleSet::GatherRuleProcessors(sheetType aType)
|
||||
}
|
||||
}
|
||||
mRuleProcessors[aType] = nullptr;
|
||||
if (aType == eScopedDocSheet) {
|
||||
if (aType == SheetType::ScopedDoc) {
|
||||
for (uint32_t i = 0; i < mScopedDocSheetRuleProcessors.Length(); i++) {
|
||||
nsIStyleRuleProcessor* processor = mScopedDocSheetRuleProcessors[i].get();
|
||||
Element* scope =
|
||||
@@ -422,9 +423,9 @@ nsStyleSet::GatherRuleProcessors(sheetType aType)
|
||||
// Clear mScopedDocSheetRuleProcessors, but save it.
|
||||
oldScopedDocRuleProcessors.SwapElements(mScopedDocSheetRuleProcessors);
|
||||
}
|
||||
if (mAuthorStyleDisabled && (aType == eDocSheet ||
|
||||
aType == eScopedDocSheet ||
|
||||
aType == eStyleAttrSheet)) {
|
||||
if (mAuthorStyleDisabled && (aType == SheetType::Doc ||
|
||||
aType == SheetType::ScopedDoc ||
|
||||
aType == SheetType::StyleAttr)) {
|
||||
// Don't regather if this level is disabled. Note that we gather
|
||||
// preshint sheets no matter what, but then skip them for some
|
||||
// elements later if mAuthorStyleDisabled.
|
||||
@@ -433,24 +434,24 @@ nsStyleSet::GatherRuleProcessors(sheetType aType)
|
||||
switch (aType) {
|
||||
// handle the types for which have a rule processor that does not
|
||||
// implement the style sheet interface.
|
||||
case eAnimationSheet:
|
||||
case SheetType::Animation:
|
||||
MOZ_ASSERT(mSheets[aType].IsEmpty());
|
||||
mRuleProcessors[aType] = PresContext()->AnimationManager();
|
||||
return NS_OK;
|
||||
case eTransitionSheet:
|
||||
case SheetType::Transition:
|
||||
MOZ_ASSERT(mSheets[aType].IsEmpty());
|
||||
mRuleProcessors[aType] = PresContext()->TransitionManager();
|
||||
return NS_OK;
|
||||
case eStyleAttrSheet:
|
||||
case SheetType::StyleAttr:
|
||||
MOZ_ASSERT(mSheets[aType].IsEmpty());
|
||||
mRuleProcessors[aType] = PresContext()->Document()->GetInlineStyleSheet();
|
||||
return NS_OK;
|
||||
case ePresHintSheet:
|
||||
case SheetType::PresHint:
|
||||
MOZ_ASSERT(mSheets[aType].IsEmpty());
|
||||
mRuleProcessors[aType] =
|
||||
PresContext()->Document()->GetAttributeStyleSheet();
|
||||
return NS_OK;
|
||||
case eSVGAttrAnimationSheet:
|
||||
case SheetType::SVGAttrAnimation:
|
||||
MOZ_ASSERT(mSheets[aType].IsEmpty());
|
||||
mRuleProcessors[aType] =
|
||||
PresContext()->Document()->GetSVGAttrAnimationRuleProcessor();
|
||||
@@ -459,9 +460,9 @@ nsStyleSet::GatherRuleProcessors(sheetType aType)
|
||||
// keep going
|
||||
break;
|
||||
}
|
||||
if (aType == eScopedDocSheet) {
|
||||
if (aType == SheetType::ScopedDoc) {
|
||||
// Create a rule processor for each scope.
|
||||
uint32_t count = mSheets[eScopedDocSheet].Count();
|
||||
uint32_t count = mSheets[SheetType::ScopedDoc].Count();
|
||||
if (count) {
|
||||
// Gather the scoped style sheets into an array as
|
||||
// CSSStyleSheets, and mark all of their scope elements
|
||||
@@ -469,7 +470,7 @@ nsStyleSet::GatherRuleProcessors(sheetType aType)
|
||||
nsTArray<CSSStyleSheet*> sheets(count);
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
RefPtr<CSSStyleSheet> sheet =
|
||||
do_QueryObject(mSheets[eScopedDocSheet].ObjectAt(i));
|
||||
do_QueryObject(mSheets[SheetType::ScopedDoc].ObjectAt(i));
|
||||
sheets.AppendElement(sheet);
|
||||
|
||||
Element* scope = sheet->GetScopeElement();
|
||||
@@ -511,8 +512,7 @@ nsStyleSet::GatherRuleProcessors(sheetType aType)
|
||||
sheetsForScope.AppendElements(sheets.Elements() + start, end - start);
|
||||
nsCSSRuleProcessor* oldRP = oldScopedRuleProcessorHash.Get(scope);
|
||||
mScopedDocSheetRuleProcessors.AppendElement
|
||||
(new nsCSSRuleProcessor(sheetsForScope, uint8_t(aType), scope,
|
||||
oldRP));
|
||||
(new nsCSSRuleProcessor(sheetsForScope, aType, scope, oldRP));
|
||||
|
||||
start = end;
|
||||
} while (start < count);
|
||||
@@ -521,8 +521,8 @@ nsStyleSet::GatherRuleProcessors(sheetType aType)
|
||||
}
|
||||
if (mSheets[aType].Count()) {
|
||||
switch (aType) {
|
||||
case eAgentSheet:
|
||||
case eUserSheet: {
|
||||
case SheetType::Agent:
|
||||
case SheetType::User: {
|
||||
// levels containing non-scoped CSS style sheets whose rule processors
|
||||
// we want to re-use
|
||||
nsCOMArray<nsIStyleSheet>& sheets = mSheets[aType];
|
||||
@@ -539,7 +539,7 @@ nsStyleSet::GatherRuleProcessors(sheetType aType)
|
||||
nsCSSRuleProcessor* rp =
|
||||
RuleProcessorCache::GetRuleProcessor(cssSheetsRaw, PresContext());
|
||||
if (!rp) {
|
||||
rp = new nsCSSRuleProcessor(cssSheets, uint8_t(aType), nullptr,
|
||||
rp = new nsCSSRuleProcessor(cssSheets, aType, nullptr,
|
||||
static_cast<nsCSSRuleProcessor*>(
|
||||
oldRuleProcessor.get()),
|
||||
true /* aIsShared */);
|
||||
@@ -555,8 +555,8 @@ nsStyleSet::GatherRuleProcessors(sheetType aType)
|
||||
rp->AddStyleSetRef();
|
||||
break;
|
||||
}
|
||||
case eDocSheet:
|
||||
case eOverrideSheet: {
|
||||
case SheetType::Doc:
|
||||
case SheetType::Override: {
|
||||
// levels containing non-scoped CSS stylesheets whose rule processors
|
||||
// we don't want to re-use
|
||||
nsCOMArray<nsIStyleSheet>& sheets = mSheets[aType];
|
||||
@@ -567,7 +567,7 @@ nsStyleSet::GatherRuleProcessors(sheetType aType)
|
||||
cssSheets.AppendElement(cssSheet);
|
||||
}
|
||||
mRuleProcessors[aType] =
|
||||
new nsCSSRuleProcessor(cssSheets, uint8_t(aType), nullptr,
|
||||
new nsCSSRuleProcessor(cssSheets, aType, nullptr,
|
||||
static_cast<nsCSSRuleProcessor*>(
|
||||
oldRuleProcessor.get()));
|
||||
} break;
|
||||
@@ -593,7 +593,7 @@ IsScopedStyleSheet(nsIStyleSheet* aSheet)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsStyleSet::AppendStyleSheet(sheetType aType, nsIStyleSheet *aSheet)
|
||||
nsStyleSet::AppendStyleSheet(SheetType aType, nsIStyleSheet *aSheet)
|
||||
{
|
||||
NS_PRECONDITION(aSheet, "null arg");
|
||||
NS_ASSERTION(aSheet->IsApplicable(),
|
||||
@@ -610,7 +610,7 @@ nsStyleSet::AppendStyleSheet(sheetType aType, nsIStyleSheet *aSheet)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsStyleSet::PrependStyleSheet(sheetType aType, nsIStyleSheet *aSheet)
|
||||
nsStyleSet::PrependStyleSheet(SheetType aType, nsIStyleSheet *aSheet)
|
||||
{
|
||||
NS_PRECONDITION(aSheet, "null arg");
|
||||
NS_ASSERTION(aSheet->IsApplicable(),
|
||||
@@ -627,7 +627,7 @@ nsStyleSet::PrependStyleSheet(sheetType aType, nsIStyleSheet *aSheet)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsStyleSet::RemoveStyleSheet(sheetType aType, nsIStyleSheet *aSheet)
|
||||
nsStyleSet::RemoveStyleSheet(SheetType aType, nsIStyleSheet *aSheet)
|
||||
{
|
||||
NS_PRECONDITION(aSheet, "null arg");
|
||||
NS_ASSERTION(aSheet->IsComplete(),
|
||||
@@ -642,7 +642,7 @@ nsStyleSet::RemoveStyleSheet(sheetType aType, nsIStyleSheet *aSheet)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsStyleSet::ReplaceSheets(sheetType aType,
|
||||
nsStyleSet::ReplaceSheets(SheetType aType,
|
||||
const nsCOMArray<nsIStyleSheet> &aNewSheets)
|
||||
{
|
||||
bool cssSheetType = IsCSSSheetType(aType);
|
||||
@@ -666,7 +666,7 @@ nsStyleSet::ReplaceSheets(sheetType aType,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsStyleSet::InsertStyleSheetBefore(sheetType aType, nsIStyleSheet *aNewSheet,
|
||||
nsStyleSet::InsertStyleSheetBefore(SheetType aType, nsIStyleSheet *aNewSheet,
|
||||
nsIStyleSheet *aReferenceSheet)
|
||||
{
|
||||
NS_PRECONDITION(aNewSheet && aReferenceSheet, "null arg");
|
||||
@@ -688,13 +688,19 @@ nsStyleSet::InsertStyleSheetBefore(sheetType aType, nsIStyleSheet *aNewSheet,
|
||||
return DirtyRuleProcessors(aType);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
DirtyBit(SheetType aType)
|
||||
{
|
||||
return 1 << uint32_t(aType);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsStyleSet::DirtyRuleProcessors(sheetType aType)
|
||||
nsStyleSet::DirtyRuleProcessors(SheetType aType)
|
||||
{
|
||||
if (!mBatching)
|
||||
return GatherRuleProcessors(aType);
|
||||
|
||||
mDirty |= 1 << aType;
|
||||
mDirty |= DirtyBit(aType);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -710,9 +716,9 @@ nsStyleSet::SetAuthorStyleDisabled(bool aStyleDisabled)
|
||||
if (aStyleDisabled == !mAuthorStyleDisabled) {
|
||||
mAuthorStyleDisabled = aStyleDisabled;
|
||||
BeginUpdate();
|
||||
mDirty |= 1 << eDocSheet |
|
||||
1 << eScopedDocSheet |
|
||||
1 << eStyleAttrSheet;
|
||||
mDirty |= DirtyBit(SheetType::Doc) |
|
||||
DirtyBit(SheetType::ScopedDoc) |
|
||||
DirtyBit(SheetType::StyleAttr);
|
||||
return EndUpdate();
|
||||
}
|
||||
return NS_OK;
|
||||
@@ -727,9 +733,9 @@ nsStyleSet::AddDocStyleSheet(nsIStyleSheet* aSheet, nsIDocument* aDocument)
|
||||
NS_ASSERTION(aSheet->IsApplicable(),
|
||||
"Inapplicable sheet being placed in style set");
|
||||
|
||||
sheetType type = IsScopedStyleSheet(aSheet) ?
|
||||
eScopedDocSheet :
|
||||
eDocSheet;
|
||||
SheetType type = IsScopedStyleSheet(aSheet) ?
|
||||
SheetType::ScopedDoc :
|
||||
SheetType::Doc;
|
||||
nsCOMArray<nsIStyleSheet>& sheets = mSheets[type];
|
||||
|
||||
bool present = sheets.RemoveObject(aSheet);
|
||||
@@ -771,7 +777,8 @@ nsStyleSet::RemoveDocStyleSheet(nsIStyleSheet *aSheet)
|
||||
{
|
||||
RefPtr<CSSStyleSheet> cssSheet = do_QueryObject(aSheet);
|
||||
bool isScoped = cssSheet && cssSheet->GetScopeElement();
|
||||
return RemoveStyleSheet(isScoped ? eScopedDocSheet : eDocSheet, aSheet);
|
||||
return RemoveStyleSheet(isScoped ? SheetType::ScopedDoc : SheetType::Doc,
|
||||
aSheet);
|
||||
}
|
||||
|
||||
// Batching
|
||||
@@ -790,9 +797,9 @@ nsStyleSet::EndUpdate()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
for (int i = 0; i < eSheetTypeCount; ++i) {
|
||||
if (mDirty & (1 << i)) {
|
||||
nsresult rv = GatherRuleProcessors(sheetType(i));
|
||||
for (SheetType type : MakeEnumeratedRange(SheetType::Count)) {
|
||||
if (mDirty & DirtyBit(type)) {
|
||||
nsresult rv = GatherRuleProcessors(type);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
}
|
||||
@@ -814,7 +821,7 @@ static inline bool
|
||||
IsMoreSpecificThanAnimation(nsRuleNode *aRuleNode)
|
||||
{
|
||||
return !aRuleNode->IsRoot() &&
|
||||
(aRuleNode->GetLevel() == nsStyleSet::eTransitionSheet ||
|
||||
(aRuleNode->GetLevel() == SheetType::Transition ||
|
||||
aRuleNode->IsImportantRule());
|
||||
}
|
||||
|
||||
@@ -826,7 +833,7 @@ GetAnimationRule(nsRuleNode *aRuleNode)
|
||||
n = n->GetParent();
|
||||
}
|
||||
|
||||
if (n->IsRoot() || n->GetLevel() != nsStyleSet::eAnimationSheet) {
|
||||
if (n->IsRoot() || n->GetLevel() != SheetType::Animation) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -848,17 +855,17 @@ ReplaceAnimationRule(nsRuleNode *aOldRuleNode,
|
||||
|
||||
if (aOldAnimRule) {
|
||||
MOZ_ASSERT(n->GetRule() == aOldAnimRule, "wrong rule");
|
||||
MOZ_ASSERT(n->GetLevel() == nsStyleSet::eAnimationSheet,
|
||||
MOZ_ASSERT(n->GetLevel() == SheetType::Animation,
|
||||
"wrong level");
|
||||
n = n->GetParent();
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!IsMoreSpecificThanAnimation(n) &&
|
||||
(n->IsRoot() || n->GetLevel() != nsStyleSet::eAnimationSheet),
|
||||
(n->IsRoot() || n->GetLevel() != SheetType::Animation),
|
||||
"wrong level");
|
||||
|
||||
if (aNewAnimRule) {
|
||||
n = n->Transition(aNewAnimRule, nsStyleSet::eAnimationSheet, false);
|
||||
n = n->Transition(aNewAnimRule, SheetType::Animation, false);
|
||||
n->SetIsAnimationRule();
|
||||
}
|
||||
|
||||
@@ -1113,30 +1120,30 @@ nsStyleSet::FileRules(nsIStyleRuleProcessor::EnumFunc aCollectorFunc,
|
||||
// this will be either the root or one of the restriction rules.
|
||||
nsRuleNode* lastRestrictionRN = aRuleWalker->CurrentNode();
|
||||
|
||||
aRuleWalker->SetLevel(eAgentSheet, false, true);
|
||||
if (mRuleProcessors[eAgentSheet])
|
||||
(*aCollectorFunc)(mRuleProcessors[eAgentSheet], aData);
|
||||
aRuleWalker->SetLevel(SheetType::Agent, false, true);
|
||||
if (mRuleProcessors[SheetType::Agent])
|
||||
(*aCollectorFunc)(mRuleProcessors[SheetType::Agent], aData);
|
||||
nsRuleNode* lastAgentRN = aRuleWalker->CurrentNode();
|
||||
bool haveImportantUARules = !aRuleWalker->GetCheckForImportantRules();
|
||||
|
||||
aRuleWalker->SetLevel(eUserSheet, false, true);
|
||||
aRuleWalker->SetLevel(SheetType::User, false, true);
|
||||
bool skipUserStyles =
|
||||
aElement && aElement->IsInNativeAnonymousSubtree();
|
||||
if (!skipUserStyles && mRuleProcessors[eUserSheet]) // NOTE: different
|
||||
(*aCollectorFunc)(mRuleProcessors[eUserSheet], aData);
|
||||
if (!skipUserStyles && mRuleProcessors[SheetType::User]) // NOTE: different
|
||||
(*aCollectorFunc)(mRuleProcessors[SheetType::User], aData);
|
||||
nsRuleNode* lastUserRN = aRuleWalker->CurrentNode();
|
||||
bool haveImportantUserRules = !aRuleWalker->GetCheckForImportantRules();
|
||||
|
||||
aRuleWalker->SetLevel(ePresHintSheet, false, false);
|
||||
if (mRuleProcessors[ePresHintSheet])
|
||||
(*aCollectorFunc)(mRuleProcessors[ePresHintSheet], aData);
|
||||
aRuleWalker->SetLevel(SheetType::PresHint, false, false);
|
||||
if (mRuleProcessors[SheetType::PresHint])
|
||||
(*aCollectorFunc)(mRuleProcessors[SheetType::PresHint], aData);
|
||||
|
||||
aRuleWalker->SetLevel(eSVGAttrAnimationSheet, false, false);
|
||||
if (mRuleProcessors[eSVGAttrAnimationSheet])
|
||||
(*aCollectorFunc)(mRuleProcessors[eSVGAttrAnimationSheet], aData);
|
||||
aRuleWalker->SetLevel(SheetType::SVGAttrAnimation, false, false);
|
||||
if (mRuleProcessors[SheetType::SVGAttrAnimation])
|
||||
(*aCollectorFunc)(mRuleProcessors[SheetType::SVGAttrAnimation], aData);
|
||||
nsRuleNode* lastSVGAttrAnimationRN = aRuleWalker->CurrentNode();
|
||||
|
||||
aRuleWalker->SetLevel(eDocSheet, false, true);
|
||||
aRuleWalker->SetLevel(SheetType::Doc, false, true);
|
||||
bool cutOffInheritance = false;
|
||||
if (mBindingManager && aElement) {
|
||||
// We can supply additional document-level sheets that should be walked.
|
||||
@@ -1145,8 +1152,8 @@ nsStyleSet::FileRules(nsIStyleRuleProcessor::EnumFunc aCollectorFunc,
|
||||
&cutOffInheritance);
|
||||
}
|
||||
if (!skipUserStyles && !cutOffInheritance && // NOTE: different
|
||||
mRuleProcessors[eDocSheet])
|
||||
(*aCollectorFunc)(mRuleProcessors[eDocSheet], aData);
|
||||
mRuleProcessors[SheetType::Doc])
|
||||
(*aCollectorFunc)(mRuleProcessors[SheetType::Doc], aData);
|
||||
nsRuleNode* lastDocRN = aRuleWalker->CurrentNode();
|
||||
bool haveImportantDocRules = !aRuleWalker->GetCheckForImportantRules();
|
||||
nsTArray<nsRuleNode*> lastScopedRNs;
|
||||
@@ -1157,7 +1164,7 @@ nsStyleSet::FileRules(nsIStyleRuleProcessor::EnumFunc aCollectorFunc,
|
||||
lastScopedRNs.SetLength(mScopedDocSheetRuleProcessors.Length());
|
||||
haveImportantScopedRules.SetLength(mScopedDocSheetRuleProcessors.Length());
|
||||
for (uint32_t i = 0; i < mScopedDocSheetRuleProcessors.Length(); i++) {
|
||||
aRuleWalker->SetLevel(eScopedDocSheet, false, true);
|
||||
aRuleWalker->SetLevel(SheetType::ScopedDoc, false, true);
|
||||
nsCSSRuleProcessor* processor =
|
||||
static_cast<nsCSSRuleProcessor*>(mScopedDocSheetRuleProcessors[i].get());
|
||||
aData->mScope = processor->GetScopeElement();
|
||||
@@ -1169,25 +1176,25 @@ nsStyleSet::FileRules(nsIStyleRuleProcessor::EnumFunc aCollectorFunc,
|
||||
aData->mScope = nullptr;
|
||||
}
|
||||
nsRuleNode* lastScopedRN = aRuleWalker->CurrentNode();
|
||||
aRuleWalker->SetLevel(eStyleAttrSheet, false, true);
|
||||
if (mRuleProcessors[eStyleAttrSheet])
|
||||
(*aCollectorFunc)(mRuleProcessors[eStyleAttrSheet], aData);
|
||||
aRuleWalker->SetLevel(SheetType::StyleAttr, false, true);
|
||||
if (mRuleProcessors[SheetType::StyleAttr])
|
||||
(*aCollectorFunc)(mRuleProcessors[SheetType::StyleAttr], aData);
|
||||
nsRuleNode* lastStyleAttrRN = aRuleWalker->CurrentNode();
|
||||
bool haveImportantStyleAttrRules = !aRuleWalker->GetCheckForImportantRules();
|
||||
|
||||
aRuleWalker->SetLevel(eOverrideSheet, false, true);
|
||||
if (mRuleProcessors[eOverrideSheet])
|
||||
(*aCollectorFunc)(mRuleProcessors[eOverrideSheet], aData);
|
||||
aRuleWalker->SetLevel(SheetType::Override, false, true);
|
||||
if (mRuleProcessors[SheetType::Override])
|
||||
(*aCollectorFunc)(mRuleProcessors[SheetType::Override], aData);
|
||||
nsRuleNode* lastOvrRN = aRuleWalker->CurrentNode();
|
||||
bool haveImportantOverrideRules = !aRuleWalker->GetCheckForImportantRules();
|
||||
|
||||
// This needs to match IsMoreSpecificThanAnimation() above.
|
||||
aRuleWalker->SetLevel(eAnimationSheet, false, false);
|
||||
(*aCollectorFunc)(mRuleProcessors[eAnimationSheet], aData);
|
||||
aRuleWalker->SetLevel(SheetType::Animation, false, false);
|
||||
(*aCollectorFunc)(mRuleProcessors[SheetType::Animation], aData);
|
||||
|
||||
if (haveAnyImportantScopedRules) {
|
||||
for (uint32_t i = lastScopedRNs.Length(); i-- != 0; ) {
|
||||
aRuleWalker->SetLevel(eScopedDocSheet, true, false);
|
||||
aRuleWalker->SetLevel(SheetType::ScopedDoc, true, false);
|
||||
nsRuleNode* startRN = lastScopedRNs[i];
|
||||
nsRuleNode* endRN = i == 0 ? lastDocRN : lastScopedRNs[i - 1];
|
||||
if (haveImportantScopedRules[i]) {
|
||||
@@ -1207,7 +1214,7 @@ nsStyleSet::FileRules(nsIStyleRuleProcessor::EnumFunc aCollectorFunc,
|
||||
#endif
|
||||
|
||||
if (haveImportantDocRules) {
|
||||
aRuleWalker->SetLevel(eDocSheet, true, false);
|
||||
aRuleWalker->SetLevel(SheetType::Doc, true, false);
|
||||
AddImportantRules(lastDocRN, lastSVGAttrAnimationRN, aRuleWalker); // doc
|
||||
}
|
||||
#ifdef DEBUG
|
||||
@@ -1217,7 +1224,7 @@ nsStyleSet::FileRules(nsIStyleRuleProcessor::EnumFunc aCollectorFunc,
|
||||
#endif
|
||||
|
||||
if (haveImportantStyleAttrRules) {
|
||||
aRuleWalker->SetLevel(eStyleAttrSheet, true, false);
|
||||
aRuleWalker->SetLevel(SheetType::StyleAttr, true, false);
|
||||
AddImportantRules(lastStyleAttrRN, lastScopedRN, aRuleWalker); // style attr
|
||||
}
|
||||
#ifdef DEBUG
|
||||
@@ -1227,7 +1234,7 @@ nsStyleSet::FileRules(nsIStyleRuleProcessor::EnumFunc aCollectorFunc,
|
||||
#endif
|
||||
|
||||
if (haveImportantOverrideRules) {
|
||||
aRuleWalker->SetLevel(eOverrideSheet, true, false);
|
||||
aRuleWalker->SetLevel(SheetType::Override, true, false);
|
||||
AddImportantRules(lastOvrRN, lastStyleAttrRN, aRuleWalker); // override
|
||||
}
|
||||
#ifdef DEBUG
|
||||
@@ -1241,7 +1248,7 @@ nsStyleSet::FileRules(nsIStyleRuleProcessor::EnumFunc aCollectorFunc,
|
||||
#endif
|
||||
|
||||
if (haveImportantUserRules) {
|
||||
aRuleWalker->SetLevel(eUserSheet, true, false);
|
||||
aRuleWalker->SetLevel(SheetType::User, true, false);
|
||||
AddImportantRules(lastUserRN, lastAgentRN, aRuleWalker); //user
|
||||
}
|
||||
#ifdef DEBUG
|
||||
@@ -1251,7 +1258,7 @@ nsStyleSet::FileRules(nsIStyleRuleProcessor::EnumFunc aCollectorFunc,
|
||||
#endif
|
||||
|
||||
if (haveImportantUARules) {
|
||||
aRuleWalker->SetLevel(eAgentSheet, true, false);
|
||||
aRuleWalker->SetLevel(SheetType::Agent, true, false);
|
||||
AddImportantRules(lastAgentRN, lastRestrictionRN, aRuleWalker); //agent
|
||||
}
|
||||
#ifdef DEBUG
|
||||
@@ -1267,8 +1274,8 @@ nsStyleSet::FileRules(nsIStyleRuleProcessor::EnumFunc aCollectorFunc,
|
||||
#ifdef DEBUG
|
||||
nsRuleNode *lastImportantRN = aRuleWalker->CurrentNode();
|
||||
#endif
|
||||
aRuleWalker->SetLevel(eTransitionSheet, false, false);
|
||||
(*aCollectorFunc)(mRuleProcessors[eTransitionSheet], aData);
|
||||
aRuleWalker->SetLevel(SheetType::Transition, false, false);
|
||||
(*aCollectorFunc)(mRuleProcessors[SheetType::Transition], aData);
|
||||
#ifdef DEBUG
|
||||
AssertNoCSSRules(aRuleWalker->CurrentNode(), lastImportantRN);
|
||||
#endif
|
||||
@@ -1284,18 +1291,18 @@ nsStyleSet::WalkRuleProcessors(nsIStyleRuleProcessor::EnumFunc aFunc,
|
||||
{
|
||||
NS_ASSERTION(mBatching == 0, "rule processors out of date");
|
||||
|
||||
if (mRuleProcessors[eAgentSheet])
|
||||
(*aFunc)(mRuleProcessors[eAgentSheet], aData);
|
||||
if (mRuleProcessors[SheetType::Agent])
|
||||
(*aFunc)(mRuleProcessors[SheetType::Agent], aData);
|
||||
|
||||
bool skipUserStyles = aData->mElement->IsInNativeAnonymousSubtree();
|
||||
if (!skipUserStyles && mRuleProcessors[eUserSheet]) // NOTE: different
|
||||
(*aFunc)(mRuleProcessors[eUserSheet], aData);
|
||||
if (!skipUserStyles && mRuleProcessors[SheetType::User]) // NOTE: different
|
||||
(*aFunc)(mRuleProcessors[SheetType::User], aData);
|
||||
|
||||
if (mRuleProcessors[ePresHintSheet])
|
||||
(*aFunc)(mRuleProcessors[ePresHintSheet], aData);
|
||||
if (mRuleProcessors[SheetType::PresHint])
|
||||
(*aFunc)(mRuleProcessors[SheetType::PresHint], aData);
|
||||
|
||||
if (mRuleProcessors[eSVGAttrAnimationSheet])
|
||||
(*aFunc)(mRuleProcessors[eSVGAttrAnimationSheet], aData);
|
||||
if (mRuleProcessors[SheetType::SVGAttrAnimation])
|
||||
(*aFunc)(mRuleProcessors[SheetType::SVGAttrAnimation], aData);
|
||||
|
||||
bool cutOffInheritance = false;
|
||||
if (mBindingManager) {
|
||||
@@ -1307,19 +1314,19 @@ nsStyleSet::WalkRuleProcessors(nsIStyleRuleProcessor::EnumFunc aFunc,
|
||||
}
|
||||
}
|
||||
if (!skipUserStyles && !cutOffInheritance) {
|
||||
if (mRuleProcessors[eDocSheet]) // NOTE: different
|
||||
(*aFunc)(mRuleProcessors[eDocSheet], aData);
|
||||
if (mRuleProcessors[SheetType::Doc]) // NOTE: different
|
||||
(*aFunc)(mRuleProcessors[SheetType::Doc], aData);
|
||||
if (aData->mElement->IsElementInStyleScope()) {
|
||||
for (uint32_t i = 0; i < mScopedDocSheetRuleProcessors.Length(); i++)
|
||||
(*aFunc)(mScopedDocSheetRuleProcessors[i], aData);
|
||||
}
|
||||
}
|
||||
if (mRuleProcessors[eStyleAttrSheet])
|
||||
(*aFunc)(mRuleProcessors[eStyleAttrSheet], aData);
|
||||
if (mRuleProcessors[eOverrideSheet])
|
||||
(*aFunc)(mRuleProcessors[eOverrideSheet], aData);
|
||||
(*aFunc)(mRuleProcessors[eAnimationSheet], aData);
|
||||
(*aFunc)(mRuleProcessors[eTransitionSheet], aData);
|
||||
if (mRuleProcessors[SheetType::StyleAttr])
|
||||
(*aFunc)(mRuleProcessors[SheetType::StyleAttr], aData);
|
||||
if (mRuleProcessors[SheetType::Override])
|
||||
(*aFunc)(mRuleProcessors[SheetType::Override], aData);
|
||||
(*aFunc)(mRuleProcessors[SheetType::Animation], aData);
|
||||
(*aFunc)(mRuleProcessors[SheetType::Transition], aData);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1393,7 +1400,7 @@ nsStyleSet::ResolveStyleForRules(nsStyleContext* aParentContext,
|
||||
nsRuleWalker ruleWalker(mRuleTree, mAuthorStyleDisabled);
|
||||
// FIXME: Perhaps this should be passed in, but it probably doesn't
|
||||
// matter.
|
||||
ruleWalker.SetLevel(eDocSheet, false, false);
|
||||
ruleWalker.SetLevel(SheetType::Doc, false, false);
|
||||
for (uint32_t i = 0; i < aRules.Length(); i++) {
|
||||
ruleWalker.ForwardOnPossiblyCSSRule(aRules.ElementAt(i));
|
||||
}
|
||||
@@ -1417,7 +1424,7 @@ nsStyleSet::ResolveStyleByAddingRules(nsStyleContext* aBaseContext,
|
||||
// resulting context. It's also the right thing for the one case (the
|
||||
// transition manager's cover rule) where we put the result of this
|
||||
// function in the style context tree.
|
||||
ruleWalker.SetLevel(eTransitionSheet, false, false);
|
||||
ruleWalker.SetLevel(SheetType::Transition, false, false);
|
||||
for (int32_t i = 0; i < aRules.Count(); i++) {
|
||||
ruleWalker.ForwardOnPossiblyCSSRule(aRules.ObjectAt(i));
|
||||
}
|
||||
@@ -1452,37 +1459,37 @@ nsStyleSet::ResolveStyleByAddingRules(nsStyleContext* aBaseContext,
|
||||
|
||||
struct RuleNodeInfo {
|
||||
nsIStyleRule* mRule;
|
||||
uint8_t mLevel;
|
||||
SheetType mLevel;
|
||||
bool mIsImportant;
|
||||
bool mIsAnimationRule;
|
||||
};
|
||||
|
||||
struct CascadeLevel {
|
||||
uint8_t mLevel;
|
||||
SheetType mLevel;
|
||||
bool mIsImportant;
|
||||
bool mCheckForImportantRules;
|
||||
nsRestyleHint mLevelReplacementHint;
|
||||
};
|
||||
|
||||
static const CascadeLevel gCascadeLevels[] = {
|
||||
{ nsStyleSet::eAgentSheet, false, false, nsRestyleHint(0) },
|
||||
{ nsStyleSet::eUserSheet, false, false, nsRestyleHint(0) },
|
||||
{ nsStyleSet::ePresHintSheet, false, false, nsRestyleHint(0) },
|
||||
{ nsStyleSet::eSVGAttrAnimationSheet, false, false, eRestyle_SVGAttrAnimations },
|
||||
{ nsStyleSet::eDocSheet, false, false, nsRestyleHint(0) },
|
||||
{ nsStyleSet::eScopedDocSheet, false, false, nsRestyleHint(0) },
|
||||
{ nsStyleSet::eStyleAttrSheet, false, true, eRestyle_StyleAttribute |
|
||||
eRestyle_StyleAttribute_Animations },
|
||||
{ nsStyleSet::eOverrideSheet, false, false, nsRestyleHint(0) },
|
||||
{ nsStyleSet::eAnimationSheet, false, false, eRestyle_CSSAnimations },
|
||||
{ nsStyleSet::eScopedDocSheet, true, false, nsRestyleHint(0) },
|
||||
{ nsStyleSet::eDocSheet, true, false, nsRestyleHint(0) },
|
||||
{ nsStyleSet::eStyleAttrSheet, true, false, eRestyle_StyleAttribute |
|
||||
eRestyle_StyleAttribute_Animations },
|
||||
{ nsStyleSet::eOverrideSheet, true, false, nsRestyleHint(0) },
|
||||
{ nsStyleSet::eUserSheet, true, false, nsRestyleHint(0) },
|
||||
{ nsStyleSet::eAgentSheet, true, false, nsRestyleHint(0) },
|
||||
{ nsStyleSet::eTransitionSheet, false, false, eRestyle_CSSTransitions },
|
||||
{ SheetType::Agent, false, false, nsRestyleHint(0) },
|
||||
{ SheetType::User, false, false, nsRestyleHint(0) },
|
||||
{ SheetType::PresHint, false, false, nsRestyleHint(0) },
|
||||
{ SheetType::SVGAttrAnimation, false, false, eRestyle_SVGAttrAnimations },
|
||||
{ SheetType::Doc, false, false, nsRestyleHint(0) },
|
||||
{ SheetType::ScopedDoc, false, false, nsRestyleHint(0) },
|
||||
{ SheetType::StyleAttr, false, true, eRestyle_StyleAttribute |
|
||||
eRestyle_StyleAttribute_Animations },
|
||||
{ SheetType::Override, false, false, nsRestyleHint(0) },
|
||||
{ SheetType::Animation, false, false, eRestyle_CSSAnimations },
|
||||
{ SheetType::ScopedDoc, true, false, nsRestyleHint(0) },
|
||||
{ SheetType::Doc, true, false, nsRestyleHint(0) },
|
||||
{ SheetType::StyleAttr, true, false, eRestyle_StyleAttribute |
|
||||
eRestyle_StyleAttribute_Animations },
|
||||
{ SheetType::Override, true, false, nsRestyleHint(0) },
|
||||
{ SheetType::User, true, false, nsRestyleHint(0) },
|
||||
{ SheetType::Agent, true, false, nsRestyleHint(0) },
|
||||
{ SheetType::Transition, false, false, eRestyle_CSSTransitions },
|
||||
};
|
||||
|
||||
nsRuleNode*
|
||||
@@ -1547,7 +1554,7 @@ nsStyleSet::RuleNodeWithReplacement(Element* aElement,
|
||||
|
||||
if (doReplace) {
|
||||
switch (level->mLevel) {
|
||||
case nsStyleSet::eAnimationSheet: {
|
||||
case SheetType::Animation: {
|
||||
if (aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement ||
|
||||
aPseudoType == nsCSSPseudoElements::ePseudo_before ||
|
||||
aPseudoType == nsCSSPseudoElements::ePseudo_after) {
|
||||
@@ -1560,7 +1567,7 @@ nsStyleSet::RuleNodeWithReplacement(Element* aElement,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case nsStyleSet::eTransitionSheet: {
|
||||
case SheetType::Transition: {
|
||||
if (aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement ||
|
||||
aPseudoType == nsCSSPseudoElements::ePseudo_before ||
|
||||
aPseudoType == nsCSSPseudoElements::ePseudo_after) {
|
||||
@@ -1573,22 +1580,22 @@ nsStyleSet::RuleNodeWithReplacement(Element* aElement,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case nsStyleSet::eSVGAttrAnimationSheet: {
|
||||
case SheetType::SVGAttrAnimation: {
|
||||
SVGAttrAnimationRuleProcessor* ruleProcessor =
|
||||
static_cast<SVGAttrAnimationRuleProcessor*>(
|
||||
mRuleProcessors[eSVGAttrAnimationSheet].get());
|
||||
mRuleProcessors[SheetType::SVGAttrAnimation].get());
|
||||
if (ruleProcessor &&
|
||||
aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement) {
|
||||
ruleProcessor->ElementRulesMatching(aElement, &ruleWalker);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case nsStyleSet::eStyleAttrSheet: {
|
||||
case SheetType::StyleAttr: {
|
||||
if (!level->mIsImportant) {
|
||||
// First time through, we handle the non-!important rule.
|
||||
nsHTMLCSSStyleSheet* ruleProcessor =
|
||||
static_cast<nsHTMLCSSStyleSheet*>(
|
||||
mRuleProcessors[eStyleAttrSheet].get());
|
||||
mRuleProcessors[SheetType::StyleAttr].get());
|
||||
if (ruleProcessor) {
|
||||
lastScopedRN = ruleWalker.CurrentNode();
|
||||
if (aPseudoType ==
|
||||
@@ -1768,7 +1775,7 @@ nsStyleSet::WalkRestrictionRule(nsCSSPseudoElements::Type aPseudoType,
|
||||
nsRuleWalker* aRuleWalker)
|
||||
{
|
||||
// This needs to match GetPseudoRestriction in nsRuleNode.cpp.
|
||||
aRuleWalker->SetLevel(eAgentSheet, false, false);
|
||||
aRuleWalker->SetLevel(SheetType::Agent, false, false);
|
||||
if (aPseudoType == nsCSSPseudoElements::ePseudo_firstLetter)
|
||||
aRuleWalker->Forward(mFirstLetterRule);
|
||||
else if (aPseudoType == nsCSSPseudoElements::ePseudo_firstLine)
|
||||
@@ -1780,7 +1787,7 @@ nsStyleSet::WalkRestrictionRule(nsCSSPseudoElements::Type aPseudoType,
|
||||
void
|
||||
nsStyleSet::WalkDisableTextZoomRule(Element* aElement, nsRuleWalker* aRuleWalker)
|
||||
{
|
||||
aRuleWalker->SetLevel(eAgentSheet, false, false);
|
||||
aRuleWalker->SetLevel(SheetType::Agent, false, false);
|
||||
if (aElement->IsSVGElement(nsGkAtoms::text))
|
||||
aRuleWalker->Forward(mDisableTextZoomStyleRule);
|
||||
}
|
||||
@@ -2021,7 +2028,7 @@ nsStyleSet::AppendFontFaceRules(nsTArray<nsFontFaceRuleContainer>& aArray)
|
||||
|
||||
nsPresContext* presContext = PresContext();
|
||||
for (uint32_t i = 0; i < ArrayLength(gCSSSheetTypes); ++i) {
|
||||
if (gCSSSheetTypes[i] == eScopedDocSheet)
|
||||
if (gCSSSheetTypes[i] == SheetType::ScopedDoc)
|
||||
continue;
|
||||
nsCSSRuleProcessor *ruleProc = static_cast<nsCSSRuleProcessor*>
|
||||
(mRuleProcessors[gCSSSheetTypes[i]].get());
|
||||
@@ -2039,7 +2046,7 @@ nsStyleSet::KeyframesRuleForName(const nsString& aName)
|
||||
|
||||
nsPresContext* presContext = PresContext();
|
||||
for (uint32_t i = ArrayLength(gCSSSheetTypes); i-- != 0; ) {
|
||||
if (gCSSSheetTypes[i] == eScopedDocSheet)
|
||||
if (gCSSSheetTypes[i] == SheetType::ScopedDoc)
|
||||
continue;
|
||||
nsCSSRuleProcessor *ruleProc = static_cast<nsCSSRuleProcessor*>
|
||||
(mRuleProcessors[gCSSSheetTypes[i]].get());
|
||||
@@ -2061,7 +2068,7 @@ nsStyleSet::CounterStyleRuleForName(const nsAString& aName)
|
||||
|
||||
nsPresContext* presContext = PresContext();
|
||||
for (uint32_t i = ArrayLength(gCSSSheetTypes); i-- != 0; ) {
|
||||
if (gCSSSheetTypes[i] == eScopedDocSheet)
|
||||
if (gCSSSheetTypes[i] == SheetType::ScopedDoc)
|
||||
continue;
|
||||
nsCSSRuleProcessor *ruleProc = static_cast<nsCSSRuleProcessor*>
|
||||
(mRuleProcessors[gCSSSheetTypes[i]].get());
|
||||
@@ -2137,7 +2144,7 @@ nsStyleSet::AppendPageRules(nsTArray<nsCSSPageRule*>& aArray)
|
||||
|
||||
nsPresContext* presContext = PresContext();
|
||||
for (uint32_t i = 0; i < ArrayLength(gCSSSheetTypes); ++i) {
|
||||
if (gCSSSheetTypes[i] == eScopedDocSheet)
|
||||
if (gCSSSheetTypes[i] == SheetType::ScopedDoc)
|
||||
continue;
|
||||
nsCSSRuleProcessor* ruleProc = static_cast<nsCSSRuleProcessor*>
|
||||
(mRuleProcessors[gCSSSheetTypes[i]].get());
|
||||
@@ -2437,16 +2444,14 @@ nsStyleSet::MediumFeaturesChanged()
|
||||
// We can't use WalkRuleProcessors without a content node.
|
||||
nsPresContext* presContext = PresContext();
|
||||
bool stylesChanged = false;
|
||||
for (uint32_t i = 0; i < ArrayLength(mRuleProcessors); ++i) {
|
||||
nsIStyleRuleProcessor *processor = mRuleProcessors[i];
|
||||
for (nsIStyleRuleProcessor* processor : mRuleProcessors) {
|
||||
if (!processor) {
|
||||
continue;
|
||||
}
|
||||
bool thisChanged = processor->MediumFeaturesChanged(presContext);
|
||||
stylesChanged = stylesChanged || thisChanged;
|
||||
}
|
||||
for (uint32_t i = 0; i < mScopedDocSheetRuleProcessors.Length(); ++i) {
|
||||
nsIStyleRuleProcessor *processor = mScopedDocSheetRuleProcessors[i];
|
||||
for (nsIStyleRuleProcessor* processor : mScopedDocSheetRuleProcessors) {
|
||||
bool thisChanged = processor->MediumFeaturesChanged(presContext);
|
||||
stylesChanged = stylesChanged || thisChanged;
|
||||
}
|
||||
@@ -2502,7 +2507,7 @@ nsStyleSet::InitialStyleRule()
|
||||
}
|
||||
|
||||
bool
|
||||
nsStyleSet::HasRuleProcessorUsedByMultipleStyleSets(sheetType aSheetType)
|
||||
nsStyleSet::HasRuleProcessorUsedByMultipleStyleSets(SheetType aSheetType)
|
||||
{
|
||||
MOZ_ASSERT(size_t(aSheetType) < ArrayLength(mRuleProcessors));
|
||||
if (!IsCSSSheetType(aSheetType) || !mRuleProcessors[aSheetType]) {
|
||||
|
||||
Reference in New Issue
Block a user