| OLD | NEW |
| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 result.append('{'); | 192 result.append('{'); |
| 193 appendUnsignedAsHex(c, result); | 193 appendUnsignedAsHex(c, result); |
| 194 result.append('}'); | 194 result.append('}'); |
| 195 } | 195 } |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 result.append('"'); | 198 result.append('"'); |
| 199 return result.toString(); | 199 return result.toString(); |
| 200 } | 200 } |
| 201 | 201 |
| 202 static inline Color colorWithFallback(const RenderObject& o, const Color& color) |
| 203 { |
| 204 return color.isValid() ? color : o.resolveColor(CSSPropertyColor); |
| 205 } |
| 206 |
| 202 void RenderTreeAsText::writeRenderObject(TextStream& ts, const RenderObject& o,
RenderAsTextBehavior behavior) | 207 void RenderTreeAsText::writeRenderObject(TextStream& ts, const RenderObject& o,
RenderAsTextBehavior behavior) |
| 203 { | 208 { |
| 204 ts << o.renderName(); | 209 ts << o.renderName(); |
| 205 | 210 |
| 206 if (behavior & RenderAsTextShowAddresses) | 211 if (behavior & RenderAsTextShowAddresses) |
| 207 ts << " " << static_cast<const void*>(&o); | 212 ts << " " << static_cast<const void*>(&o); |
| 208 | 213 |
| 209 if (o.style() && o.style()->zIndex()) | 214 if (o.style() && o.style()->zIndex()) |
| 210 ts << " zI: " << o.style()->zIndex(); | 215 ts << " zI: " << o.style()->zIndex(); |
| 211 | 216 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 | 260 |
| 256 // FIXME: Convert layout test results to report sub-pixel values, in the mea
ntime using enclosingIntRect | 261 // FIXME: Convert layout test results to report sub-pixel values, in the mea
ntime using enclosingIntRect |
| 257 // for consistency with old results. | 262 // for consistency with old results. |
| 258 ts << " " << enclosingIntRect(r); | 263 ts << " " << enclosingIntRect(r); |
| 259 | 264 |
| 260 if (!(o.isText() && !o.isBR())) { | 265 if (!(o.isText() && !o.isBR())) { |
| 261 if (o.isFileUploadControl()) | 266 if (o.isFileUploadControl()) |
| 262 ts << " " << quoteAndEscapeNonPrintables(toRenderFileUploadControl(&
o)->fileTextValue()); | 267 ts << " " << quoteAndEscapeNonPrintables(toRenderFileUploadControl(&
o)->fileTextValue()); |
| 263 | 268 |
| 264 if (o.parent()) { | 269 if (o.parent()) { |
| 265 Color color = o.style()->visitedDependentColor(CSSPropertyColor); | 270 Color color = o.resolveColor(CSSPropertyColor); |
| 266 if (o.parent()->style()->visitedDependentColor(CSSPropertyColor) !=
color) | 271 if (o.parent()->resolveColor(CSSPropertyColor) != color) |
| 267 ts << " [color=" << color.nameForRenderTreeAsText() << "]"; | 272 ts << " [color=" << color.nameForRenderTreeAsText() << "]"; |
| 268 | 273 |
| 269 // Do not dump invalid or transparent backgrounds, since that is the
default. | 274 // Do not dump invalid or transparent backgrounds, since that is the
default. |
| 270 Color backgroundColor = o.style()->visitedDependentColor(CSSProperty
BackgroundColor); | 275 Color backgroundColor = o.resolveColor(CSSPropertyBackgroundColor); |
| 271 if (o.parent()->style()->visitedDependentColor(CSSPropertyBackground
Color) != backgroundColor | 276 if (o.parent()->resolveColor(CSSPropertyBackgroundColor) != backgrou
ndColor |
| 272 && backgroundColor.isValid() && backgroundColor.rgb()) | 277 && backgroundColor.isValid() && backgroundColor.rgb()) |
| 273 ts << " [bgcolor=" << backgroundColor.nameForRenderTreeAsText()
<< "]"; | 278 ts << " [bgcolor=" << backgroundColor.nameForRenderTreeAsText()
<< "]"; |
| 274 | 279 |
| 275 Color textFillColor = o.style()->visitedDependentColor(CSSPropertyWe
bkitTextFillColor); | 280 Color textFillColor = o.resolveColor(CSSPropertyWebkitTextFillColor)
; |
| 276 if (o.parent()->style()->visitedDependentColor(CSSPropertyWebkitText
FillColor) != textFillColor | 281 if (o.parent()->resolveColor(CSSPropertyWebkitTextFillColor) != text
FillColor |
| 277 && textFillColor.isValid() && textFillColor != color && textFill
Color.rgb()) | 282 && textFillColor.isValid() && textFillColor != color && textFill
Color.rgb()) |
| 278 ts << " [textFillColor=" << textFillColor.nameForRenderTreeAsTex
t() << "]"; | 283 ts << " [textFillColor=" << textFillColor.nameForRenderTreeAsTex
t() << "]"; |
| 279 | 284 |
| 280 Color textStrokeColor = o.style()->visitedDependentColor(CSSProperty
WebkitTextStrokeColor); | 285 Color textStrokeColor = o.resolveColor(CSSPropertyWebkitTextStrokeCo
lor); |
| 281 if (o.parent()->style()->visitedDependentColor(CSSPropertyWebkitText
StrokeColor) != textStrokeColor | 286 if (o.parent()->resolveColor(CSSPropertyWebkitTextStrokeColor) != te
xtStrokeColor |
| 282 && textStrokeColor.isValid() && textStrokeColor != color && text
StrokeColor.rgb()) | 287 && textStrokeColor.isValid() && textStrokeColor != color && text
StrokeColor.rgb()) |
| 283 ts << " [textStrokeColor=" << textStrokeColor.nameForRenderTreeA
sText() << "]"; | 288 ts << " [textStrokeColor=" << textStrokeColor.nameForRenderTreeA
sText() << "]"; |
| 284 | 289 |
| 285 if (o.parent()->style()->textStrokeWidth() != o.style()->textStrokeW
idth() && o.style()->textStrokeWidth() > 0) | 290 if (o.parent()->style()->textStrokeWidth() != o.style()->textStrokeW
idth() && o.style()->textStrokeWidth() > 0) |
| 286 ts << " [textStrokeWidth=" << o.style()->textStrokeWidth() << "]
"; | 291 ts << " [textStrokeWidth=" << o.style()->textStrokeWidth() << "]
"; |
| 287 } | 292 } |
| 288 | 293 |
| 289 if (!o.isBoxModelObject()) | 294 if (!o.isBoxModelObject()) |
| 290 return; | 295 return; |
| 291 | 296 |
| 292 const RenderBoxModelObject& box = *toRenderBoxModelObject(&o); | 297 const RenderBoxModelObject& box = *toRenderBoxModelObject(&o); |
| 293 if (box.borderTop() || box.borderRight() || box.borderBottom() || box.bo
rderLeft()) { | 298 if (box.borderTop() || box.borderRight() || box.borderBottom() || box.bo
rderLeft()) { |
| 294 ts << " [border:"; | 299 ts << " [border:"; |
| 295 | 300 |
| 296 BorderValue prevBorder = o.style()->borderTop(); | 301 BorderValue prevBorder = o.style()->borderTop(); |
| 297 if (!box.borderTop()) | 302 if (!box.borderTop()) |
| 298 ts << " none"; | 303 ts << " none"; |
| 299 else { | 304 else { |
| 300 ts << " (" << box.borderTop() << "px "; | 305 ts << " (" << box.borderTop() << "px "; |
| 301 printBorderStyle(ts, o.style()->borderTopStyle()); | 306 printBorderStyle(ts, o.style()->borderTopStyle()); |
| 302 Color col = o.style()->borderTopColor(); | 307 Color col = colorWithFallback(o, o.style()->borderTopColor()); |
| 303 if (!col.isValid()) | |
| 304 col = o.style()->color(); | |
| 305 ts << col.nameForRenderTreeAsText() << ")"; | 308 ts << col.nameForRenderTreeAsText() << ")"; |
| 306 } | 309 } |
| 307 | 310 |
| 308 if (o.style()->borderRight() != prevBorder) { | 311 if (o.style()->borderRight() != prevBorder) { |
| 309 prevBorder = o.style()->borderRight(); | 312 prevBorder = o.style()->borderRight(); |
| 310 if (!box.borderRight()) | 313 if (!box.borderRight()) |
| 311 ts << " none"; | 314 ts << " none"; |
| 312 else { | 315 else { |
| 313 ts << " (" << box.borderRight() << "px "; | 316 ts << " (" << box.borderRight() << "px "; |
| 314 printBorderStyle(ts, o.style()->borderRightStyle()); | 317 printBorderStyle(ts, o.style()->borderRightStyle()); |
| 315 Color col = o.style()->borderRightColor(); | 318 Color col = colorWithFallback(o, o.style()->borderRightColor
()); |
| 316 if (!col.isValid()) | |
| 317 col = o.style()->color(); | |
| 318 ts << col.nameForRenderTreeAsText() << ")"; | 319 ts << col.nameForRenderTreeAsText() << ")"; |
| 319 } | 320 } |
| 320 } | 321 } |
| 321 | 322 |
| 322 if (o.style()->borderBottom() != prevBorder) { | 323 if (o.style()->borderBottom() != prevBorder) { |
| 323 prevBorder = box.style()->borderBottom(); | 324 prevBorder = box.style()->borderBottom(); |
| 324 if (!box.borderBottom()) | 325 if (!box.borderBottom()) |
| 325 ts << " none"; | 326 ts << " none"; |
| 326 else { | 327 else { |
| 327 ts << " (" << box.borderBottom() << "px "; | 328 ts << " (" << box.borderBottom() << "px "; |
| 328 printBorderStyle(ts, o.style()->borderBottomStyle()); | 329 printBorderStyle(ts, o.style()->borderBottomStyle()); |
| 329 Color col = o.style()->borderBottomColor(); | 330 Color col = colorWithFallback(o, o.style()->borderBottomColo
r()); |
| 330 if (!col.isValid()) | |
| 331 col = o.style()->color(); | |
| 332 ts << col.nameForRenderTreeAsText() << ")"; | 331 ts << col.nameForRenderTreeAsText() << ")"; |
| 333 } | 332 } |
| 334 } | 333 } |
| 335 | 334 |
| 336 if (o.style()->borderLeft() != prevBorder) { | 335 if (o.style()->borderLeft() != prevBorder) { |
| 337 prevBorder = o.style()->borderLeft(); | 336 prevBorder = o.style()->borderLeft(); |
| 338 if (!box.borderLeft()) | 337 if (!box.borderLeft()) |
| 339 ts << " none"; | 338 ts << " none"; |
| 340 else { | 339 else { |
| 341 ts << " (" << box.borderLeft() << "px "; | 340 ts << " (" << box.borderLeft() << "px "; |
| 342 printBorderStyle(ts, o.style()->borderLeftStyle()); | 341 printBorderStyle(ts, o.style()->borderLeftStyle()); |
| 343 Color col = o.style()->borderLeftColor(); | 342 Color col = colorWithFallback(o, o.style()->borderLeftColor(
)); |
| 344 if (!col.isValid()) | |
| 345 col = o.style()->color(); | |
| 346 ts << col.nameForRenderTreeAsText() << ")"; | 343 ts << col.nameForRenderTreeAsText() << ")"; |
| 347 } | 344 } |
| 348 } | 345 } |
| 349 | 346 |
| 350 ts << "]"; | 347 ts << "]"; |
| 351 } | 348 } |
| 352 } | 349 } |
| 353 | 350 |
| 354 if (o.isTableCell()) { | 351 if (o.isTableCell()) { |
| 355 const RenderTableCell& c = *toRenderTableCell(&o); | 352 const RenderTableCell& c = *toRenderTableCell(&o); |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 element->document()->updateLayout(); | 860 element->document()->updateLayout(); |
| 864 | 861 |
| 865 RenderObject* renderer = element->renderer(); | 862 RenderObject* renderer = element->renderer(); |
| 866 if (!renderer || !renderer->isListItem()) | 863 if (!renderer || !renderer->isListItem()) |
| 867 return String(); | 864 return String(); |
| 868 | 865 |
| 869 return toRenderListItem(renderer)->markerText(); | 866 return toRenderListItem(renderer)->markerText(); |
| 870 } | 867 } |
| 871 | 868 |
| 872 } // namespace WebCore | 869 } // namespace WebCore |
| OLD | NEW |