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="/base/ui/drag_handle.html">
20 tv.exportTo('cc', function() {
22 * Displays a LayerTreeHostImpl snapshot in a human readable form.
25 var LayerTreeHostImplSnapshotView = tv.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 tv.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 if (this.selection_ == selection)
89 this.selection_ = selection;
90 this.layerPicker_.selection = selection;
91 this.layerView_.selection = selection;
92 tv.dispatchSimpleEvent(this, 'cc-selection-change');
95 onLayerPickerSelectionChanged_: function() {
96 this.selection_ = this.layerPicker_.selection;
97 this.layerView_.selection = this.selection;
98 this.layerView_.layerTreeImpl = this.layerPicker_.layerTreeImpl;
99 this.layerView_.isRenderPassQuads = this.layerPicker_.isRenderPassQuads;
100 this.layerView_.regenerateContent();
101 tv.dispatchSimpleEvent(this, 'cc-selection-change');
104 onLayerViewSelectionChanged_: function() {
105 this.selection_ = this.layerView_.selection;
106 this.layerPicker_.selection = this.selection;
107 tv.dispatchSimpleEvent(this, 'cc-selection-change');
110 get extraHighlightsByLayerId() {
111 return this.layerView_.extraHighlightsByLayerId;
114 set extraHighlightsByLayerId(extraHighlightsByLayerId) {
115 this.layerView_.extraHighlightsByLayerId = extraHighlightsByLayerId;
119 tracing.analysis.ObjectSnapshotView.register(
120 'cc::LayerTreeHostImpl', LayerTreeHostImplSnapshotView);
123 LayerTreeHostImplSnapshotView: LayerTreeHostImplSnapshotView