mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-03 13:02:09 +02:00
LibGUI: Prevent "hide unnecessary scrollbars" from showing unwanted bars
When using this mode on an AbstractScrollWidget, it was not honoring the related "scrollbars enabled" setting. If scrollbars are disabled, they should never be made visible by the "unnecessary scrollbars" logic.
This commit is contained in:
Notes:
sideshowbarker
2024-07-17 22:09:47 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/33fd9ea5b3
@@ -156,11 +156,11 @@ void AbstractScrollableWidget::set_should_hide_unnecessary_scrollbars(bool shoul
|
||||
return;
|
||||
|
||||
m_should_hide_unnecessary_scrollbars = should_hide_unnecessary_scrollbars;
|
||||
if (should_hide_unnecessary_scrollbars)
|
||||
if (should_hide_unnecessary_scrollbars) {
|
||||
update_scrollbar_ranges();
|
||||
else {
|
||||
m_horizontal_scrollbar->set_visible(true);
|
||||
m_vertical_scrollbar->set_visible(true);
|
||||
} else {
|
||||
m_horizontal_scrollbar->set_visible(m_scrollbars_enabled);
|
||||
m_vertical_scrollbar->set_visible(m_scrollbars_enabled);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,6 +176,11 @@ void AbstractScrollableWidget::update_scrollbar_ranges()
|
||||
|
||||
void AbstractScrollableWidget::update_scrollbar_visibility()
|
||||
{
|
||||
if (!m_scrollbars_enabled) {
|
||||
m_horizontal_scrollbar->set_visible(false);
|
||||
m_vertical_scrollbar->set_visible(false);
|
||||
return;
|
||||
}
|
||||
if (should_hide_unnecessary_scrollbars()) {
|
||||
// If there has not been a min_size set, the content_size can be used as a substitute
|
||||
auto effective_min_content_size = m_min_content_size;
|
||||
|
||||
Reference in New Issue
Block a user