- Revision
- 198383
- Author
- [email protected]
- Date
- 2016-03-17 23:56:26 -0700 (Thu, 17 Mar 2016)
Log Message
REGRESSION(r195661): [GTK] very slow scrolling
https://bugs.webkit.org/show_bug.cgi?id=155334
Reviewed by Michael Catanzaro.
We need to also restore the PerAxisData visible length when it's
reset because of a non animated scroll. To prevent making the same
mistake in the future, the current position and visible lengths
members are now required to construct PerAxisData. This also
simplifies the code and ensures that when the ScrollAnimatorSmooth
is created, it's updated to the current position.
* platform/ScrollAnimationSmooth.cpp:
(WebCore::ScrollAnimationSmooth::ScrollAnimationSmooth):
Initialize PerAxisData members.
(WebCore::ScrollAnimationSmooth::setCurrentPosition): Pass the
current position and visible length as parameters to the
PerAxisData constructor.
(WebCore::ScrollAnimationSmooth::animateScroll): Ditto.
* platform/ScrollAnimationSmooth.h: Add a PerAxisData constructor
that receives current position and visible length and disallow to
use the default constructor.
* platform/ScrollAnimatorSmooth.cpp:
(WebCore::ScrollAnimatorSmooth::ScrollAnimatorSmooth): Pass the
current position to the ScrollAnimationSmooth constructor.
* platform/gtk/ScrollAnimatorGtk.cpp:
(WebCore::ScrollAnimatorGtk::ensureSmoothScrollingAnimation): Ditto.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (198382 => 198383)
--- trunk/Source/WebCore/ChangeLog 2016-03-18 06:53:27 UTC (rev 198382)
+++ trunk/Source/WebCore/ChangeLog 2016-03-18 06:56:26 UTC (rev 198383)
@@ -1,3 +1,33 @@
+2016-03-17 Carlos Garcia Campos <[email protected]>
+
+ REGRESSION(r195661): [GTK] very slow scrolling
+ https://bugs.webkit.org/show_bug.cgi?id=155334
+
+ Reviewed by Michael Catanzaro.
+
+ We need to also restore the PerAxisData visible length when it's
+ reset because of a non animated scroll. To prevent making the same
+ mistake in the future, the current position and visible lengths
+ members are now required to construct PerAxisData. This also
+ simplifies the code and ensures that when the ScrollAnimatorSmooth
+ is created, it's updated to the current position.
+
+ * platform/ScrollAnimationSmooth.cpp:
+ (WebCore::ScrollAnimationSmooth::ScrollAnimationSmooth):
+ Initialize PerAxisData members.
+ (WebCore::ScrollAnimationSmooth::setCurrentPosition): Pass the
+ current position and visible length as parameters to the
+ PerAxisData constructor.
+ (WebCore::ScrollAnimationSmooth::animateScroll): Ditto.
+ * platform/ScrollAnimationSmooth.h: Add a PerAxisData constructor
+ that receives current position and visible length and disallow to
+ use the default constructor.
+ * platform/ScrollAnimatorSmooth.cpp:
+ (WebCore::ScrollAnimatorSmooth::ScrollAnimatorSmooth): Pass the
+ current position to the ScrollAnimationSmooth constructor.
+ * platform/gtk/ScrollAnimatorGtk.cpp:
+ (WebCore::ScrollAnimatorGtk::ensureSmoothScrollingAnimation): Ditto.
+
2016-03-17 Chris Fleizach <[email protected]>
AX: WEB: VoiceOver does not announce some WAI-ARIA document structures
Modified: trunk/Source/WebCore/platform/ScrollAnimationSmooth.cpp (198382 => 198383)
--- trunk/Source/WebCore/platform/ScrollAnimationSmooth.cpp 2016-03-18 06:53:27 UTC (rev 198382)
+++ trunk/Source/WebCore/platform/ScrollAnimationSmooth.cpp 2016-03-18 06:56:26 UTC (rev 198383)
@@ -40,9 +40,11 @@
static const double tickTime = 1 / frameRate;
static const double minimumTimerInterval = .001;
-ScrollAnimationSmooth::ScrollAnimationSmooth(ScrollableArea& scrollableArea, std::function<void (FloatPoint&&)>&& notifyPositionChangedFunction)
+ScrollAnimationSmooth::ScrollAnimationSmooth(ScrollableArea& scrollableArea, const FloatPoint& position, std::function<void (FloatPoint&&)>&& notifyPositionChangedFunction)
: ScrollAnimation(scrollableArea)
, m_notifyPositionChangedFunction(WTFMove(notifyPositionChangedFunction))
+ , m_horizontalData(position.x(), scrollableArea.visibleWidth())
+ , m_verticalData(position.y(), scrollableArea.visibleHeight())
#if USE(REQUEST_ANIMATION_FRAME_TIMER)
, m_animationTimer(*this, &ScrollAnimationSmooth::animationTimerFired)
#else
@@ -88,13 +90,8 @@
void ScrollAnimationSmooth::setCurrentPosition(const FloatPoint& position)
{
stop();
- m_horizontalData = PerAxisData();
- m_horizontalData.currentPosition = position.x();
- m_horizontalData.desiredPosition = m_horizontalData.currentPosition;
-
- m_verticalData = PerAxisData();
- m_verticalData.currentPosition = position.y();
- m_verticalData.desiredPosition = m_verticalData.currentPosition;
+ m_horizontalData = PerAxisData(position.x(), m_horizontalData.visibleLength);
+ m_verticalData = PerAxisData(position.y(), m_verticalData.visibleLength);
}
#if !USE(REQUEST_ANIMATION_FRAME_TIMER)
@@ -379,11 +376,7 @@
double newPosition = data.currentPosition;
if (deltaTime > data.animationTime) {
- double desiredPosition = data.desiredPosition;
- int visibleLength = data.visibleLength;
- data = ""
- data.currentPosition = desiredPosition;
- data.visibleLength = visibleLength;
+ data = "" data.visibleLength);
return false;
}
if (deltaTime < data.attackTime)
Modified: trunk/Source/WebCore/platform/ScrollAnimationSmooth.h (198382 => 198383)
--- trunk/Source/WebCore/platform/ScrollAnimationSmooth.h 2016-03-18 06:53:27 UTC (rev 198382)
+++ trunk/Source/WebCore/platform/ScrollAnimationSmooth.h 2016-03-18 06:56:26 UTC (rev 198383)
@@ -43,7 +43,7 @@
class ScrollAnimationSmooth final: public ScrollAnimation {
public:
- ScrollAnimationSmooth(ScrollableArea&, std::function<void (FloatPoint&&)>&& notifyPositionChangedFunction);
+ ScrollAnimationSmooth(ScrollableArea&, const FloatPoint&, std::function<void (FloatPoint&&)>&& notifyPositionChangedFunction);
virtual ~ScrollAnimationSmooth();
enum class Curve {
@@ -64,6 +64,15 @@
#endif
struct PerAxisData {
+ PerAxisData() = delete;
+
+ PerAxisData(float position, int length)
+ : currentPosition(position)
+ , desiredPosition(position)
+ , visibleLength(length)
+ {
+ }
+
float currentPosition { 0 };
double currentVelocity { 0 };
Modified: trunk/Source/WebCore/platform/ScrollAnimatorSmooth.cpp (198382 => 198383)
--- trunk/Source/WebCore/platform/ScrollAnimatorSmooth.cpp 2016-03-18 06:53:27 UTC (rev 198382)
+++ trunk/Source/WebCore/platform/ScrollAnimatorSmooth.cpp 2016-03-18 06:56:26 UTC (rev 198383)
@@ -48,7 +48,7 @@
ScrollAnimatorSmooth::ScrollAnimatorSmooth(ScrollableArea& scrollableArea)
: ScrollAnimator(scrollableArea)
- , m_animation(std::make_unique<ScrollAnimationSmooth>(scrollableArea, [this](FloatPoint&& position) {
+ , m_animation(std::make_unique<ScrollAnimationSmooth>(scrollableArea, m_currentPosition, [this](FloatPoint&& position) {
FloatSize delta = position - m_currentPosition;
m_currentPosition = WTFMove(position);
notifyPositionChanged(delta);
Modified: trunk/Source/WebCore/platform/gtk/ScrollAnimatorGtk.cpp (198382 => 198383)
--- trunk/Source/WebCore/platform/gtk/ScrollAnimatorGtk.cpp 2016-03-18 06:53:27 UTC (rev 198382)
+++ trunk/Source/WebCore/platform/gtk/ScrollAnimatorGtk.cpp 2016-03-18 06:56:26 UTC (rev 198383)
@@ -66,12 +66,11 @@
if (m_animation)
return;
- m_animation = std::make_unique<ScrollAnimationSmooth>(m_scrollableArea, [this](FloatPoint&& position) {
+ m_animation = std::make_unique<ScrollAnimationSmooth>(m_scrollableArea, m_currentPosition, [this](FloatPoint&& position) {
FloatSize delta = position - m_currentPosition;
m_currentPosition = WTFMove(position);
notifyPositionChanged(delta);
});
- m_animation->setCurrentPosition(m_currentPosition);
}
bool ScrollAnimatorGtk::scroll(ScrollbarOrientation orientation, ScrollGranularity granularity, float step, float multiplier)