LibWeb+LibWebView+WebContent: Add a setting to control autoscrolling

This commit is contained in:
Timothy Flynn
2026-04-13 10:55:24 -04:00
committed by Tim Flynn
parent 6cf4fa80a7
commit 79893b9cef
Notes: github-actions[bot] 2026-04-13 17:51:31 +00:00
14 changed files with 148 additions and 1 deletions

View File

@@ -365,6 +365,21 @@
</div>
</div>
</div>
<h3 class="card-title">Browsing Behavior</h3>
<div class="card">
<div class="card-body">
<div class="card-group">
<div class="inline-container">
<label for="enable-autoscroll">Enable autoscrolling</label>
<input id="enable-autoscroll" type="checkbox" switch />
</div>
<p class="description">
Scroll pages by pressing the middle mouse button and moving the mouse.
</p>
</div>
</div>
</div>
</div>
<div class="tab-panel" id="tab-search">
@@ -620,6 +635,7 @@
};
</script>
<script src="resource://ladybird/about-pages/settings/browsing-behavior.js" type="module"></script>
<script src="resource://ladybird/about-pages/settings/default-zoom-level.js" type="module"></script>
<script src="resource://ladybird/about-pages/settings/languages.js" type="module"></script>
<script src="resource://ladybird/about-pages/settings/network.js" type="module"></script>

View File

@@ -0,0 +1,20 @@
const enableAutoscroll = document.querySelector("#enable-autoscroll");
let BROWSING_BEHAVIOR = {};
const loadSettings = settings => {
BROWSING_BEHAVIOR = settings.browsingBehavior || {};
enableAutoscroll.checked = !!BROWSING_BEHAVIOR.enableAutoscroll;
};
enableAutoscroll.addEventListener("change", () => {
BROWSING_BEHAVIOR.enableAutoscroll = enableAutoscroll.checked;
ladybird.sendMessage("setBrowsingBehavior", BROWSING_BEHAVIOR);
});
document.addEventListener("WebUIMessage", event => {
if (event.detail.name === "loadSettings") {
loadSettings(event.detail.data);
}
});