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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp

Issue 2280153002: Refactoring out the code in LayoutTreeAsText::writeLayoutObject. (Closed)
Patch Set: Rename helper 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp b/third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp
index 2f92cd27047e5013658362845706473343a46a19..69a80acbb0153e4a8c3ed197f06c301f4a1069ff 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp
@@ -183,43 +183,7 @@ void LayoutTreeAsText::writeLayoutObject(TextStream& ts, const LayoutObject& o,
}
}
- LayoutBlock* cb = o.containingBlock();
- bool adjustForTableCells = cb ? cb->isTableCell() : false;
-
- LayoutRect r;
- if (o.isText()) {
- // FIXME: Would be better to dump the bounding box x and y rather than the first run's x and y, but that would involve updating
- // many test results.
- const LayoutText& text = toLayoutText(o);
- IntRect linesBox = enclosingIntRect(text.linesBoundingBox());
- r = LayoutRect(IntRect(text.firstRunX(), text.firstRunY(), linesBox.width(), linesBox.height()));
- if (adjustForTableCells && !text.hasTextBoxes())
- adjustForTableCells = false;
- } else if (o.isLayoutInline()) {
- // FIXME: Would be better not to just dump 0, 0 as the x and y here.
- const LayoutInline& inlineFlow = toLayoutInline(o);
- IntRect linesBox = enclosingIntRect(inlineFlow.linesBoundingBox());
- r = LayoutRect(IntRect(0, 0, linesBox.width(), linesBox.height()));
- adjustForTableCells = false;
- } else if (o.isTableCell()) {
- // FIXME: Deliberately dump the "inner" box of table cells, since that is what current results reflect. We'd like
- // to clean up the results to dump both the outer box and the intrinsic padding so that both bits of information are
- // captured by the results.
- const LayoutTableCell& cell = toLayoutTableCell(o);
- r = LayoutRect(cell.location().x(), cell.location().y() + cell.intrinsicPaddingBefore(), cell.size().width(), cell.size().height() - cell.intrinsicPaddingBefore() - cell.intrinsicPaddingAfter());
- } else if (o.isBox()) {
- r = toLayoutBox(&o)->frameRect();
- }
-
- // FIXME: Temporary in order to ensure compatibility with existing layout test results.
- if (adjustForTableCells)
- r.move(0, -toLayoutTableCell(o.containingBlock())->intrinsicPaddingBefore());
-
- if (o.isLayoutView()) {
- r.setWidth(LayoutUnit(toLayoutView(o).viewWidth(IncludeScrollbars)));
- r.setHeight(LayoutUnit(toLayoutView(o).viewHeight(IncludeScrollbars)));
- }
-
+ LayoutRect r = o.debugRect();
ts << " " << r;
if (!(o.isText() && !o.isBR())) {

Powered by Google App Engine
This is Rietveld 408576698