Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / devtools / front_end / ui / PieChart.js
index 13501d9..7dcef2c 100644 (file)
  * @constructor
  * @param {number} size
  * @param {function(number):string=} formatter
+ * @param {boolean=} showTotal
  */
-WebInspector.PieChart = function(size, formatter)
+WebInspector.PieChart = function(size, formatter, showTotal)
 {
     var shadowSize = WebInspector.PieChart._ShadowSizePercent;
-    this.element = document.createElementWithClass("div", "pie-chart");
-    this.element.appendChild(WebInspector.View.createStyleElement("pieChart.css"));
+    this.element = createElementWithClass("div", "pie-chart");
+    this.element.appendChild(WebInspector.View.createStyleElement("ui/pieChart.css"));
     var svg = this._createSVGChild(this.element, "svg");
     svg.setAttribute("width", (100 * (1 + 2 * shadowSize)) + "%");
     svg.setAttribute("height", (100 * (1 + 2 * shadowSize)) + "%");
@@ -50,7 +51,8 @@ WebInspector.PieChart = function(size, formatter)
     background.setAttribute("r", 1);
     background.setAttribute("fill", "hsl(0,0%,92%)");
     this._foregroundElement = this.element.createChild("div", "pie-chart-foreground");
-    this._totalElement = this._foregroundElement.createChild("div", "pie-chart-total");
+    if (showTotal)
+        this._totalElement = this._foregroundElement.createChild("div", "pie-chart-total");
     this._formatter = formatter;
     this._slices = [];
     this._lastAngle = -Math.PI/2;
@@ -74,7 +76,8 @@ WebInspector.PieChart.prototype = {
             totalString = this._formatter ? this._formatter(totalValue) : totalValue;
         else
             totalString = "";
-        this._totalElement.textContent = totalString;
+        if (this._totalElement)
+            this._totalElement.textContent = totalString;
     },
 
     /**
@@ -114,6 +117,7 @@ WebInspector.PieChart.prototype = {
      * @param {!Element} parent
      * @param {string} childType
      * @return {!Element}
+     * @suppressGlobalPropertiesCheck
      */
     _createSVGChild: function(parent, childType)
     {