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

Side by Side Diff: third_party/WebKit/WebCore/rendering/RenderTreeAsText.cpp

Issue 21184: WebKit merge 40722:40785 (part 1) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 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 | Annotate | Revision Log
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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 185
186 IntRect r; 186 IntRect r;
187 if (o.isText()) { 187 if (o.isText()) {
188 // 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 188 // 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
189 // many test results. 189 // many test results.
190 const RenderText& text = *toRenderText(&o); 190 const RenderText& text = *toRenderText(&o);
191 IntRect linesBox = text.linesBoundingBox(); 191 IntRect linesBox = text.linesBoundingBox();
192 r = IntRect(text.firstRunX(), text.firstRunY(), linesBox.width(), linesB ox.height()); 192 r = IntRect(text.firstRunX(), text.firstRunY(), linesBox.width(), linesB ox.height());
193 if (adjustForTableCells && !text.firstTextBox()) 193 if (adjustForTableCells && !text.firstTextBox())
194 adjustForTableCells = false; 194 adjustForTableCells = false;
195 } else if (o.isBox()) { 195 } else if (o.isRenderInline()) {
196 if (o.isRenderInline()) { 196 // FIXME: Would be better not to just dump 0, 0 as the x and y here.
197 // FIXME: Would be better not to just dump 0, 0 as the x and y here. 197 const RenderInline& inlineFlow = *toRenderInline(&o);
198 const RenderInline& inlineFlow = *toRenderInline(&o); 198 r = IntRect(0, 0, inlineFlow.linesBoundingBox().width(), inlineFlow.line sBoundingBox().height());
199 r = IntRect(0, 0, inlineFlow.linesBoundingBox().width(), inlineFlow. linesBoundingBox().height()); 199 adjustForTableCells = false;
200 adjustForTableCells = false; 200 } else if (o.isTableCell()) {
201 } else if (o.isTableCell()) { 201 // FIXME: Deliberately dump the "inner" box of table cells, since that i s what current results reflect. We'd like
202 // FIXME: Deliberately dump the "inner" box of table cells, since th at is what current results reflect. We'd like 202 // to clean up the results to dump both the outer box and the intrinsic padding so that both bits of information are
203 // to clean up the results to dump both the outer box and the intrin sic padding so that both bits of information are 203 // captured by the results.
204 // captured by the results. 204 const RenderTableCell& cell = static_cast<const RenderTableCell&>(o);
205 const RenderTableCell& cell = static_cast<const RenderTableCell&>(o) ; 205 r = IntRect(cell.x(), cell.y() + cell.intrinsicPaddingTop(), cell.width( ), cell.height() - cell.intrinsicPaddingTop() - cell.intrinsicPaddingBottom());
206 r = IntRect(cell.x(), cell.y() + cell.intrinsicPaddingTop(), cell.wi dth(), cell.height() - cell.intrinsicPaddingTop() - cell.intrinsicPaddingBottom( )); 206 } else if (o.isBox())
207 } else 207 r = toRenderBox(&o)->frameRect();
208 r = toRenderBox(&o)->frameRect();
209 }
210 208
211 // FIXME: Temporary in order to ensure compatibility with existing layout te st results. 209 // FIXME: Temporary in order to ensure compatibility with existing layout te st results.
212 if (adjustForTableCells) 210 if (adjustForTableCells)
213 r.move(0, -static_cast<RenderTableCell*>(o.containingBlock())->intrinsic PaddingTop()); 211 r.move(0, -static_cast<RenderTableCell*>(o.containingBlock())->intrinsic PaddingTop());
214 212
215 ts << " " << r; 213 ts << " " << r;
216 214
217 if (!(o.isText() && !o.isBR())) { 215 if (!(o.isText() && !o.isBR())) {
218 if (o.parent() && (o.parent()->style()->color() != o.style()->color())) 216 if (o.parent() && (o.parent()->style()->color() != o.style()->color()))
219 ts << " [color=" << o.style()->color().name() << "]"; 217 ts << " [color=" << o.style()->color().name() << "]";
(...skipping 10 matching lines...) Expand all
230 228
231 if (o.parent() && (o.parent()->style()->textStrokeColor() != o.style()-> textStrokeColor()) && 229 if (o.parent() && (o.parent()->style()->textStrokeColor() != o.style()-> textStrokeColor()) &&
232 o.style()->textStrokeColor().isValid() && o.style()->textStrokeColor () != o.style()->color() && 230 o.style()->textStrokeColor().isValid() && o.style()->textStrokeColor () != o.style()->color() &&
233 o.style()->textStrokeColor().rgb()) 231 o.style()->textStrokeColor().rgb())
234 ts << " [textStrokeColor=" << o.style()->textStrokeColor().name() << "]"; 232 ts << " [textStrokeColor=" << o.style()->textStrokeColor().name() << "]";
235 233
236 if (o.parent() && (o.parent()->style()->textStrokeWidth() != o.style()-> textStrokeWidth()) && 234 if (o.parent() && (o.parent()->style()->textStrokeWidth() != o.style()-> textStrokeWidth()) &&
237 o.style()->textStrokeWidth() > 0) 235 o.style()->textStrokeWidth() > 0)
238 ts << " [textStrokeWidth=" << o.style()->textStrokeWidth() << "]"; 236 ts << " [textStrokeWidth=" << o.style()->textStrokeWidth() << "]";
239 237
240 if (!o.isBox()) 238 if (!o.isBoxModelObject())
241 return ts; 239 return ts;
242 240
243 const RenderBox& box = *toRenderBox(&o); 241 const RenderBoxModelObject& box = *toRenderBoxModelObject(&o);
244 if (box.borderTop() || box.borderRight() || box.borderBottom() || box.bo rderLeft()) { 242 if (box.borderTop() || box.borderRight() || box.borderBottom() || box.bo rderLeft()) {
245 ts << " [border:"; 243 ts << " [border:";
246 244
247 BorderValue prevBorder; 245 BorderValue prevBorder;
248 if (o.style()->borderTop() != prevBorder) { 246 if (o.style()->borderTop() != prevBorder) {
249 prevBorder = o.style()->borderTop(); 247 prevBorder = o.style()->borderTop();
250 if (!box.borderTop()) 248 if (!box.borderTop())
251 ts << " none"; 249 ts << " none";
252 else { 250 else {
253 ts << " (" << box.borderTop() << "px "; 251 ts << " (" << box.borderTop() << "px ";
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 o->view()->frameView()->layout(); 540 o->view()->frameView()->layout();
543 if (o->hasLayer()) { 541 if (o->hasLayer()) {
544 RenderLayer* l = toRenderBox(o)->layer(); 542 RenderLayer* l = toRenderBox(o)->layer();
545 writeLayers(ts, l, l, IntRect(l->xPos(), l->yPos(), l->width(), l->heigh t())); 543 writeLayers(ts, l, l, IntRect(l->xPos(), l->yPos(), l->width(), l->heigh t()));
546 writeSelection(ts, o); 544 writeSelection(ts, o);
547 } 545 }
548 return ts.release(); 546 return ts.release();
549 } 547 }
550 548
551 } // namespace WebCore 549 } // namespace WebCore
OLDNEW
« no previous file with comments | « third_party/WebKit/WebCore/rendering/RenderText.cpp ('k') | third_party/WebKit/WebCore/rendering/RenderView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698