Title: [125863] trunk/Source/WebCore
Revision
125863
Author
ca...@chromium.org
Date
2012-08-17 00:38:15 -0700 (Fri, 17 Aug 2012)

Log Message

Web Inspector: CPU profile view select overlaps with status bar buttons
https://bugs.webkit.org/show_bug.cgi?id=94243

Reviewed by Pavel Feldman.

- use StatusBarComboBox inated of plain select element in the status bar of CPU profile view;
- add StatusBarComboBox.select()

* inspector/front-end/CPUProfileView.js:
(WebInspector.CPUProfileView.prototype.get statusBarItems):
* inspector/front-end/StatusBarButton.js:
(WebInspector.StatusBarComboBox.prototype.selectedOption):
(WebInspector.StatusBarComboBox.prototype.select):
* inspector/front-end/externs.js: drive-by fix: add declaration to suppress compilation error;
(Array.prototype.select):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (125862 => 125863)


--- trunk/Source/WebCore/ChangeLog	2012-08-17 06:32:39 UTC (rev 125862)
+++ trunk/Source/WebCore/ChangeLog	2012-08-17 07:38:15 UTC (rev 125863)
@@ -1,3 +1,21 @@
+2012-08-16  Andrey Kosyakov  <ca...@chromium.org>
+
+        Web Inspector: CPU profile view select overlaps with status bar buttons
+        https://bugs.webkit.org/show_bug.cgi?id=94243
+
+        Reviewed by Pavel Feldman.
+
+        - use StatusBarComboBox inated of plain select element in the status bar of CPU profile view;
+        - add StatusBarComboBox.select()
+
+        * inspector/front-end/CPUProfileView.js:
+        (WebInspector.CPUProfileView.prototype.get statusBarItems):
+        * inspector/front-end/StatusBarButton.js:
+        (WebInspector.StatusBarComboBox.prototype.selectedOption):
+        (WebInspector.StatusBarComboBox.prototype.select):
+        * inspector/front-end/externs.js: drive-by fix: add declaration to suppress compilation error;
+        (Array.prototype.select):
+
 2012-08-16  Vsevolod Vlasov  <vse...@chromium.org>
 
         Web Inspector: Snippet script mapping should not load snippets until workspace reset event is dispatched on scripts panel.

Modified: trunk/Source/WebCore/inspector/front-end/CPUProfileView.js (125862 => 125863)


--- trunk/Source/WebCore/inspector/front-end/CPUProfileView.js	2012-08-17 06:32:39 UTC (rev 125862)
+++ trunk/Source/WebCore/inspector/front-end/CPUProfileView.js	2012-08-17 07:38:15 UTC (rev 125863)
@@ -54,18 +54,19 @@
     this.dataGrid.element.addEventListener("mousedown", this._mouseDownInDataGrid.bind(this), true);
     this.dataGrid.show(this.element);
 
-    this.viewSelectElement = document.createElement("select");
-    this.viewSelectElement.className = "status-bar-item";
-    this.viewSelectElement.addEventListener("change", this._changeView.bind(this), false);
+    this.viewSelectComboBox = new WebInspector.StatusBarComboBox(this._changeView.bind(this));
 
     var heavyViewOption = document.createElement("option");
     heavyViewOption.label = WebInspector.UIString("Heavy (Bottom Up)");
+    heavyViewOption.value = WebInspector.CPUProfileView._TypeHeavy;
     var treeViewOption = document.createElement("option");
     treeViewOption.label = WebInspector.UIString("Tree (Top Down)");
-    this.viewSelectElement.appendChild(heavyViewOption);
-    this.viewSelectElement.appendChild(treeViewOption);
-    this.viewSelectElement.selectedIndex = this._viewType.get() === WebInspector.CPUProfileView._TypeHeavy ? 0 : 1;
+    treeViewOption.value = WebInspector.CPUProfileView._TypeTree;
 
+    this.viewSelectComboBox.addOption(heavyViewOption);
+    this.viewSelectComboBox.addOption(treeViewOption);
+    this.viewSelectComboBox.select(this._viewType.get() === WebInspector.CPUProfileView._TypeHeavy ? heavyViewOption : treeViewOption);
+
     this.percentButton = new WebInspector.StatusBarButton("", "percent-time-status-bar-item");
     this.percentButton.addEventListener("click", this._percentClicked, this);
 
@@ -109,7 +110,7 @@
 WebInspector.CPUProfileView.prototype = {
     get statusBarItems()
     {
-        return [this.viewSelectElement, this.percentButton.element, this.focusButton.element, this.excludeButton.element, this.resetButton.element];
+        return [this.viewSelectComboBox.element, this.percentButton.element, this.focusButton.element, this.excludeButton.element, this.resetButton.element];
     },
 
     get bottomUpProfileDataGridTree()
@@ -385,11 +386,13 @@
         if (!this.profile)
             return;
 
-        if (this.viewSelectElement.selectedIndex == 1) {
+        switch (this.viewSelectComboBox.selectedOption().value) {
+        case WebInspector.CPUProfileView._TypeTree:
             this.profileDataGridTree = this.topDownProfileDataGridTree;
             this._sortProfile();
             this._viewType.set(WebInspector.CPUProfileView._TypeTree);
-        } else if (this.viewSelectElement.selectedIndex == 0) {
+            break;
+        case WebInspector.CPUProfileView._TypeHeavy:
             this.profileDataGridTree = this.bottomUpProfileDataGridTree;
             this._sortProfile();
             this._viewType.set(WebInspector.CPUProfileView._TypeHeavy);

Modified: trunk/Source/WebCore/inspector/front-end/StatusBarButton.js (125862 => 125863)


--- trunk/Source/WebCore/inspector/front-end/StatusBarButton.js	2012-08-17 06:32:39 UTC (rev 125862)
+++ trunk/Source/WebCore/inspector/front-end/StatusBarButton.js	2012-08-17 07:38:15 UTC (rev 125863)
@@ -291,5 +291,13 @@
         if (this._selectElement.selectedIndex >= 0)
             return this._selectElement[this._selectElement.selectedIndex];
         return null;
+    },
+
+    /**
+     * @param {Element} option
+     */
+    select: function(option)
+    {
+        this._selectElement.selectedIndex = Array.prototype.indexOf.call(this._selectElement, option);
     }
 }

Modified: trunk/Source/WebCore/inspector/front-end/externs.js (125862 => 125863)


--- trunk/Source/WebCore/inspector/front-end/externs.js	2012-08-17 06:32:39 UTC (rev 125862)
+++ trunk/Source/WebCore/inspector/front-end/externs.js	2012-08-17 07:38:15 UTC (rev 125863)
@@ -96,6 +96,13 @@
  */
 Array.prototype.qselect = function(k, comparator) {}
 
+/**
+ * @this {Array.<*>}
+ * @param {string} field
+ * @return {Array.<*>}
+ */
+Array.prototype.select = function(field) {}
+
 DOMApplicationCache.prototype.UNCACHED = 0;
 DOMApplicationCache.prototype.IDLE = 1;
 DOMApplicationCache.prototype.CHECKING = 2;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to