Index: tracing/tracing/extras/chrome/layout_tree.html |
diff --git a/tracing/tracing/extras/chrome/layout_tree.html b/tracing/tracing/extras/chrome/layout_tree.html |
index 98e8f14e09925e20e9ba4ab7943bf4b677bc7b92..bf57f69fcaa3ef9b69d337b138eb903bd09f10a0 100644 |
--- a/tracing/tracing/extras/chrome/layout_tree.html |
+++ b/tracing/tracing/extras/chrome/layout_tree.html |
@@ -5,6 +5,7 @@ Use of this source code is governed by a BSD-style license that can be |
found in the LICENSE file. |
--> |
+<link rel="import" href="/tracing/extras/chrome/layout_object.html"> |
<link rel="import" href="/tracing/model/event_registry.html"> |
<link rel="import" href="/tracing/model/object_instance.html"> |
@@ -27,11 +28,48 @@ tr.exportTo('tr.e.chrome', function() { |
function LayoutTreeSnapshot() { |
ObjectSnapshot.apply(this, arguments); |
- this.rootLayoutObject = new tr.e.chrome.LayoutObject(this, this.args); |
+ |
+ // If this LayoutTree is a subframe like an iframe, then this is the |
+ // LayoutObject that contains it: |
+ this.parentLayoutObject_ = undefined; |
+ |
+ // The LocalFrame should be 1:1 with a RenderFrame object, which should be |
+ // 1:1 with a FrameTreeNode object. |
} |
LayoutTreeSnapshot.prototype = { |
__proto__: ObjectSnapshot.prototype, |
+ |
+ initialize: function() { |
+ this.rootLayoutObject = new tr.e.chrome.LayoutObject(this, this.args); |
+ }, |
+ |
+ get parentLayoutObject() { |
+ return this.parentLayoutObject_; |
+ }, |
+ |
+ get parentLayoutTreeSnapshot() { |
+ if (this.parentLayoutObject) |
+ return this.parentLayoutObject.snapshot; |
+ return undefined; |
+ }, |
+ |
+ get rootLayoutTreeSnapshot() { |
+ var o = this; |
+ while (o.parentLayoutObject && o.parentLayoutObject.snapshot) { |
+ o = o.parentLayoutObject.snapshot; |
+ } |
+ return o; |
+ }, |
+ |
+ set parentLayoutObject(o) { |
+ if (this.parentLayoutObject_) { |
+ console.warn('Duplicate parentLayoutObject: ' + |
+ 'TODO split LayoutTreeSnapshot ', |
+ this.parentLayoutObject, o); |
+ } |
+ this.parentLayoutObject_ = o; |
+ } |
}; |
ObjectSnapshot.register(LayoutTreeSnapshot, {typeName: 'LayoutTree'}); |