3 Copyright (c) 2013 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file.
8 <link rel="stylesheet" href="/cc/layer_tree_host_impl_view.css">
10 <link rel="import" href="/cc/layer_tree_host_impl.html">
11 <link rel="import" href="/cc/layer_picker.html">
12 <link rel="import" href="/cc/layer_view.html">
13 <link rel="import" href="/cc/tile.html">
14 <link rel="import" href="/tracing/analysis/object_snapshot_view.html">
15 <link rel="import" href="/tvcm/ui/drag_handle.html">
20 tvcm.exportTo('cc', function() {
22 * Displays a LayerTreeHostImpl snapshot in a human readable form.
25 var LayerTreeHostImplSnapshotView = tvcm.ui.define(
26 'layer-tree-host-impl-snapshot-view',
27 tracing.analysis.ObjectSnapshotView);
29 LayerTreeHostImplSnapshotView.prototype = {
30 __proto__: tracing.analysis.ObjectSnapshotView.prototype,
32 decorate: function() {
33 this.classList.add('lthi-s-view');
35 this.selection_ = undefined;
37 this.layerPicker_ = new cc.LayerPicker();
38 this.layerPicker_.addEventListener(
40 this.onLayerPickerSelectionChanged_.bind(this));
42 this.layerView_ = new cc.LayerView();
43 this.layerView_.addEventListener(
45 this.onLayerViewSelectionChanged_.bind(this));
46 this.dragHandle_ = new tvcm.ui.DragHandle();
47 this.dragHandle_.horizontal = false;
48 this.dragHandle_.target = this.layerView_;
50 this.appendChild(this.layerPicker_);
51 this.appendChild(this.dragHandle_);
52 this.appendChild(this.layerView_);
54 // Make sure we have the current values from layerView_ and layerPicker_,
55 // since those might have been created before we added the listener.
56 this.onLayerViewSelectionChanged_();
57 this.onLayerPickerSelectionChanged_();
61 get objectSnapshot() {
62 return this.objectSnapshot_;
65 set objectSnapshot(objectSnapshot) {
66 this.objectSnapshot_ = objectSnapshot;
68 var lthi = this.objectSnapshot;
71 layerTreeImpl = lthi.getTree(this.layerPicker_.whichTree);
73 this.layerPicker_.lthiSnapshot = lthi;
74 this.layerView_.layerTreeImpl = layerTreeImpl;
75 this.layerView_.regenerateContent();
79 this.selection = this.selection_.findEquivalent(lthi);
83 return this.selection_;
86 set selection(selection) {
87 this.selection_ = selection;
88 this.layerPicker_.selection = selection;
89 this.layerView_.selection = selection;
92 onLayerPickerSelectionChanged_: function() {
93 this.selection_ = this.layerPicker_.selection;
94 this.layerView_.selection = this.selection;
95 this.layerView_.layerTreeImpl = this.layerPicker_.layerTreeImpl;
96 this.layerView_.isRenderPassQuads = this.layerPicker_.isRenderPassQuads;
97 this.layerView_.regenerateContent();
100 onLayerViewSelectionChanged_: function() {
101 this.selection_ = this.layerView_.selection;
102 this.layerPicker_.selection = this.selection;
107 tracing.analysis.ObjectSnapshotView.register(
108 'cc::LayerTreeHostImpl', LayerTreeHostImplSnapshotView);
111 LayerTreeHostImplSnapshotView: LayerTreeHostImplSnapshotView