Bug 1834133 part 1: Remove about:config prefs layout.css.notify-of-unvisited and layout.css.always-repaint-on-unvisited. r=emilio

Update all of their usages to assume that they're true (which they have been, by-default, for several years).

Differential Revision: https://phabricator.services.mozilla.com/D178569
This commit is contained in:
Daniel Holbert 2023-05-20 06:07:48 +00:00
parent 0d97343733
commit 06aa3fba93
6 changed files with 15 additions and 50 deletions

View file

@ -116,9 +116,6 @@ void BaseHistory::RegisterVisitedCallback(nsIURI* aURI, Link* aLink) {
case VisitedStatus::Unknown:
break;
case VisitedStatus::Unvisited:
if (!StaticPrefs::layout_css_notify_of_unvisited()) {
break;
}
[[fallthrough]];
case VisitedStatus::Visited:
aLink->VisitedQueryFinished(links->mStatus == VisitedStatus::Visited);
@ -159,11 +156,6 @@ void BaseHistory::NotifyVisited(
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aStatus != VisitedStatus::Unknown);
if (aStatus == VisitedStatus::Unvisited &&
!StaticPrefs::layout_css_notify_of_unvisited()) {
return;
}
NotifyVisitedInThisProcess(aURI, aStatus);
if (XRE_IsParentProcess()) {
NotifyVisitedFromParent(aURI, aStatus, aListOfProcessesToNotify);

View file

@ -81,12 +81,10 @@ void Link::VisitedQueryFinished(bool aVisited) {
// Tell the element to update its visited state.
mElement->UpdateState(true);
if (StaticPrefs::layout_css_always_repaint_on_unvisited()) {
// Even if the state didn't actually change, we need to repaint in order for
// the visited state not to be observable.
nsLayoutUtils::PostRestyleEvent(GetElement(), RestyleHint::RestyleSubtree(),
nsChangeHint_RepaintFrame);
}
// Even if the state didn't actually change, we need to repaint in order for
// the visited state not to be observable.
nsLayoutUtils::PostRestyleEvent(GetElement(), RestyleHint::RestyleSubtree(),
nsChangeHint_RepaintFrame);
}
ElementState Link::LinkState() const {

View file

@ -3300,24 +3300,17 @@ void RestyleManager::ElementStateChanged(Element* aElement,
const ElementState kVisitedAndUnvisited =
ElementState::VISITED | ElementState::UNVISITED;
// When visited links are disabled, they cannot influence style for obvious
// reasons.
//
// When layout.css.always-repaint-on-unvisited is true, we'll restyle when the
// relevant visited query finishes, regardless of the style (see
// Link::VisitedQueryFinished). So there's no need to do anything as a result
// of this state change just yet.
// We'll restyle when the relevant visited query finishes, regardless of the
// style (see Link::VisitedQueryFinished). So there's no need to do anything
// as a result of this state change just yet.
//
// Note that this check checks for _both_ bits: This is only true when visited
// changes to unvisited or vice-versa, but not when we start or stop being a
// link itself.
if (aChangedBits.HasAllStates(kVisitedAndUnvisited)) {
if (!Gecko_VisitedStylesEnabled(aElement->OwnerDoc()) ||
StaticPrefs::layout_css_always_repaint_on_unvisited()) {
aChangedBits &= ~kVisitedAndUnvisited;
if (aChangedBits.IsEmpty()) {
return;
}
aChangedBits &= ~kVisitedAndUnvisited;
if (aChangedBits.IsEmpty()) {
return;
}
}

View file

@ -8287,18 +8287,6 @@
value: true
mirror: always
# Whether we get notified of history queries for visited even if unvisited.
- name: layout.css.notify-of-unvisited
type: RelaxedAtomicBool
value: true
mirror: always
# Whether we always restyle / repaint as a result of a visited query
- name: layout.css.always-repaint-on-unvisited
type: RelaxedAtomicBool
value: true
mirror: always
# Make `zoom` a `transform` + `transform-origin` alias.
- name: layout.css.zoom-transform-hack.enabled
type: RelaxedAtomicBool

View file

@ -43,9 +43,7 @@ class mock_Link : public mozilla::dom::Link {
bool GotNotified() const { return !mDeathGrip; }
void AwaitNewNotification(Handler aNewHandler) {
MOZ_ASSERT(
!mDeathGrip || !mozilla::StaticPrefs::layout_css_notify_of_unvisited(),
"Still waiting for a notification");
MOZ_ASSERT(!mDeathGrip, "Still waiting for a notification");
// Create a cyclic ownership, so that the link will be released only
// after its status has been updated. This will ensure that, when it should
// run the next test, it will happen at the end of the test function, if

View file

@ -165,10 +165,8 @@ void test_visited_notifies() {
void test_unvisited_does_not_notify_part2() {
using namespace test_unvisited_does_not_notify;
if (StaticPrefs::layout_css_notify_of_unvisited()) {
SpinEventLoopUntil("places:test_unvisited_does_not_notify_part2"_ns,
[&]() { return testLink->GotNotified(); });
}
SpinEventLoopUntil("places:test_unvisited_does_not_notify_part2"_ns,
[&]() { return testLink->GotNotified(); });
// We would have had a failure at this point had the content node been told it
// was visited. Therefore, now we change it so that it expects a visited
@ -238,10 +236,8 @@ void test_new_visit_notifies_waiting_Link() {
nsCOMPtr<IHistory> history = do_get_IHistory();
history->RegisterVisitedCallback(testURI, link);
if (StaticPrefs::layout_css_notify_of_unvisited()) {
SpinEventLoopUntil("places:test_new_visit_notifies_waiting_Link"_ns,
[&]() { return link->GotNotified(); });
}
SpinEventLoopUntil("places:test_new_visit_notifies_waiting_Link"_ns,
[&]() { return link->GotNotified(); });
link->AwaitNewNotification(expect_visit);