OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/layout/TracedLayoutObject.h" | 5 #include "core/layout/TracedLayoutObject.h" |
6 | 6 |
7 #include "core/frame/FrameView.h" | |
7 #include "core/layout/LayoutInline.h" | 8 #include "core/layout/LayoutInline.h" |
9 #include "core/layout/LayoutPart.h" | |
8 #include "core/layout/LayoutTableCell.h" | 10 #include "core/layout/LayoutTableCell.h" |
9 #include "core/layout/LayoutText.h" | 11 #include "core/layout/LayoutText.h" |
10 #include "core/layout/LayoutView.h" | 12 #include "core/layout/LayoutView.h" |
13 #include "public/web/WebLocalFrame.h" | |
14 #include "web/WebLocalFrameImpl.h" | |
11 #include <inttypes.h> | 15 #include <inttypes.h> |
12 | 16 |
13 namespace blink { | 17 namespace blink { |
14 | 18 |
15 namespace { | 19 namespace { |
16 | 20 |
17 void dumpToTracedValue(const LayoutObject& object, bool traceGeometry, TracedVal ue* tracedValue) | 21 void dumpToTracedValue(const LayoutObject& object, bool traceGeometry, TracedVal ue* tracedValue) |
18 { | 22 { |
23 if (object.isLayoutPart()) { | |
24 FrameView* frameView = toFrameView(toLayoutPart(object).widget()); | |
25 if (frameView) { | |
26 WebLocalFrame* frame = WebLocalFrameImpl::fromFrame(frameView->frame ()); | |
27 tracedValue->beginDictionary("tree"); | |
28 tracedValue->setString("scope", "LayoutTree"); | |
29 tracedValue->setString("id_ref", String::format("%p", frame)); | |
30 tracedValue->endDictionary(); | |
31 } | |
32 } | |
33 | |
19 tracedValue->setString("address", String::format("%" PRIxPTR, reinterpret_ca st<uintptr_t>(&object))); | 34 tracedValue->setString("address", String::format("%" PRIxPTR, reinterpret_ca st<uintptr_t>(&object))); |
20 tracedValue->setString("name", object.name()); | 35 tracedValue->setString("name", object.name()); |
21 if (Node* node = object.node()) { | 36 if (Node* node = object.node()) { |
22 tracedValue->setString("tag", node->nodeName()); | 37 tracedValue->setString("tag", node->nodeName()); |
23 if (node->isElementNode()) { | 38 if (node->isElementNode()) { |
24 Element& element = toElement(*node); | 39 Element& element = toElement(*node); |
benjhayden
2016/06/03 18:12:28
tracedValue->setString("originURL", element.origin
| |
25 if (element.hasID()) | 40 if (element.hasID()) |
26 tracedValue->setString("htmlId", element.getIdAttribute()); | 41 tracedValue->setString("htmlId", element.getIdAttribute()); |
27 if (element.hasClass()) { | 42 if (element.hasClass()) { |
28 tracedValue->beginArray("classNames"); | 43 tracedValue->beginArray("classNames"); |
29 for (size_t i = 0; i < element.classNames().size(); ++i) | 44 for (size_t i = 0; i < element.classNames().size(); ++i) |
30 tracedValue->pushString(element.classNames()[i]); | 45 tracedValue->pushString(element.classNames()[i]); |
31 tracedValue->endArray(); | 46 tracedValue->endArray(); |
32 } | 47 } |
48 if (object.isLayoutIFrame() | |
49 || object.isLayoutImage() | |
50 || object.isVideo()) | |
51 tracedValue->setString("src", element.getAttribute("src")); | |
33 } | 52 } |
34 } | 53 } |
35 | 54 |
36 // FIXME: When the fixmes in LayoutTreeAsText::writeLayoutObject() are | 55 // FIXME: When the fixmes in LayoutTreeAsText::writeLayoutObject() are |
37 // fixed, deduplicate it with this. | 56 // fixed, deduplicate it with this. |
38 if (traceGeometry) { | 57 if (traceGeometry) { |
39 tracedValue->setDouble("absX", object.absoluteBoundingBoxRect().x()); | 58 tracedValue->setDouble("absX", object.absoluteBoundingBoxRect().x()); |
40 tracedValue->setDouble("absY", object.absoluteBoundingBoxRect().y()); | 59 tracedValue->setDouble("absY", object.absoluteBoundingBoxRect().y()); |
41 LayoutRect rect; | 60 LayoutRect rect; |
42 if (object.isText()) | 61 if (object.isText()) |
(...skipping 20 matching lines...) Expand all Loading... | |
63 if (object.selfNeedsLayout()) | 82 if (object.selfNeedsLayout()) |
64 tracedValue->setBoolean("selfNeeds", object.selfNeedsLayout()); | 83 tracedValue->setBoolean("selfNeeds", object.selfNeedsLayout()); |
65 if (object.needsPositionedMovementLayout()) | 84 if (object.needsPositionedMovementLayout()) |
66 tracedValue->setBoolean("positionedMovement", object.needsPositionedMove mentLayout()); | 85 tracedValue->setBoolean("positionedMovement", object.needsPositionedMove mentLayout()); |
67 if (object.normalChildNeedsLayout()) | 86 if (object.normalChildNeedsLayout()) |
68 tracedValue->setBoolean("childNeeds", object.normalChildNeedsLayout()); | 87 tracedValue->setBoolean("childNeeds", object.normalChildNeedsLayout()); |
69 if (object.posChildNeedsLayout()) | 88 if (object.posChildNeedsLayout()) |
70 tracedValue->setBoolean("posChildNeeds", object.posChildNeedsLayout()); | 89 tracedValue->setBoolean("posChildNeeds", object.posChildNeedsLayout()); |
71 if (object.isTableCell()) { | 90 if (object.isTableCell()) { |
72 const LayoutTableCell& c = toLayoutTableCell(object); | 91 const LayoutTableCell& c = toLayoutTableCell(object); |
73 tracedValue->setDouble("row", c.rowIndex()); | 92 if (c.row()->rowIndexWasSet() && |
74 tracedValue->setDouble("col", c.absoluteColumnIndex()); | 93 (!c.row()->section() || !c.row()->section()->needsCellRecalc())) |
94 tracedValue->setDouble("row", c.rowIndex()); | |
95 if (c.hasSetAbsoluteColumnIndex()) | |
96 tracedValue->setDouble("col", c.absoluteColumnIndex()); | |
75 if (c.rowSpan() != 1) | 97 if (c.rowSpan() != 1) |
76 tracedValue->setDouble("rowSpan", c.rowSpan()); | 98 tracedValue->setDouble("rowSpan", c.rowSpan()); |
77 if (c.colSpan() != 1) | 99 if (c.colSpan() != 1) |
78 tracedValue->setDouble("colSpan", c.colSpan()); | 100 tracedValue->setDouble("colSpan", c.colSpan()); |
79 } | 101 } |
80 if (object.isAnonymous()) | 102 if (object.isAnonymous()) |
81 tracedValue->setBoolean("anonymous", object.isAnonymous()); | 103 tracedValue->setBoolean("anonymous", object.isAnonymous()); |
82 if (object.isRelPositioned()) | 104 if (object.isRelPositioned()) |
83 tracedValue->setBoolean("relativePositioned", object.isRelPositioned()); | 105 tracedValue->setBoolean("relativePositioned", object.isRelPositioned()); |
84 if (object.isStickyPositioned()) | 106 if (object.isStickyPositioned()) |
(...skipping 11 matching lines...) Expand all Loading... | |
96 tracedValue->endArray(); | 118 tracedValue->endArray(); |
97 } | 119 } |
98 } | 120 } |
99 | 121 |
100 } // namespace | 122 } // namespace |
101 | 123 |
102 PassOwnPtr<TracedValue> TracedLayoutObject::create(const LayoutView& view, bool traceGeometry) | 124 PassOwnPtr<TracedValue> TracedLayoutObject::create(const LayoutView& view, bool traceGeometry) |
103 { | 125 { |
104 OwnPtr<TracedValue> tracedValue = TracedValue::create(); | 126 OwnPtr<TracedValue> tracedValue = TracedValue::create(); |
105 dumpToTracedValue(view, traceGeometry, tracedValue.get()); | 127 dumpToTracedValue(view, traceGeometry, tracedValue.get()); |
128 | |
129 LayoutObject* o = view.frameView()->frame().ownerLayoutObject(); | |
130 if (o) { | |
131 FrameView* frameView = toFrameView(toLayoutPart(o)->widget()); | |
132 if (frameView) { | |
133 WebLocalFrame* wlf = WebLocalFrameImpl::fromFrame(frameView->frame() ); | |
134 tracedValue->beginDictionary("owner"); | |
135 tracedValue->setString("LayoutObject", String::format("%" PRIxPTR, r einterpret_cast<uintptr_t>(o))); | |
136 tracedValue->setString("LayoutTree", String::format("%p", wlf)); | |
137 tracedValue->endDictionary(); | |
138 } | |
139 } | |
140 | |
106 return tracedValue; | 141 return tracedValue; |
107 } | 142 } |
108 | 143 |
109 } // namespace blink | 144 } // namespace blink |
OLD | NEW |