UI: Initial clean up and improvements

See preview @ https://primiano-dot-perfetto-ui.appspot.com

Major changes:
 - Make both the OverviewTimeline and the TimeAxis a pure
   canvas-based panel. This removes the need of a full mithril
   redraw when panning horizontally.
 - Ensure that no mithirl redraws happen when panning horizontally,
   and only canvases are redrawn.
 - Make the effects of selections on the overview timeline be
   visible in real-time on the tracks.
 - Make the zoom logic simpler. Following the mouse pointer
   when zooming is too confusing, especially when using the ADWS
   navigation, where the position of the pointer is irrelevant.

Minor changes:
- Switch all time units to seconds and introduce TimeSpan
  for ranges.
- Compute properly trace duration for both chrome and android
  traces.
- Add a notion of total trace time to the state,
  computed by the controller when loading the trace.
- Move the query for the overview timeline to the controller,
  make it work for both chrome and android traces.
- Centralize all animation frames in the raf scheduler and make
  the Animation class be a client of that.
- Simplify PanAndZoomHandler and introduce acceleration factor for
  long presses.

TBR=hjd

Change-Id: I81bdde5734409c4017a53cc24de33c82db0551f0
diff --git a/ui/src/common/state.ts b/ui/src/common/state.ts
index 129ff4b..935b7be 100644
--- a/ui/src/common/state.ts
+++ b/ui/src/common/state.ts
@@ -47,6 +47,11 @@
 
 export interface PermalinkConfig { state: State; }
 
+export interface TraceTime {
+  startSec: number;
+  endSec: number;
+}
+
 export interface State {
   route: string|null;
   nextId: number;
@@ -55,6 +60,7 @@
    * Open traces.
    */
   engines: ObjectById<EngineConfig>;
+  traceTime: TraceTime;
   tracks: ObjectById<TrackState>;
   displayedTrackIds: string[];
   queries: ObjectById<QueryConfig>;
@@ -65,9 +71,10 @@
   return {
     route: null,
     nextId: 0,
+    engines: {},
+    traceTime: {startSec: 0, endSec: 10},
     tracks: {},
     displayedTrackIds: [],
-    engines: {},
     queries: {},
     permalink: null,
   };