Bug 1783183 - Make overlap between scrolled pages configurable r=dholbert

Differential Revision: https://phabricator.services.mozilla.com/D208733
This commit is contained in:
ash 2024-05-08 06:06:28 +00:00
Родитель 4ca5cb765e
Коммит afafb3bbd1
2 изменённых файлов: 26 добавлений и 8 удалений

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

@ -5211,15 +5211,19 @@ nsSize nsHTMLScrollFrame::GetPageScrollAmount() const {
}
nsSize lineScrollAmount = GetLineScrollAmount();
const int32_t maxOverlapPercent = std::clamp(
StaticPrefs::toolkit_scrollbox_pagescroll_maxOverlapPercent(), 0, 80);
const int32_t maxOverlapLines =
std::max(StaticPrefs::toolkit_scrollbox_pagescroll_maxOverlapLines(), 0);
// The page increment is the size of the page, minus the smaller of
// 10% of the size or 2 lines.
return nsSize(effectiveScrollPortSize.width -
std::min(effectiveScrollPortSize.width / 10,
2 * lineScrollAmount.width),
effectiveScrollPortSize.height -
std::min(effectiveScrollPortSize.height / 10,
2 * lineScrollAmount.height));
// The page increment is the size of the page, minus some overlap.
return nsSize(
effectiveScrollPortSize.width -
std::min(effectiveScrollPortSize.width * maxOverlapPercent / 100,
maxOverlapLines * lineScrollAmount.width),
effectiveScrollPortSize.height -
std::min(effectiveScrollPortSize.height * maxOverlapPercent / 100,
maxOverlapLines * lineScrollAmount.height));
}
/**

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

@ -15382,6 +15382,20 @@
value: 3
mirror: always
# The maximum overlap between pages when scrolling with
# page-up/page-down/spacebar, as a percentage of scrollport size.
- name: toolkit.scrollbox.pagescroll.maxOverlapPercent
type: RelaxedAtomicInt32
value: 10
mirror: always
# The maximum overlap between pages when scrolling with
# page-up/page-down/spacebar, in lines.
- name: toolkit.scrollbox.pagescroll.maxOverlapLines
type: RelaxedAtomicInt32
value: 2
mirror: always
# The lateWriteChecksStage and fastShutdownStage below represent the stage
# of shutdown after which we (for lateWriteChecksStage) crash / gather
# telemetry data on file writes, or (for fastShutdownStage) we call _exit(0).