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

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

Issue 1922223003: Change linesBoundingBox to return LayoutRect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 /* 1 /*
2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 } 184 }
185 185
186 LayoutBlock* cb = o.containingBlock(); 186 LayoutBlock* cb = o.containingBlock();
187 bool adjustForTableCells = cb ? cb->isTableCell() : false; 187 bool adjustForTableCells = cb ? cb->isTableCell() : false;
188 188
189 LayoutRect r; 189 LayoutRect r;
190 if (o.isText()) { 190 if (o.isText()) {
191 // FIXME: Would be better to dump the bounding box x and y rather than t he first run's x and y, but that would involve updating 191 // FIXME: Would be better to dump the bounding box x and y rather than t he first run's x and y, but that would involve updating
192 // many test results. 192 // many test results.
193 const LayoutText& text = toLayoutText(o); 193 const LayoutText& text = toLayoutText(o);
194 IntRect linesBox = text.linesBoundingBox(); 194 IntRect linesBox = enclosingIntRect(text.linesBoundingBox());
195 r = LayoutRect(IntRect(text.firstRunX(), text.firstRunY(), linesBox.widt h(), linesBox.height())); 195 r = LayoutRect(IntRect(text.firstRunX(), text.firstRunY(), linesBox.widt h(), linesBox.height()));
196 if (adjustForTableCells && !text.hasTextBoxes()) 196 if (adjustForTableCells && !text.hasTextBoxes())
197 adjustForTableCells = false; 197 adjustForTableCells = false;
198 } else if (o.isLayoutInline()) { 198 } else if (o.isLayoutInline()) {
199 // FIXME: Would be better not to just dump 0, 0 as the x and y here. 199 // FIXME: Would be better not to just dump 0, 0 as the x and y here.
200 const LayoutInline& inlineFlow = toLayoutInline(o); 200 const LayoutInline& inlineFlow = toLayoutInline(o);
201 r = LayoutRect(IntRect(0, 0, inlineFlow.linesBoundingBox().width(), inli neFlow.linesBoundingBox().height())); 201 IntRect linesBox = enclosingIntRect(inlineFlow.linesBoundingBox());
202 r = LayoutRect(IntRect(0, 0, linesBox.width(), linesBox.height()));
202 adjustForTableCells = false; 203 adjustForTableCells = false;
203 } else if (o.isTableCell()) { 204 } else if (o.isTableCell()) {
204 // FIXME: Deliberately dump the "inner" box of table cells, since that i s what current results reflect. We'd like 205 // FIXME: Deliberately dump the "inner" box of table cells, since that i s what current results reflect. We'd like
205 // to clean up the results to dump both the outer box and the intrinsic padding so that both bits of information are 206 // to clean up the results to dump both the outer box and the intrinsic padding so that both bits of information are
206 // captured by the results. 207 // captured by the results.
207 const LayoutTableCell& cell = toLayoutTableCell(o); 208 const LayoutTableCell& cell = toLayoutTableCell(o);
208 r = LayoutRect(cell.location().x(), cell.location().y() + cell.intrinsic PaddingBefore(), cell.size().width(), cell.size().height() - cell.intrinsicPaddi ngBefore() - cell.intrinsicPaddingAfter()); 209 r = LayoutRect(cell.location().x(), cell.location().y() + cell.intrinsic PaddingBefore(), cell.size().width(), cell.size().height() - cell.intrinsicPaddi ngBefore() - cell.intrinsicPaddingAfter());
209 } else if (o.isBox()) { 210 } else if (o.isBox()) {
210 r = toLayoutBox(&o)->frameRect(); 211 r = toLayoutBox(&o)->frameRect();
211 } 212 }
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 element->document().updateLayout(); 846 element->document().updateLayout();
846 847
847 LayoutObject* layoutObject = element->layoutObject(); 848 LayoutObject* layoutObject = element->layoutObject();
848 if (!layoutObject || !layoutObject->isListItem()) 849 if (!layoutObject || !layoutObject->isListItem())
849 return String(); 850 return String();
850 851
851 return toLayoutListItem(layoutObject)->markerText(); 852 return toLayoutListItem(layoutObject)->markerText();
852 } 853 }
853 854
854 } // namespace blink 855 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutText.cpp ('k') | third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698