Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: third_party/WebKit/Source/core/layout/TracedLayoutObject.cpp

Issue 2280153002: Refactoring out the code in LayoutTreeAsText::writeLayoutObject. (Closed)
Patch Set: Initial commit Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 19 matching lines...) Expand all
30 for (size_t i = 0; i < element.classNames().size(); ++i) 30 for (size_t i = 0; i < element.classNames().size(); ++i)
31 tracedValue->pushString(element.classNames()[i]); 31 tracedValue->pushString(element.classNames()[i]);
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 LayoutRect rect = object.debugRect();
benjhayden 2016/08/29 20:45:27 Can you restore absX and absY? Sorry, I realize I
lunalu1 2016/08/30 20:35:30 Done.
41 tracedValue->setDouble("absY", object.absoluteBoundingBoxRect().y());
42 LayoutRect rect;
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()); 41 tracedValue->setDouble("relX", rect.x());
50 tracedValue->setDouble("relY", rect.y()); 42 tracedValue->setDouble("relY", rect.y());
51 tracedValue->setDouble("width", rect.width()); 43 tracedValue->setDouble("width", rect.width());
52 tracedValue->setDouble("height", rect.height()); 44 tracedValue->setDouble("height", rect.height());
53 } else { 45 } else {
54 tracedValue->setDouble("absX", 0); 46 tracedValue->setDouble("absX", 0);
55 tracedValue->setDouble("absY", 0); 47 tracedValue->setDouble("absY", 0);
56 tracedValue->setDouble("relX", 0); 48 tracedValue->setDouble("relX", 0);
57 tracedValue->setDouble("relY", 0); 49 tracedValue->setDouble("relY", 0);
58 tracedValue->setDouble("width", 0); 50 tracedValue->setDouble("width", 0);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } // namespace 93 } // namespace
102 94
103 std::unique_ptr<TracedValue> TracedLayoutObject::create(const LayoutView& view, bool traceGeometry) 95 std::unique_ptr<TracedValue> TracedLayoutObject::create(const LayoutView& view, bool traceGeometry)
104 { 96 {
105 std::unique_ptr<TracedValue> tracedValue = TracedValue::create(); 97 std::unique_ptr<TracedValue> tracedValue = TracedValue::create();
106 dumpToTracedValue(view, traceGeometry, tracedValue.get()); 98 dumpToTracedValue(view, traceGeometry, tracedValue.get());
107 return tracedValue; 99 return tracedValue;
108 } 100 }
109 101
110 } // namespace blink 102 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698