summaryrefslogtreecommitdiffstats
path: root/webkit/support/web_gesture_curve_mock.cc
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-10 06:48:45 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-10 06:48:45 +0000
commit002de2f6f5aa1287b779c178f39dd112861b9c69 (patch)
tree84af5dbf408d7c410560e2cdd73963e0ea9317ac /webkit/support/web_gesture_curve_mock.cc
parent1dd862554bb698ac52a92539bf8b676ac664dff0 (diff)
downloadchromium_src-002de2f6f5aa1287b779c178f39dd112861b9c69.zip
chromium_src-002de2f6f5aa1287b779c178f39dd112861b9c69.tar.gz
chromium_src-002de2f6f5aa1287b779c178f39dd112861b9c69.tar.bz2
Fix member variable order in WebGestureCurve implementations
The call to scrollBy() can result in the curve going away, so it's unsafe to touch member variables after making the call. Covered by webkit_unit_tests. BUG=169156 Review URL: https://chromiumcodereview.appspot.com/11778080 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176037 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/support/web_gesture_curve_mock.cc')
-rw-r--r--webkit/support/web_gesture_curve_mock.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/webkit/support/web_gesture_curve_mock.cc b/webkit/support/web_gesture_curve_mock.cc
index 00e6358..43fe5cc 100644
--- a/webkit/support/web_gesture_curve_mock.cc
+++ b/webkit/support/web_gesture_curve_mock.cc
@@ -22,7 +22,9 @@ bool WebGestureCurveMock::apply(double time,
WebKit::WebSize displacement(velocity_.x * time, velocity_.y * time);
WebKit::WebPoint increment(displacement.width - cumulative_scroll_.width,
displacement.height - cumulative_scroll_.height);
- target->scrollBy(increment);
cumulative_scroll_ = displacement;
+ // scrollBy() could delete this curve if the animation is over, so don't
+ // touch any member variables after making that call.
+ target->scrollBy(increment);
return true;
}