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: case VisitedStatus::Unknown:
break; break;
case VisitedStatus::Unvisited: case VisitedStatus::Unvisited:
if (!StaticPrefs::layout_css_notify_of_unvisited()) {
break;
}
[[fallthrough]]; [[fallthrough]];
case VisitedStatus::Visited: case VisitedStatus::Visited:
aLink->VisitedQueryFinished(links->mStatus == VisitedStatus::Visited); aLink->VisitedQueryFinished(links->mStatus == VisitedStatus::Visited);
@ -159,11 +156,6 @@ void BaseHistory::NotifyVisited(
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aStatus != VisitedStatus::Unknown); MOZ_ASSERT(aStatus != VisitedStatus::Unknown);
if (aStatus == VisitedStatus::Unvisited &&
!StaticPrefs::layout_css_notify_of_unvisited()) {
return;
}
NotifyVisitedInThisProcess(aURI, aStatus); NotifyVisitedInThisProcess(aURI, aStatus);
if (XRE_IsParentProcess()) { if (XRE_IsParentProcess()) {
NotifyVisitedFromParent(aURI, aStatus, aListOfProcessesToNotify); NotifyVisitedFromParent(aURI, aStatus, aListOfProcessesToNotify);

View file

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

View file

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

View file

@ -8287,18 +8287,6 @@
value: true value: true
mirror: always 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. # Make `zoom` a `transform` + `transform-origin` alias.
- name: layout.css.zoom-transform-hack.enabled - name: layout.css.zoom-transform-hack.enabled
type: RelaxedAtomicBool type: RelaxedAtomicBool

View file

@ -43,9 +43,7 @@ class mock_Link : public mozilla::dom::Link {
bool GotNotified() const { return !mDeathGrip; } bool GotNotified() const { return !mDeathGrip; }
void AwaitNewNotification(Handler aNewHandler) { void AwaitNewNotification(Handler aNewHandler) {
MOZ_ASSERT( MOZ_ASSERT(!mDeathGrip, "Still waiting for a notification");
!mDeathGrip || !mozilla::StaticPrefs::layout_css_notify_of_unvisited(),
"Still waiting for a notification");
// Create a cyclic ownership, so that the link will be released only // 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 // 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 // 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() { void test_unvisited_does_not_notify_part2() {
using namespace test_unvisited_does_not_notify; using namespace test_unvisited_does_not_notify;
if (StaticPrefs::layout_css_notify_of_unvisited()) { SpinEventLoopUntil("places:test_unvisited_does_not_notify_part2"_ns,
SpinEventLoopUntil("places:test_unvisited_does_not_notify_part2"_ns, [&]() { return testLink->GotNotified(); });
[&]() { return testLink->GotNotified(); });
}
// We would have had a failure at this point had the content node been told it // 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 // 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(); nsCOMPtr<IHistory> history = do_get_IHistory();
history->RegisterVisitedCallback(testURI, link); history->RegisterVisitedCallback(testURI, link);
if (StaticPrefs::layout_css_notify_of_unvisited()) { SpinEventLoopUntil("places:test_new_visit_notifies_waiting_Link"_ns,
SpinEventLoopUntil("places:test_new_visit_notifies_waiting_Link"_ns, [&]() { return link->GotNotified(); });
[&]() { return link->GotNotified(); });
}
link->AwaitNewNotification(expect_visit); link->AwaitNewNotification(expect_visit);