<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[247904] trunk/Tools</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/247904">247904</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2019-07-29 07:40:16 -0700 (Mon, 29 Jul 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Canvas Timeline] Compact canvas timeline
https://bugs.webkit.org/show_bug.cgi?id=200177

Patch by Zhifei Fang <zhifei_fang@apple.com> on 2019-07-29
Reviewed by Jonathan Bedard.

* resultsdbpy/resultsdbpy/view/static/library/js/components/BaseComponents.js:
* resultsdbpy/resultsdbpy/view/static/library/js/components/TimelineComponents.js:
(Timeline.CanvasSeriesComponent):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsresultsdbpyresultsdbpyviewstaticlibraryjscomponentsBaseComponentsjs">trunk/Tools/resultsdbpy/resultsdbpy/view/static/library/js/components/BaseComponents.js</a></li>
<li><a href="#trunkToolsresultsdbpyresultsdbpyviewstaticlibraryjscomponentsTimelineComponentsjs">trunk/Tools/resultsdbpy/resultsdbpy/view/static/library/js/components/TimelineComponents.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (247903 => 247904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2019-07-29 14:33:57 UTC (rev 247903)
+++ trunk/Tools/ChangeLog       2019-07-29 14:40:16 UTC (rev 247904)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2019-07-29  Zhifei Fang  <zhifei_fang@apple.com>
+
+        [Canvas Timeline] Compact canvas timeline
+        https://bugs.webkit.org/show_bug.cgi?id=200177
+
+        Reviewed by Jonathan Bedard.
+
+        * resultsdbpy/resultsdbpy/view/static/library/js/components/BaseComponents.js:
+        * resultsdbpy/resultsdbpy/view/static/library/js/components/TimelineComponents.js:
+        (Timeline.CanvasSeriesComponent):
+
</ins><span class="cx"> 2019-07-29  Carlos Garcia Campos  <cgarcia@igalia.com>
</span><span class="cx"> 
</span><span class="cx">         Multiple context menu actions broken for YouTube videos
</span></span></pre></div>
<a id="trunkToolsresultsdbpyresultsdbpyviewstaticlibraryjscomponentsBaseComponentsjs"></a>
<div class="modfile"><h4>Modified: trunk/Tools/resultsdbpy/resultsdbpy/view/static/library/js/components/BaseComponents.js (247903 => 247904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/resultsdbpy/resultsdbpy/view/static/library/js/components/BaseComponents.js  2019-07-29 14:33:57 UTC (rev 247903)
+++ trunk/Tools/resultsdbpy/resultsdbpy/view/static/library/js/components/BaseComponents.js     2019-07-29 14:40:16 UTC (rev 247904)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx"> import {
</span><span class="cx">     DOM, REF, diff, EventStream, uuidv4
</span><span class="cx"> }
</span><del>-from '../js/Ref.js';
</del><ins>+from '../Ref.js';
</ins><span class="cx"> 
</span><span class="cx"> function ApplyNewChildren(element, oldArray, newArray, childToKeyFunc, itemProcessor) {
</span><span class="cx">     const newChildren = [];
</span></span></pre></div>
<a id="trunkToolsresultsdbpyresultsdbpyviewstaticlibraryjscomponentsTimelineComponentsjs"></a>
<div class="modfile"><h4>Modified: trunk/Tools/resultsdbpy/resultsdbpy/view/static/library/js/components/TimelineComponents.js (247903 => 247904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/resultsdbpy/resultsdbpy/view/static/library/js/components/TimelineComponents.js      2019-07-29 14:33:57 UTC (rev 247903)
+++ trunk/Tools/resultsdbpy/resultsdbpy/view/static/library/js/components/TimelineComponents.js 2019-07-29 14:40:16 UTC (rev 247904)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx"> import {
</span><span class="cx">     DOM, REF, FP, EventStream
</span><span class="cx"> }
</span><del>-from '../js/Ref.js';
</del><ins>+from '../Ref.js';
</ins><span class="cx"> 
</span><span class="cx"> import {isDarkMode} from '../Utils.js';
</span><span class="cx"> import {ListComponent, ListProvider, ListProviderReceiver} from './BaseComponents.js'
</span><span class="lines">@@ -185,10 +185,11 @@
</span><span class="cx">     // Get the css value, this component assume to use with webkit.css
</span><span class="cx">     const computedStyle = getComputedStyle(document.body);
</span><span class="cx">     let radius = parseInt(computedStyle.getPropertyValue('--smallSize')) / 2;
</span><ins>+    let dotMargin = parseInt(computedStyle.getPropertyValue('--tinySize')) / 2;
</ins><span class="cx">     let fontFamily = computedStyle.getPropertyValue('font-family');
</span><span class="cx">     let defaultDotColor = computedStyle.getPropertyValue('--greenLight').trim();
</span><span class="cx">     let defaultEmptyLineColor = computedStyle.getPropertyValue('--grey').trim();
</span><del>-    let defaultFontSize = computedStyle.getPropertyValue('--tinySize');
</del><ins>+    let defaultFontSize = parseInt(computedStyle.getPropertyValue('--tinySize'));
</ins><span class="cx"> 
</span><span class="cx">     // Get configuration
</span><span class="cx">     // Default order is left is biggest
</span><span class="lines">@@ -197,8 +198,10 @@
</span><span class="cx">     const comp = typeof option.compareFunc === "function" ? option.compareFunc : (a, b) => a - b;
</span><span class="cx">     const onDotClick = typeof option.onDotClick === "function" ? option.onDotClick : null;
</span><span class="cx">     const onDotHover = typeof option.onDotHover === "function" ? option.onDotHover : null;
</span><del>-    const height = option.height ? option.height : 2 * radius;
</del><ins>+    const tagHeight = defaultFontSize;
+    const height = option.height ? option.height : 2 * radius + tagHeight;
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx">     // Draw dot api can be used in user defined render function
</span><span class="cx">     const drawDot = (context, x, y, isEmpty, tag = null, useRadius, color, emptylineColor) => {
</span><span class="cx">         useRadius = useRadius ? useRadius : radius;
</span><span class="lines">@@ -206,17 +209,18 @@
</span><span class="cx">         emptylineColor = emptylineColor ? emptylineColor : defaultEmptyLineColor;
</span><span class="cx">             if (!isEmpty) {
</span><span class="cx">                 //Draw the dot
</span><del>-                context.arc(x + 3 * radius, y, radius, 0, 2 * Math.PI);
</del><ins>+                context.arc(x + dotMargin + radius, y, radius, 0, 2 * Math.PI);
</ins><span class="cx">                 context.fillStyle = color;
</span><span class="cx">                 context.fill();
</span><span class="cx">                 if (typeof tag === "number" || typeof tag === "string") {
</span><span class="cx">                     context.font = `${fontFamily} ${defaultFontSize}px`;
</span><del>-                    context.fillText(tag, x + 4 * radius, y + radius);
</del><ins>+                    const tagSize = context.measureText(tag);
+                    context.fillText(tag, x + dotMargin + radius - tagSize.width / 2, radius * 2 + tagSize.emHeightAscent);
</ins><span class="cx">                 }
</span><span class="cx">             } else {
</span><span class="cx">                 context.beginPath();
</span><del>-                context.moveTo(x + 2 * radius, y);
-                context.lineTo(x + 4 * radius, y);
</del><ins>+                context.moveTo(x + dotMargin, y);
+                context.lineTo(x + dotMargin + 2 * radius, y);
</ins><span class="cx">                 context.lineWidth = 1;
</span><span class="cx">                 context.strokeStyle = defaultEmptyLineColor;
</span><span class="cx">                 context.stroke();
</span><span class="lines">@@ -244,9 +248,9 @@
</span><span class="cx">             }));
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    const dotWidth = 3 * 2 * radius;
</del><ins>+    const dotWidth = 2 * (radius + dotMargin);
</ins><span class="cx">     const padding = 100 * dotWidth / getDevicePixelRatio();
</span><del>-    const offscreenCachedRender = offscreenCachedRenderFactory(padding, radius * 2);
</del><ins>+    const offscreenCachedRender = offscreenCachedRenderFactory(padding, height);
</ins><span class="cx"> 
</span><span class="cx">     // Generate the dot cache
</span><span class="cx">     const redrawCache = (offscreenCanvas, element, stateDiff, state, notifyToRender) => {
</span><span class="lines">@@ -338,7 +342,7 @@
</span><span class="cx">             width: 0,
</span><span class="cx">         },
</span><span class="cx">         onElementMount: (element) => {
</span><del>-            setupCanvasHeightWithDpr(element, radius * 2);
</del><ins>+            setupCanvasHeightWithDpr(element, height);
</ins><span class="cx">             setupCanvasContextScale(element);
</span><span class="cx">             if (onDotClick) {
</span><span class="cx">                 element.addEventListener('click', (e) => {
</span><span class="lines">@@ -499,7 +503,7 @@
</span><span class="cx">     const fontRotate = 60 * Math.PI / 180;
</span><span class="cx">     const fontTopRotate = 300 * Math.PI / 180;
</span><span class="cx">     const linkColor = computedStyle.getPropertyValue('--linkColor');
</span><del>-    const scaleWidth = parseInt(computedStyle.getPropertyValue('--smallSize')) * 3;
</del><ins>+    const scaleWidth = parseInt(computedStyle.getPropertyValue('--smallSize')) + parseInt(computedStyle.getPropertyValue('--tinySize'));
</ins><span class="cx">     const scaleTagLineHeight = parseInt(computedStyle.getPropertyValue('--smallSize'));
</span><span class="cx">     const scaleTagLinePadding = 10;
</span><span class="cx">     const scaleBroadLineHeight = parseInt(computedStyle.getPropertyValue('--tinySize')) / 2;
</span></span></pre>
</div>
</div>

</body>
</html>