Index: chrome_linux64/resources/inspector/AuditsPanel.js |
=================================================================== |
--- chrome_linux64/resources/inspector/AuditsPanel.js (revision 237140) |
+++ chrome_linux64/resources/inspector/AuditsPanel.js (working copy) |
@@ -1,8 +1,8 @@ |
WebInspector.AuditsPanel=function() |
-{WebInspector.Panel.call(this,"audits");this.registerRequiredCSS("panelEnablerView.css");this.registerRequiredCSS("auditsPanel.css");this.createSidebarViewWithTree();this.auditsTreeElement=new WebInspector.SidebarSectionTreeElement("",{},true);this.sidebarTree.appendChild(this.auditsTreeElement);this.auditsTreeElement.listItemElement.addStyleClass("hidden");this.auditsItemTreeElement=new WebInspector.AuditsSidebarTreeElement(this);this.auditsTreeElement.appendChild(this.auditsItemTreeElement);this.auditResultsTreeElement=new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("RESULTS"),{},true);this.sidebarTree.appendChild(this.auditResultsTreeElement);this.auditResultsTreeElement.expand();this.clearResultsButton=new WebInspector.StatusBarButton(WebInspector.UIString("Clear audit results."),"clear-status-bar-item");this.clearResultsButton.addEventListener("click",this._clearButtonClicked,this);this.viewsContainerElement=this.splitView.mainElement;this._constructCategories();this._auditController=new WebInspector.AuditController(this);this._launcherView=new WebInspector.AuditLauncherView(this._auditController);for(var id in this.categoriesById) |
+{WebInspector.Panel.call(this,"audits");this.registerRequiredCSS("panelEnablerView.css");this.registerRequiredCSS("auditsPanel.css");this.createSidebarViewWithTree();this.splitView.mainElement.addStyleClass("vbox");this.auditsTreeElement=new WebInspector.SidebarSectionTreeElement("",{},true);this.sidebarTree.appendChild(this.auditsTreeElement);this.auditsTreeElement.listItemElement.addStyleClass("hidden");this.auditsItemTreeElement=new WebInspector.AuditsSidebarTreeElement(this);this.auditsTreeElement.appendChild(this.auditsItemTreeElement);this.auditResultsTreeElement=new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("RESULTS"),{},true);this.sidebarTree.appendChild(this.auditResultsTreeElement);this.auditResultsTreeElement.expand();this.viewsContainerElement=this.splitView.mainElement;this._constructCategories();this._auditController=new WebInspector.AuditController(this);this._launcherView=new WebInspector.AuditLauncherView(this._auditController);for(var id in this.categoriesById) |
this._launcherView.addCategory(this.categoriesById[id]);} |
-WebInspector.AuditsPanel.prototype={get statusBarItems() |
-{return[this.clearResultsButton.element];},get categoriesById() |
+WebInspector.AuditsPanel.prototype={canSearch:function() |
+{return false;},get categoriesById() |
{return this._auditCategoriesById;},addCategory:function(category) |
{this.categoriesById[category.id]=category;this._launcherView.addCategory(category);},getCategory:function(id) |
{return this.categoriesById[id];},_constructCategories:function() |
@@ -19,7 +19,7 @@ |
this._visibleView.detach();this._visibleView=x;if(x) |
x.show(this.viewsContainerElement);},wasShown:function() |
{WebInspector.Panel.prototype.wasShown.call(this);if(!this._visibleView) |
-this.auditsItemTreeElement.select();},_clearButtonClicked:function() |
+this.auditsItemTreeElement.select();},clearResults:function() |
{this.auditsItemTreeElement.revealAndSelect();this.auditResultsTreeElement.removeChildren();},__proto__:WebInspector.Panel.prototype} |
WebInspector.AuditCategory=function(displayName) |
{this._displayName=displayName;this._rules=[];} |
@@ -107,7 +107,8 @@ |
startAuditWhenResourcesReady.call(this);else |
this._reloadResources(startAuditWhenResourcesReady.bind(this));WebInspector.userMetrics.AuditsStarted.record();},_reloadResources:function(callback) |
{this._pageReloadCallback=callback;PageAgent.reload(false);},_didMainResourceLoad:function() |
-{if(this._pageReloadCallback){var callback=this._pageReloadCallback;delete this._pageReloadCallback;callback();}}};WebInspector.AuditFormatters=function() |
+{if(this._pageReloadCallback){var callback=this._pageReloadCallback;delete this._pageReloadCallback;callback();}},clearResults:function() |
+{this._auditsPanel.clearResults();}};WebInspector.AuditFormatters=function() |
{} |
WebInspector.AuditFormatters.Registry={text:function(text) |
{return document.createTextNode(text);},snippet:function(snippetText) |
@@ -148,7 +149,8 @@ |
this._auditController.initiateAudit(catIds,this._progressIndicator,this._auditPresentStateElement.checked,onAuditStarted.bind(this),this._setAuditRunning.bind(this,false));},_stopAudit:function() |
{this._displayResourceLoadingProgress=false;this._progressIndicator.cancel();this._progressIndicator.done();delete this._progressIndicator;},_toggleUIComponents:function(disable) |
{this._selectAllCheckboxElement.disabled=disable;this._categoriesElement.disabled=disable;this._auditPresentStateElement.disabled=disable;this._auditReloadedStateElement.disabled=disable;},_launchButtonClicked:function(event) |
-{this._setAuditRunning(!this._auditRunning);},_selectAllClicked:function(checkCategories,userGesture) |
+{this._setAuditRunning(!this._auditRunning);},_clearButtonClicked:function() |
+{this._auditController.clearResults();},_selectAllClicked:function(checkCategories,userGesture) |
{var childNodes=this._categoriesElement.childNodes;for(var i=0,length=childNodes.length;i<length;++i) |
childNodes[i].firstChild.checked=checkCategories;this._currentCategoriesCount=checkCategories?this._sortedCategories.length:0;this._selectedCategoriesUpdated(userGesture);},_categoryClicked:function(event) |
{this._currentCategoriesCount+=event.target.checked?1:-1;this._selectAllCheckboxElement.checked=this._currentCategoriesCount===this._sortedCategories.length;this._selectedCategoriesUpdated(true);},_createCategoryElement:function(title,id) |
@@ -157,7 +159,7 @@ |
{this._headerElement=document.createElement("h1");this._headerElement.textContent=WebInspector.UIString("Select audits to run");for(var child=0;child<this._contentElement.children.length;++child) |
this._contentElement.removeChild(this._contentElement.children[child]);this._contentElement.appendChild(this._headerElement);function handleSelectAllClick(event) |
{this._selectAllClicked(event.target.checked,true);} |
-var categoryElement=this._createCategoryElement(WebInspector.UIString("Select All"),"");categoryElement.id="audit-launcher-selectall";this._selectAllCheckboxElement=categoryElement.firstChild;this._selectAllCheckboxElement.checked=this._selectedCategoriesSetting.get()[WebInspector.AuditLauncherView.AllCategoriesKey];this._selectAllCheckboxElement.addEventListener("click",handleSelectAllClick.bind(this),false);this._contentElement.appendChild(categoryElement);this._categoriesElement=this._contentElement.createChild("fieldset","audit-categories-container");this._currentCategoriesCount=0;this._contentElement.createChild("div","flexible-space");this._buttonContainerElement=this._contentElement.createChild("div","button-container");var labelElement=this._buttonContainerElement.createChild("label");this._auditPresentStateElement=labelElement.createChild("input");this._auditPresentStateElement.name="audit-mode";this._auditPresentStateElement.type="radio";this._auditPresentStateElement.checked=true;this._auditPresentStateLabelElement=document.createTextNode(WebInspector.UIString("Audit Present State"));labelElement.appendChild(this._auditPresentStateLabelElement);labelElement=this._buttonContainerElement.createChild("label");this._auditReloadedStateElement=labelElement.createChild("input");this._auditReloadedStateElement.name="audit-mode";this._auditReloadedStateElement.type="radio";labelElement.appendChild(document.createTextNode("Reload Page and Audit on Load"));this._launchButton=this._buttonContainerElement.createChild("button");this._launchButton.textContent=WebInspector.UIString("Run");this._launchButton.addEventListener("click",this._launchButtonClicked.bind(this),false);this._selectAllClicked(this._selectAllCheckboxElement.checked);},_updateResourceProgress:function() |
+var categoryElement=this._createCategoryElement(WebInspector.UIString("Select All"),"");categoryElement.id="audit-launcher-selectall";this._selectAllCheckboxElement=categoryElement.firstChild;this._selectAllCheckboxElement.checked=this._selectedCategoriesSetting.get()[WebInspector.AuditLauncherView.AllCategoriesKey];this._selectAllCheckboxElement.addEventListener("click",handleSelectAllClick.bind(this),false);this._contentElement.appendChild(categoryElement);this._categoriesElement=this._contentElement.createChild("fieldset","audit-categories-container");this._currentCategoriesCount=0;this._contentElement.createChild("div","flexible-space");this._buttonContainerElement=this._contentElement.createChild("div","button-container");var labelElement=this._buttonContainerElement.createChild("label");this._auditPresentStateElement=labelElement.createChild("input");this._auditPresentStateElement.name="audit-mode";this._auditPresentStateElement.type="radio";this._auditPresentStateElement.checked=true;this._auditPresentStateLabelElement=document.createTextNode(WebInspector.UIString("Audit Present State"));labelElement.appendChild(this._auditPresentStateLabelElement);labelElement=this._buttonContainerElement.createChild("label");this._auditReloadedStateElement=labelElement.createChild("input");this._auditReloadedStateElement.name="audit-mode";this._auditReloadedStateElement.type="radio";labelElement.appendChild(document.createTextNode("Reload Page and Audit on Load"));this._launchButton=this._buttonContainerElement.createChild("button");this._launchButton.textContent=WebInspector.UIString("Run");this._launchButton.addEventListener("click",this._launchButtonClicked.bind(this),false);this._clearButton=this._buttonContainerElement.createChild("button");this._clearButton.textContent=WebInspector.UIString("Clear");this._clearButton.addEventListener("click",this._clearButtonClicked.bind(this),false);this._selectAllClicked(this._selectAllCheckboxElement.checked);},_updateResourceProgress:function() |
{if(this._displayResourceLoadingProgress) |
this._progressIndicator.setTitle(WebInspector.UIString("Loading (%d of %d)",this._loadedResources,this._totalResources));},_selectedCategoriesUpdated:function(userGesture) |
{var selectedCategories=userGesture?{}:this._selectedCategoriesSetting.get();var childNodes=this._categoriesElement.childNodes;for(var i=0,length=childNodes.length;i<length;++i) |