From 08af25f4f744f5c290ffa7af6670f8c5d2da5b56 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Tue, 27 Dec 2016 12:20:16 +0100 Subject: [PATCH] WebScrollBar: Don't update value while slider is down Makes the scrolling smoother --- src/lib/webengine/webscrollbar.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/lib/webengine/webscrollbar.cpp b/src/lib/webengine/webscrollbar.cpp index 426db2aa8..0ecaa429f 100644 --- a/src/lib/webengine/webscrollbar.cpp +++ b/src/lib/webengine/webscrollbar.cpp @@ -43,23 +43,27 @@ void WebScrollBar::updateValues(const QSize &viewport) setMinimum(0); setParent(m_view->overlayWidget()); - m_blockScrolling = true; + int newValue; if (orientation() == Qt::Vertical) { setFixedHeight(viewport.height()); move(m_view->width() - width(), 0); setPageStep(viewport.height()); setMaximum(std::max(0, m_view->page()->contentsSize().toSize().height() - viewport.height())); - setValue(m_view->page()->scrollPosition().toPoint().y()); + newValue = m_view->page()->scrollPosition().toPoint().y(); } else { setFixedWidth(viewport.width()); move(0, m_view->height() - height()); setPageStep(viewport.width()); setMaximum(std::max(0, m_view->page()->contentsSize().toSize().width() - viewport.width())); - setValue(m_view->page()->scrollPosition().toPoint().x()); + newValue = m_view->page()->scrollPosition().toPoint().x(); } - m_blockScrolling = false; + if (!isSliderDown()) { + m_blockScrolling = true; + setValue(newValue); + m_blockScrolling = false; + } setVisible(maximum() > minimum()); }