Index: tracing/tracing/extras/chrome/layout_object.html |
diff --git a/tracing/tracing/extras/chrome/layout_object.html b/tracing/tracing/extras/chrome/layout_object.html |
index 1403ff1eec38d57e19c929ff60c59bfa360e9404..873837392748853569d0c081e928d0fecdaf3bcc 100644 |
--- a/tracing/tracing/extras/chrome/layout_object.html |
+++ b/tracing/tracing/extras/chrome/layout_object.html |
@@ -34,8 +34,10 @@ tr.exportTo('tr.e.chrome', function() { |
row: 1, |
rowSpan: 1, |
selfNeeds: 1, |
+ src: 1, |
stickyPositioned: 1, |
tag: 1, |
+ tree: 1, |
width: 1 |
}; |
@@ -70,6 +72,29 @@ tr.exportTo('tr.e.chrome', function() { |
this.tableCol_ = args.col; |
this.tableRowSpan_ = args.rowSpan; |
this.tableColSpan_ = args.colSpan; |
+ this.sourceURL_ = args.src; |
+ this.subtree_ = args.tree; |
+ |
+ if (this.subtree_ && this.subtree_.id_ref) { |
+ var objects = this.snapshot.objectInstance.parent.objects; |
+ var sid = {scope: 'LayoutTree', id: this.subtree_.id_ref}; |
+ var ts = this.snapshot.ts; |
+ |
+ console.debug('manually patching', this.subtree_, sid, ts, |
+ this.snapshot, objects, objects.getObjectInstanceAt(sid, ts)); |
+ |
+ this.subtree_ = objects.getSnapshotAt(sid, ts); |
+ |
+ if (!this.subtree_) { |
+ console.warn('Unable to patch subtree', sid.id, ts); |
+ } else { |
+ console.debug('manually patched', this.subtree_); |
+ } |
+ } |
+ |
+ if (this.subtree instanceof tr.e.chrome.LayoutTreeSnapshot) { |
+ this.subtree.parentLayoutObject = this; |
+ } |
if (args.children) { |
args.children.forEach(function(child) { |
@@ -88,6 +113,24 @@ tr.exportTo('tr.e.chrome', function() { |
return this.snapshot_; |
}, |
+ get root() { |
+ return this.snapshot_.rootLayoutObject; |
+ }, |
+ |
+ // If this LayoutObject is an iframe, return that frame's |
+ // LayoutTreeSnapshot. |
+ get subtree() { |
+ return this.subtree_; |
+ }, |
+ |
+ get width() { |
+ return this.absoluteRect.width; |
+ }, |
+ |
+ get height() { |
+ return this.absoluteRect.height; |
+ }, |
+ |
get id() { |
return this.id_; |
}, |
@@ -96,6 +139,10 @@ tr.exportTo('tr.e.chrome', function() { |
return this.name_; |
}, |
+ get sourceURL() { |
+ return this.sourceURL_; |
+ }, |
+ |
get tag() { |
return this.tag_; |
}, |
@@ -104,6 +151,20 @@ tr.exportTo('tr.e.chrome', function() { |
return this.relativeRect_; |
}, |
+ get viewportRelativeRect() { |
+ var x = 0; |
+ var y = 0; |
+ var frameLayoutObject = this; |
+ while (frameLayoutObject) { |
+ x += frameLayoutObject.absoluteRect.x; |
+ y += frameLayoutObject.absoluteRect.y; |
+ |
+ frameLayoutObject = frameLayoutObject.snapshot.parentLayoutObject; |
+ } |
+ |
+ return tr.b.Rect.fromXYWH(x, y, this.width, this.height); |
+ }, |
+ |
get absoluteRect() { |
return this.absoluteRect_; |
}, |
@@ -160,14 +221,23 @@ tr.exportTo('tr.e.chrome', function() { |
return this.childLayoutObjects_.length > 0; |
}, |
+ get frameLayoutTree() { |
+ // If this LayoutObject is an iframe, return that iframe's LayoutTree. |
+ }, |
+ |
get childLayoutObjects() { |
return this.childLayoutObjects_; |
}, |
traverseTree: function(cb, opt_this) { |
cb.call(opt_this, this); |
+ |
+ if (this.subtree) |
+ this.subtree.rootLayoutObject.traverseTree(cb, opt_this); |
+ |
if (!this.hasChildLayoutObjects) |
return; |
+ |
this.childLayoutObjects.forEach(function(child) { |
child.traverseTree(cb, opt_this); |
}); |