Title: [240872] trunk/Source/WebInspectorUI
- Revision
- 240872
- Author
- [email protected]
- Date
- 2019-02-01 13:40:25 -0800 (Fri, 01 Feb 2019)
Log Message
Web Inspector: Make WI.ColumnChart a WI.View subclass
https://bugs.webkit.org/show_bug.cgi?id=194171
Rubber-stamped by Devin Rousso.
* UserInterface/Views/CPUTimelineOverviewGraph.js:
(WI.CPUTimelineOverviewGraph):
* UserInterface/Views/ColumnChart.js:
(WI.ColumnChart):
(WI.ColumnChart.prototype.set size):
(WI.ColumnChart.prototype.layout):
(WI.ColumnChart.prototype.get element): Deleted.
(WI.ColumnChart.prototype.needsLayout): Deleted.
(WI.ColumnChart.prototype.updateLayout): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (240871 => 240872)
--- trunk/Source/WebInspectorUI/ChangeLog 2019-02-01 21:24:20 UTC (rev 240871)
+++ trunk/Source/WebInspectorUI/ChangeLog 2019-02-01 21:40:25 UTC (rev 240872)
@@ -1,5 +1,22 @@
2019-02-01 Joseph Pecoraro <[email protected]>
+ Web Inspector: Make WI.ColumnChart a WI.View subclass
+ https://bugs.webkit.org/show_bug.cgi?id=194171
+
+ Rubber-stamped by Devin Rousso.
+
+ * UserInterface/Views/CPUTimelineOverviewGraph.js:
+ (WI.CPUTimelineOverviewGraph):
+ * UserInterface/Views/ColumnChart.js:
+ (WI.ColumnChart):
+ (WI.ColumnChart.prototype.set size):
+ (WI.ColumnChart.prototype.layout):
+ (WI.ColumnChart.prototype.get element): Deleted.
+ (WI.ColumnChart.prototype.needsLayout): Deleted.
+ (WI.ColumnChart.prototype.updateLayout): Deleted.
+
+2019-02-01 Joseph Pecoraro <[email protected]>
+
Web Inspector: Make WI.StackedLineChart a WI.View subclass
https://bugs.webkit.org/show_bug.cgi?id=194119
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CPUTimelineOverviewGraph.js (240871 => 240872)
--- trunk/Source/WebInspectorUI/UserInterface/Views/CPUTimelineOverviewGraph.js 2019-02-01 21:24:20 UTC (rev 240871)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CPUTimelineOverviewGraph.js 2019-02-01 21:40:25 UTC (rev 240872)
@@ -39,6 +39,7 @@
let size = new WI.Size(0, this.height);
this._chart = new WI.ColumnChart(size);
+ this.addSubview(this._chart);
this.element.appendChild(this._chart.element);
this._legendElement = this.element.appendChild(document.createElement("div"));
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ColumnChart.js (240871 => 240872)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ColumnChart.js 2019-02-01 21:24:20 UTC (rev 240871)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ColumnChart.js 2019-02-01 21:40:25 UTC (rev 240872)
@@ -32,8 +32,8 @@
//
// - There is a single rect for each bar.
//
-// <div class="line-chart">
-// <svg width="800" height="75" viewbox="0 0 800 75">
+// <div class="column-chart">
+// <svg viewBox="0 0 800 75">
// <rect width="<w>" height="<h>" transform="translate(<x>, <y>)" />
// <rect width="<w>" height="<h>" transform="translate(<x>, <y>)" />
// ...
@@ -40,15 +40,17 @@
// </svg>
// </div>
-WI.ColumnChart = class ColumnChart
+WI.ColumnChart = class ColumnChart extends WI.View
{
constructor(size)
{
- this._element = document.createElement("div");
- this._element.classList.add("column-chart");
+ super();
- this._svgElement = this._element.appendChild(createSVGElement("svg"));
+ this.element.classList.add("column-chart");
+ this._svgElement = this.element.appendChild(createSVGElement("svg"));
+ this._svgElement.setAttribute("preserveAspectRatio", "none");
+
this._columns = [];
this.size = size;
}
@@ -55,8 +57,6 @@
// Public
- get element() { return this._element; }
-
get size()
{
return this._size;
@@ -66,9 +66,7 @@
{
this._size = size;
- this._svgElement.setAttribute("width", size.width);
- this._svgElement.setAttribute("height", size.height);
- this._svgElement.setAttribute("viewbox", `0 0 ${size.width} ${size.height}`);
+ this._svgElement.setAttribute("viewBox", `0 0 ${size.width} ${size.height}`);
}
addColumn(x, y, width, height)
@@ -81,21 +79,15 @@
this._columns = [];
}
- needsLayout()
+ // Protected
+
+ layout()
{
- if (this._scheduledLayoutUpdateIdentifier)
+ super.layout();
+
+ if (this.layoutReason === WI.View.LayoutReason.Resize)
return;
- this._scheduledLayoutUpdateIdentifier = requestAnimationFrame(this.updateLayout.bind(this));
- }
-
- updateLayout()
- {
- if (this._scheduledLayoutUpdateIdentifier) {
- cancelAnimationFrame(this._scheduledLayoutUpdateIdentifier);
- this._scheduledLayoutUpdateIdentifier = undefined;
- }
-
this._svgElement.removeChildren();
for (let {x, y, width, height} of this._columns) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes