Fix subtle bugs in sky-scrollable

Previously the scrollbar wasn't constrained to the scrollable element and we
had messed up the math on the fling curve.

TBR=eseidel@chromium.org

Review URL: https://codereview.chromium.org/947303003
This commit is contained in:
Adam Barth 2015-02-23 14:20:52 -08:00
parent 374f71edcf
commit bc9b3e319e
4 changed files with 7 additions and 6 deletions

View File

@ -36,7 +36,7 @@ class FlingCurve {
FlingCurve(double velocity, double startTime) {
double startingVelocity = math.min(_kMaxVelocity, velocity.abs());
_timeOffset = _velocityAtTime(startingVelocity);
_timeOffset = _timeAtVelocity(startingVelocity);
_positionOffset = _positionAtTime(_timeOffset);
_startTime = startTime / 1000.0;
_previousPosition = 0.0;

View File

@ -19,7 +19,7 @@
right: 0;
}
#content {
background-color: yellow;
background-color: white;
will-change: transform;
position: absolute;
width: 256px;

View File

@ -11,6 +11,7 @@
:host {
overflow: hidden;
position: relative;
will-change: transform;
}
#scrollable {
will-change: transform;

View File

@ -108,10 +108,10 @@ scoped_ptr<blink::WebInputEvent> BuildWebGestureEvent(
break;
case mojo::EVENT_TYPE_SCROLL_FLING_START:
web_event->type = blink::WebInputEvent::GestureFlingStart;
// TODO(abarth): Why don't we need to divide by the device_pixel_ratio
// here? For some reason, this seems to get the right velocity.
web_event->data.flingStart.velocityX = event->gesture_data->velocity_x;
web_event->data.flingStart.velocityY = event->gesture_data->velocity_y;
web_event->data.flingStart.velocityX =
event->gesture_data->velocity_x / device_pixel_ratio;
web_event->data.flingStart.velocityY =
event->gesture_data->velocity_y / device_pixel_ratio;
break;
case mojo::EVENT_TYPE_SCROLL_FLING_CANCEL:
web_event->type = blink::WebInputEvent::GestureFlingCancel;