Changeset 219216 in webkit
- Timestamp:
- Jul 6, 2017 2:13:24 PM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r219215 r219216 1 2017-07-06 Zalan Bujtas <zalan@apple.com> 2 3 Use WTFLogAlways for debug logging so that it shows up in device system logs 4 https://bugs.webkit.org/show_bug.cgi?id=173450 5 6 Reviewed by Simon Fraser. 7 8 If you want to showRenderTree() on-device, the result doesn't show in system log so you can't see it. 9 Switch to WTFLogAlways to fix this, for showRenderTree and its dependencies. 10 11 * platform/text/TextStream.cpp: 12 (WebCore::writeIndent): 13 * rendering/InlineBox.cpp: 14 (WebCore::InlineBox::showLineTreeAndMark): 15 (WebCore::InlineBox::showLineBox): 16 * rendering/InlineBox.h: 17 * rendering/InlineFlowBox.cpp: 18 (WebCore::InlineFlowBox::showLineTreeAndMark): 19 * rendering/InlineFlowBox.h: 20 * rendering/InlineTextBox.cpp: 21 (WebCore::InlineTextBox::showLineBox): 22 * rendering/InlineTextBox.h: 23 * rendering/RenderBlockFlow.cpp: 24 (WebCore::RenderBlockFlow::showLineTreeAndMark): 25 * rendering/RenderBlockFlow.h: 26 * rendering/RenderObject.cpp: 27 (WebCore::showRenderTreeLegend): 28 (WebCore::RenderObject::showRenderTreeForThis): 29 (WebCore::RenderObject::showLineTreeForThis): 30 (WebCore::RenderObject::showRegionsInformation): 31 (WebCore::RenderObject::showRenderObject): 32 (WebCore::RenderObject::showRenderSubTreeAndMark): 33 * rendering/RenderObject.h: 34 * rendering/SimpleLineLayoutFunctions.cpp: 35 (WebCore::SimpleLineLayout::printPrefix): 36 (WebCore::SimpleLineLayout::showLineLayoutForFlow): 37 * rendering/SimpleLineLayoutFunctions.h: 38 1 39 2017-07-06 Myles C. Maxfield <mmaxfield@apple.com> 2 40 -
trunk/Source/WebCore/platform/text/TextStream.cpp
r208466 r219216 187 187 void writeIndent(TextStream& ts, int indent) 188 188 { 189 for (int i = 0; i !=indent; ++i)189 for (int i = 0; i < indent; ++i) 190 190 ts << " "; 191 191 } -
trunk/Source/WebCore/rendering/InlineBox.cpp
r218879 r219216 28 28 #include "RenderLineBreak.h" 29 29 #include "RootInlineBox.h" 30 #include "TextStream.h" 30 31 31 32 #if ENABLE(TREE_DEBUGGING) … … 101 102 } 102 103 103 void InlineBox:: showLineTreeAndMark(const InlineBox* markedBox, int depth) const104 { 105 showLineBox(markedBox == this, depth);106 } 107 108 void InlineBox:: showLineBox(bool mark, int depth) const109 { 110 fprintf(stderr, "-------- %c-", isDirty() ? 'D' : '-');104 void InlineBox::outputLineTreeAndMark(TextStream& stream, const InlineBox* markedBox, int depth) const 105 { 106 outputLineBox(stream, markedBox == this, depth); 107 } 108 109 void InlineBox::outputLineBox(TextStream& stream, bool mark, int depth) const 110 { 111 stream << "-------- " << (isDirty() ? "D" : "-") << "-"; 111 112 int printedCharacters = 0; 112 113 if (mark) { 113 fprintf(stderr, "*");114 stream << "*"; 114 115 ++printedCharacters; 115 116 } 116 117 while (++printedCharacters <= depth * 2) 117 fputc(' ', stderr); 118 fprintf(stderr, "%s (%.2f, %.2f) (%.2f, %.2f) (%p) renderer->(%p)\n", boxName(), x(), y(), width(), height(), this, &renderer()); 118 stream << " "; 119 stream << boxName() << " " << FloatRect(x(), y(), width(), height()) << " (" << this << ") renderer->(" << &renderer() << ")"; 120 stream.nextLine(); 119 121 } 120 122 -
trunk/Source/WebCore/rendering/InlineBox.h
r218950 r219216 77 77 void showLineTreeForThis() const; 78 78 79 virtual void showLineTreeAndMark(const InlineBox* markedBox, int depth) const;80 virtual void showLineBox(bool mark, int depth) const;79 virtual void outputLineTreeAndMark(TextStream&, const InlineBox* markedBox, int depth) const; 80 virtual void outputLineBox(TextStream&, bool mark, int depth) const; 81 81 virtual const char* boxName() const; 82 82 #endif -
trunk/Source/WebCore/rendering/InlineFlowBox.cpp
r213634 r219216 1736 1736 } 1737 1737 1738 void InlineFlowBox:: showLineTreeAndMark(const InlineBox* markedBox, int depth) const1739 { 1740 InlineBox:: showLineTreeAndMark(markedBox, depth);1738 void InlineFlowBox::outputLineTreeAndMark(TextStream& stream, const InlineBox* markedBox, int depth) const 1739 { 1740 InlineBox::outputLineTreeAndMark(stream, markedBox, depth); 1741 1741 for (const InlineBox* box = firstChild(); box; box = box->nextOnLine()) 1742 box-> showLineTreeAndMark(markedBox, depth + 1);1742 box->outputLineTreeAndMark(stream, markedBox, depth + 1); 1743 1743 } 1744 1744 -
trunk/Source/WebCore/rendering/InlineFlowBox.h
r210758 r219216 72 72 73 73 #if ENABLE(TREE_DEBUGGING) 74 void showLineTreeAndMark(const InlineBox* markedBox, int depth) const override;74 void outputLineTreeAndMark(TextStream&, const InlineBox* markedBox, int depth) const override; 75 75 const char* boxName() const override; 76 76 #endif -
trunk/Source/WebCore/rendering/InlineTextBox.cpp
r219199 r219216 49 49 #include "TextPaintStyle.h" 50 50 #include "TextPainter.h" 51 #include "TextStream.h" 51 52 #include <stdio.h> 52 53 #include <wtf/text/CString.h> … … 1124 1125 } 1125 1126 1126 void InlineTextBox:: showLineBox(bool mark, int depth) const1127 { 1128 fprintf(stderr, "-------- %c-", isDirty() ? 'D' : '-');1127 void InlineTextBox::outputLineBox(TextStream& stream, bool mark, int depth) const 1128 { 1129 stream << "-------- " << (isDirty() ? "D" : "-") << "-"; 1129 1130 1130 1131 int printedCharacters = 0; 1131 1132 if (mark) { 1132 fprintf(stderr, "*");1133 stream << "*"; 1133 1134 ++printedCharacters; 1134 1135 } 1135 1136 while (++printedCharacters <= depth * 2) 1136 fputc(' ', stderr);1137 stream << " "; 1137 1138 1138 1139 String value = renderer().text(); … … 1140 1141 value.replaceWithLiteral('\\', "\\\\"); 1141 1142 value.replaceWithLiteral('\n', "\\n"); 1142 fprintf(stderr, "%s (%.2f, %.2f) (%.2f, %.2f) (%p) renderer->(%p) run(%d, %d) \"%s\"\n", boxName(), x(), y(), width(), height(), this, &renderer(), start(), start() + len(), value.utf8().data()); 1143 stream << boxName() << " " << FloatRect(x(), y(), width(), height()) << " (" << this << ") renderer->(" << &renderer() << ") run(" << start() << ", " << start() + len() << ") \"" << value.utf8().data() << "\""; 1144 stream.nextLine(); 1143 1145 } 1144 1146 -
trunk/Source/WebCore/rendering/InlineTextBox.h
r213614 r219216 98 98 99 99 #if ENABLE(TREE_DEBUGGING) 100 void showLineBox(bool mark, int depth) const final;100 void outputLineBox(TextStream&, bool mark, int depth) const final; 101 101 const char* boxName() const final; 102 102 #endif -
trunk/Source/WebCore/rendering/RenderBlockFlow.cpp
r217848 r219216 3770 3770 3771 3771 #if ENABLE(TREE_DEBUGGING) 3772 void RenderBlockFlow:: showLineTreeAndMark(const InlineBox* markedBox, int depth) const3772 void RenderBlockFlow::outputLineTreeAndMark(TextStream& stream, const InlineBox* markedBox, int depth) const 3773 3773 { 3774 3774 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRootBox()) 3775 root-> showLineTreeAndMark(markedBox, depth);3775 root->outputLineTreeAndMark(stream, markedBox, depth); 3776 3776 3777 3777 if (auto simpleLineLayout = this->simpleLineLayout()) 3778 SimpleLineLayout:: showLineLayoutForFlow(*this, *simpleLineLayout, depth);3778 SimpleLineLayout::outputLineLayoutForFlow(stream, *this, *simpleLineLayout, depth); 3779 3779 } 3780 3780 #endif -
trunk/Source/WebCore/rendering/RenderBlockFlow.h
r214110 r219216 373 373 374 374 #if ENABLE(TREE_DEBUGGING) 375 void showLineTreeAndMark(const InlineBox* markedBox, int depth) const;375 void outputLineTreeAndMark(TextStream&, const InlineBox* markedBox, int depth) const; 376 376 #endif 377 377 -
trunk/Source/WebCore/rendering/RenderObject.cpp
r218879 r219216 70 70 #include "SVGRenderSupport.h" 71 71 #include "StyleResolver.h" 72 #include "TextStream.h" 72 73 #include "TransformState.h" 73 74 #include <algorithm> … … 1008 1009 #if ENABLE(TREE_DEBUGGING) 1009 1010 1010 static void showRenderTreeLegend() 1011 { 1012 fprintf(stderr, "\n(B)lock/(I)nline/I(N)line-block, (A)bsolute/Fi(X)ed/(R)elative/Stic(K)y, (F)loating, (O)verflow clip, Anon(Y)mous, (G)enerated, has(L)ayer, (C)omposited, (+)Dirty style, (+)Dirty layout\n"); 1011 static void outputRenderTreeLegend(TextStream& stream) 1012 { 1013 stream.nextLine(); 1014 stream << "(B)lock/(I)nline/I(N)line-block, (A)bsolute/Fi(X)ed/(R)elative/Stic(K)y, (F)loating, (O)verflow clip, Anon(Y)mous, (G)enerated, has(L)ayer, (C)omposited, (+)Dirty style, (+)Dirty layout"; 1015 stream.nextLine(); 1013 1016 } 1014 1017 … … 1025 1028 while (root->parent()) 1026 1029 root = root->parent(); 1027 showRenderTreeLegend(); 1028 root->showRenderSubTreeAndMark(this, 1); 1030 TextStream stream(TextStream::LineMode::MultipleLine, TextStream::Formatting::SVGStyleRect); 1031 outputRenderTreeLegend(stream); 1032 root->outputRenderSubTreeAndMark(stream, this, 1); 1033 WTFLogAlways("%s", stream.release().utf8().data()); 1029 1034 } 1030 1035 … … 1033 1038 if (!is<RenderBlockFlow>(*this)) 1034 1039 return; 1035 showRenderTreeLegend(); 1036 showRenderObject(false, 1); 1037 downcast<RenderBlockFlow>(*this).showLineTreeAndMark(nullptr, 2); 1040 TextStream stream(TextStream::LineMode::MultipleLine, TextStream::Formatting::SVGStyleRect); 1041 outputRenderTreeLegend(stream); 1042 outputRenderObject(stream, false, 1); 1043 downcast<RenderBlockFlow>(*this).outputLineTreeAndMark(stream, nullptr, 2); 1044 WTFLogAlways("%s", stream.release().utf8().data()); 1038 1045 } 1039 1046 … … 1055 1062 } 1056 1063 1057 void RenderObject:: showRegionsInformation() const1064 void RenderObject::outputRegionsInformation(TextStream& stream) const 1058 1065 { 1059 1066 const RenderFlowThread* ftcb = flowThreadContainingBlockFromRenderer(this); … … 1073 1080 RenderRegion* endRegion = nullptr; 1074 1081 ftcb->getRegionRangeForBox(downcast<RenderBox>(this), startRegion, endRegion); 1075 fprintf(stderr, " [Rs:%p Re:%p]", startRegion, endRegion);1076 } 1077 1078 void RenderObject:: showRenderObject(bool mark, int depth) const1082 stream << " [Rs:" << startRegion << " Re:" << endRegion << "]"; 1083 } 1084 1085 void RenderObject::outputRenderObject(TextStream& stream, bool mark, int depth) const 1079 1086 { 1080 1087 if (isInlineBlockOrInlineTable()) 1081 fputc('N', stderr);1088 stream << "N"; 1082 1089 else if (isInline()) 1083 fputc('I', stderr);1090 stream << "I"; 1084 1091 else 1085 fputc('B', stderr);1086 1092 stream << "B"; 1093 1087 1094 if (isPositioned()) { 1088 1095 if (isRelPositioned()) 1089 fputc('R', stderr);1096 stream << "R"; 1090 1097 else if (isStickyPositioned()) 1091 fputc('K', stderr);1098 stream << "K"; 1092 1099 else if (isOutOfFlowPositioned()) { 1093 1100 if (style().position() == AbsolutePosition) 1094 fputc('A', stderr);1101 stream << "A"; 1095 1102 else 1096 fputc('X', stderr);1103 stream << "X"; 1097 1104 } 1098 1105 } else 1099 fputc('-', stderr);1106 stream << "-"; 1100 1107 1101 1108 if (isFloating()) 1102 fputc('F', stderr);1109 stream << "F"; 1103 1110 else 1104 fputc('-', stderr);1111 stream << "-"; 1105 1112 1106 1113 if (hasOverflowClip()) 1107 fputc('O', stderr);1114 stream << "O"; 1108 1115 else 1109 fputc('-', stderr);1116 stream << "-"; 1110 1117 1111 1118 if (isAnonymous()) 1112 fputc('Y', stderr);1119 stream << "Y"; 1113 1120 else 1114 fputc('-', stderr);1121 stream << "-"; 1115 1122 1116 1123 if (isPseudoElement() || isAnonymous()) 1117 fputc('G', stderr);1124 stream << "G"; 1118 1125 else 1119 fputc('-', stderr);1126 stream << "-"; 1120 1127 1121 1128 if (hasLayer()) 1122 fputc('L', stderr);1129 stream << "L"; 1123 1130 else 1124 fputc('-', stderr);1131 stream << "-"; 1125 1132 1126 1133 if (isComposited()) 1127 fputc('C', stderr);1134 stream << "C"; 1128 1135 else 1129 fputc('-', stderr);1130 1131 fputc(' ', stderr);1136 stream << "-"; 1137 1138 stream << " "; 1132 1139 1133 1140 if (node() && node()->needsStyleRecalc()) 1134 fputc('+', stderr);1141 stream << "+"; 1135 1142 else 1136 fputc('-', stderr);1143 stream << "-"; 1137 1144 1138 1145 if (needsLayout()) 1139 fputc('+', stderr);1146 stream << "+"; 1140 1147 else 1141 fputc('-', stderr);1148 stream << "-"; 1142 1149 1143 1150 int printedCharacters = 0; 1144 1151 if (mark) { 1145 fprintf(stderr, "*");1152 stream << "*"; 1146 1153 ++printedCharacters; 1147 1154 } 1148 1155 1149 1156 while (++printedCharacters <= depth * 2) 1150 fputc(' ', stderr);1157 stream << " "; 1151 1158 1152 1159 if (node()) 1153 fprintf(stderr, "%s ", node()->nodeName().utf8().data());1160 stream << node()->nodeName().utf8().data() << " "; 1154 1161 1155 1162 String name = renderName(); … … 1157 1164 int pos = name.find('('); 1158 1165 if (pos > 0) 1159 fprintf(stderr, "%s", name.left(pos - 1).utf8().data());1166 stream << name.left(pos - 1).utf8().data(); 1160 1167 else 1161 fprintf(stderr, "%s", name.utf8().data());1168 stream << name.utf8().data(); 1162 1169 1163 1170 if (is<RenderBox>(*this)) { … … 1166 1173 if (renderBox.isInFlowPositioned()) 1167 1174 boxRect.move(renderBox.offsetForInFlowPosition()); 1168 fprintf(stderr, " (%.2f, %.2f) (%.2f, %.2f)", boxRect.x(), boxRect.y(), boxRect.width(), boxRect.height());1175 stream << " " << boxRect; 1169 1176 } else if (is<RenderInline>(*this) && isInFlowPositioned()) { 1170 1177 FloatSize inlineOffset = downcast<RenderInline>(*this).offsetForInFlowPosition(); 1171 fprintf(stderr, " (%.2f, %.2f)", inlineOffset.width(), inlineOffset.height());1172 } 1173 1174 fprintf(stderr, " renderer->(%p)", this);1178 stream << " (" << inlineOffset.width() << ", " << inlineOffset.height() << ")"; 1179 } 1180 1181 stream << " renderer->(" << this << ")"; 1175 1182 if (node()) { 1176 fprintf(stderr, " node->(%p)", node());1183 stream << " node->(" << node() << ")"; 1177 1184 if (node()->isTextNode()) { 1178 1185 String value = node()->nodeValue(); 1179 fprintf(stderr, " length->(%u)", value.length());1186 stream << " length->(" << value.length() << ")"; 1180 1187 1181 1188 value.replaceWithLiteral('\\', "\\\\"); … … 1185 1192 if (value.length() > maxPrintedLength) { 1186 1193 String substring = value.substring(0, maxPrintedLength); 1187 fprintf(stderr, " \"%s\"...", substring.utf8().data());1194 stream << " \"" << substring.utf8().data() << "\"..."; 1188 1195 } else 1189 fprintf(stderr, " \"%s\"", value.utf8().data());1196 stream << " \"" << value.utf8().data() << "\""; 1190 1197 } 1191 1198 } … … 1193 1200 auto& renderer = downcast<RenderBoxModelObject>(*this); 1194 1201 if (renderer.hasContinuation()) 1195 fprintf(stderr, " continuation->(%p)", renderer.continuation());1196 } 1197 showRegionsInformation();1202 stream << " continuation->(" << renderer.continuation() << ")"; 1203 } 1204 outputRegionsInformation(stream); 1198 1205 if (needsLayout()) { 1199 fprintf(stderr, " layout->");1206 stream << " layout->"; 1200 1207 if (selfNeedsLayout()) 1201 fprintf(stderr, "[self]");1208 stream << "[self]"; 1202 1209 if (normalChildNeedsLayout()) 1203 fprintf(stderr, "[normal child]");1210 stream << "[normal child]"; 1204 1211 if (posChildNeedsLayout()) 1205 fprintf(stderr, "[positioned child]");1212 stream << "[positioned child]"; 1206 1213 if (needsSimplifiedNormalFlowLayout()) 1207 fprintf(stderr, "[simplified]");1214 stream << "[simplified]"; 1208 1215 if (needsPositionedMovementLayout()) 1209 fprintf(stderr, "[positioned movement]");1210 } 1211 fprintf(stderr, "\n");1212 } 1213 1214 void RenderObject:: showRenderSubTreeAndMark(const RenderObject* markedObject, int depth) const1215 { 1216 showRenderObject(markedObject == this, depth);1216 stream << "[positioned movement]"; 1217 } 1218 stream.nextLine(); 1219 } 1220 1221 void RenderObject::outputRenderSubTreeAndMark(TextStream& stream, const RenderObject* markedObject, int depth) const 1222 { 1223 outputRenderObject(stream, markedObject == this, depth); 1217 1224 if (is<RenderBlockFlow>(*this)) 1218 downcast<RenderBlockFlow>(*this). showLineTreeAndMark(nullptr, depth + 1);1219 1220 for ( const RenderObject* child = firstChildSlow(); child; child = child->nextSibling())1221 child-> showRenderSubTreeAndMark(markedObject, depth + 1);1225 downcast<RenderBlockFlow>(*this).outputLineTreeAndMark(stream, nullptr, depth + 1); 1226 1227 for (auto* child = firstChildSlow(); child; child = child->nextSibling()) 1228 child->outputRenderSubTreeAndMark(stream, markedObject, depth + 1); 1222 1229 } 1223 1230 -
trunk/Source/WebCore/rendering/RenderObject.h
r218793 r219216 206 206 void showLineTreeForThis() const; 207 207 208 void showRenderObject(bool mark, int depth) const;209 void showRenderSubTreeAndMark(const RenderObject* markedObject, int depth) const;210 void showRegionsInformation() const;208 void outputRenderObject(TextStream&, bool mark, int depth) const; 209 void outputRenderSubTreeAndMark(TextStream&, const RenderObject* markedObject, int depth) const; 210 void outputRegionsInformation(TextStream&) const; 211 211 #endif 212 212 -
trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp
r218879 r219216 47 47 #include "TextPaintStyle.h" 48 48 #include "TextPainter.h" 49 #include "TextStream.h" 49 50 50 51 #if ENABLE(TREE_DEBUGGING) … … 262 263 263 264 #if ENABLE(TREE_DEBUGGING) 264 static void printPrefix( int& printedCharacters, int depth)265 { 266 fprintf(stderr, "-------- --");265 static void printPrefix(TextStream& stream, int& printedCharacters, int depth) 266 { 267 stream << "-------- --"; 267 268 printedCharacters = 0; 268 269 while (++printedCharacters <= depth * 2) 269 fputc(' ', stderr);270 } 271 272 void showLineLayoutForFlow(const RenderBlockFlow& flow, const Layout& layout, int depth)270 stream << " "; 271 } 272 273 void outputLineLayoutForFlow(TextStream& stream, const RenderBlockFlow& flow, const Layout& layout, int depth) 273 274 { 274 275 int printedCharacters = 0; 275 printPrefix(printedCharacters, depth); 276 277 fprintf(stderr, "SimpleLineLayout (%u lines, %u runs) (%p)\n", layout.lineCount(), layout.runCount(), &layout); 276 printPrefix(stream, printedCharacters, depth); 277 278 stream << "SimpleLineLayout (" << layout.lineCount() << " lines, " << layout.runCount() << " runs) (" << &layout << ")"; 279 stream.nextLine(); 278 280 ++depth; 279 281 280 282 for (auto run : runResolver(flow, layout)) { 281 283 FloatRect rect = run.rect(); 282 printPrefix( printedCharacters, depth);284 printPrefix(stream, printedCharacters, depth); 283 285 if (run.start() < run.end()) { 284 fprintf(stderr, "line %u run(%u, %u) (%.2f, %.2f) (%.2f, %.2f) \"%s\"\n", run.lineIndex(), run.start(), run.end(), 285 rect.x(), rect.y(), rect.width(), rect.height(), run.text().toStringWithoutCopying().utf8().data()); 286 stream << "line " << run.lineIndex() << " run(" << run.start() << ", " << run.end() << ") " << rect << " \"" << run.text().toStringWithoutCopying().utf8().data() << "\""; 286 287 } else { 287 288 ASSERT(run.start() == run.end()); 288 fprintf(stderr, "line break %u run(%u, %u) (%.2f, %.2f) (%.2f, %.2f)\n", run.lineIndex(), run.start(), run.end(), rect.x(), rect.y(), rect.width(), rect.height()); 289 } 290 } 289 stream << "line break " << run.lineIndex() << " run(" << run.start() << ", " << run.end() << ") " << rect; 290 } 291 } 292 stream.nextLine(); 291 293 } 292 294 #endif -
trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.h
r218793 r219216 68 68 69 69 #if ENABLE(TREE_DEBUGGING) 70 void showLineLayoutForFlow(const RenderBlockFlow&, const Layout&, int depth);70 void outputLineLayoutForFlow(TextStream&, const RenderBlockFlow&, const Layout&, int depth); 71 71 #endif 72 72
Note: See TracChangeset
for help on using the changeset viewer.