Merge pull request #1848 from abarth/icon_size

Icon should use an enum rather than an int for size
diff --git a/examples/raw/hello_world.dart b/examples/raw/hello_world.dart
index 7275b03..a8faa38 100644
--- a/examples/raw/hello_world.dart
+++ b/examples/raw/hello_world.dart
@@ -21,8 +21,8 @@
 }
 
 ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
-  final double devicePixelRatio = ui.view.devicePixelRatio;
-  ui.Rect sceneBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width * devicePixelRatio, ui.view.height * devicePixelRatio);
+  final double devicePixelRatio = ui.window.devicePixelRatio;
+  ui.Rect sceneBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.window.size.width * devicePixelRatio, ui.window.size.height * devicePixelRatio);
   Float64List deviceTransform = new Float64List(16)
     ..[0] = devicePixelRatio
     ..[5] = devicePixelRatio
@@ -35,23 +35,23 @@
   return sceneBuilder.build();
 }
 
-void beginFrame(double timeStamp) {
-  ui.Rect paintBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width, ui.view.height);
+void beginFrame(Duration timeStamp) {
+  ui.Rect paintBounds = ui.Point.origin & ui.window.size;
   ui.Picture picture = paint(paintBounds);
   ui.Scene scene = composite(picture, paintBounds);
-  ui.view.scene = scene;
+  ui.window.render(scene);
 }
 
 bool handleEvent(ui.Event event) {
   if (event.type == 'pointerdown') {
     color = new ui.Color.fromARGB(255, 0, 0, 255);
-    ui.view.scheduleFrame();
+    ui.window.scheduleFrame();
     return true;
   }
 
   if (event.type == 'pointerup') {
     color = new ui.Color.fromARGB(255, 0, 255, 0);
-    ui.view.scheduleFrame();
+    ui.window.scheduleFrame();
     return true;
   }
 
@@ -66,7 +66,7 @@
 void main() {
   print('Hello, world');
   color = new ui.Color.fromARGB(255, 0, 255, 0);
-  ui.view.setFrameCallback(beginFrame);
-  ui.view.setEventCallback(handleEvent);
-  ui.view.scheduleFrame();
+  ui.window.onBeginFrame = beginFrame;
+  ui.window.onEvent = handleEvent;
+  ui.window.scheduleFrame();
 }
diff --git a/examples/raw/painting.dart b/examples/raw/painting.dart
index 7888966..292d7b1 100644
--- a/examples/raw/painting.dart
+++ b/examples/raw/painting.dart
@@ -17,9 +17,9 @@
   canvas.drawPaint(new ui.Paint()..color = const ui.Color(0xFFFFFFFF));
 
   canvas.save();
-  canvas.translate(-mid.x/2.0, ui.view.height*2.0);
+  canvas.translate(-mid.x/2.0, ui.window.size.height*2.0);
   canvas.clipRect(
-      new ui.Rect.fromLTRB(0.0, -ui.view.height, ui.view.width, radius));
+      new ui.Rect.fromLTRB(0.0, -ui.window.size.height, ui.window.size.width, radius));
 
   canvas.translate(mid.x, mid.y);
   paint.color = const ui.Color.fromARGB(128, 255, 0, 255);
@@ -94,8 +94,8 @@
 }
 
 ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
-  final double devicePixelRatio = ui.view.devicePixelRatio;
-  ui.Rect sceneBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width * devicePixelRatio, ui.view.height * devicePixelRatio);
+  final double devicePixelRatio = ui.window.devicePixelRatio;
+  ui.Rect sceneBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.window.size.width * devicePixelRatio, ui.window.size.height * devicePixelRatio);
   Float64List deviceTransform = new Float64List(16)
     ..[0] = devicePixelRatio
     ..[5] = devicePixelRatio
@@ -108,14 +108,14 @@
   return sceneBuilder.build();
 }
 
-void beginFrame(double timeStamp) {
-  ui.Rect paintBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width, ui.view.height);
+void beginFrame(Duration timeStamp) {
+  ui.Rect paintBounds = ui.Point.origin & ui.window.size;
   ui.Picture picture = paint(paintBounds);
   ui.Scene scene = composite(picture, paintBounds);
-  ui.view.scene = scene;
+  ui.window.render(scene);
 }
 
 void main() {
-  ui.view.setFrameCallback(beginFrame);
-  ui.view.scheduleFrame();
+  ui.window.onBeginFrame = beginFrame;
+  ui.window.scheduleFrame();
 }
diff --git a/examples/raw/shadow.dart b/examples/raw/shadow.dart
index eedeb0a..f53e01e 100644
--- a/examples/raw/shadow.dart
+++ b/examples/raw/shadow.dart
@@ -37,8 +37,8 @@
 }
 
 ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
-  final double devicePixelRatio = ui.view.devicePixelRatio;
-  ui.Rect sceneBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width * devicePixelRatio, ui.view.height * devicePixelRatio);
+  final double devicePixelRatio = ui.window.devicePixelRatio;
+  ui.Rect sceneBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.window.size.width * devicePixelRatio, ui.window.size.height * devicePixelRatio);
   Float64List deviceTransform = new Float64List(16)
     ..[0] = devicePixelRatio
     ..[5] = devicePixelRatio
@@ -51,14 +51,14 @@
   return sceneBuilder.build();
 }
 
-void beginFrame(double timeStamp) {
-  ui.Rect paintBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width, ui.view.height);
+void beginFrame(Duration timeStamp) {
+  ui.Rect paintBounds = ui.Point.origin & ui.window.size;
   ui.Picture picture = paint(paintBounds);
   ui.Scene scene = composite(picture, paintBounds);
-  ui.view.scene = scene;
+  ui.window.render(scene);
 }
 
 void main() {
-  ui.view.setFrameCallback(beginFrame);
-  ui.view.scheduleFrame();
+  ui.window.onBeginFrame = beginFrame;
+  ui.window.scheduleFrame();
 }
diff --git a/examples/raw/spinning_arabic.dart b/examples/raw/spinning_arabic.dart
index 637ffd6..6811664 100644
--- a/examples/raw/spinning_arabic.dart
+++ b/examples/raw/spinning_arabic.dart
@@ -6,14 +6,14 @@
 import 'dart:ui' as ui;
 import 'dart:typed_data';
 
-double timeBase = null;
+Duration timeBase = null;
 ui.Paragraph paragraph;
 
 ui.Picture paint(ui.Rect paintBounds, double delta) {
   ui.PictureRecorder recorder = new ui.PictureRecorder();
   ui.Canvas canvas = new ui.Canvas(recorder, paintBounds);
 
-  canvas.translate(ui.view.width / 2.0, ui.view.height / 2.0);
+  canvas.translate(ui.window.size.width / 2.0, ui.window.size.height / 2.0);
   canvas.rotate(math.PI * delta / 1800);
   canvas.drawRect(new ui.Rect.fromLTRB(-100.0, -100.0, 100.0, 100.0),
                   new ui.Paint()..color = const ui.Color.fromARGB(255, 0, 255, 0));
@@ -29,8 +29,8 @@
 }
 
 ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
-  final double devicePixelRatio = ui.view.devicePixelRatio;
-  ui.Rect sceneBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width * devicePixelRatio, ui.view.height * devicePixelRatio);
+  final double devicePixelRatio = ui.window.devicePixelRatio;
+  ui.Rect sceneBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.window.size.width * devicePixelRatio, ui.window.size.height * devicePixelRatio);
   Float64List deviceTransform = new Float64List(16)
     ..[0] = devicePixelRatio
     ..[5] = devicePixelRatio
@@ -43,15 +43,15 @@
   return sceneBuilder.build();
 }
 
-void beginFrame(double timeStamp) {
+void beginFrame(Duration timeStamp) {
   if (timeBase == null)
     timeBase = timeStamp;
-  double delta = timeStamp - timeBase;
-  ui.Rect paintBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width, ui.view.height);
+  double delta = (timeStamp - timeBase).inMicroseconds / Duration.MICROSECONDS_PER_MILLISECOND;
+  ui.Rect paintBounds = ui.Point.origin & ui.window.size;
   ui.Picture picture = paint(paintBounds, delta);
   ui.Scene scene = composite(picture, paintBounds);
-  ui.view.scene = scene;
-  ui.view.scheduleFrame();
+  ui.window.render(scene);
+  ui.window.scheduleFrame();
 }
 
 void main() {
@@ -63,6 +63,6 @@
   builder.addText(" و أكثر قليلا لجعله أطول. ");
   paragraph = builder.build(new ui.ParagraphStyle());
 
-  ui.view.setFrameCallback(beginFrame);
-  ui.view.scheduleFrame();
+  ui.window.onBeginFrame = beginFrame;
+  ui.window.scheduleFrame();
 }
diff --git a/examples/raw/spinning_image.dart b/examples/raw/spinning_image.dart
index cd2973b..0afb14f 100644
--- a/examples/raw/spinning_image.dart
+++ b/examples/raw/spinning_image.dart
@@ -8,7 +8,7 @@
 
 import 'package:flutter/services.dart';
 
-double timeBase = null;
+Duration timeBase = null;
 
 ui.Image image = null;
 String url1 = "https://raw.githubusercontent.com/dart-lang/logos/master/logos_and_wordmarks/dart-logo.png";
@@ -42,8 +42,8 @@
 }
 
 ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
-  final double devicePixelRatio = ui.view.devicePixelRatio;
-  ui.Rect sceneBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width * devicePixelRatio, ui.view.height * devicePixelRatio);
+  final double devicePixelRatio = ui.window.devicePixelRatio;
+  ui.Rect sceneBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.window.size.width * devicePixelRatio, ui.window.size.height * devicePixelRatio);
   Float64List deviceTransform = new Float64List(16)
     ..[0] = devicePixelRatio
     ..[5] = devicePixelRatio
@@ -56,15 +56,15 @@
   return sceneBuilder.build();
 }
 
-void beginFrame(double timeStamp) {
+void beginFrame(Duration timeStamp) {
   if (timeBase == null)
     timeBase = timeStamp;
-  double delta = timeStamp - timeBase;
-  ui.Rect paintBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width, ui.view.height);
+  double delta = (timeStamp - timeBase).inMicroseconds / Duration.MICROSECONDS_PER_MILLISECOND;
+  ui.Rect paintBounds = ui.Point.origin & ui.window.size;
   ui.Picture picture = paint(paintBounds, delta);
   ui.Scene scene = composite(picture, paintBounds);
-  ui.view.scene = scene;
-  ui.view.scheduleFrame();
+  ui.window.render(scene);
+  ui.window.scheduleFrame();
 }
 
 
@@ -72,7 +72,7 @@
   if (result != image) {
     print("${result.width}x${result.width} image loaded!");
     image = result;
-    ui.view.scheduleFrame();
+    ui.window.scheduleFrame();
   } else {
     print("Existing image was loaded again");
   }
@@ -93,6 +93,6 @@
 
 void main() {
   imageCache.load(url1).first.then(handleImageLoad);
-  ui.view.setEventCallback(handleEvent);
-  ui.view.setFrameCallback(beginFrame);
+  ui.window.onEvent = handleEvent;
+  ui.window.onBeginFrame = beginFrame;
 }
diff --git a/examples/raw/spinning_square.dart b/examples/raw/spinning_square.dart
index 8a98bbd..82bb32c 100644
--- a/examples/raw/spinning_square.dart
+++ b/examples/raw/spinning_square.dart
@@ -6,16 +6,16 @@
 import 'dart:ui' as ui;
 import 'dart:typed_data';
 
-double timeBase = null;
+Duration timeBase = null;
 
-void beginFrame(double timeStamp) {
+void beginFrame(Duration timeStamp) {
   ui.tracing.begin('beginFrame');
   if (timeBase == null)
     timeBase = timeStamp;
-  double delta = timeStamp - timeBase;
+  double delta = (timeStamp - timeBase).inMicroseconds / Duration.MICROSECONDS_PER_MILLISECOND;
 
   // paint
-  ui.Rect paintBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width, ui.view.height);
+  ui.Rect paintBounds = ui.Point.origin & ui.window.size;
   ui.PictureRecorder recorder = new ui.PictureRecorder();
   ui.Canvas canvas = new ui.Canvas(recorder, paintBounds);
   canvas.translate(paintBounds.width / 2.0, paintBounds.height / 2.0);
@@ -25,8 +25,8 @@
   ui.Picture picture = recorder.endRecording();
 
   // composite
-  final double devicePixelRatio = ui.view.devicePixelRatio;
-  ui.Rect sceneBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width * devicePixelRatio, ui.view.height * devicePixelRatio);
+  final double devicePixelRatio = ui.window.devicePixelRatio;
+  ui.Rect sceneBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.window.size.width * devicePixelRatio, ui.window.size.height * devicePixelRatio);
   Float64List deviceTransform = new Float64List(16)
     ..[0] = devicePixelRatio
     ..[5] = devicePixelRatio
@@ -36,13 +36,13 @@
     ..pushTransform(deviceTransform)
     ..addPicture(ui.Offset.zero, picture, paintBounds)
     ..pop();
-  ui.view.scene = sceneBuilder.build();
+  ui.window.render(sceneBuilder.build());
 
   ui.tracing.end('beginFrame');
-  ui.view.scheduleFrame();
+  ui.window.scheduleFrame();
 }
 
 void main() {
-  ui.view.setFrameCallback(beginFrame);
-  ui.view.scheduleFrame();
+  ui.window.onBeginFrame = beginFrame;
+  ui.window.scheduleFrame();
 }
diff --git a/examples/rendering/interactive_flex.dart b/examples/rendering/interactive_flex.dart
index b0f45a1..c42b285 100644
--- a/examples/rendering/interactive_flex.dart
+++ b/examples/rendering/interactive_flex.dart
@@ -101,5 +101,5 @@
 
   updateTaskDescription('Interactive Flex', topColor);
   new FlutterBinding(root: root);
-  ui.view.setEventCallback(handleEvent);
+  ui.window.onEvent = handleEvent;
 }
diff --git a/examples/stocks/lib/stock_menu.dart b/examples/stocks/lib/stock_menu.dart
index f58ab32..5363aa3 100644
--- a/examples/stocks/lib/stock_menu.dart
+++ b/examples/stocks/lib/stock_menu.dart
@@ -12,8 +12,8 @@
   switch (await showMenu(
     context: context,
     position: new MenuPosition(
-      right: ui.view.paddingRight + _kMenuMargin,
-      top: ui.view.paddingTop + _kMenuMargin
+      right: ui.window.padding.right + _kMenuMargin,
+      top: ui.window.padding.top + _kMenuMargin
     ),
     items: <PopupMenuItem>[
       new PopupMenuItem(
diff --git a/sky/packages/sky/lib/material.dart b/sky/packages/sky/lib/material.dart
index a2560cc..8f4df1b 100644
--- a/sky/packages/sky/lib/material.dart
+++ b/sky/packages/sky/lib/material.dart
@@ -20,7 +20,6 @@
 export 'src/material/drawer_header.dart';
 export 'src/material/drawer_item.dart';
 export 'src/material/dropdown.dart';
-export 'src/material/edges.dart';
 export 'src/material/flat_button.dart';
 export 'src/material/floating_action_button.dart';
 export 'src/material/icon.dart';
diff --git a/sky/packages/sky/lib/src/animation/scheduler.dart b/sky/packages/sky/lib/src/animation/scheduler.dart
index c0b4178..2d374f8 100644
--- a/sky/packages/sky/lib/src/animation/scheduler.dart
+++ b/sky/packages/sky/lib/src/animation/scheduler.dart
@@ -27,7 +27,7 @@
 class Scheduler {
   /// Requires clients to use the [scheduler] singleton
   Scheduler._() {
-    ui.view.setFrameCallback(beginFrame);
+    ui.window.onBeginFrame = beginFrame;
   }
 
   bool _haveScheduledVisualUpdate = false;
@@ -49,13 +49,11 @@
   /// [requestAnimationFrame], then calls all the callbacks registered by
   /// [addPersistentFrameCallback], which typically drive the rendering pipeline,
   /// and finally calls the callbacks registered by [requestPostFrameCallback].
-  void beginFrame(double rawTimeStamp) {
+  void beginFrame(Duration rawTimeStamp) {
     assert(!_inFrame);
     _inFrame = true;
-    rawTimeStamp /= timeDilation;
-    final Duration timeStamp = new Duration(
-      microseconds: (rawTimeStamp * Duration.MICROSECONDS_PER_MILLISECOND).round()
-    );
+    Duration timeStamp = new Duration(
+        microseconds: (rawTimeStamp.inMicroseconds / timeDilation).round());
     _haveScheduledVisualUpdate = false;
     assert(_postFrameCallbacks.length == 0);
 
@@ -148,7 +146,7 @@
   void ensureVisualUpdate() {
     if (_haveScheduledVisualUpdate)
       return;
-    ui.view.scheduleFrame();
+    ui.window.scheduleFrame();
     _haveScheduledVisualUpdate = true;
   }
 }
diff --git a/sky/packages/sky/lib/src/animation/scroll_behavior.dart b/sky/packages/sky/lib/src/animation/scroll_behavior.dart
index 23656e6..636cb59 100644
--- a/sky/packages/sky/lib/src/animation/scroll_behavior.dart
+++ b/sky/packages/sky/lib/src/animation/scroll_behavior.dart
@@ -109,11 +109,11 @@
   // scrolling less than one logical pixel per frame. We're essentially
   // normalizing by the devicePixelRatio so that the threshold has the
   // same effect independent of the device's pixel density.
-  double endVelocity = 15.0 * ui.view.devicePixelRatio;
+  double endVelocity = 15.0 * ui.window.devicePixelRatio;
 
   // Similar to endVelocity. Stop scrolling when we're this close to
   // destiniation scroll offset.
-  double endDistance = 0.5 * ui.view.devicePixelRatio;
+  double endDistance = 0.5 * ui.window.devicePixelRatio;
 
   SpringDescription spring = new SpringDescription.withDampingRatio(mass: 1.0, springConstant: 170.0, ratio: 1.1);
   ScrollSimulation simulation =
@@ -124,7 +124,7 @@
 
 Simulation _createSnapScrollSimulation(double startOffset, double endOffset, double velocity) {
   double startVelocity = velocity * _kSecondsPerMillisecond;
-  double endVelocity = 15.0 * ui.view.devicePixelRatio * velocity.sign;
+  double endVelocity = 15.0 * ui.window.devicePixelRatio * velocity.sign;
   return new FrictionSimulation.through(startOffset, endOffset, startVelocity, endVelocity);
 }
 
diff --git a/sky/packages/sky/lib/src/material/edges.dart b/sky/packages/sky/lib/src/material/edges.dart
deleted file mode 100644
index c753c42..0000000
--- a/sky/packages/sky/lib/src/material/edges.dart
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-enum MaterialEdge { canvas, card, circle }
-
-// This map gives the border radii for each type of material.
-const Map<MaterialEdge, double> edges = const <MaterialEdge, double>{
-  MaterialEdge.canvas: null,
-  MaterialEdge.card: 2.0,
-  MaterialEdge.circle: null,
-};
diff --git a/sky/packages/sky/lib/src/material/scaffold.dart b/sky/packages/sky/lib/src/material/scaffold.dart
index 6eb8b39..5d735bf 100644
--- a/sky/packages/sky/lib/src/material/scaffold.dart
+++ b/sky/packages/sky/lib/src/material/scaffold.dart
@@ -28,7 +28,7 @@
   Widget build(BuildContext context) {
     double toolBarHeight = 0.0;
     if (toolBar != null)
-      toolBarHeight = kToolBarHeight + ui.view.paddingTop;
+      toolBarHeight = kToolBarHeight + ui.window.padding.top;
 
     double statusBarHeight = 0.0;
     if (statusBar != null)
diff --git a/sky/packages/sky/lib/src/rendering/binding.dart b/sky/packages/sky/lib/src/rendering/binding.dart
index cf9da77..3d4f72a7 100644
--- a/sky/packages/sky/lib/src/rendering/binding.dart
+++ b/sky/packages/sky/lib/src/rendering/binding.dart
@@ -132,9 +132,9 @@
     assert(_instance == null);
     _instance = this;
 
-    ui.view.setEventCallback(_handleEvent);
+    ui.window.onEvent = _handleEvent;
+    ui.window.onMetricsChanged = _handleMetricsChanged;
 
-    ui.view.setMetricsChangedCallback(_handleMetricsChanged);
     if (renderViewOverride == null) {
       _renderView = new RenderView(child: root);
       _renderView.attach();
@@ -166,7 +166,7 @@
   bool removeMetricListener(MetricListener listener) => _metricListeners.remove(listener);
 
   void _handleMetricsChanged() {
-    Size size = new Size(ui.view.width, ui.view.height);
+    Size size = ui.window.size;
     _renderView.rootConstraints = new ViewConstraints(size: size);
     for (MetricListener listener in _metricListeners)
       listener(size);
diff --git a/sky/packages/sky/lib/src/rendering/view.dart b/sky/packages/sky/lib/src/rendering/view.dart
index a9b739b..009be1a 100644
--- a/sky/packages/sky/lib/src/rendering/view.dart
+++ b/sky/packages/sky/lib/src/rendering/view.dart
@@ -62,7 +62,7 @@
   }
 
   Matrix4 get _logicalToDeviceTransform {
-    double devicePixelRatio = ui.view.devicePixelRatio;
+    double devicePixelRatio = ui.window.devicePixelRatio;
     return new Matrix4.diagonal3Values(devicePixelRatio, devicePixelRatio, 1.0);
   }
 
@@ -119,10 +119,10 @@
     ui.tracing.begin('RenderView.compositeFrame');
     try {
       (layer as TransformLayer).transform = _logicalToDeviceTransform;
-      Rect bounds = Point.origin & (size * ui.view.devicePixelRatio);
+      Rect bounds = Point.origin & (size * ui.window.devicePixelRatio);
       ui.SceneBuilder builder = new ui.SceneBuilder(bounds);
       layer.addToScene(builder, Offset.zero);
-      ui.view.scene = builder.build();
+      ui.window.render(builder.build());
     } finally {
       ui.tracing.end('RenderView.compositeFrame');
     }
@@ -130,6 +130,6 @@
 
   Rect get paintBounds => Point.origin & size;
 
-  String debugDescribeSettings(String prefix) => '${prefix}view width: ${ui.view.width} (in device pixels)\n${prefix}view height: ${ui.view.height} (in device pixels)\n${prefix}device pixel ratio: ${ui.view.devicePixelRatio} (device pixels per logical pixel)\n${prefix}root constraints: $rootConstraints (in logical pixels)\n';
+  String debugDescribeSettings(String prefix) => '${prefix}window size: ${ui.window.size} (in device pixels)\n${prefix}device pixel ratio: ${ui.window.devicePixelRatio} (device pixels per logical pixel)\n${prefix}root constraints: $rootConstraints (in logical pixels)\n';
   // call to ${super.debugDescribeSettings(prefix)} is omitted because the root superclasses don't include any interesting information for this class
 }
diff --git a/sky/packages/sky/lib/src/rendering/viewport.dart b/sky/packages/sky/lib/src/rendering/viewport.dart
index a447779..942dbcb 100644
--- a/sky/packages/sky/lib/src/rendering/viewport.dart
+++ b/sky/packages/sky/lib/src/rendering/viewport.dart
@@ -136,7 +136,7 @@
   }
 
   Offset get _scrollOffsetRoundedToIntegerDevicePixels {
-    double devicePixelRatio = ui.view.devicePixelRatio;
+    double devicePixelRatio = ui.window.devicePixelRatio;
     int dxInDevicePixels = (scrollOffset.dx * devicePixelRatio).round();
     int dyInDevicePixels = (scrollOffset.dy * devicePixelRatio).round();
     return new Offset(dxInDevicePixels / devicePixelRatio,
diff --git a/sky/unit/test/animation/scheduler_test.dart b/sky/unit/test/animation/scheduler_test.dart
index 89abadb..dbfe1b5 100644
--- a/sky/unit/test/animation/scheduler_test.dart
+++ b/sky/unit/test/animation/scheduler_test.dart
@@ -26,7 +26,7 @@
     scheduler.requestAnimationFrame(firstCallback);
     secondId = scheduler.requestAnimationFrame(secondCallback);
 
-    scheduler.beginFrame(16.0);
+    scheduler.beginFrame(const Duration(milliseconds: 16));
 
     expect(firstCallbackRan, isTrue);
     expect(secondCallbackRan, isFalse);
@@ -34,7 +34,7 @@
     firstCallbackRan = false;
     secondCallbackRan = false;
 
-    scheduler.beginFrame(32.0);
+    scheduler.beginFrame(const Duration(milliseconds: 32));
 
     expect(firstCallbackRan, isFalse);
     expect(secondCallbackRan, isFalse);
diff --git a/sky/unit/test/widget/widget_tester.dart b/sky/unit/test/widget/widget_tester.dart
index e215572..ac0a965 100644
--- a/sky/unit/test/widget/widget_tester.dart
+++ b/sky/unit/test/widget/widget_tester.dart
@@ -42,7 +42,7 @@
   void pump([ Duration duration ]) {
     if (duration != null)
       async.elapse(duration);
-    scheduler.beginFrame(clock.now().millisecondsSinceEpoch.toDouble());
+    scheduler.beginFrame(new Duration(milliseconds: clock.now().millisecondsSinceEpoch));
     async.flushMicrotasks();
   }