Title: [248134] trunk/Tools
Revision
248134
Author
[email protected]
Date
2019-08-01 14:45:42 -0700 (Thu, 01 Aug 2019)

Log Message

[results.webkit.org] Timeline.CanvasXAxisComponent height should be defined by option
https://bugs.webkit.org/show_bug.cgi?id=200321

Patch by Zhifei Fang <[email protected]> on 2019-08-01
Reviewed by Jonathan Bedard.

*resultsdbpy/resultsdbpy/view/static/library/js/components/TimelineComponents.js:
Let the axis' height be defined in the option. Timeine component will use this value as
padding-top for headers which allows headers start in the right position, even with multiple
top axises.
(Timeline.CanvasSeriesComponent):
(prototype.Timeline.CanvasContainer):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (248133 => 248134)


--- trunk/Tools/ChangeLog	2019-08-01 21:30:39 UTC (rev 248133)
+++ trunk/Tools/ChangeLog	2019-08-01 21:45:42 UTC (rev 248134)
@@ -1,5 +1,19 @@
 2019-08-01  Zhifei Fang  <[email protected]>
 
+        [results.webkit.org] Timeline.CanvasXAxisComponent height should be defined by option
+        https://bugs.webkit.org/show_bug.cgi?id=200321
+
+        Reviewed by Jonathan Bedard.
+
+        *resultsdbpy/resultsdbpy/view/static/library/js/components/TimelineComponents.js:
+        Let the axis' height be defined in the option. Timeine component will use this value as 
+        padding-top for headers which allows headers start in the right position, even with multiple 
+        top axises.
+        (Timeline.CanvasSeriesComponent):
+        (prototype.Timeline.CanvasContainer):
+
+2019-08-01  Zhifei Fang  <[email protected]>
+
         results.webkit.org: Collision detection for dots is off by 2 * dotMargin
         https://bugs.webkit.org/show_bug.cgi?id=200347
 

Modified: trunk/Tools/resultsdbpy/resultsdbpy/view/static/library/js/components/TimelineComponents.js (248133 => 248134)


--- trunk/Tools/resultsdbpy/resultsdbpy/view/static/library/js/components/TimelineComponents.js	2019-08-01 21:30:39 UTC (rev 248133)
+++ trunk/Tools/resultsdbpy/resultsdbpy/view/static/library/js/components/TimelineComponents.js	2019-08-01 21:45:42 UTC (rev 248134)
@@ -509,7 +509,7 @@
     const scaleTagLinePadding = 10;
     const scaleBroadLineHeight = parseInt(computedStyle.getPropertyValue('--tinySize')) / 2;
     const maxinumTextHeight = scaleWidth * 4.5;
-    const canvasHeight = parseInt(computedStyle.getPropertyValue('--smallSize')) * 4;
+    const canvasHeight = typeof option.height === "number" ? option.height : parseInt(computedStyle.getPropertyValue('--smallSize')) * 5;
     const sqrt3 = Math.sqrt(3);
 
     const drawScale = (scaleLabel, group, context, x, y, isHoverable, lineColor, groupColor) => {
@@ -732,12 +732,14 @@
                 <canvas ref="${canvasRef}">
             </div>`;
         }),
-        isAxis: true // Mark self as an axis
+        isAxis: true, // Mark self as an axis,
+        height: canvasHeight, // Expose Height to parent
     };
 }
 
 Timeline.CanvasContainer = (exporter, ...children) => {
-    const hasTopXAxis = children[0].isAxis;
+    let headerAxisPlaceHolderHeight = 0;
+    let topAxis = true;
     const upackChildren = (children) => {
         const headers = [];
         const serieses = [];
@@ -749,6 +751,10 @@
             if (child.header)
                 headers.push(child.header);
             serieses.push(child.series);
+            if (child.isAxis && topAxis)
+                headerAxisPlaceHolderHeight += child.height;
+            else if (topAxis)
+                topAxis = false;
         });
         return {headers, serieses};
     };
@@ -763,7 +769,7 @@
     }));
     return (
         `<div class="timeline">
-            <div class="header ${hasTopXAxis ? "with-top-x-axis" : ""}">
+            <div class="header" style="padding-top:${headerAxisPlaceHolderHeight}px">
                 ${ListComponent(composer, ...headers)}
             </div>
             ${XScrollableCanvasProvider(composer, ...serieses)}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to