Changeset 249124 in webkit
- Timestamp:
- Aug 26, 2019, 4:36:50 PM (7 years ago)
- Location:
- trunk/Tools
- Files:
-
- 8 edited
-
ChangeLog (modified) (1 diff)
-
resultsdbpy/resultsdbpy/view/static/js/timeline.js (modified) (8 diffs)
-
resultsdbpy/resultsdbpy/view/static/library/css/docs.yaml (modified) (3 diffs)
-
resultsdbpy/resultsdbpy/view/static/library/css/generate-webkit-css-docs (modified) (3 diffs)
-
resultsdbpy/resultsdbpy/view/static/library/css/index.html (modified) (7 diffs)
-
resultsdbpy/resultsdbpy/view/static/library/css/webkit.css (modified) (4 diffs)
-
resultsdbpy/resultsdbpy/view/static/library/js/components/TimelineComponents.js (modified) (6 diffs)
-
resultsdbpy/resultsdbpy/view/templates/base.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r249116 r249124 1 2019-08-26 Zhifei Fang <zhifei_fang@apple.com> 2 3 [results.webkit.org Timline] Add symbols to the timeline dot 4 https://bugs.webkit.org/show_bug.cgi?id=201105 5 6 Reviewed by Jonathan Bedard. 7 8 * resultsdbpy/resultsdbpy/view/static/js/timeline.js: 9 * resultsdbpy/resultsdbpy/view/static/library/js/components/TimelineComponents.js: 10 (Timeline.CanvasSeriesComponent): Modify the drawDot api to provide user ability to add symbol to the dots, it supports unicode symbol 11 * resultsdbpy/resultsdbpy/view/templates/base.html: Add the encoding UTF-8 for the page, so that we can add unicode symbol to the dots 12 1 13 2019-08-26 Yusuke Suzuki <ysuzuki@apple.com> 2 14 -
trunk/Tools/resultsdbpy/resultsdbpy/view/static/js/timeline.js
r249111 r249124 43 43 PASS: 0x40, 44 44 }; 45 46 const TestResultsSymbolMap = { 47 success: '✓', 48 failed: '𝖷', 49 timedout: '⎋', 50 crashed: '!', 51 } 45 52 46 53 class Expectations … … 544 551 let tag = null; 545 552 let color = colorMap.success; 553 let symbol = TestResultsSymbolMap.success; 546 554 if (data.stats) { 547 555 tag = data.stats[`tests${willFilterExpected ? '_unexpected_' : '_'}failed`]; … … 556 564 557 565 failureTypeOrder.forEach(type => { 558 if (data.stats[`tests${willFilterExpected ? '_unexpected_' : '_'}${type}`] > 0) 566 if (data.stats[`tests${willFilterExpected ? '_unexpected_' : '_'}${type}`] > 0) { 559 567 color = colorMap[type]; 568 symbol = TestResultsSymbolMap[type]; 569 } 560 570 }); 561 571 } else { … … 564 574 resultId = Expectations.stringToStateId(Expectations.unexpectedResults(data.actual, data.expected)); 565 575 failureTypeOrder.forEach(type => { 566 if (Expectations.stringToStateId(failureTypeMapping[type]) >= resultId) 576 if (Expectations.stringToStateId(failureTypeMapping[type]) >= resultId) { 567 577 color = colorMap[type]; 578 symbol = TestResultsSymbolMap[type]; 579 } 568 580 }); 569 581 } 570 582 571 return drawDot(context, x, y, false, tag ? tag : null, false, color);583 return drawDot(context, x, y, false, tag ? tag : null, symbol, false, color); 572 584 }, 573 585 }; … … 791 803 <div class="lengend timeline"> 792 804 <div class="item"> 793 <div class="dot success">< /div>805 <div class="dot success"><div class="text">${TestResultsSymbolMap.success}</div></div> 794 806 ${LegendLabel( 795 807 updateLabelEvents, … … 799 811 </div> 800 812 <div class="item"> 801 <div class="dot failed">< /div>813 <div class="dot failed"><div class="text">${TestResultsSymbolMap.failed}</div></div> 802 814 ${LegendLabel( 803 815 updateLabelEvents, … … 807 819 </div> 808 820 <div class="item"> 809 <div class="dot timeout">< /div>821 <div class="dot timeout"><div class="text">${TestResultsSymbolMap.timedout}</div></div> 810 822 ${LegendLabel( 811 823 updateLabelEvents, … … 815 827 </div> 816 828 <div class="item"> 817 <div class="dot crash">< /div>829 <div class="dot crash"><div class="text">${TestResultsSymbolMap.crashed}</div></div> 818 830 ${LegendLabel( 819 831 updateLabelEvents, -
trunk/Tools/resultsdbpy/resultsdbpy/view/static/library/css/docs.yaml
r249021 r249124 1406 1406 <div class="lengend"> 1407 1407 <div class="item"> 1408 <div class="dot success"></div> 1408 <div class="dot success"> 1409 <div class="text">✓</div> 1410 </div> 1409 1411 <div class="label">Tests Pass</div> 1410 1412 </div> … … 1423 1425 <div class="lengend horizontal"> 1424 1426 <div class="item"> 1425 <div class="dot success"></div> 1427 <div class="dot success"> 1428 <div class="text">✓</div> 1429 </div> 1426 1430 <div class="label">Tests Pass</div> 1427 1431 </div> … … 1440 1444 <div class="lengend timeline"> 1441 1445 <div class="item"> 1442 <div class="dot success"></div> 1446 <div class="dot success"> 1447 <div class="text">✓</div> 1448 </div> 1443 1449 <div class="label">Tests Pass</div> 1444 1450 </div> -
trunk/Tools/resultsdbpy/resultsdbpy/view/static/library/css/generate-webkit-css-docs
r249021 r249124 26 26 import yaml 27 27 import sys 28 import codecs 28 29 29 30 html_template = jinja2.Template(""" … … 36 37 <link rel="shortcut icon" sizes="32x32" type="image/x-icon" href="https://webkit.org/favicon.ico"> 37 38 <meta content="width=device-width, initial-scale=1, viewport-fit=cover" name="viewport"> 39 <meta charset="UTF-8"> 38 40 </head> 39 41 <body> … … 136 138 with open(args.yaml) as input_f: 137 139 docs_cfg = yaml.load(input_f) 138 with open(args.output, 'w') as output_f:140 with codecs.open(args.output, 'w', "utf-8") as output_f: 139 141 output_f.write(html_template.render(sections=docs_cfg)); 140 142 print("Output to {}".format(args.output)) -
trunk/Tools/resultsdbpy/resultsdbpy/view/static/library/css/index.html
r249021 r249124 8 8 <link rel="shortcut icon" sizes="32x32" type="image/x-icon" href="https://webkit.org/favicon.ico"> 9 9 <meta content="width=device-width, initial-scale=1, viewport-fit=cover" name="viewport"> 10 <meta charset="UTF-8"> 10 11 </head> 11 12 <body> … … 3106 3107 <pre><xmp><div class="lengend"> 3107 3108 <div class="item"> 3108 <div class="dot success"></div> 3109 <div class="dot success"> 3110 <div class="text">✓</div> 3111 </div> 3109 3112 <div class="label">Tests Pass</div> 3110 3113 </div> … … 3122 3125 <div class="lengend"> 3123 3126 <div class="item"> 3124 <div class="dot success"></div> 3127 <div class="dot success"> 3128 <div class="text">✓</div> 3129 </div> 3125 3130 <div class="label">Tests Pass</div> 3126 3131 </div> … … 3144 3149 <pre><xmp><div class="lengend horizontal"> 3145 3150 <div class="item"> 3146 <div class="dot success"></div> 3151 <div class="dot success"> 3152 <div class="text">✓</div> 3153 </div> 3147 3154 <div class="label">Tests Pass</div> 3148 3155 </div> … … 3160 3167 <div class="lengend horizontal"> 3161 3168 <div class="item"> 3162 <div class="dot success"></div> 3169 <div class="dot success"> 3170 <div class="text">✓</div> 3171 </div> 3163 3172 <div class="label">Tests Pass</div> 3164 3173 </div> … … 3182 3191 <pre><xmp><div class="lengend timeline"> 3183 3192 <div class="item"> 3184 <div class="dot success"></div> 3193 <div class="dot success"> 3194 <div class="text">✓</div> 3195 </div> 3185 3196 <div class="label">Tests Pass</div> 3186 3197 </div> … … 3198 3209 <div class="lengend timeline"> 3199 3210 <div class="item"> 3200 <div class="dot success"></div> 3211 <div class="dot success"> 3212 <div class="text">✓</div> 3213 </div> 3201 3214 <div class="label">Tests Pass</div> 3202 3215 </div> -
trunk/Tools/resultsdbpy/resultsdbpy/view/static/library/css/webkit.css
r249021 r249124 2129 2129 display: flex; 2130 2130 vertical-align: middle; 2131 align-items: center; 2131 2132 } 2132 2133 2133 2134 .lengend>.item .dot{ 2134 width: var(--tinySize); 2135 height: var(--tinySize); 2136 border-radius: var(--tinySize); 2135 width: var(--smallSize); 2136 height: var(--smallSize); 2137 border-radius: var(--smallSize); 2138 font-size: calc(var(--tinySize)); 2139 text-align: middle; 2137 2140 flex: none; 2138 2141 vertical-align: middle; … … 2140 2143 display: flex; 2141 2144 margin: 0 var(--tinySize); 2145 position: relative; 2146 } 2147 .lengend>.item .dot .text { 2148 font-size: calc(var(--tinySize)); 2149 font-weight: 400; 2150 text-align: center; 2151 width: var(--smallSize); 2152 height: var(--smallSize); 2153 display: inline-block; 2154 -webkit-touch-callout: none; 2155 -webkit-user-select: none; 2156 user-select: none; 2157 cursor: default; 2142 2158 } 2143 2159 .timeline.lengend>.item .dot::before{ 2144 margin-left: calc(0px - var(--tinySize));2160 left: calc(0px - var(--tinySize)); 2145 2161 width: var(--tinySize); 2146 2162 content: ""; … … 2149 2165 display: inline-block; 2150 2166 flex: none; 2167 position: absolute; 2151 2168 } 2152 2169 .timeline.lengend>.item .dot::after{ 2153 margin-left: var(--tinySize);2170 right: calc(0px - var(--tinySize)); 2154 2171 width: var(--tinySize); 2155 2172 content: ""; … … 2158 2175 display: inline-block; 2159 2176 flex: none; 2177 position: absolute; 2160 2178 } 2161 2179 .lengend>.item .label{ 2162 2180 font-size: var(--tinySize); 2163 line-height: 1;2164 2181 padding: 0 4px; 2165 2182 } -
trunk/Tools/resultsdbpy/resultsdbpy/view/static/library/js/components/TimelineComponents.js
r248995 r249124 216 216 let defaultDotColor = computedStyle.getPropertyValue('--greenLight').trim(); 217 217 let defaultEmptyLineColor = computedStyle.getPropertyValue('--grey').trim(); 218 let defaultFontSize = parseInt(computedStyle.getPropertyValue('--tinySize')); 218 let defaultInnerLableColor = computedStyle.getPropertyValue('--white').trim(); 219 let defaultFontSize = 10; 219 220 220 221 // Get configuration … … 229 230 const height = option.height ? option.height : 2 * radius + tagHeight; 230 231 const colorBatchRender = new ColorBatchRender(); 232 let drawLabelsSeqs = []; 231 233 232 234 // Draw dot api can be used in user defined render function 233 const drawDot = (context, x, y, isEmpty, tag = null, useRadius, color, emptylineColor) => {235 const drawDot = (context, x, y, isEmpty, tag = null, innerLabel, useRadius, color, innerLabelColor, emptylineColor) => { 234 236 useRadius = useRadius ? useRadius : radius; 235 237 color = color ? color : defaultDotColor; 236 238 emptylineColor = emptylineColor ? emptylineColor : defaultEmptyLineColor; 239 innerLabelColor = innerLabelColor ? innerLabelColor : defaultInnerLableColor; 240 const fontSize = useRadius * 1.5; 241 const baselineY = y + useRadius; 237 242 if (!isEmpty) { 238 243 // Draw the dot 239 244 colorBatchRender.lazyCreateColorSeqs(color, (context) => { 240 245 context.beginPath(); 246 drawLabelsSeqs = []; 241 247 }, (context, color) => { 242 248 context.fillStyle = color; 243 249 context.fill(); 250 context.font = `${fontSize}px ${fontFamily}`; 251 context.textBaseline = "top"; 252 context.textAlign = "center"; 253 context.fontWeight = 400; 254 context.fillStyle = innerLabelColor; 255 drawLabelsSeqs.forEach(seq => seq()); 244 256 }); 245 257 colorBatchRender.addSeq(color, (context, color) => { 246 context.arc(x + dotMargin + radius, y, radius, 0, 2 * Math.PI); 247 }); 248 258 context.arc(x + dotMargin + useRadius, baselineY, useRadius, 0, 2 * Math.PI); 259 if (typeof innerLabel === "number" || typeof innerLabel === "string") { 260 drawLabelsSeqs.push(() => { 261 // Draw the inner label 262 const innerLabelSize = context.measureText(innerLabel); 263 const fontHeight = innerLabelSize.fontBoundingBoxAscent + innerLabelSize.fontBoundingBoxDescent; 264 const actualHeight = innerLabelSize.actualBoundingBoxAscent + innerLabelSize.actualBoundingBoxDescent; 265 const realStartGap = innerLabelSize.fontBoundingBoxAscent - innerLabelSize.actualBoundingBoxAscent; 266 context.fillText(innerLabel, x + dotMargin + useRadius, y - realStartGap + useRadius - (actualHeight < fontHeight ? actualHeight : fontHeight) / 2); 267 }); 268 } 269 }); 249 270 } else { 250 271 // Draw the empty … … 256 277 }); 257 278 colorBatchRender.addSeq(emptylineColor, (context) => { 258 context.moveTo(x + dotMargin, y);259 context.lineTo(x + dotMargin + 2 * radius, y);279 context.moveTo(x + dotMargin, baselineY); 280 context.lineTo(x + dotMargin + 2 * useRadius, baselineY); 260 281 context.lineWidth = 1; 261 282 }); … … 264 285 // Draw the tag 265 286 if (typeof tag === "number" || typeof tag === "string") { 266 context.font = `${ fontFamily} ${defaultFontSize}px`;287 context.font = `${defaultFontSize}px ${fontFamily}`; 267 288 context.fillStyle = color; 268 const tagSize = context.measureText(tag); 269 context.fillText(tag, x + dotMargin + radius - tagSize.width / 2, radius * 2 + tagSize.emHeightAscent); 270 } 289 context.textAlign = "center"; 290 context.textBaseline = "top"; 291 context.fillText(tag, x + dotMargin + radius, baselineY + useRadius); 292 } 293 271 294 }; 272 295 const render = typeof option.renderFactory === "function" ? option.renderFactory(drawDot) : (dot, context, x, y) => drawDot(context, x, y, !dot); … … 350 373 let x = i * dotWidth - scrollLeft; 351 374 if (currentDotIndex < dots.length && comp(scales[i], getScale(dots[currentDotIndex])) === 0) { 352 render(dots[currentDotIndex], context, x, radius);375 render(dots[currentDotIndex], context, x, 0); 353 376 dots[currentDotIndex]._dotCenter = {x: x + dotMargin + radius, y: radius}; 354 377 dots[currentDotIndex]._cachedScrollLeft = scrollLeft; … … 356 379 currentDotIndex += 1; 357 380 } else 358 render(null, context, x, radius);381 render(null, context, x, 0); 359 382 } 360 383 colorBatchRender.batchRender(context); -
trunk/Tools/resultsdbpy/resultsdbpy/view/templates/base.html
r248859 r249124 28 28 <head> 29 29 <title>{{title}}</title> 30 <meta content="width=device-width, initial-scale=1, viewport-fit=cover" name="viewport"> 31 <meta charset="UTF-8"> 30 32 <link rel="stylesheet" type="text/css" href="/library/css/webkit.css"> 31 33 {% block head %}{% endblock %}
Note:
See TracChangeset
for help on using the changeset viewer.