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
diff --git a/sky/framework/fling-curve.dart b/sky/framework/fling-curve.dart index 6a476d7..3a9f54f 100644 --- a/sky/framework/fling-curve.dart +++ b/sky/framework/fling-curve.dart
@@ -36,7 +36,7 @@ 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;
diff --git a/sky/framework/sky-drawer.sky b/sky/framework/sky-drawer.sky index 9a54caa..906f4f4 100644 --- a/sky/framework/sky-drawer.sky +++ b/sky/framework/sky-drawer.sky
@@ -19,7 +19,7 @@ right: 0; } #content { - background-color: yellow; + background-color: white; will-change: transform; position: absolute; width: 256px;
diff --git a/sky/framework/sky-scrollable.sky b/sky/framework/sky-scrollable.sky index fa287a0..3e41d88 100644 --- a/sky/framework/sky-scrollable.sky +++ b/sky/framework/sky-scrollable.sky
@@ -11,6 +11,7 @@ :host { overflow: hidden; position: relative; + will-change: transform; } #scrollable { will-change: transform;
diff --git a/sky/viewer/converters/input_event_types.cc b/sky/viewer/converters/input_event_types.cc index d5bb31e..3aa297d 100644 --- a/sky/viewer/converters/input_event_types.cc +++ b/sky/viewer/converters/input_event_types.cc
@@ -108,10 +108,10 @@ 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;