Title: [240871] trunk/Source/WebInspectorUI
- Revision
- 240871
- Author
- joep...@webkit.org
- Date
- 2019-02-01 13:24:20 -0800 (Fri, 01 Feb 2019)
Log Message
Web Inspector: Make WI.StackedLineChart a WI.View subclass
https://bugs.webkit.org/show_bug.cgi?id=194119
Rubber-stamped by Devin Rousso.
* UserInterface/Views/LineChart.js:
(WI.LineChart.prototype.layout):
(WI.LineChart):
* UserInterface/Views/MemoryTimelineOverviewGraph.js:
(WI.MemoryTimelineOverviewGraph):
* UserInterface/Views/StackedLineChart.js:
(WI.StackedLineChart):
(WI.StackedLineChart.prototype.set size):
(WI.StackedLineChart.prototype.layout):
(WI.StackedLineChart.prototype.get element): Deleted.
(WI.StackedLineChart.prototype.get points): Deleted.
(WI.StackedLineChart.prototype.needsLayout): Deleted.
(WI.StackedLineChart.prototype.updateLayout): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (240870 => 240871)
--- trunk/Source/WebInspectorUI/ChangeLog 2019-02-01 21:24:18 UTC (rev 240870)
+++ trunk/Source/WebInspectorUI/ChangeLog 2019-02-01 21:24:20 UTC (rev 240871)
@@ -1,5 +1,26 @@
2019-02-01 Joseph Pecoraro <pecor...@apple.com>
+ Web Inspector: Make WI.StackedLineChart a WI.View subclass
+ https://bugs.webkit.org/show_bug.cgi?id=194119
+
+ Rubber-stamped by Devin Rousso.
+
+ * UserInterface/Views/LineChart.js:
+ (WI.LineChart.prototype.layout):
+ (WI.LineChart):
+ * UserInterface/Views/MemoryTimelineOverviewGraph.js:
+ (WI.MemoryTimelineOverviewGraph):
+ * UserInterface/Views/StackedLineChart.js:
+ (WI.StackedLineChart):
+ (WI.StackedLineChart.prototype.set size):
+ (WI.StackedLineChart.prototype.layout):
+ (WI.StackedLineChart.prototype.get element): Deleted.
+ (WI.StackedLineChart.prototype.get points): Deleted.
+ (WI.StackedLineChart.prototype.needsLayout): Deleted.
+ (WI.StackedLineChart.prototype.updateLayout): Deleted.
+
+2019-02-01 Joseph Pecoraro <pecor...@apple.com>
+
Web Inspector: Make WI.CircleChart a WI.View subclass
https://bugs.webkit.org/show_bug.cgi?id=194118
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LineChart.js (240870 => 240871)
--- trunk/Source/WebInspectorUI/UserInterface/Views/LineChart.js 2019-02-01 21:24:18 UTC (rev 240870)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LineChart.js 2019-02-01 21:24:20 UTC (rev 240871)
@@ -33,7 +33,7 @@
// - There is a single path for line.
//
// <div class="line-chart">
-// <svg width="800" height="75" viewBox="0 0 800 75">
+// <svg viewBox="0 0 800 75">
// <path d="..."/>
// </svg>
// </div>
@@ -88,6 +88,8 @@
layout()
{
+ super.layout();
+
if (this.layoutReason === WI.View.LayoutReason.Resize)
return;
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/MemoryTimelineOverviewGraph.js (240870 => 240871)
--- trunk/Source/WebInspectorUI/UserInterface/Views/MemoryTimelineOverviewGraph.js 2019-02-01 21:24:18 UTC (rev 240870)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/MemoryTimelineOverviewGraph.js 2019-02-01 21:24:20 UTC (rev 240871)
@@ -39,8 +39,9 @@
this._didInitializeCategories = false;
- let size = new WI.Size(0, this.height);
- this._chart = new WI.StackedLineChart(size);
+ this._chart = new WI.StackedLineChart;
+ this._chart.size = new WI.Size(0, this.height);
+ this.addSubview(this._chart);
this.element.appendChild(this._chart.element);
this._legendElement = this.element.appendChild(document.createElement("div"));
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/StackedLineChart.js (240870 => 240871)
--- trunk/Source/WebInspectorUI/UserInterface/Views/StackedLineChart.js 2019-02-01 21:24:18 UTC (rev 240870)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/StackedLineChart.js 2019-02-01 21:24:20 UTC (rev 240871)
@@ -38,30 +38,31 @@
// that the paths for lower sections overlap the paths for upper sections.
//
// <div class="stacked-line-chart">
-// <svg width="1000" height="100" viewbox="0 0 1000 100">
+// <svg viewBox="0 0 1000 100">
+// <path class="section-class-name-2" d="..."/>
// <path class="section-class-name-1" d="..."/>
-// <path class="section-class-name-2" d="..."/>
// </svg>
// </div>
-WI.StackedLineChart = class StackedLineChart
+WI.StackedLineChart = class StackedLineChart extends WI.View
{
- constructor(size)
+ constructor()
{
- this._element = document.createElement("div");
- this._element.classList.add("stacked-line-chart");
+ super();
- this._chartElement = this._element.appendChild(createSVGElement("svg"));
+ this.element.classList.add("stacked-line-chart");
+
+ this._chartElement = this.element.appendChild(createSVGElement("svg"));
+ this._chartElement.setAttribute("preserveAspectRatio", "none");
+
this._pathElements = [];
this._points = [];
- this.size = size;
+ this._size = null;
}
// Public
- get element() { return this._element; }
-
get size()
{
return this._size;
@@ -69,11 +70,14 @@
set size(size)
{
+ if (this._size && this._size.equals(size))
+ return;
+
this._size = size;
- this._chartElement.setAttribute("width", size.width);
- this._chartElement.setAttribute("height", size.height);
- this._chartElement.setAttribute("viewbox", `0 0 ${size.width} ${size.height}`);
+ this._chartElement.setAttribute("viewBox", `0 0 ${size.width} ${size.height}`);
+
+ this.needsLayout();
}
initializeSections(sectionClassNames)
@@ -102,21 +106,18 @@
this._points = [];
}
- needsLayout()
+ // Protected
+
+ layout()
{
- if (this._scheduledLayoutUpdateIdentifier)
+ super.layout();
+
+ if (this.layoutReason === WI.View.LayoutReason.Resize)
return;
- this._scheduledLayoutUpdateIdentifier = requestAnimationFrame(this.updateLayout.bind(this));
- }
+ if (!this._size)
+ return;
- updateLayout()
- {
- if (this._scheduledLayoutUpdateIdentifier) {
- cancelAnimationFrame(this._scheduledLayoutUpdateIdentifier);
- this._scheduledLayoutUpdateIdentifier = undefined;
- }
-
let pathComponents = [];
let length = this._pathElements.length;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes