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

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

Issue 940373003: Rename RenderText to LayoutText (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « Source/core/layout/LayoutTextFragment.cpp ('k') | Source/core/layout/LayoutWordBreak.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 } 182 }
183 } 183 }
184 184
185 LayoutBlock* cb = o.containingBlock(); 185 LayoutBlock* cb = o.containingBlock();
186 bool adjustForTableCells = cb ? cb->isTableCell() : false; 186 bool adjustForTableCells = cb ? cb->isTableCell() : false;
187 187
188 LayoutRect r; 188 LayoutRect r;
189 if (o.isText()) { 189 if (o.isText()) {
190 // 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 190 // 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 // many test results. 191 // many test results.
192 const RenderText& text = toRenderText(o); 192 const LayoutText& text = toLayoutText(o);
193 IntRect linesBox = text.linesBoundingBox(); 193 IntRect linesBox = text.linesBoundingBox();
194 r = LayoutRect(IntRect(text.firstRunX(), text.firstRunY(), linesBox.widt h(), linesBox.height())); 194 r = LayoutRect(IntRect(text.firstRunX(), text.firstRunY(), linesBox.widt h(), linesBox.height()));
195 if (adjustForTableCells && !text.firstTextBox()) 195 if (adjustForTableCells && !text.firstTextBox())
196 adjustForTableCells = false; 196 adjustForTableCells = false;
197 } else if (o.isLayoutInline()) { 197 } else if (o.isLayoutInline()) {
198 // FIXME: Would be better not to just dump 0, 0 as the x and y here. 198 // FIXME: Would be better not to just dump 0, 0 as the x and y here.
199 const LayoutInline& inlineFlow = toLayoutInline(o); 199 const LayoutInline& inlineFlow = toLayoutInline(o);
200 r = LayoutRect(IntRect(0, 0, inlineFlow.linesBoundingBox().width(), inli neFlow.linesBoundingBox().height())); 200 r = LayoutRect(IntRect(0, 0, inlineFlow.linesBoundingBox().width(), inli neFlow.linesBoundingBox().height()));
201 adjustForTableCells = false; 201 adjustForTableCells = false;
202 } else if (o.isTableCell()) { 202 } else if (o.isTableCell()) {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 if (havePrevious) 397 if (havePrevious)
398 ts << ","; 398 ts << ",";
399 ts << " positioned child"; 399 ts << " positioned child";
400 } 400 }
401 401
402 if (needsLayout) 402 if (needsLayout)
403 ts << ")"; 403 ts << ")";
404 } 404 }
405 } 405 }
406 406
407 static void writeTextRun(TextStream& ts, const RenderText& o, const InlineTextBo x& run) 407 static void writeTextRun(TextStream& ts, const LayoutText& o, const InlineTextBo x& run)
408 { 408 {
409 // FIXME: For now use an "enclosingIntRect" model for x, y and logicalWidth, although this makes it harder 409 // FIXME: For now use an "enclosingIntRect" model for x, y and logicalWidth, although this makes it harder
410 // to detect any changes caused by the conversion to floating point. :( 410 // to detect any changes caused by the conversion to floating point. :(
411 int x = run.x(); 411 int x = run.x();
412 int y = run.y(); 412 int y = run.y();
413 int logicalWidth = ceilf(run.left() + run.logicalWidth()) - x; 413 int logicalWidth = ceilf(run.left() + run.logicalWidth()) - x;
414 414
415 // FIXME: Table cell adjustment is temporary until results can be updated. 415 // FIXME: Table cell adjustment is temporary until results can be updated.
416 if (o.containingBlock()->isTableCell()) 416 if (o.containingBlock()->isTableCell())
417 y -= toLayoutTableCell(o.containingBlock())->intrinsicPaddingBefore(); 417 y -= toLayoutTableCell(o.containingBlock())->intrinsicPaddingBefore();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 writeSVGImage(ts, toLayoutSVGImage(o), indent); 463 writeSVGImage(ts, toLayoutSVGImage(o), indent);
464 return; 464 return;
465 } 465 }
466 466
467 writeIndent(ts, indent); 467 writeIndent(ts, indent);
468 468
469 LayoutTreeAsText::writeLayoutObject(ts, o, behavior); 469 LayoutTreeAsText::writeLayoutObject(ts, o, behavior);
470 ts << "\n"; 470 ts << "\n";
471 471
472 if (o.isText() && !o.isBR()) { 472 if (o.isText() && !o.isBR()) {
473 const RenderText& text = toRenderText(o); 473 const LayoutText& text = toLayoutText(o);
474 for (InlineTextBox* box = text.firstTextBox(); box; box = box->nextTextB ox()) { 474 for (InlineTextBox* box = text.firstTextBox(); box; box = box->nextTextB ox()) {
475 writeIndent(ts, indent + 1); 475 writeIndent(ts, indent + 1);
476 writeTextRun(ts, text, *box); 476 writeTextRun(ts, text, *box);
477 } 477 }
478 } 478 }
479 479
480 for (LayoutObject* child = o.slowFirstChild(); child; child = child->nextSib ling()) { 480 for (LayoutObject* child = o.slowFirstChild(); child; child = child->nextSib ling()) {
481 if (child->hasLayer()) 481 if (child->hasLayer())
482 continue; 482 continue;
483 write(ts, *child, indent + 1, behavior); 483 write(ts, *child, indent + 1, behavior);
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 return externalRepresentation(toLayoutBox(renderer), behavior | LayoutAsText ShowAllLayers); 745 return externalRepresentation(toLayoutBox(renderer), behavior | LayoutAsText ShowAllLayers);
746 } 746 }
747 747
748 static void writeCounterValuesFromChildren(TextStream& stream, LayoutObject* par ent, bool& isFirstCounter) 748 static void writeCounterValuesFromChildren(TextStream& stream, LayoutObject* par ent, bool& isFirstCounter)
749 { 749 {
750 for (LayoutObject* child = parent->slowFirstChild(); child; child = child->n extSibling()) { 750 for (LayoutObject* child = parent->slowFirstChild(); child; child = child->n extSibling()) {
751 if (child->isCounter()) { 751 if (child->isCounter()) {
752 if (!isFirstCounter) 752 if (!isFirstCounter)
753 stream << " "; 753 stream << " ";
754 isFirstCounter = false; 754 isFirstCounter = false;
755 String str(toRenderText(child)->text()); 755 String str(toLayoutText(child)->text());
756 stream << str; 756 stream << str;
757 } 757 }
758 } 758 }
759 } 759 }
760 760
761 String counterValueForElement(Element* element) 761 String counterValueForElement(Element* element)
762 { 762 {
763 // Make sure the element is not freed during the layout. 763 // Make sure the element is not freed during the layout.
764 RefPtrWillBeRawPtr<Element> protector(element); 764 RefPtrWillBeRawPtr<Element> protector(element);
765 element->document().updateLayout(); 765 element->document().updateLayout();
(...skipping 14 matching lines...) Expand all
780 element->document().updateLayout(); 780 element->document().updateLayout();
781 781
782 LayoutObject* renderer = element->renderer(); 782 LayoutObject* renderer = element->renderer();
783 if (!renderer || !renderer->isListItem()) 783 if (!renderer || !renderer->isListItem())
784 return String(); 784 return String();
785 785
786 return toLayoutListItem(renderer)->markerText(); 786 return toLayoutListItem(renderer)->markerText();
787 } 787 }
788 788
789 } // namespace blink 789 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutTextFragment.cpp ('k') | Source/core/layout/LayoutWordBreak.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698