| 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 if (!(o.isText() && !o.isBR())) { | 185 if (!(o.isText() && !o.isBR())) { |
| 186 if (o.isFileUploadControl()) | 186 if (o.isFileUploadControl()) |
| 187 ts << " " << quoteAndEscapeNonPrintables( | 187 ts << " " << quoteAndEscapeNonPrintables( |
| 188 toLayoutFileUploadControl(&o)->fileTextValue()); | 188 toLayoutFileUploadControl(&o)->fileTextValue()); |
| 189 | 189 |
| 190 if (o.parent()) { | 190 if (o.parent()) { |
| 191 Color color = o.resolveColor(CSSPropertyColor); | 191 Color color = o.resolveColor(CSSPropertyColor); |
| 192 if (o.parent()->resolveColor(CSSPropertyColor) != color) | 192 if (o.parent()->resolveColor(CSSPropertyColor) != color) |
| 193 ts << " [color=" << color << "]"; | 193 ts << " [color=" << color << "]"; |
| 194 | 194 |
| 195 // Do not dump invalid or transparent backgrounds, since that is the defau
lt. | 195 // Do not dump invalid or transparent backgrounds, since that is the |
| 196 // default. |
| 196 Color backgroundColor = o.resolveColor(CSSPropertyBackgroundColor); | 197 Color backgroundColor = o.resolveColor(CSSPropertyBackgroundColor); |
| 197 if (o.parent()->resolveColor(CSSPropertyBackgroundColor) != | 198 if (o.parent()->resolveColor(CSSPropertyBackgroundColor) != |
| 198 backgroundColor && | 199 backgroundColor && |
| 199 backgroundColor.rgb()) | 200 backgroundColor.rgb()) |
| 200 ts << " [bgcolor=" << backgroundColor << "]"; | 201 ts << " [bgcolor=" << backgroundColor << "]"; |
| 201 | 202 |
| 202 Color textFillColor = o.resolveColor(CSSPropertyWebkitTextFillColor); | 203 Color textFillColor = o.resolveColor(CSSPropertyWebkitTextFillColor); |
| 203 if (o.parent()->resolveColor(CSSPropertyWebkitTextFillColor) != | 204 if (o.parent()->resolveColor(CSSPropertyWebkitTextFillColor) != |
| 204 textFillColor && | 205 textFillColor && |
| 205 textFillColor != color && textFillColor.rgb()) | 206 textFillColor != color && textFillColor.rgb()) |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 int indent) { | 426 int indent) { |
| 426 for (const InlineFlowBox* rootBox = o.firstLineBox(); rootBox; | 427 for (const InlineFlowBox* rootBox = o.firstLineBox(); rootBox; |
| 427 rootBox = rootBox->nextLineBox()) { | 428 rootBox = rootBox->nextLineBox()) { |
| 428 writeInlineFlowBox(ts, *rootBox, indent); | 429 writeInlineFlowBox(ts, *rootBox, indent); |
| 429 } | 430 } |
| 430 } | 431 } |
| 431 | 432 |
| 432 static void writeTextRun(TextStream& ts, | 433 static void writeTextRun(TextStream& ts, |
| 433 const LayoutText& o, | 434 const LayoutText& o, |
| 434 const InlineTextBox& run) { | 435 const InlineTextBox& run) { |
| 435 // FIXME: For now use an "enclosingIntRect" model for x, y and logicalWidth, a
lthough this makes it harder | 436 // FIXME: For now use an "enclosingIntRect" model for x, y and logicalWidth, |
| 436 // to detect any changes caused by the conversion to floating point. :( | 437 // although this makes it harder to detect any changes caused by the |
| 438 // conversion to floating point. :( |
| 437 int x = run.x().toInt(); | 439 int x = run.x().toInt(); |
| 438 int y = run.y().toInt(); | 440 int y = run.y().toInt(); |
| 439 int logicalWidth = (run.left() + run.logicalWidth()).ceil() - x; | 441 int logicalWidth = (run.left() + run.logicalWidth()).ceil() - x; |
| 440 | 442 |
| 441 // FIXME: Table cell adjustment is temporary until results can be updated. | 443 // FIXME: Table cell adjustment is temporary until results can be updated. |
| 442 if (o.containingBlock()->isTableCell()) | 444 if (o.containingBlock()->isTableCell()) |
| 443 y -= toLayoutTableCell(o.containingBlock())->intrinsicPaddingBefore(); | 445 y -= toLayoutTableCell(o.containingBlock())->intrinsicPaddingBefore(); |
| 444 | 446 |
| 445 ts << "text run at (" << x << "," << y << ") width " << logicalWidth; | 447 ts << "text run at (" << x << "," << y << ") width " << logicalWidth; |
| 446 if (!run.isLeftToRightDirection() || run.dirOverride()) { | 448 if (!run.isLeftToRightDirection() || run.dirOverride()) { |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 String str(toLayoutText(child)->text()); | 858 String str(toLayoutText(child)->text()); |
| 857 stream << str; | 859 stream << str; |
| 858 } | 860 } |
| 859 } | 861 } |
| 860 } | 862 } |
| 861 | 863 |
| 862 String counterValueForElement(Element* element) { | 864 String counterValueForElement(Element* element) { |
| 863 element->document().updateStyleAndLayout(); | 865 element->document().updateStyleAndLayout(); |
| 864 TextStream stream; | 866 TextStream stream; |
| 865 bool isFirstCounter = true; | 867 bool isFirstCounter = true; |
| 866 // The counter layoutObjects should be children of :before or :after pseudo-el
ements. | 868 // The counter layoutObjects should be children of :before or :after |
| 869 // pseudo-elements. |
| 867 if (LayoutObject* before = element->pseudoElementLayoutObject(PseudoIdBefore)) | 870 if (LayoutObject* before = element->pseudoElementLayoutObject(PseudoIdBefore)) |
| 868 writeCounterValuesFromChildren(stream, before, isFirstCounter); | 871 writeCounterValuesFromChildren(stream, before, isFirstCounter); |
| 869 if (LayoutObject* after = element->pseudoElementLayoutObject(PseudoIdAfter)) | 872 if (LayoutObject* after = element->pseudoElementLayoutObject(PseudoIdAfter)) |
| 870 writeCounterValuesFromChildren(stream, after, isFirstCounter); | 873 writeCounterValuesFromChildren(stream, after, isFirstCounter); |
| 871 return stream.release(); | 874 return stream.release(); |
| 872 } | 875 } |
| 873 | 876 |
| 874 String markerTextForListItem(Element* element) { | 877 String markerTextForListItem(Element* element) { |
| 875 element->document().updateStyleAndLayout(); | 878 element->document().updateStyleAndLayout(); |
| 876 | 879 |
| 877 LayoutObject* layoutObject = element->layoutObject(); | 880 LayoutObject* layoutObject = element->layoutObject(); |
| 878 if (!layoutObject || !layoutObject->isListItem()) | 881 if (!layoutObject || !layoutObject->isListItem()) |
| 879 return String(); | 882 return String(); |
| 880 | 883 |
| 881 return toLayoutListItem(layoutObject)->markerText(); | 884 return toLayoutListItem(layoutObject)->markerText(); |
| 882 } | 885 } |
| 883 | 886 |
| 884 } // namespace blink | 887 } // namespace blink |
| OLD | NEW |