| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2008 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 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 #ifndef RenderTreeAsText_h | 26 #ifndef RenderTreeAsText_h |
| 27 #define RenderTreeAsText_h | 27 #define RenderTreeAsText_h |
| 28 #include "platform/text/TextStream.h" | 28 #include "platform/text/TextStream.h" |
| 29 | 29 |
| 30 #include "wtf/Forward.h" | 30 #include "wtf/Forward.h" |
| 31 | 31 |
| 32 namespace WebCore { | 32 namespace WebCore { |
| 33 | 33 |
| 34 class Element; | 34 class Element; |
| 35 class FloatPoint; | |
| 36 class FloatSize; | |
| 37 class Frame; | 35 class Frame; |
| 38 class IntPoint; | |
| 39 class IntRect; | |
| 40 class LayoutPoint; | |
| 41 class RenderObject; | 36 class RenderObject; |
| 42 class TextStream; | 37 class TextStream; |
| 43 | 38 |
| 44 enum RenderAsTextBehaviorFlags { | 39 enum RenderAsTextBehaviorFlags { |
| 45 RenderAsTextBehaviorNormal = 0, | 40 RenderAsTextBehaviorNormal = 0, |
| 46 RenderAsTextShowAllLayers = 1 << 0, // Dump all layers, not just those that
would paint. | 41 RenderAsTextShowAllLayers = 1 << 0, // Dump all layers, not just those that
would paint. |
| 47 RenderAsTextShowLayerNesting = 1 << 1, // Annotate the layer lists. | 42 RenderAsTextShowLayerNesting = 1 << 1, // Annotate the layer lists. |
| 48 RenderAsTextShowCompositedLayers = 1 << 2, // Show which layers are composit
ed. | 43 RenderAsTextShowCompositedLayers = 1 << 2, // Show which layers are composit
ed. |
| 49 RenderAsTextShowAddresses = 1 << 3, // Show layer and renderer addresses. | 44 RenderAsTextShowAddresses = 1 << 3, // Show layer and renderer addresses. |
| 50 RenderAsTextShowIDAndClass = 1 << 4, // Show id and class attributes | 45 RenderAsTextShowIDAndClass = 1 << 4, // Show id and class attributes |
| 51 RenderAsTextPrintingMode = 1 << 5, // Dump the tree in printing mode. | 46 RenderAsTextPrintingMode = 1 << 5, // Dump the tree in printing mode. |
| 52 RenderAsTextDontUpdateLayout = 1 << 6, // Don't update layout, to make it sa
fe to call showLayerTree() from the debugger inside layout or painting code. | 47 RenderAsTextDontUpdateLayout = 1 << 6, // Don't update layout, to make it sa
fe to call showLayerTree() from the debugger inside layout or painting code. |
| 53 RenderAsTextShowLayoutState = 1 << 7 // Print the various 'needs layout' bit
s on renderers. | 48 RenderAsTextShowLayoutState = 1 << 7 // Print the various 'needs layout' bit
s on renderers. |
| 54 }; | 49 }; |
| 55 typedef unsigned RenderAsTextBehavior; | 50 typedef unsigned RenderAsTextBehavior; |
| 56 | 51 |
| 57 // You don't need pageWidthInPixels if you don't specify RenderAsTextInPrintingM
ode. | 52 // You don't need pageWidthInPixels if you don't specify RenderAsTextInPrintingM
ode. |
| 58 String externalRepresentation(Frame*, RenderAsTextBehavior = RenderAsTextBehavio
rNormal); | 53 String externalRepresentation(Frame*, RenderAsTextBehavior = RenderAsTextBehavio
rNormal); |
| 59 String externalRepresentation(Element*, RenderAsTextBehavior = RenderAsTextBehav
iorNormal); | 54 String externalRepresentation(Element*, RenderAsTextBehavior = RenderAsTextBehav
iorNormal); |
| 60 void write(TextStream&, const RenderObject&, int indent = 0, RenderAsTextBehavio
r = RenderAsTextBehaviorNormal); | 55 void write(TextStream&, const RenderObject&, int indent = 0, RenderAsTextBehavio
r = RenderAsTextBehaviorNormal); |
| 61 void writeIndent(TextStream&, int indent); | |
| 62 | 56 |
| 63 class RenderTreeAsText { | 57 class RenderTreeAsText { |
| 64 // FIXME: This is a cheesy hack to allow easy access to RenderStyle colors. It
won't be needed if we convert | 58 // FIXME: This is a cheesy hack to allow easy access to RenderStyle colors. It
won't be needed if we convert |
| 65 // it to use visitedDependentColor instead. (This just involves rebaselining man
y results though, so for now it's | 59 // it to use visitedDependentColor instead. (This just involves rebaselining man
y results though, so for now it's |
| 66 // not being done). | 60 // not being done). |
| 67 public: | 61 public: |
| 68 static void writeRenderObject(TextStream& ts, const RenderObject& o, RenderAsTex
tBehavior behavior); | 62 static void writeRenderObject(TextStream& ts, const RenderObject& o, RenderAsTex
tBehavior behavior); |
| 69 }; | 63 }; |
| 70 | 64 |
| 71 TextStream& operator<<(TextStream&, const IntPoint&); | |
| 72 TextStream& operator<<(TextStream&, const IntRect&); | |
| 73 TextStream& operator<<(TextStream&, const LayoutPoint&); | |
| 74 TextStream& operator<<(TextStream&, const FloatPoint&); | |
| 75 TextStream& operator<<(TextStream&, const FloatSize&); | |
| 76 | |
| 77 template<typename Item> | |
| 78 TextStream& operator<<(TextStream& ts, const Vector<Item>& vector) | |
| 79 { | |
| 80 ts << "["; | |
| 81 | |
| 82 unsigned size = vector.size(); | |
| 83 for (unsigned i = 0; i < size; ++i) { | |
| 84 ts << vector[i]; | |
| 85 if (i < size - 1) | |
| 86 ts << ", "; | |
| 87 } | |
| 88 | |
| 89 ts << "]"; | |
| 90 return ts; | |
| 91 } | |
| 92 | |
| 93 // Helper function shared with SVGRenderTreeAsText | 65 // Helper function shared with SVGRenderTreeAsText |
| 94 String quoteAndEscapeNonPrintables(const String&); | 66 String quoteAndEscapeNonPrintables(const String&); |
| 95 | 67 |
| 96 String counterValueForElement(Element*); | 68 String counterValueForElement(Element*); |
| 97 | 69 |
| 98 String markerTextForListItem(Element*); | 70 String markerTextForListItem(Element*); |
| 99 | 71 |
| 100 } // namespace WebCore | 72 } // namespace WebCore |
| 101 | 73 |
| 102 #endif // RenderTreeAsText_h | 74 #endif // RenderTreeAsText_h |
| OLD | NEW |