Bug 1418217 - Move visited links pref to StylePrefs. r=TYLin

On a CLOSED TREE to fix Servo bustage.

MozReview-Commit-ID: HLukaX0EFFv
This commit is contained in:
Cameron McCormack 2017-11-17 14:47:34 +08:00 коммит произвёл Emilio Cobos Álvarez
Родитель 12e4204b4d
Коммит 99c87da38a
7 изменённых файлов: 5 добавлений и 29 удалений

Просмотреть файл

@ -236,7 +236,6 @@ nsLayoutStatics::Initialize()
} }
StylePrefs::Init(); StylePrefs::Init();
nsCSSRuleProcessor::Startup();
#ifdef MOZ_XUL #ifdef MOZ_XUL
rv = nsXULPopupManager::Init(); rv = nsXULPopupManager::Init();

Просмотреть файл

@ -307,12 +307,6 @@ Gecko_IsPrivateBrowsingEnabled(const nsIDocument* aDoc)
return loadContext && loadContext->UsePrivateBrowsing(); return loadContext && loadContext->UsePrivateBrowsing();
} }
bool
Gecko_AreVisitedLinksEnabled()
{
return nsCSSRuleProcessor::VisitedLinksEnabled();
}
EventStates::ServoType EventStates::ServoType
Gecko_ElementState(RawGeckoElementBorrowed aElement) Gecko_ElementState(RawGeckoElementBorrowed aElement)
{ {

Просмотреть файл

@ -235,8 +235,6 @@ Gecko_GetActiveLinkAttrDeclarationBlock(RawGeckoElementBorrowed element);
// Returns whether private browsing is enabled for a given element. // Returns whether private browsing is enabled for a given element.
bool Gecko_IsPrivateBrowsingEnabled(const nsIDocument* aDoc); bool Gecko_IsPrivateBrowsingEnabled(const nsIDocument* aDoc);
// Returns whether visited links are enabled.
bool Gecko_AreVisitedLinksEnabled();
// Animations // Animations
bool bool

Просмотреть файл

@ -18,6 +18,7 @@ bool StylePrefs::sMozGradientsEnabled;
bool StylePrefs::sControlCharVisibility; bool StylePrefs::sControlCharVisibility;
bool StylePrefs::sFramesTimingFunctionEnabled; bool StylePrefs::sFramesTimingFunctionEnabled;
bool StylePrefs::sUnprefixedFullscreenApiEnabled; bool StylePrefs::sUnprefixedFullscreenApiEnabled;
bool StylePrefs::sVisitedLinksEnabled;
/* static */ void /* static */ void
StylePrefs::Init() StylePrefs::Init()
@ -38,6 +39,8 @@ StylePrefs::Init()
"layout.css.frames-timing.enabled"); "layout.css.frames-timing.enabled");
Preferences::AddBoolVarCache(&sUnprefixedFullscreenApiEnabled, Preferences::AddBoolVarCache(&sUnprefixedFullscreenApiEnabled,
"full-screen-api.unprefix.enabled"); "full-screen-api.unprefix.enabled");
Preferences::AddBoolVarCache(&sVisitedLinksEnabled,
"layout.css.visited_links_enabled");
} }
} // namespace mozilla } // namespace mozilla

Просмотреть файл

@ -21,6 +21,7 @@ struct StylePrefs
static bool sControlCharVisibility; static bool sControlCharVisibility;
static bool sFramesTimingFunctionEnabled; static bool sFramesTimingFunctionEnabled;
static bool sUnprefixedFullscreenApiEnabled; static bool sUnprefixedFullscreenApiEnabled;
static bool sVisitedLinksEnabled;
static void Init(); static void Init();
}; };

Просмотреть файл

@ -61,10 +61,6 @@ using namespace mozilla::dom;
typedef ArenaAllocator<4096, 8> CascadeAllocator; typedef ArenaAllocator<4096, 8> CascadeAllocator;
#define VISITED_PSEUDO_PREF "layout.css.visited_links_enabled"
static bool gSupportVisitedPseudo = true;
static nsTArray< RefPtr<nsAtom> >* sSystemMetrics = 0; static nsTArray< RefPtr<nsAtom> >* sSystemMetrics = 0;
#ifdef XP_WIN #ifdef XP_WIN
@ -1051,19 +1047,6 @@ nsCSSRuleProcessor::ClearSheets()
mSheets.Clear(); mSheets.Clear();
} }
/* static */ void
nsCSSRuleProcessor::Startup()
{
Preferences::AddBoolVarCache(&gSupportVisitedPseudo, VISITED_PSEUDO_PREF,
true);
}
/* static */ bool
nsCSSRuleProcessor::VisitedLinksEnabled()
{
return gSupportVisitedPseudo;
}
/* static */ void /* static */ void
nsCSSRuleProcessor::InitSystemMetrics() nsCSSRuleProcessor::InitSystemMetrics()
{ {
@ -1259,7 +1242,7 @@ nsCSSRuleProcessor::GetContentState(const Element* aElement,
// than in GetContentStateForVisitedHandling, so that we don't // than in GetContentStateForVisitedHandling, so that we don't
// expose that :visited support is disabled to the Web page. // expose that :visited support is disabled to the Web page.
if (state.HasState(NS_EVENT_STATE_VISITED) && if (state.HasState(NS_EVENT_STATE_VISITED) &&
(!gSupportVisitedPseudo || (!StylePrefs::sVisitedLinksEnabled ||
aElement->OwnerDoc()->IsBeingUsedAsImage() || aElement->OwnerDoc()->IsBeingUsedAsImage() ||
aUsingPrivateBrowsing)) { aUsingPrivateBrowsing)) {
state &= ~NS_EVENT_STATE_VISITED; state &= ~NS_EVENT_STATE_VISITED;

Просмотреть файл

@ -81,8 +81,6 @@ public:
public: public:
nsresult ClearRuleCascades(); nsresult ClearRuleCascades();
static bool VisitedLinksEnabled();
static void Startup();
static void InitSystemMetrics(); static void InitSystemMetrics();
static void Shutdown(); static void Shutdown();
static void FreeSystemMetrics(); static void FreeSystemMetrics();