| 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/layout/LayoutInline.h" | 7 #include "core/layout/LayoutInline.h" |
| 8 #include "core/layout/LayoutTableCell.h" | 8 #include "core/layout/LayoutTableCell.h" |
| 9 #include "core/layout/LayoutText.h" | 9 #include "core/layout/LayoutText.h" |
| 10 #include "core/layout/LayoutView.h" | 10 #include "core/layout/LayoutView.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 tracedValue->endArray(); | 32 tracedValue->endArray(); |
| 33 } | 33 } |
| 34 } | 34 } |
| 35 } | 35 } |
| 36 | 36 |
| 37 // FIXME: When the fixmes in LayoutTreeAsText::writeLayoutObject() are | 37 // FIXME: When the fixmes in LayoutTreeAsText::writeLayoutObject() are |
| 38 // fixed, deduplicate it with this. | 38 // fixed, deduplicate it with this. |
| 39 if (traceGeometry) { | 39 if (traceGeometry) { |
| 40 tracedValue->setDouble("absX", object.absoluteBoundingBoxRect().x()); | 40 tracedValue->setDouble("absX", object.absoluteBoundingBoxRect().x()); |
| 41 tracedValue->setDouble("absY", object.absoluteBoundingBoxRect().y()); | 41 tracedValue->setDouble("absY", object.absoluteBoundingBoxRect().y()); |
| 42 LayoutRect rect; | 42 LayoutRect rect = object.debugRect(); |
| 43 if (object.isText()) | |
| 44 rect = LayoutRect(toLayoutText(object).linesBoundingBox()); | |
| 45 else if (object.isLayoutInline()) | |
| 46 rect = LayoutRect(toLayoutInline(object).linesBoundingBox()); | |
| 47 else if (object.isBox()) | |
| 48 rect = toLayoutBox(&object)->frameRect(); | |
| 49 tracedValue->setDouble("relX", rect.x()); | 43 tracedValue->setDouble("relX", rect.x()); |
| 50 tracedValue->setDouble("relY", rect.y()); | 44 tracedValue->setDouble("relY", rect.y()); |
| 51 tracedValue->setDouble("width", rect.width()); | 45 tracedValue->setDouble("width", rect.width()); |
| 52 tracedValue->setDouble("height", rect.height()); | 46 tracedValue->setDouble("height", rect.height()); |
| 53 } else { | 47 } else { |
| 54 tracedValue->setDouble("absX", 0); | 48 tracedValue->setDouble("absX", 0); |
| 55 tracedValue->setDouble("absY", 0); | 49 tracedValue->setDouble("absY", 0); |
| 56 tracedValue->setDouble("relX", 0); | 50 tracedValue->setDouble("relX", 0); |
| 57 tracedValue->setDouble("relY", 0); | 51 tracedValue->setDouble("relY", 0); |
| 58 tracedValue->setDouble("width", 0); | 52 tracedValue->setDouble("width", 0); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 } // namespace | 95 } // namespace |
| 102 | 96 |
| 103 std::unique_ptr<TracedValue> TracedLayoutObject::create(const LayoutView& view,
bool traceGeometry) | 97 std::unique_ptr<TracedValue> TracedLayoutObject::create(const LayoutView& view,
bool traceGeometry) |
| 104 { | 98 { |
| 105 std::unique_ptr<TracedValue> tracedValue = TracedValue::create(); | 99 std::unique_ptr<TracedValue> tracedValue = TracedValue::create(); |
| 106 dumpToTracedValue(view, traceGeometry, tracedValue.get()); | 100 dumpToTracedValue(view, traceGeometry, tracedValue.get()); |
| 107 return tracedValue; | 101 return tracedValue; |
| 108 } | 102 } |
| 109 | 103 |
| 110 } // namespace blink | 104 } // namespace blink |
| OLD | NEW |