mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-31 11:37:30 +09:00
Issue #2835 - Part 2: Implement processing of import rules based on order of appearance
This commit is contained in:
parent
be3d8491c7
commit
37230e7b21
4 changed files with 31 additions and 4 deletions
|
|
@ -16,6 +16,7 @@
|
||||||
#include "PLDHashTable.h"
|
#include "PLDHashTable.h"
|
||||||
#include "nsICSSPseudoComparator.h"
|
#include "nsICSSPseudoComparator.h"
|
||||||
#include "mozilla/MemoryReporting.h"
|
#include "mozilla/MemoryReporting.h"
|
||||||
|
#include "mozilla/css/ImportRule.h"
|
||||||
#include "mozilla/css/StyleRule.h"
|
#include "mozilla/css/StyleRule.h"
|
||||||
#include "mozilla/css/GroupRule.h"
|
#include "mozilla/css/GroupRule.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
|
|
@ -649,6 +650,12 @@ CascadeRuleEnumFunc(css::Rule* aRule, void* aData)
|
||||||
if (!layer->mData->mCounterStyleRules.AppendElement(counterStyleRule)) {
|
if (!layer->mData->mCounterStyleRules.AppendElement(counterStyleRule)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} else if (css::Rule::IMPORT_RULE == type &&
|
||||||
|
nsCSSRuleUtils::LoadImportedSheetsInOrderEnabled()) {
|
||||||
|
css::ImportRule* importRule = static_cast<css::ImportRule*>(aRule);
|
||||||
|
nsCSSRuleProcessor::CascadeSheet(
|
||||||
|
importRule->GetStyleSheet()->AsConcrete(),
|
||||||
|
layer);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -660,10 +667,12 @@ nsCSSRuleProcessor::CascadeSheet(CSSStyleSheet* aSheet, CascadeLayer* aLayer)
|
||||||
aSheet->UseForPresentation(aLayer->mPresContext,
|
aSheet->UseForPresentation(aLayer->mPresContext,
|
||||||
aLayer->mCacheKey) &&
|
aLayer->mCacheKey) &&
|
||||||
aSheet->mInner) {
|
aSheet->mInner) {
|
||||||
CSSStyleSheet* child = aSheet->mInner->mFirstChild;
|
if (!nsCSSRuleUtils::LoadImportedSheetsInOrderEnabled()) {
|
||||||
while (child) {
|
CSSStyleSheet* child = aSheet->mInner->mFirstChild;
|
||||||
CascadeSheet(child, aLayer);
|
while (child) {
|
||||||
child = child->mNext;
|
CascadeSheet(child, aLayer);
|
||||||
|
child = child->mNext;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!aSheet->mInner->mOrderedRules.EnumerateForwards(CascadeRuleEnumFunc,
|
if (!aSheet->mInner->mOrderedRules.EnumerateForwards(CascadeRuleEnumFunc,
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ using namespace mozilla::dom;
|
||||||
#define VISITED_PSEUDO_PREF "layout.css.visited_links_enabled"
|
#define VISITED_PSEUDO_PREF "layout.css.visited_links_enabled"
|
||||||
|
|
||||||
static bool gSupportVisitedPseudo = true;
|
static bool gSupportVisitedPseudo = true;
|
||||||
|
static bool gLoadImportedSheetsInOrder = true;
|
||||||
|
|
||||||
static nsTArray<nsCOMPtr<nsIAtom>>* sSystemMetrics = 0;
|
static nsTArray<nsCOMPtr<nsIAtom>>* sSystemMetrics = 0;
|
||||||
|
|
||||||
|
|
@ -31,6 +32,9 @@ nsCSSRuleUtils::Startup()
|
||||||
{
|
{
|
||||||
Preferences::AddBoolVarCache(
|
Preferences::AddBoolVarCache(
|
||||||
&gSupportVisitedPseudo, VISITED_PSEUDO_PREF, true);
|
&gSupportVisitedPseudo, VISITED_PSEUDO_PREF, true);
|
||||||
|
Preferences::AddBoolVarCache(&gLoadImportedSheetsInOrder,
|
||||||
|
"layout.css.load-imported-sheets-in-order",
|
||||||
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
|
@ -206,6 +210,12 @@ nsCSSRuleUtils::HasSystemMetric(nsIAtom* aMetric)
|
||||||
return sSystemMetrics->IndexOf(aMetric) != sSystemMetrics->NoIndex;
|
return sSystemMetrics->IndexOf(aMetric) != sSystemMetrics->NoIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* static */ bool
|
||||||
|
nsCSSRuleUtils::LoadImportedSheetsInOrderEnabled()
|
||||||
|
{
|
||||||
|
return gLoadImportedSheetsInOrder;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
/* static */ uint8_t
|
/* static */ uint8_t
|
||||||
nsCSSRuleUtils::GetWindowsThemeIdentifier()
|
nsCSSRuleUtils::GetWindowsThemeIdentifier()
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@ struct nsCSSRuleUtils
|
||||||
static void FreeSystemMetrics();
|
static void FreeSystemMetrics();
|
||||||
static bool HasSystemMetric(nsIAtom* aMetric);
|
static bool HasSystemMetric(nsIAtom* aMetric);
|
||||||
|
|
||||||
|
static bool LoadImportedSheetsInOrderEnabled();
|
||||||
|
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
// Cached theme identifier for the moz-windows-theme media query.
|
// Cached theme identifier for the moz-windows-theme media query.
|
||||||
static uint8_t GetWindowsThemeIdentifier();
|
static uint8_t GetWindowsThemeIdentifier();
|
||||||
|
|
|
||||||
|
|
@ -2704,6 +2704,12 @@ pref("layout.css.resizeobserver.enabled", true);
|
||||||
// Is support for cascade layers enabled?
|
// Is support for cascade layers enabled?
|
||||||
pref("layout.css.cascade-layers.enabled", true);
|
pref("layout.css.cascade-layers.enabled", true);
|
||||||
|
|
||||||
|
// Should rules in imported style sheets be added based on the order
|
||||||
|
// of appearance of their respective @import rules in the parent
|
||||||
|
// style sheet? Otherwise, they are added before rules preceding
|
||||||
|
// @import are processed, which is problematic for cascade layers.
|
||||||
|
pref("layout.css.load-imported-sheets-in-order", true);
|
||||||
|
|
||||||
// pref for which side vertical scrollbars should be on
|
// pref for which side vertical scrollbars should be on
|
||||||
// 0 = end-side in UI direction
|
// 0 = end-side in UI direction
|
||||||
// 1 = end-side in document/content direction
|
// 1 = end-side in document/content direction
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue