[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

pfeldman at chromium.org pfeldman at chromium.org
Thu Apr 8 02:17:45 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit a24cfeaeab3874815f9e4bc5cc34116e0956297a
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Mar 9 17:34:16 2010 +0000

    2010-03-09  Yury Semikhatsky  <yurys at chromium.org>
    
            Reviewed by Pavel Feldman.
    
            When enable resource tracking state changes use the same method as
            location.reload for reloading inspected page.
    
            https://bugs.webkit.org/show_bug.cgi?id=35923
    
            * inspector/InspectorBackend.cpp:
            (WebCore::InspectorBackend::reloadPage):
            * inspector/InspectorController.cpp:
            (WebCore::InspectorController::enableResourceTracking):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55727 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 8bcfeba..20d66f7 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -16,6 +16,95 @@
 
         Reviewed by Timothy Hatcher.
 
+        Web Inspector: Refactor Audits panel presentation layer.
+        This change removes unnecessary complexity:
+          - Audit scores were not used
+          - Audit rule parameters are passed as rule constructor arguments
+          - View management aligned with the rest of the front-end
+          - Single TreeOutline is used for category results (no need to create sections for those)
+          - Rules code beautified and simplified where possible
+          - Some UI improvements applied (see attached screenshot)
+
+        https://bugs.webkit.org/show_bug.cgi?id=35860
+
+        * inspector/front-end/AuditCategories.js:
+        (WebInspector.AuditCategories.PagePerformance.prototype.initialize):
+        (WebInspector.AuditCategories.NetworkUtilization.prototype.initialize):
+        * inspector/front-end/AuditResultView.js:
+        (WebInspector.AuditResultView):
+        (WebInspector.AuditCategoryResultPane):
+        (WebInspector.AuditCategoryResultPane.prototype._appendResult):
+        * inspector/front-end/AuditRules.js:
+        (WebInspector.AuditRules.GzipRule.prototype.doRun):
+        (WebInspector.AuditRules.CombineExternalResourcesRule):
+        (WebInspector.AuditRules.CombineExternalResourcesRule.prototype.doRun):
+        (WebInspector.AuditRules.CombineJsResourcesRule):
+        (WebInspector.AuditRules.CombineCssResourcesRule):
+        (WebInspector.AuditRules.MinimizeDnsLookupsRule):
+        (WebInspector.AuditRules.MinimizeDnsLookupsRule.prototype.doRun):
+        (WebInspector.AuditRules.ParallelizeDownloadRule):
+        (WebInspector.AuditRules.ParallelizeDownloadRule.prototype.doRun):
+        (WebInspector.AuditRules.UnusedCssRule):
+        (WebInspector.AuditRules.UnusedCssRule.prototype.doRun.evalCallback):
+        (WebInspector.AuditRules.UnusedCssRule.prototype.doRun.routine):
+        (WebInspector.AuditRules.UnusedCssRule.prototype.doRun):
+        (WebInspector.AuditRules.CacheControlRule):
+        (WebInspector.AuditRules.CacheControlRule.prototype.doRun):
+        (WebInspector.AuditRules.CacheControlRule.prototype.execCheck):
+        (WebInspector.AuditRules.BrowserCacheControlRule):
+        (WebInspector.AuditRules.BrowserCacheControlRule.prototype.handleNonCacheableResources):
+        (WebInspector.AuditRules.BrowserCacheControlRule.prototype.runChecks):
+        (WebInspector.AuditRules.ProxyCacheControlRule):
+        (WebInspector.AuditRules.ProxyCacheControlRule.prototype.runChecks):
+        (WebInspector.AuditRules.ImageDimensionsRule):
+        (WebInspector.AuditRules.ImageDimensionsRule.prototype.doRun):
+        (WebInspector.AuditRules.CssInHeadRule):
+        (WebInspector.AuditRules.CssInHeadRule.prototype.doRun):
+        (WebInspector.AuditRules.CssInHeadRule.prototype.doRun.routine):
+        (WebInspector.AuditRules.StylesScriptsOrderRule):
+        (WebInspector.AuditRules.StylesScriptsOrderRule.prototype.doRun):
+        (WebInspector.AuditRules.StylesScriptsOrderRule.prototype.doRun.routine):
+        (WebInspector.AuditRules.CookieRuleBase):
+        (WebInspector.AuditRules.CookieRuleBase.prototype.doRun.resultCallback):
+        (WebInspector.AuditRules.CookieRuleBase.prototype.doRun):
+        (WebInspector.AuditRules.CookieSizeRule):
+        (WebInspector.AuditRules.CookieSizeRule.prototype.processCookies):
+        (WebInspector.AuditRules.StaticCookielessRule):
+        (WebInspector.AuditRules.StaticCookielessRule.prototype.processCookies):
+        * inspector/front-end/AuditsPanel.js:
+        (WebInspector.AuditsPanel):
+        (WebInspector.AuditsPanel.prototype._executeAudit.ruleResultReadyCallback):
+        (WebInspector.AuditsPanel.prototype._executeAudit):
+        (WebInspector.AuditsPanel.prototype._reloadResources):
+        (WebInspector.AuditsPanel.prototype._didMainResourceLoad):
+        (WebInspector.AuditsPanel.prototype.showResults):
+        (WebInspector.AuditsPanel.prototype.showLauncherView):
+        (WebInspector.AuditsPanel.prototype.get visibleView):
+        (WebInspector.AuditsPanel.prototype.set visibleView):
+        (WebInspector.AuditsPanel.prototype.show):
+        (WebInspector.AuditsPanel.prototype._clearButtonClicked):
+        (WebInspector.AuditCategory.prototype.addRule):
+        (WebInspector.AuditRule):
+        (WebInspector.AuditRule.prototype.set severity):
+        (WebInspector.AuditRule.prototype.run):
+        (WebInspector.AuditRule.prototype.doRun):
+        (WebInspector.AuditCategoryResult):
+        (WebInspector.AuditCategoryResult.prototype.addRuleResult):
+        (WebInspector.AuditRuleResult):
+        (WebInspector.AuditRuleResult.prototype.addChild):
+        (WebInspector.AuditRuleResult.prototype.addURL):
+        (WebInspector.AuditRuleResult.prototype.addURLs):
+        (WebInspector.AuditRuleResult.prototype.addSnippet):
+        * inspector/front-end/Settings.js:
+        * inspector/front-end/audits.css:
+        * inspector/front-end/inspector.js:
+        (WebInspector._createPanels):
+        (WebInspector.documentKeyDown):
+
+2010-03-09  Pavel Feldman  <pfeldman at chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
         Web Inspector: highlight text node containers while searching for node.
 
         https://bugs.webkit.org/show_bug.cgi?id=35912
diff --git a/WebCore/inspector/front-end/AuditCategories.js b/WebCore/inspector/front-end/AuditCategories.js
index 6931b5f..01b5ff9 100644
--- a/WebCore/inspector/front-end/AuditCategories.js
+++ b/WebCore/inspector/front-end/AuditCategories.js
@@ -37,9 +37,9 @@ WebInspector.AuditCategories.PagePerformance.AuditCategoryName = "Web Page Perfo
 WebInspector.AuditCategories.PagePerformance.prototype = {
     initialize: function()
     {
-        this.addRule(new WebInspector.AuditRules.UnusedCssRule());
-        this.addRule(new WebInspector.AuditRules.CssInHeadRule({InlineURLScore: 6, InlineStylesheetScore: 21}));
-        this.addRule(new WebInspector.AuditRules.StylesScriptsOrderRule({CSSAfterJSURLScore: 11, InlineBetweenResourcesScore: 21}));
+        this.addRule(new WebInspector.AuditRules.UnusedCssRule(), WebInspector.AuditRule.Severity.Warning);
+        this.addRule(new WebInspector.AuditRules.CssInHeadRule(), WebInspector.AuditRule.Severity.Severe);
+        this.addRule(new WebInspector.AuditRules.StylesScriptsOrderRule(), WebInspector.AuditRule.Severity.Severe);
     }
 }
 
@@ -54,16 +54,16 @@ WebInspector.AuditCategories.NetworkUtilization.AuditCategoryName = "Network Uti
 WebInspector.AuditCategories.NetworkUtilization.prototype = {
     initialize: function()
     {
-        this.addRule(new WebInspector.AuditRules.GzipRule());
-        this.addRule(new WebInspector.AuditRules.ImageDimensionsRule({ScorePerImageUse: 5}));
-        this.addRule(new WebInspector.AuditRules.CookieSizeRule({MinBytesThreshold: 400, MaxBytesThreshold: 1000}));
-        this.addRule(new WebInspector.AuditRules.StaticCookielessRule({MinResources: 5}));
-        this.addRule(new WebInspector.AuditRules.CombineJsResourcesRule({AllowedPerDomain: 2, ScorePerResource: 11}));
-        this.addRule(new WebInspector.AuditRules.CombineCssResourcesRule({AllowedPerDomain: 2, ScorePerResource: 11}));
-        this.addRule(new WebInspector.AuditRules.MinimizeDnsLookupsRule({HostCountThreshold: 4, ViolationDomainScore: 6}));
-        this.addRule(new WebInspector.AuditRules.ParallelizeDownloadRule({OptimalHostnameCount: 4, MinRequestThreshold: 10, MinBalanceThreshold: 0.5}));
-        this.addRule(new WebInspector.AuditRules.BrowserCacheControlRule());
-        this.addRule(new WebInspector.AuditRules.ProxyCacheControlRule());
+        this.addRule(new WebInspector.AuditRules.GzipRule(), WebInspector.AuditRule.Severity.Severe);
+        this.addRule(new WebInspector.AuditRules.ImageDimensionsRule(), WebInspector.AuditRule.Severity.Warning);
+        this.addRule(new WebInspector.AuditRules.CookieSizeRule(400), WebInspector.AuditRule.Severity.Warning);
+        this.addRule(new WebInspector.AuditRules.StaticCookielessRule(5), WebInspector.AuditRule.Severity.Warning);
+        this.addRule(new WebInspector.AuditRules.CombineJsResourcesRule(2), WebInspector.AuditRule.Severity.Severe);
+        this.addRule(new WebInspector.AuditRules.CombineCssResourcesRule(2), WebInspector.AuditRule.Severity.Severe);
+        this.addRule(new WebInspector.AuditRules.MinimizeDnsLookupsRule(4), WebInspector.AuditRule.Severity.Warning);
+        this.addRule(new WebInspector.AuditRules.ParallelizeDownloadRule(4, 10, 0.5), WebInspector.AuditRule.Severity.Warning);
+        this.addRule(new WebInspector.AuditRules.BrowserCacheControlRule(), WebInspector.AuditRule.Severity.Severe);
+        this.addRule(new WebInspector.AuditRules.ProxyCacheControlRule(), WebInspector.AuditRule.Severity.Warning);
     }
 }
 
diff --git a/WebCore/inspector/front-end/AuditResultView.js b/WebCore/inspector/front-end/AuditResultView.js
index ac818fb..0f43d24 100644
--- a/WebCore/inspector/front-end/AuditResultView.js
+++ b/WebCore/inspector/front-end/AuditResultView.js
@@ -31,24 +31,10 @@
 WebInspector.AuditResultView = function(categoryResults)
 {
     WebInspector.View.call(this);
+    this.element.className = "audit-result-view";
 
-    this.element.id = "audit-result-view";
-
-    function entrySortFunction(a, b)
-    {
-        var result = b.type - a.type;
-        if (!result)
-            result = (a.value || "").localeCompare(b.value || "");
-        return result;
-    }
-
-    for (var i = 0; i < categoryResults.length; ++i) {
-        var entries = categoryResults[i].entries;
-        if (entries) {
-            entries.sort(entrySortFunction);
-            this.element.appendChild(new WebInspector.AuditCategoryResultPane(categoryResults[i]).element);
-        }
-    }
+    for (var i = 0; i < categoryResults.length; ++i)
+        this.element.appendChild(new WebInspector.AuditCategoryResultPane(categoryResults[i]).element);
 }
 
 WebInspector.AuditResultView.prototype.__proto__ = WebInspector.View.prototype;
@@ -57,82 +43,49 @@ WebInspector.AuditResultView.prototype.__proto__ = WebInspector.View.prototype;
 WebInspector.AuditCategoryResultPane = function(categoryResult)
 {
     WebInspector.SidebarPane.call(this, categoryResult.title);
-    this.expand();
-    for (var i = 0; i < categoryResult.entries.length; ++i)
-        this.bodyElement.appendChild(new WebInspector.AuditRuleResultPane(categoryResult.entries[i]).element);
-}
-
-WebInspector.AuditCategoryResultPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
-
-
-WebInspector.AuditRuleResultPane = function(ruleResult)
-{
-    WebInspector.SidebarPane.call(this, ruleResult.value);
-    if (!ruleResult.children)
-        return;
-
-    this._decorateRuleResult(ruleResult);
-
-    for (var i = 0; i < ruleResult.children.length; ++i) {
-        var section = new WebInspector.AuditRuleResultChildSection(ruleResult.children[i]);
-        this.bodyElement.appendChild(section.element);
-    }
-}
-
-WebInspector.AuditRuleResultPane.prototype = {
-    _decorateRuleResult: function(ruleResult)
-    {
-        if (ruleResult.type == WebInspector.AuditRuleResult.Type.NA)
-            return;
-
-        var scoreElement = document.createElement("img");
-        scoreElement.className = "score";
-        var className = (ruleResult.type == WebInspector.AuditRuleResult.Type.Violation) ? "red" : "green";
-        scoreElement.addStyleClass(className);
-        this.element.insertBefore(scoreElement, this.element.firstChild);
-    }
-}
-
-WebInspector.AuditRuleResultPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
-
-
-WebInspector.AuditRuleResultChildSection = function(entry)
-{
-    WebInspector.Section.call(this, entry.value);
-    var children = entry.children;
-    this._hasChildren = !!children && children.length;
-    if (!this._hasChildren)
-        this.element.addStyleClass("blank-section");
-    else {
-        this.contentElement = document.createElement("div");
-        this.contentElement.addStyleClass("section-content");
-        for (var i = 0; i < children.length; ++i) {
-            var paraElement = document.createElement("p");
-            paraElement.innerHTML = children[i].value;
-            this.contentElement.appendChild(paraElement);
+    var treeOutlineElement = document.createElement("ol");
+    this.bodyElement.addStyleClass("audit-result-tree");
+    this.bodyElement.appendChild(treeOutlineElement);
+
+    this._treeOutline = new TreeOutline(treeOutlineElement);
+    this._treeOutline.expandTreeElementsWhenArrowing = true;
+    for (var i = 0; i < categoryResult.ruleResults.length; ++i) {
+        var ruleResult = categoryResult.ruleResults[i];
+        var treeElement = this._appendResult(this._treeOutline, ruleResult);
+        treeElement.listItemElement.addStyleClass("audit-result");
+
+        if (ruleResult.severity) {
+            var severityElement = document.createElement("img");
+            severityElement.className = "severity-" + ruleResult.severity;
+            treeElement.listItemElement.appendChild(severityElement);
         }
-        this.contentElement.appendChild(paraElement);
-        this.element.appendChild(this.contentElement);
     }
+    this.expand();
 }
 
-WebInspector.AuditRuleResultChildSection.prototype = {
-
-    // title is considered pure HTML
-    set title(x)
-    {
-        if (this._title === x)
-            return;
-        this._title = x;
-
-        this.titleElement.innerHTML = x;
-    },
-
-    expand: function()
+WebInspector.AuditCategoryResultPane.prototype = {
+    _appendResult: function(parentTreeElement, result)
     {
-        if (this._hasChildren)
-            WebInspector.Section.prototype.expand.call(this);
+        var title = result.value;
+        if (result.violationCount)
+            title = String.sprintf("%s (%d)", title, result.violationCount);
+
+        var treeElement = new TreeElement(title, null, !!result.children);
+        parentTreeElement.appendChild(treeElement);
+
+        if (result.className)
+            treeElement.listItemElement.addStyleClass(result.className);
+        if (result.children) {
+            for (var i = 0; i < result.children.length; ++i)
+                this._appendResult(treeElement, result.children[i]);
+        }
+        if (result.expanded) {
+            treeElement.listItemElement.removeStyleClass("parent");
+            treeElement.listItemElement.addStyleClass("parent-expanded");
+            treeElement.expand();
+        }
+        return treeElement;
     }
 }
 
-WebInspector.AuditRuleResultChildSection.prototype.__proto__ = WebInspector.Section.prototype;
+WebInspector.AuditCategoryResultPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
diff --git a/WebCore/inspector/front-end/AuditRules.js b/WebCore/inspector/front-end/AuditRules.js
index e2ed94b..273622f 100644
--- a/WebCore/inspector/front-end/AuditRules.js
+++ b/WebCore/inspector/front-end/AuditRules.js
@@ -42,27 +42,6 @@ WebInspector.AuditRules.CacheableResponseCodes =
     304: true // Underlying resource is cacheable
 }
 
-/**
- * @param {Array} array Array of Elements (outerHTML is used) or strings (plain value is used as innerHTML)
- */
-WebInspector.AuditRules.arrayAsUL = function(array, shouldLinkify)
-{
-    if (!array.length)
-        return "";
-    var ulElement = document.createElement("ul");
-    for (var i = 0; i < array.length; ++i) {
-        var liElement = document.createElement("li");
-        if (array[i] instanceof Element)
-            liElement.appendChild(array[i]);
-        else if (shouldLinkify)
-            liElement.appendChild(WebInspector.linkifyURLAsNode(array[i]));
-        else
-            liElement.innerHTML = array[i];
-        ulElement.appendChild(liElement);
-    }
-    return ulElement.outerHTML;
-}
-
 WebInspector.AuditRules.getDomainToResourcesMap = function(resources, types, regexp, needFullResources)
 {
     var domainToResourcesMap = {};
@@ -98,43 +77,29 @@ WebInspector.AuditRules.GzipRule = function()
 WebInspector.AuditRules.GzipRule.prototype = {
     doRun: function(resources, result, callback)
     {
-        try {
-            var commonMessage = undefined;
-            var totalSavings = 0;
-            var compressedSize = 0
-            var candidateSize = 0
-            var outputResources = [];
-            for (var i = 0, length = resources.length; i < length; ++i) {
-                var resource = resources[i];
-                if (this._shouldCompress(resource)) {
-                    var size = resource.resourceSize;
-                    candidateSize += size;
-                    if (this._isCompressed(resource)) {
-                        compressedSize += size;
-                        continue;
-                    }
-                    if (!commonMessage)
-                        commonMessage = result.appendChild("");
-                    var savings = 2 * size / 3;
-                    totalSavings += savings;
-                    outputResources.push(
-                        String.sprintf("Compressing %s could save ~%s",
-                        WebInspector.linkifyURL(resource.url), Number.bytesToString(savings)));
+        var totalSavings = 0;
+        var compressedSize = 0;
+        var candidateSize = 0;
+        var summary = result.addChild("", true);
+        for (var i = 0, length = resources.length; i < length; ++i) {
+            var resource = resources[i];
+            if (this._shouldCompress(resource)) {
+                var size = resource.resourceSize;
+                candidateSize += size;
+                if (this._isCompressed(resource)) {
+                    compressedSize += size;
+                    continue;
                 }
+                var savings = 2 * size / 3;
+                totalSavings += savings;
+                summary.addChild(String.sprintf("%s could save ~%s", WebInspector.linkifyURL(resource.url), Number.bytesToString(savings)));
+                result.violationCount++;
             }
-            if (commonMessage) {
-              commonMessage.value =
-                  String.sprintf("Compressing the following resources with gzip could reduce their " +
-                      "transfer size by about two thirds (~%s):", Number.bytesToString(totalSavings));
-              commonMessage.appendChild(WebInspector.AuditRules.arrayAsUL(outputResources));
-              result.score = 100 * compressedSize / candidateSize;
-              result.type = WebInspector.AuditRuleResult.Type.Violation;
-            }
-        } catch(e) {
-            console.log(e);
-        } finally {
-            callback(result);
         }
+        if (!totalSavings)
+            return callback(null);
+        summary.value = String.sprintf("Compressing the following resources with gzip could reduce their transfer size by about two thirds (~%s):", Number.bytesToString(totalSavings));
+        callback(result);
     },
 
     _isCompressed: function(resource)
@@ -152,98 +117,93 @@ WebInspector.AuditRules.GzipRule.prototype = {
 WebInspector.AuditRules.GzipRule.prototype.__proto__ = WebInspector.AuditRule.prototype;
 
 
-WebInspector.AuditRules.CombineExternalResourcesRule = function(id, name, type, resourceTypeName, parametersObject)
+WebInspector.AuditRules.CombineExternalResourcesRule = function(id, name, type, resourceTypeName, allowedPerDomain)
 {
-    WebInspector.AuditRule.call(this, id, name, parametersObject);
+    WebInspector.AuditRule.call(this, id, name);
     this._type = type;
     this._resourceTypeName = resourceTypeName;
+    this._allowedPerDomain = allowedPerDomain;
 }
 
 WebInspector.AuditRules.CombineExternalResourcesRule.prototype = {
     doRun: function(resources, result, callback)
     {
-        try {
-            var domainToResourcesMap = WebInspector.AuditRules.getDomainToResourcesMap(resources, [this._type], WebInspector.URLRegExp);
-            var penalizedResourceCount = 0;
-            // TODO: refactor according to the chosen i18n approach
-            for (var domain in domainToResourcesMap) {
-                var domainResources = domainToResourcesMap[domain];
-                var extraResourceCount = domainResources.length - this.getValue("AllowedPerDomain");
-                if (extraResourceCount <= 0)
-                    continue;
-                penalizedResourceCount += extraResourceCount - 1;
-                result.appendChild(
-                    String.sprintf("There are %d %s files served from %s. Consider combining them into as few files as possible.",
-                    domainResources.length, this._resourceTypeName, domain));
-            }
-            result.score = 100 - (penalizedResourceCount * this.getValue("ScorePerResource"));
-            result.type = WebInspector.AuditRuleResult.Type.Hint;
-        } catch(e) {
-            console.log(e);
-        } finally {
-            callback(result);
+        var domainToResourcesMap = WebInspector.AuditRules.getDomainToResourcesMap(resources, [this._type], WebInspector.URLRegExp);
+        var penalizedResourceCount = 0;
+        // TODO: refactor according to the chosen i18n approach
+        var summary = result.addChild("", true);
+        for (var domain in domainToResourcesMap) {
+            var domainResources = domainToResourcesMap[domain];
+            var extraResourceCount = domainResources.length - this._allowedPerDomain;
+            if (extraResourceCount <= 0)
+                continue;
+            penalizedResourceCount += extraResourceCount - 1;
+            summary.addChild(String.sprintf("%d %s resources served from %s.", domainResources.length, this._resourceTypeName, domain));
+            result.violationCount += domainResources.length;
         }
+        if (!penalizedResourceCount)
+            return callback(null);
+
+        summary.value = "There are multiple resources served from same domain. Consider combining them into as few files as possible.";
+        callback(result);
     }
-};
+}
 
 WebInspector.AuditRules.CombineExternalResourcesRule.prototype.__proto__ = WebInspector.AuditRule.prototype;
 
 
-WebInspector.AuditRules.CombineJsResourcesRule = function(parametersObject) {
-    WebInspector.AuditRules.CombineExternalResourcesRule.call(this, "page-externaljs", "Combine external JavaScript", WebInspector.Resource.Type.Script, "JS", parametersObject);
+WebInspector.AuditRules.CombineJsResourcesRule = function(allowedPerDomain) {
+    WebInspector.AuditRules.CombineExternalResourcesRule.call(this, "page-externaljs", "Combine external JavaScript", WebInspector.Resource.Type.Script, "JavaScript", allowedPerDomain);
 }
 
 WebInspector.AuditRules.CombineJsResourcesRule.prototype.__proto__ = WebInspector.AuditRules.CombineExternalResourcesRule.prototype;
 
 
-WebInspector.AuditRules.CombineCssResourcesRule = function(parametersObject) {
-    WebInspector.AuditRules.CombineExternalResourcesRule.call(this, "page-externalcss", "Combine external CSS", WebInspector.Resource.Type.Stylesheet, "CSS", parametersObject);
+WebInspector.AuditRules.CombineCssResourcesRule = function(allowedPerDomain) {
+    WebInspector.AuditRules.CombineExternalResourcesRule.call(this, "page-externalcss", "Combine external CSS", WebInspector.Resource.Type.Stylesheet, "CSS", allowedPerDomain);
 }
 
 WebInspector.AuditRules.CombineCssResourcesRule.prototype.__proto__ = WebInspector.AuditRules.CombineExternalResourcesRule.prototype;
 
 
-WebInspector.AuditRules.MinimizeDnsLookupsRule = function(parametersObject) {
-    WebInspector.AuditRule.call(this, "network-minimizelookups", "Minimize DNS lookups", parametersObject);
+WebInspector.AuditRules.MinimizeDnsLookupsRule = function(hostCountThreshold) {
+    WebInspector.AuditRule.call(this, "network-minimizelookups", "Minimize DNS lookups");
+    this._hostCountThreshold = hostCountThreshold;
 }
 
 WebInspector.AuditRules.MinimizeDnsLookupsRule.prototype = {
     doRun: function(resources, result, callback)
     {
-        try {
-            var violationDomains = [];
-            var domainToResourcesMap = WebInspector.AuditRules.getDomainToResourcesMap(resources, undefined, WebInspector.URLRegExp);
-            for (var domain in domainToResourcesMap) {
-                if (domainToResourcesMap[domain].length > 1)
-                    continue;
-                var match = domain.match(WebInspector.URLRegExp);
-                if (!match)
-                    continue;
-                if (!match[2].search(WebInspector.AuditRules.IPAddressRegexp))
-                    continue; // an IP address
-                violationDomains.push(match[2]);
-            }
-            if (violationDomains.length <= this.getValue("HostCountThreshold"))
-                return;
-            var commonMessage = result.appendChild(
-                "The following domains only serve one resource each. If possible, avoid the extra DNS " +
-                "lookups by serving these resources from existing domains.");
-            commonMessage.appendChild(WebInspector.AuditRules.arrayAsUL(violationDomains));
-            result.score = 100 - violationDomains.length * this.getValue("ViolationDomainScore");
-        } catch(e) {
-            console.log(e);
-        } finally {
-            callback(result);
+        var summary = result.addChild("");
+        var domainToResourcesMap = WebInspector.AuditRules.getDomainToResourcesMap(resources, undefined, WebInspector.URLRegExp);
+        for (var domain in domainToResourcesMap) {
+            if (domainToResourcesMap[domain].length > 1)
+                continue;
+            var match = domain.match(WebInspector.URLRegExp);
+            if (!match)
+                continue;
+            if (!match[2].search(WebInspector.AuditRules.IPAddressRegexp))
+                continue; // an IP address
+            summary.addSnippet(match[2]);
+            result.violationCount++;
         }
+        if (!summary.children || summary.children.length <= this._hostCountThreshold)
+            return callback(null);
+
+        summary.value = "The following domains only serve one resource each. If possible, avoid the extra DNS lookups by serving these resources from existing domains.";
+        callback(result);
     }
 }
 
 WebInspector.AuditRules.MinimizeDnsLookupsRule.prototype.__proto__ = WebInspector.AuditRule.prototype;
 
 
-WebInspector.AuditRules.ParallelizeDownloadRule = function(parametersObject)
+WebInspector.AuditRules.ParallelizeDownloadRule = function(optimalHostnameCount, minRequestThreshold, minBalanceThreshold)
 {
-    WebInspector.AuditRule.call(this, "network-parallelizehosts", "Parallelize downloads across hostnames", parametersObject);
+    WebInspector.AuditRule.call(this, "network-parallelizehosts", "Parallelize downloads across hostnames");
+    this._optimalHostnameCount = optimalHostnameCount;
+    this._minRequestThreshold = minRequestThreshold;
+    this._minBalanceThreshold = minBalanceThreshold;
 }
 
 
@@ -257,65 +217,50 @@ WebInspector.AuditRules.ParallelizeDownloadRule.prototype = {
             return (aCount < bCount) ? 1 : (aCount == bCount) ? 0 : -1;
         }
 
-        try {
-            var domainToResourcesMap = WebInspector.AuditRules.getDomainToResourcesMap(
-                resources,
-                [WebInspector.Resource.Type.Stylesheet, WebInspector.Resource.Type.Image],
-                WebInspector.URLRegExp,
-                true);
-
-            var hosts = [];
-            for (var url in domainToResourcesMap)
-                hosts.push(url);
+        var domainToResourcesMap = WebInspector.AuditRules.getDomainToResourcesMap(
+            resources,
+            [WebInspector.Resource.Type.Stylesheet, WebInspector.Resource.Type.Image],
+            WebInspector.URLRegExp,
+            true);
 
-            if (!hosts.length)
-                return; // no hosts (local file or something)
+        var hosts = [];
+        for (var url in domainToResourcesMap)
+            hosts.push(url);
 
-            hosts.sort(hostSorter);
+        if (!hosts.length)
+            return callback(null); // no hosts (local file or something)
 
-            var optimalHostnameCount = this.getValue("OptimalHostnameCount");
-            if (hosts.length > optimalHostnameCount)
-                hosts.splice(optimalHostnameCount);
+        hosts.sort(hostSorter);
 
-            var busiestHostResourceCount = domainToResourcesMap[hosts[0]].length;
-            var resourceCountAboveThreshold = busiestHostResourceCount - this.getValue("MinRequestThreshold");
-            if (resourceCountAboveThreshold <= 0)
-                return;
+        var optimalHostnameCount = this._optimalHostnameCount;
+        if (hosts.length > optimalHostnameCount)
+            hosts.splice(optimalHostnameCount);
 
-            var avgResourcesPerHost = 0;
-            for (var i = 0, size = hosts.length; i < size; ++i)
-                avgResourcesPerHost += domainToResourcesMap[hosts[i]].length;
+        var busiestHostResourceCount = domainToResourcesMap[hosts[0]].length;
+        var resourceCountAboveThreshold = busiestHostResourceCount - this._minRequestThreshold;
+        if (resourceCountAboveThreshold <= 0)
+            return callback(null);
 
-            // Assume optimal parallelization.
-            avgResourcesPerHost /= optimalHostnameCount;
+        var avgResourcesPerHost = 0;
+        for (var i = 0, size = hosts.length; i < size; ++i)
+            avgResourcesPerHost += domainToResourcesMap[hosts[i]].length;
 
-            avgResourcesPerHost = Math.max(avgResourcesPerHost, 1);
+        // Assume optimal parallelization.
+        avgResourcesPerHost /= optimalHostnameCount;
+        avgResourcesPerHost = Math.max(avgResourcesPerHost, 1);
 
-            var pctAboveAvg = (resourceCountAboveThreshold / avgResourcesPerHost) - 1.0;
+        var pctAboveAvg = (resourceCountAboveThreshold / avgResourcesPerHost) - 1.0;
+        var minBalanceThreshold = this._minBalanceThreshold;
+        if (pctAboveAvg < minBalanceThreshold)
+            return callback(null);
 
-            var minBalanceThreshold = this.getValue("MinBalanceThreshold");
-            if (pctAboveAvg < minBalanceThreshold) {
-                result.score = 100;
-                return;
-            }
+        var resourcesOnBusiestHost = domainToResourcesMap[hosts[0]];
+        var entry = result.addChild(String.sprintf("This page makes %d parallelizable requests to %s. Increase download parallelization by distributing the following requests across multiple hostnames.", busiestHostResourceCount, hosts[0]), true);
+        for (var i = 0; i < resourcesOnBusiestHost.length; ++i)
+            entry.addURL(resourcesOnBusiestHost[i].url);
 
-            result.score = (1 - (pctAboveAvg - minBalanceThreshold)) * 100;
-            result.type = WebInspector.AuditRuleResult.Type.Hint;
-
-            var resourcesOnBusiestHost = domainToResourcesMap[hosts[0]];
-            var commonMessage = result.appendChild(
-                String.sprintf("This page makes %d parallelizable requests to %s" +
-                ". Increase download parallelization by distributing the following" +
-                " requests across multiple hostnames.", busiestHostResourceCount, hosts[0]));
-            var outputResources = [];
-            for (var i = 0, size = resourcesOnBusiestHost.length; i < size; ++i)
-                outputResources.push(resourcesOnBusiestHost[i].url);
-            commonMessage.appendChild(WebInspector.AuditRules.arrayAsUL(outputResources, true));
-        } catch(e) {
-            console.log(e);
-        } finally {
-            callback(result);
-        }
+        result.violationCount = resourcesOnBusiestHost.length;
+        callback(result);
     }
 }
 
@@ -324,119 +269,82 @@ WebInspector.AuditRules.ParallelizeDownloadRule.prototype.__proto__ = WebInspect
 
 // The reported CSS rule size is incorrect (parsed != original in WebKit),
 // so use percentages instead, which gives a better approximation.
-WebInspector.AuditRules.UnusedCssRule = function(parametersObject)
+WebInspector.AuditRules.UnusedCssRule = function()
 {
-    WebInspector.AuditRule.call(this, "page-unusedcss", "Remove unused CSS", parametersObject);
+    WebInspector.AuditRule.call(this, "page-unusedcss", "Remove unused CSS rules");
 }
 
 WebInspector.AuditRules.UnusedCssRule.prototype = {
-    _getUnusedStylesheetRatioMessage: function(unusedLength, type, location, styleSheetLength)
-    {
-        var url = type === "href"
-            ? WebInspector.linkifyURL(location)
-            : String.sprintf("Inline block #%s", location);
-        var pctUnused = Math.round(unusedLength / styleSheetLength * 100);
-        return String.sprintf("%s: %f%% (estimated) is not used by the current page.", url, pctUnused);
-    },
-
-    _getUnusedTotalRatioMessage: function(unusedLength, totalLength)
-    {
-        var pctUnused = Math.round(unusedLength / totalLength * 100);
-        return String.sprintf("%d%% of CSS (estimated) is not used by the current page.", pctUnused);
-    },
-
     doRun: function(resources, result, callback)
     {
         var self = this;
-        function evalCallback(evalResult, isException) {
-            try {
-              if (isException)
-                  return;
-
-              var totalLength = 0;
-              var totalUnusedLength = 0;
-              var topMessage;
-              var styleSheetMessage;
-              for (var i = 0; i < evalResult.length; ) {
-                  var type = evalResult[i++];
-                  if (type === "totalLength") {
-                      totalLength = evalResult[i++];
-                      continue;
-                  }
-
-                  var styleSheetLength = evalResult[i++];
-                  var location = evalResult[i++];
-                  var unusedRules = evalResult[i++];
-                  styleSheetMessage = undefined;
-                  if (!topMessage)
-                      topMessage = result.appendChild("");
-
-                  var totalUnusedRuleLength = 0;
-                  var ruleSelectors = [];
-                  for (var j = 0; j < unusedRules.length; ++j) {
-                      var rule = unusedRules[j];
-                      totalUnusedRuleLength += parseInt(rule[1]);
-                      if (!styleSheetMessage)
-                          styleSheetMessage = result.appendChild("");
-                      ruleSelectors.push(rule[0]);
-                  }
-                  styleSheetMessage.appendChild(WebInspector.AuditRules.arrayAsUL(ruleSelectors));
-
-                  styleSheetMessage.value = self._getUnusedStylesheetRatioMessage(totalUnusedRuleLength, type, location, styleSheetLength);
-                  totalUnusedLength += totalUnusedRuleLength;
-              }
-              if (totalUnusedLength) {
-                  var totalUnusedPercent = totalUnusedLength / totalLength;
-                  topMessage.value = self._getUnusedTotalRatioMessage(totalUnusedLength, totalLength);
-                  var pctMultiplier = Math.log(Math.max(200, totalUnusedLength - 800)) / 7 - 0.6;
-                  result.score = (1 - totalUnusedPercent * pctMultiplier) * 100;
-                  result.type = WebInspector.AuditRuleResult.Type.Hint;
-              } else
-                  result.score = 100;
-            } catch(e) {
-                console.log(e);
-            } finally {
-                callback(result);
+        function evalCallback(routineResult, isException) {
+            if (isException || !routineResult || !routineResult.styleSheets.length)
+                return callback(null);
+
+            var totalUnusedPercent = Math.round(100 * routineResult.unusedSize / routineResult.totalSize);
+            var summary = result.addChild(String.sprintf("%d%% of CSS (estimated) is not used by the current page.", totalUnusedPercent), true);
+
+            for (var i = 0; i < routineResult.styleSheets.length; ++i) {
+                var stylesheet = routineResult.styleSheets[i];
+
+                var url = stylesheet.type === "href" ? WebInspector.linkifyURL(stylesheet.location) : String.sprintf("Inline block #%s", stylesheet.location);
+                var pctUnused = Math.round(100 * stylesheet.unusedSize / stylesheet.totalSize);
+                var entry = summary.addChild(String.sprintf("%s: %d%% (estimated) is not used by the current page.", url, pctUnused));
+
+                for (var j = 0; j < stylesheet.unusedRules.length; ++j)
+                    entry.addSnippet(stylesheet.unusedRules[j]);
+
+                result.violationCount += stylesheet.unusedRules.length;
             }
+
+            callback(result);
         }
 
         function routine()
         {
             var styleSheets = document.styleSheets;
             if (!styleSheets)
-                return {};
-            var styleSheetToUnusedRules = [];
+                return false;
+            var routineResult = { styleSheets: [] };
             var inlineBlockOrdinal = 0;
-            var totalCSSLength = 0;
+            var totalStylesheetSize = 0;
+            var totalUnusedStylesheetSize = 0;
             var pseudoSelectorRegexp = /:hover|:link|:active|:visited|:focus/;
             for (var i = 0; i < styleSheets.length; ++i) {
                 var styleSheet = styleSheets[i];
                 if (!styleSheet.cssRules)
                     continue;
-                var currentStyleSheetSize = 0;
+                var stylesheetSize = 0;
+                var unusedStylesheetSize = 0;
                 var unusedRules = [];
                 for (var curRule = 0; curRule < styleSheet.cssRules.length; ++curRule) {
                     var rule = styleSheet.cssRules[curRule];
                     var textLength = rule.cssText ? rule.cssText.length : 0;
-                    currentStyleSheetSize += textLength;
-                    totalCSSLength += textLength;
+                    stylesheetSize += textLength;
                     if (rule.type !== 1 || rule.selectorText.match(pseudoSelectorRegexp))
                         continue;
                     var nodes = document.querySelectorAll(rule.selectorText);
                     if (nodes && nodes.length)
                         continue;
-                    unusedRules.push([rule.selectorText, textLength]);
+                    unusedStylesheetSize += textLength;
+                    unusedRules.push(rule.selectorText);
                 }
+                totalStylesheetSize += stylesheetSize;
+                totalUnusedStylesheetSize += unusedStylesheetSize;
+
                 if (unusedRules.length) {
-                    styleSheetToUnusedRules.push(styleSheet.href ? "href" : "inline");
-                    styleSheetToUnusedRules.push(currentStyleSheetSize);
-                    styleSheetToUnusedRules.push(styleSheet.href ? styleSheet.href : ++inlineBlockOrdinal);
-                    styleSheetToUnusedRules.push(unusedRules);
+                    var entry = { type: styleSheet.href ? "href" : "inline",
+                                  totalSize: stylesheetSize,
+                                  unusedSize: unusedStylesheetSize,
+                                  location: styleSheet.href ? styleSheet.href : ++inlineBlockOrdinal,
+                                  unusedRules: unusedRules };
+                    routineResult.styleSheets.push(entry);
                 }
             }
-            styleSheetToUnusedRules.push("totalLength");
-            styleSheetToUnusedRules.push(totalCSSLength);
-            return styleSheetToUnusedRules;
+            routineResult.totalSize = totalStylesheetSize;
+            routineResult.unusedSize = totalUnusedStylesheetSize;
+            return routineResult;
         }
 
         WebInspector.AuditRules.evaluateInTargetWindow(routine, evalCallback);
@@ -446,34 +354,23 @@ WebInspector.AuditRules.UnusedCssRule.prototype = {
 WebInspector.AuditRules.UnusedCssRule.prototype.__proto__ = WebInspector.AuditRule.prototype;
 
 
-WebInspector.AuditRules.CacheControlRule = function(id, name, parametersObject)
+WebInspector.AuditRules.CacheControlRule = function(id, name)
 {
-    WebInspector.AuditRule.call(this, id, name, parametersObject);
+    WebInspector.AuditRule.call(this, id, name);
 }
 
 WebInspector.AuditRules.CacheControlRule.MillisPerMonth = 1000 * 60 * 60 * 24 * 30;
 
 WebInspector.AuditRules.CacheControlRule.prototype = {
 
-    InfoCheck: -1,
-    FailCheck: 0,
-    WarningCheck: 1,
-    SevereCheck: 2,
-
     doRun: function(resources, result, callback)
     {
-        try {
-            var cacheableAndNonCacheableResources = this._cacheableAndNonCacheableResources(resources);
-            if (cacheableAndNonCacheableResources[0].length) {
-                result.score = 100;
-                this.runChecks(cacheableAndNonCacheableResources[0], result);
-            }
-            this.handleNonCacheableResources(cacheableAndNonCacheableResources[1], result);
-        } catch(e) {
-            console.log(e);
-        } finally {
-            callback(result);
-        }
+        var cacheableAndNonCacheableResources = this._cacheableAndNonCacheableResources(resources);
+        if (cacheableAndNonCacheableResources[0].length)
+            this.runChecks(cacheableAndNonCacheableResources[0], result);
+        this.handleNonCacheableResources(cacheableAndNonCacheableResources[1], result);
+
+        callback(result);
     },
 
     handleNonCacheableResources: function()
@@ -495,36 +392,19 @@ WebInspector.AuditRules.CacheControlRule.prototype = {
         return processedResources;
     },
 
-    execCheck: function(messageText, resourceCheckFunction, resources, severity, result)
+    execCheck: function(messageText, resourceCheckFunction, resources, result)
     {
-        var topMessage;
-        var failingResources = 0;
         var resourceCount = resources.length;
-        var outputResources = [];
+        var urls = [];
         for (var i = 0; i < resourceCount; ++i) {
-            if (resourceCheckFunction.call(this, resources[i])) {
-                ++failingResources;
-                if (!topMessage)
-                    topMessage = result.appendChild(messageText);
-                outputResources.push(resources[i].url);
-            }
+            if (resourceCheckFunction.call(this, resources[i]))
+                urls.push(resources[i].url);
         }
-        if (topMessage)
-            topMessage.appendChild(WebInspector.AuditRules.arrayAsUL(outputResources, true));
-        if (failingResources) {
-            switch (severity) {
-                case this.FailCheck:
-                    result.score = 0;
-                    result.type = WebInspector.AuditRuleResult.Type.Violation;
-                    break;
-                case this.SevereCheck:
-                case this.WarningCheck:
-                    result.score -= 50 * severity * failingResources / resourceCount;
-                    result.type = WebInspector.AuditRuleResult.Type.Hint;
-                    break;
-            }
+        if (urls.length) {
+            var entry = result.addChild(messageText, true);
+            entry.addURLs(urls);
+            result.violationCount += urls.length;
         }
-        return topMessage;
     },
 
     freshnessLifetimeGreaterThan: function(resource, timeMs)
@@ -612,47 +492,34 @@ WebInspector.AuditRules.CacheControlRule.prototype = {
 WebInspector.AuditRules.CacheControlRule.prototype.__proto__ = WebInspector.AuditRule.prototype;
 
 
-WebInspector.AuditRules.BrowserCacheControlRule = function(parametersObject)
+WebInspector.AuditRules.BrowserCacheControlRule = function()
 {
-    WebInspector.AuditRules.CacheControlRule.call(this, "http-browsercache", "Leverage browser caching", parametersObject);
+    WebInspector.AuditRules.CacheControlRule.call(this, "http-browsercache", "Leverage browser caching");
 }
 
 WebInspector.AuditRules.BrowserCacheControlRule.prototype = {
     handleNonCacheableResources: function(resources, result)
     {
         if (resources.length) {
-            var message = result.appendChild(
-                "The following resources are explicitly non-cacheable. Consider making them cacheable if possible:");
-            var resourceOutput = [];
+            var entry = result.addChild("The following resources are explicitly non-cacheable. Consider making them cacheable if possible:", true);
+            result.violationCount += resources.length;
             for (var i = 0; i < resources.length; ++i)
-                resourceOutput.push(resources[i].url);
-            message.appendChild(WebInspector.AuditRules.arrayAsUL(resourceOutput, true));
+                entry.addURL(resources[i].url);
         }
     },
 
     runChecks: function(resources, result, callback)
     {
-        this.execCheck(
-            "The following resources are missing a cache expiration." +
-            " Resources that do not specify an expiration may not be" +
-            " cached by browsers:",
-            this._missingExpirationCheck, resources, this.SevereCheck, result);
-        this.execCheck(
-            "The following resources specify a \"Vary\" header that" +
-            " disables caching in most versions of Internet Explorer:",
-            this._varyCheck, resources, this.SevereCheck, result);
-        this.execCheck(
-            "The following cacheable resources have a short" +
-            " freshness lifetime:",
-            this._oneMonthExpirationCheck, resources, this.WarningCheck, result);
+        this.execCheck("The following resources are missing a cache expiration. Resources that do not specify an expiration may not be cached by browsers:",
+            this._missingExpirationCheck, resources, result);
+        this.execCheck("The following resources specify a \"Vary\" header that disables caching in most versions of Internet Explorer:",
+            this._varyCheck, resources, result);
+        this.execCheck("The following cacheable resources have a short freshness lifetime:",
+            this._oneMonthExpirationCheck, resources, result);
 
         // Unable to implement the favicon check due to the WebKit limitations.
-
-        this.execCheck(
-            "To further improve cache hit rate, specify an expiration" +
-            " one year in the future for the following cacheable" +
-            " resources:",
-            this._oneYearExpirationCheck, resources, this.InfoCheck, result);
+        this.execCheck("To further improve cache hit rate, specify an expiration one year in the future for the following cacheable resources:",
+            this._oneYearExpirationCheck, resources, result);
     },
 
     _missingExpirationCheck: function(resource)
@@ -691,26 +558,19 @@ WebInspector.AuditRules.BrowserCacheControlRule.prototype = {
 WebInspector.AuditRules.BrowserCacheControlRule.prototype.__proto__ = WebInspector.AuditRules.CacheControlRule.prototype;
 
 
-WebInspector.AuditRules.ProxyCacheControlRule = function(parametersObject) {
-    WebInspector.AuditRules.CacheControlRule.call(this, "http-proxycache", "Leverage proxy caching", parametersObject);
+WebInspector.AuditRules.ProxyCacheControlRule = function() {
+    WebInspector.AuditRules.CacheControlRule.call(this, "http-proxycache", "Leverage proxy caching");
 }
 
 WebInspector.AuditRules.ProxyCacheControlRule.prototype = {
     runChecks: function(resources, result, callback)
     {
-        this.execCheck(
-            "Resources with a \"?\" in the URL are not cached by most" +
-            " proxy caching servers:",
-            this._questionMarkCheck, resources, this.WarningCheck, result);
-        this.execCheck(
-            "Consider adding a \"Cache-Control: public\" header to the" +
-            " following resources:",
-            this._publicCachingCheck, resources, this.InfoCheck, result);
-        this.execCheck(
-            "The following publicly cacheable resources contain" +
-            " a Set-Cookie header. This security vulnerability" +
-            " can cause cookies to be shared by multiple users.",
-            this._setCookieCacheableCheck, resources, this.FailCheck, result);
+        this.execCheck("Resources with a \"?\" in the URL are not cached by most proxy caching servers:",
+            this._questionMarkCheck, resources, result);
+        this.execCheck("Consider adding a \"Cache-Control: public\" header to the following resources:",
+            this._publicCachingCheck, resources, result);
+        this.execCheck("The following publicly cacheable resources contain a Set-Cookie header. This security vulnerability can cause cookies to be shared by multiple users.",
+            this._setCookieCacheableCheck, resources, result);
     },
 
     _questionMarkCheck: function(resource)
@@ -735,9 +595,9 @@ WebInspector.AuditRules.ProxyCacheControlRule.prototype = {
 WebInspector.AuditRules.ProxyCacheControlRule.prototype.__proto__ = WebInspector.AuditRules.CacheControlRule.prototype;
 
 
-WebInspector.AuditRules.ImageDimensionsRule = function(parametersObject)
+WebInspector.AuditRules.ImageDimensionsRule = function()
 {
-    WebInspector.AuditRule.call(this, "page-imagedims", "Specify image dimensions", parametersObject);
+    WebInspector.AuditRule.call(this, "page-imagedims", "Specify image dimensions");
 }
 
 WebInspector.AuditRules.ImageDimensionsRule.prototype = {
@@ -745,31 +605,19 @@ WebInspector.AuditRules.ImageDimensionsRule.prototype = {
     {
         function evalCallback(evalResult, isException)
         {
-            try {
-                if (isException)
-                    return;
-                if (!evalResult || !evalResult.totalImages)
-                    return;
-                result.score = 100;
-                var topMessage = result.appendChild(
-                    "A width and height should be specified for all images in order to " +
-                    "speed up page display. The following image(s) are missing a width and/or height:");
-                var map = evalResult.map;
-                var outputResources = [];
-                for (var url in map) {
-                    var value = WebInspector.linkifyURL(url);
-                    if (map[url] > 1)
-                        value += " (" + map[url] + " uses)";
-                    outputResources.push(value);
-                    result.score -= this.getValue("ScorePerImageUse") * map[url];
-                    result.type = WebInspector.AuditRuleResult.Type.Hint;
-                }
-                topMessage.appendChild(WebInspector.AuditRules.arrayAsUL(outputResources));
-            } catch(e) {
-                console.log(e);
-            } finally {
-                callback(result);
+            if (isException || !evalResult || !evalResult.totalImages)
+                return callback(null);
+
+            var entry = result.addChild("A width and height should be specified for all images in order to speed up page display. The following image(s) are missing a width and/or height:", true);
+            var map = evalResult.map;
+            for (var url in map) {
+                var value = WebInspector.linkifyURL(url);
+                if (map[url] > 1)
+                    value += " (" + map[url] + " uses)";
+                entry.addChild(value);
+                result.violationCount++;
             }
+            callback(result);
         }
 
         function routine()
@@ -828,9 +676,9 @@ WebInspector.AuditRules.ImageDimensionsRule.prototype = {
 WebInspector.AuditRules.ImageDimensionsRule.prototype.__proto__ = WebInspector.AuditRule.prototype;
 
 
-WebInspector.AuditRules.CssInHeadRule = function(parametersObject)
+WebInspector.AuditRules.CssInHeadRule = function()
 {
-    WebInspector.AuditRule.call(this, "page-cssinhead", "Put CSS in the document head", parametersObject);
+    WebInspector.AuditRule.call(this, "page-cssinhead", "Put CSS in the document head");
 }
 
 WebInspector.AuditRules.CssInHeadRule.prototype = {
@@ -838,36 +686,22 @@ WebInspector.AuditRules.CssInHeadRule.prototype = {
     {
         function evalCallback(evalResult, isException)
         {
-            try {
-                if (isException)
-                    return;
-                if (!evalResult)
-                    return;
-                result.score = 100;
-                var outputMessages = [];
-                for (var url in evalResult) {
-                    var urlViolations = evalResult[url];
-                    var topMessage = result.appendChild(
-                        String.sprintf("CSS in the %s document body adversely impacts rendering performance.",
-                        WebInspector.linkifyURL(url)));
-                    if (urlViolations[0]) {
-                        outputMessages.push(
-                            String.sprintf("%s style block(s) in the body should be moved to the document head.", urlViolations[0]));
-                        result.score -= this.getValue("InlineURLScore") * urlViolations[0];
-                    }
-                    for (var i = 0; i < urlViolations[1].length; ++i) {
-                        outputMessages.push(
-                            String.sprintf("Link node %s should be moved to the document head", WebInspector.linkifyURL(urlViolations[1])));
-                    }
-                    result.score -= this.getValue("InlineStylesheetScore") * urlViolations[1];
-                    result.type = WebInspector.AuditRuleResult.Type.Hint;
-                }
-                topMessage.appendChild(WebInspector.AuditRules.arrayAsUL(outputMessages));
-            } catch(e) {
-                console.log(e);
-            } finally {
-                callback(result);
+            if (isException || !evalResult)
+                return callback(null);
+
+            var summary = result.addChild("");
+
+            var outputMessages = [];
+            for (var url in evalResult) {
+                var urlViolations = evalResult[url];
+                if (urlViolations[0])
+                    result.addChild(String.sprintf("%s style block(s) in the %s body should be moved to the document head.", urlViolations[0], WebInspector.linkifyURL(url)));
+                for (var i = 0; i < urlViolations[1].length; ++i)
+                    result.addChild(String.sprintf("Link node %s should be moved to the document head in %s", WebInspector.linkifyURL(urlViolations[1])), WebInspector.linkifyURL(url));
+                result.violationCount += urlViolations.length;
             }
+            summary.value = String.sprintf("CSS in the document body adversely impacts rendering performance.");
+            callback(result);
         }
 
         function routine()
@@ -891,23 +725,20 @@ WebInspector.AuditRules.CssInHeadRule.prototype = {
             var urlToViolationsArray = {};
             var found = false;
             for (var i = 0; i < views.length; ++i) {
-              var view = views[i];
-              if (!view.document)
-                  continue;
-
-              var inlineStyles = view.document.querySelectorAll("body style");
-              var inlineStylesheets = view.document.querySelectorAll(
-                  "body link[rel~='stylesheet'][href]");
-              if (!inlineStyles.length && !inlineStylesheets.length)
-                  continue;
-
-              found = true;
-              var inlineStylesheetHrefs = [];
-              for (var j = 0; j < inlineStylesheets.length; ++j)
-                  inlineStylesheetHrefs.push(inlineStylesheets[j].href);
-
-              urlToViolationsArray[view.location.href] =
-                  [inlineStyles.length, inlineStylesheetHrefs];
+                var view = views[i];
+                if (!view.document)
+                    continue;
+
+                var inlineStyles = view.document.querySelectorAll("body style");
+                var inlineStylesheets = view.document.querySelectorAll("body link[rel~='stylesheet'][href]");
+                if (!inlineStyles.length && !inlineStylesheets.length)
+                    continue;
+
+                found = true;
+                var inlineStylesheetHrefs = [];
+                for (var j = 0; j < inlineStylesheets.length; ++j)
+                    inlineStylesheetHrefs.push(inlineStylesheets[j].href);
+                urlToViolationsArray[view.location.href] = [inlineStyles.length, inlineStylesheetHrefs];
             }
             return found ? urlToViolationsArray : null;
         }
@@ -919,72 +750,44 @@ WebInspector.AuditRules.CssInHeadRule.prototype = {
 WebInspector.AuditRules.CssInHeadRule.prototype.__proto__ = WebInspector.AuditRule.prototype;
 
 
-WebInspector.AuditRules.StylesScriptsOrderRule = function(parametersObject)
+WebInspector.AuditRules.StylesScriptsOrderRule = function()
 {
-    WebInspector.AuditRule.call(this, "page-stylescriptorder", "Optimize the order of styles and scripts", parametersObject);
+    WebInspector.AuditRule.call(this, "page-stylescriptorder", "Optimize the order of styles and scripts");
 }
 
 WebInspector.AuditRules.StylesScriptsOrderRule.prototype = {
     doRun: function(resources, result, callback)
     {
-        function evalCallback(evalResult, isException)
+        function evalCallback(resultValue, isException)
         {
-            try {
-                if (isException)
-                    return;
-                if (!evalResult)
-                    return;
-
-                result.score = 100;
-                var lateCssUrls = evalResult['late'];
-                if (lateCssUrls) {
-                    var lateMessage = result.appendChild(
-                        'The following external CSS files were included after ' +
-                        'an external JavaScript file in the document head. To ' +
-                        'ensure CSS files are downloaded in parallel, always ' +
-                        'include external CSS before external JavaScript.');
-                    lateMessage.appendChild(WebInspector.AuditRules.arrayAsUL(lateCssUrls, true));
-                    result.score -= this.getValue("InlineBetweenResourcesScore") * lateCssUrls.length;
-                    result.type = WebInspector.AuditRuleResult.Type.Violation;
-                }
-                if (evalResult['cssBeforeInlineCount']) {
-                  var count = evalResult['cssBeforeInlineCount'];
-                  result.appendChild(count + ' inline script block' +
-                      (count > 1 ? 's were' : ' was') + ' found in the head between an ' +
-                      'external CSS file and another resource. To allow parallel ' +
-                      'downloading, move the inline script before the external CSS ' +
-                      'file, or after the next resource.');
-                  result.score -= this.getValue("CSSAfterJSURLScore") * count;
-                  result.type = WebInspector.AuditRuleResult.Type.Violation;
-                }
-            } catch(e) {
-                console.log(e);
-            } finally {
-                callback(result);
+            if (isException || !resultValue)
+                return callback(null);
+
+            var lateCssUrls = resultValue[0];
+            var cssBeforeInlineCount = resultValue[1];
+
+            var entry = result.addChild("The following external CSS files were included after an external JavaScript file in the document head. To ensure CSS files are downloaded in parallel, always include external CSS before external JavaScript.", true);
+            entry.addURLs(lateCssUrls);
+            result.violationCount += lateCssUrls.length;
+
+            if (cssBeforeInlineCount) {
+                result.addChild(String.sprintf(" %d inline script block%s found in the head between an external CSS file and another resource. To allow parallel downloading, move the inline script before the external CSS file, or after the next resource.", cssBeforeInlineCount, cssBeforeInlineCount > 1 ? "s were" : " was"));
+                result.violationCount += cssBeforeInlineCount;
             }
+            callback(result);
         }
 
         function routine()
         {
-            var lateStyles = document.querySelectorAll(
-                "head script[src] ~ link[rel~='stylesheet'][href]");
-            var stylesBeforeInlineScript = document.querySelectorAll(
-                "head link[rel~='stylesheet'][href] ~ script:not([src])");
-
-            var resultObject;
-            if (!lateStyles.length && !stylesBeforeInlineScript.length)
-                resultObject = null;
-            else {
-                resultObject = {};
-                if (lateStyles.length) {
-                  lateStyleUrls = [];
-                  for (var i = 0; i < lateStyles.length; ++i)
-                      lateStyleUrls.push(lateStyles[i].href);
-                  resultObject["late"] = lateStyleUrls;
-                }
-                resultObject["cssBeforeInlineCount"] = stylesBeforeInlineScript.length;
-            }
-            return resultObject;
+            var lateStyles = document.querySelectorAll("head script[src] ~ link[rel~='stylesheet'][href]");
+            var cssBeforeInlineCount = document.querySelectorAll("head link[rel~='stylesheet'][href] ~ script:not([src])").length;
+            if (!lateStyles.length && !cssBeforeInlineCount)
+                return null;
+
+            var lateStyleUrls = [];
+            for (var i = 0; i < lateStyles.length; ++i)
+                lateStyleUrls.push(lateStyles[i].href);
+            return [ lateStyleUrls, cssBeforeInlineCount ];
         }
 
         WebInspector.AuditRules.evaluateInTargetWindow(routine, evalCallback.bind(this));
@@ -994,9 +797,9 @@ WebInspector.AuditRules.StylesScriptsOrderRule.prototype = {
 WebInspector.AuditRules.StylesScriptsOrderRule.prototype.__proto__ = WebInspector.AuditRule.prototype;
 
 
-WebInspector.AuditRules.CookieRuleBase = function(id, name, parametersObject)
+WebInspector.AuditRules.CookieRuleBase = function(id, name)
 {
-    WebInspector.AuditRule.call(this, id, name, parametersObject);
+    WebInspector.AuditRule.call(this, id, name);
 }
 
 WebInspector.AuditRules.CookieRuleBase.prototype = {
@@ -1004,13 +807,8 @@ WebInspector.AuditRules.CookieRuleBase.prototype = {
     {
         var self = this;
         function resultCallback(receivedCookies, isAdvanced) {
-            try {
-                self.processCookies(isAdvanced ? receivedCookies : [], resources, result);
-            } catch(e) {
-                console.log(e);
-            } finally {
-                callback(result);
-            }
+            self.processCookies(isAdvanced ? receivedCookies : [], resources, result);
+            callback(result);
         }
         WebInspector.Cookies.getCookiesAsync(resultCallback);
     },
@@ -1039,9 +837,11 @@ WebInspector.AuditRules.CookieRuleBase.prototype = {
 WebInspector.AuditRules.CookieRuleBase.prototype.__proto__ = WebInspector.AuditRule.prototype;
 
 
-WebInspector.AuditRules.CookieSizeRule = function(parametersObject)
+WebInspector.AuditRules.CookieSizeRule = function(avgBytesThreshold)
 {
-    WebInspector.AuditRules.CookieRuleBase.call(this, "http-cookiesize", "Minimize cookie size", parametersObject);
+    WebInspector.AuditRules.CookieRuleBase.call(this, "http-cookiesize", "Minimize cookie size");
+    this._avgBytesThreshold = avgBytesThreshold;
+    this._maxBytesThreshold = 1000;
 }
 
 WebInspector.AuditRules.CookieSizeRule.prototype = {
@@ -1097,7 +897,6 @@ WebInspector.AuditRules.CookieSizeRule.prototype = {
         var matchingResourceData = {};
         this.mapResourceCookies(domainToResourcesMap, allCookies, collectorCallback.bind(this));
 
-        result.score = 100;
         for (var resourceDomain in cookiesPerResourceDomain) {
             var cookies = cookiesPerResourceDomain[resourceDomain];
             sortedCookieSizes.push({
@@ -1111,12 +910,9 @@ WebInspector.AuditRules.CookieSizeRule.prototype = {
         var hugeCookieDomains = [];
         sortedCookieSizes.sort(maxSizeSorter);
 
-        var maxBytesThreshold = this.getValue("MaxBytesThreshold");
-        var minBytesThreshold = this.getValue("MinBytesThreshold");
-
         for (var i = 0, len = sortedCookieSizes.length; i < len; ++i) {
             var maxCookieSize = sortedCookieSizes[i].maxCookieSize;
-            if (maxCookieSize > maxBytesThreshold)
+            if (maxCookieSize > this._maxBytesThreshold)
                 hugeCookieDomains.push(sortedCookieSizes[i].domain + ": " + Number.bytesToString(maxCookieSize));
         }
 
@@ -1125,45 +921,33 @@ WebInspector.AuditRules.CookieSizeRule.prototype = {
         for (var i = 0, len = sortedCookieSizes.length; i < len; ++i) {
             var domain = sortedCookieSizes[i].domain;
             var avgCookieSize = sortedCookieSizes[i].avgCookieSize;
-            if (avgCookieSize > minBytesThreshold && avgCookieSize < maxBytesThreshold)
+            if (avgCookieSize > this._avgBytesThreshold && avgCookieSize < this._maxBytesThreshold)
                 bigAvgCookieDomains.push(domain + ": " + Number.bytesToString(avgCookieSize));
         }
-        result.appendChild("The average cookie size for all requests on this page is " + Number.bytesToString(avgAllCookiesSize));
+        result.addChild(String.sprintf("The average cookie size for all requests on this page is %s", Number.bytesToString(avgAllCookiesSize)));
 
         var message;
         if (hugeCookieDomains.length) {
-            result.score = 75;
-            result.type = WebInspector.AuditRuleResult.Type.Violation;
-            message = result.appendChild(
-                String.sprintf("The following domains have a cookie size in excess of %d " +
-                " bytes. This is harmful because requests with cookies larger than 1KB" +
-                " typically cannot fit into a single network packet.", maxBytesThreshold));
-            message.appendChild(WebInspector.AuditRules.arrayAsUL(hugeCookieDomains));
+            var entry = result.addChild("The following domains have a cookie size in excess of 1KB. This is harmful because requests with cookies larger than 1KB typically cannot fit into a single network packet.", true);
+            entry.addURLs(hugeCookieDomains);
+            result.violationCount += hugeCookieDomains.length;
         }
 
         if (bigAvgCookieDomains.length) {
-            this.score -= Math.max(0, avgAllCookiesSize - minBytesThreshold) /
-                (minBytesThreshold - minBytesThreshold) / this.getValue("TotalPoints");
-            if (!result.type)
-                result.type = WebInspector.AuditRuleResult.Type.Hint;
-            message = result.appendChild(
-                String.sprintf("The following domains have an average cookie size in excess of %d" +
-                 " bytes. Reducing the size of cookies" +
-                 " for these domains can reduce the time it takes to send requests.", minBytesThreshold));
-            message.appendChild(WebInspector.AuditRules.arrayAsUL(bigAvgCookieDomains));
+            var entry = result.addChild(String.sprintf("The following domains have an average cookie size in excess of %d bytes. Reducing the size of cookies for these domains can reduce the time it takes to send requests.", this._avgBytesThreshold), true);
+            entry.addURLs(bigAvgCookieDomains.length);
+            result.violationCount += bigAvgCookieDomains.length;
         }
-
-        if (!bigAvgCookieDomains.length && !hugeCookieDomains.length)
-            result.score = WebInspector.AuditCategoryResult.ScoreNA;
     }
 }
 
 WebInspector.AuditRules.CookieSizeRule.prototype.__proto__ = WebInspector.AuditRules.CookieRuleBase.prototype;
 
 
-WebInspector.AuditRules.StaticCookielessRule = function(parametersObject)
+WebInspector.AuditRules.StaticCookielessRule = function(minResources)
 {
-    WebInspector.AuditRules.CookieRuleBase.call(this, "http-staticcookieless", "Serve static content from a cookieless domain", parametersObject);
+    WebInspector.AuditRules.CookieRuleBase.call(this, "http-staticcookieless", "Serve static content from a cookieless domain");
+    this._minResources = minResources;
 }
 
 WebInspector.AuditRules.StaticCookielessRule.prototype = {
@@ -1175,10 +959,9 @@ WebInspector.AuditRules.StaticCookielessRule.prototype = {
                 WebInspector.URLRegExp,
                 true);
         var totalStaticResources = 0;
-        var minResources = this.getValue("MinResources");
         for (var domain in domainToResourcesMap)
             totalStaticResources += domainToResourcesMap[domain].length;
-        if (totalStaticResources < minResources)
+        if (totalStaticResources < this._minResources)
             return;
         var matchingResourceData = {};
         this.mapResourceCookies(domainToResourcesMap, allCookies, this._collectorCallback.bind(this, matchingResourceData));
@@ -1189,19 +972,12 @@ WebInspector.AuditRules.StaticCookielessRule.prototype = {
             badUrls.push(url);
             cookieBytes += matchingResourceData[url]
         }
-        if (badUrls.length < minResources)
+        if (badUrls.length < this._minResources)
             return;
 
-        result.score = 100;
-        var badPoints = cookieBytes / 75;
-        var violationPct = Math.max(badUrls.length / totalStaticResources, 0.6);
-        badPoints *= violationPct;
-        result.score -= badPoints;
-        result.score = Math.max(result.score, 0);
-        result.type = WebInspector.AuditRuleResult.Type.Violation;
-        result.appendChild(String.sprintf("%s of cookies were sent with the following static resources.", Number.bytesToString(cookieBytes)));
-        var message = result.appendChild("Serve these static resources from a domain that does not set cookies:");
-        message.appendChild(WebInspector.AuditRules.arrayAsUL(badUrls, true));
+        var entry = result.addChild(String.sprintf("%s of cookies were sent with the following static resources. Serve these static resources from a domain that does not set cookies:", Number.bytesToString(cookieBytes)), true);
+        entry.addURLs(badUrls);
+        result.violationCount = badUrls.length;
     },
 
     _collectorCallback: function(matchingResourceData, resource, cookie)
diff --git a/WebCore/inspector/front-end/AuditsPanel.js b/WebCore/inspector/front-end/AuditsPanel.js
index 2a56796..350f7b7 100644
--- a/WebCore/inspector/front-end/AuditsPanel.js
+++ b/WebCore/inspector/front-end/AuditsPanel.js
@@ -37,6 +37,7 @@ WebInspector.AuditsPanel = function()
     this.createSidebar();
     this.auditsTreeElement = new WebInspector.SidebarSectionTreeElement("", {}, true);
     this.sidebarTree.appendChild(this.auditsTreeElement);
+    this.auditsTreeElement.listItemElement.addStyleClass("hidden");
     this.auditsTreeElement.expand();
 
     this.auditsItemTreeElement = new WebInspector.AuditsSidebarTreeElement();
@@ -54,6 +55,8 @@ WebInspector.AuditsPanel = function()
     this.viewsContainerElement = document.createElement("div");
     this.viewsContainerElement.id = "audit-views";
     this.element.appendChild(this.viewsContainerElement);
+
+    this._launcherView = new WebInspector.AuditLauncherView(this.categoriesById, this.initiateAudit.bind(this));
 }
 
 WebInspector.AuditsPanel.prototype = {
@@ -95,11 +98,6 @@ WebInspector.AuditsPanel.prototype = {
         return this._auditCategoriesById;
     },
 
-    get visibleView()
-    {
-        return this._visibleView;
-    },
-
     _constructCategories: function()
     {
         this._auditCategoriesById = {};
@@ -125,8 +123,8 @@ WebInspector.AuditsPanel.prototype = {
 
         function ruleResultReadyCallback(categoryResult, ruleResult)
         {
-            if (ruleResult.children)
-                categoryResult.entries.push(ruleResult);
+            if (ruleResult && ruleResult.children)
+                categoryResult.addRuleResult(ruleResult);
 
             --rulesRemaining;
 
@@ -192,14 +190,14 @@ WebInspector.AuditsPanel.prototype = {
             InspectorBackend.enableResourceTracking(false);
             this._updateLauncherViewControls(true);
         } else
-            InjectedScriptAccess.getDefault().evaluate("window.location.reload()", switchCallback);
+            InspectorBackend.reloadPage();
     },
 
     _didMainResourceLoad: function()
     {
         if (this._resourceTrackingCallback) {
             var callback = this._resourceTrackingCallback;
-            this._resourceTrackingCallback = null;
+            delete this._resourceTrackingCallback;
             callback();
         }
     },
@@ -209,35 +207,36 @@ WebInspector.AuditsPanel.prototype = {
         if (!categoryResults._resultView)
             categoryResults._resultView = new WebInspector.AuditResultView(categoryResults);
 
-        this.showView(categoryResults._resultView);
+        this.visibleView = categoryResults._resultView;
     },
 
     showLauncherView: function()
     {
-        if (!this._launcherView)
-            this._launcherView = new WebInspector.AuditLauncherView(this.categoriesById, this.initiateAudit.bind(this));
-
-        this.showView(this._launcherView);
+        this.visibleView = this._launcherView;
+    },
+    
+    get visibleView()
+    {
+        return this._visibleView;
     },
 
-    showView: function(view)
+    set visibleView(x)
     {
-        if (view) {
-            if (this._visibleView === view)
-                return;
-            this._closeVisibleView();
-            this._visibleView = view;
-        }
-        var visibleView = this.visibleView;
-        if (visibleView)
-            visibleView.show(this.viewsContainerElement);
+        if (this._visibleView === x)
+            return;
+
+        if (this._visibleView)
+            this._visibleView.hide();
+
+        this._visibleView = x;
+
+        if (x)
+            x.show(this.viewsContainerElement);
     },
 
     show: function()
     {
         WebInspector.Panel.prototype.show.call(this);
-
-        this.showView();
         this._updateLauncherViewControls(WebInspector.panels.resources.resourceTrackingEnabled);
     },
 
@@ -264,12 +263,6 @@ WebInspector.AuditsPanel.prototype = {
         this.auditsItemTreeElement.reveal();
         this.auditsItemTreeElement.select();
         this.auditResultsTreeElement.removeChildren();
-    },
-
-    _closeVisibleView: function()
-    {
-        if (this.visibleView)
-            this.visibleView.hide();
     }
 }
 
@@ -301,8 +294,9 @@ WebInspector.AuditCategory.prototype = {
         return this._rules.length;
     },
 
-    addRule: function(rule)
+    addRule: function(rule, severity)
     {
+        rule.severity = severity;
         this._rules.push(rule);
     },
 
@@ -324,11 +318,16 @@ WebInspector.AuditCategory.prototype = {
 }
 
 
-WebInspector.AuditRule = function(id, displayName, parametersObject)
+WebInspector.AuditRule = function(id, displayName)
 {
     this._id = id;
     this._displayName = displayName;
-    this._parametersObject = parametersObject;
+}
+
+WebInspector.AuditRule.Severity = {
+    Info: "info",
+    Warning: "warning",
+    Severe: "severe"
 }
 
 WebInspector.AuditRule.prototype = {
@@ -342,83 +341,72 @@ WebInspector.AuditRule.prototype = {
         return this._displayName;
     },
 
-    run: function(resources, callback)
+    set severity(severity)
     {
-        this.doRun(resources, new WebInspector.AuditRuleResult(this.displayName), callback);
+        this._severity = severity;
     },
 
-    doRun: function(resources, result, callback)
+    run: function(resources, callback)
     {
-        throw new Error("doRun() not implemented");
+        var result = new WebInspector.AuditRuleResult(this.displayName);
+        result.severity = this._severity;
+        this.doRun(resources, result, callback);
     },
 
-    getValue: function(key)
+    doRun: function(resources, result, callback)
     {
-        if (key in this._parametersObject)
-            return this._parametersObject[key];
-        else
-            throw new Error(key + " not found in rule parameters");
+        throw new Error("doRun() not implemented");
     }
 }
 
-
 WebInspector.AuditCategoryResult = function(category)
 {
     this.title = category.displayName;
-    this.entries = [];
+    this.ruleResults = [];
 }
 
 WebInspector.AuditCategoryResult.prototype = {
-    addEntry: function(value)
+    addRuleResult: function(ruleResult)
     {
-        var entry = new WebInspector.AuditRuleResult(value);
-        this.entries.push(entry);
-        return entry;
+        this.ruleResults.push(ruleResult);
     }
 }
 
-/**
- * @param {string} value The result message HTML contents.
- */
-WebInspector.AuditRuleResult = function(value)
+WebInspector.AuditRuleResult = function(value, expanded, className)
 {
     this.value = value;
-    this.type = WebInspector.AuditRuleResult.Type.NA;
-}
-
-WebInspector.AuditRuleResult.Type = {
-    // Does not denote a discovered flaw but rather represents an informational message.
-    NA: 0,
-
-    // Denotes a minor impact on the checked metric.
-    Hint: 1,
-
-    // Denotes a major impact on the checked metric.
-    Violation: 2
+    this.className = className;
+    this.expanded = expanded;
+    this.violationCount = 0;
 }
 
 WebInspector.AuditRuleResult.prototype = {
-    appendChild: function(value)
+    addChild: function(value, expanded, className)
     {
         if (!this.children)
             this.children = [];
-        var entry = new WebInspector.AuditRuleResult(value);
+        var entry = new WebInspector.AuditRuleResult(value, expanded, className);
         this.children.push(entry);
         return entry;
     },
 
-    set type(x)
+    addURL: function(url)
     {
-        this._type = x;
+        return this.addChild(WebInspector.linkifyURL(url));
     },
 
-    get type()
+    addURLs: function(urls)
     {
-        return this._type;
+        for (var i = 0; i < urls.length; ++i)
+            this.addURL(urls[i]);
+    },
+
+    addSnippet: function(snippet)
+    {
+        return this.addChild(snippet, false, "source-code");
     }
 }
 
-
 WebInspector.AuditsSidebarTreeElement = function()
 {
     this.small = false;
diff --git a/WebCore/inspector/front-end/Settings.js b/WebCore/inspector/front-end/Settings.js
index a057777..bb004a2 100644
--- a/WebCore/inspector/front-end/Settings.js
+++ b/WebCore/inspector/front-end/Settings.js
@@ -40,7 +40,8 @@ var Preferences = {
     samplingCPUProfiler: false,
     showColorNicknames: true,
     debuggerAlwaysEnabled: false,
-    profilerAlwaysEnabled: false
+    profilerAlwaysEnabled: false,
+    auditsPanelEnabled: false
 }
 
 WebInspector.populateFrontendSettings = function(settingsString)
diff --git a/WebCore/inspector/front-end/audits.css b/WebCore/inspector/front-end/audits.css
index 9d02c80..31b2287 100644
--- a/WebCore/inspector/front-end/audits.css
+++ b/WebCore/inspector/front-end/audits.css
@@ -50,104 +50,6 @@ button.clear-audit-results-status-bar-item .glyph {
     -webkit-mask-image: url(Images/clearConsoleButtonGlyph.png);
 }
 
-#audit-result-view {
-    display: none;
-    overflow: auto;
-    position: absolute;
-    top: 0;
-    left: 0;
-    right: 0;
-    bottom: 0;
-    background-color: rgb(245, 245, 245);
-    cursor: default;
-    overflow: auto;
-}
-
-#audit-result-view.visible {
-    display: block;
-}
-
-#audit-result-view > .pane img.score {
-    float: left;
-    margin-top: 2px;
-    position: relative;
-    height: 16px;
-    width: 16px;
-    z-index: 100;
-}
-
-#audit-result-view > .pane img.score.red {
-    content: url(Images/errorRedDot.png);
-}
-
-#audit-result-view > .pane img.score.green {
-    content: url(Images/successGreenDot.png);
-}
-
-#audit-result-view > .pane.expanded:nth-last-of-type(1) {
-    border-bottom: 1px solid rgb(189, 189, 189) !important;
-}
-
-#audit-result-view .pane.expanded:nth-last-of-type(1) {
-    border-bottom: 0px transparent none;
-}
-
-#audit-result-view > .pane > .body > .pane > .title {
-    padding-left: 16px;
-    background-image: none;
-    border-bottom: none;
-}
-
-#audit-result-view > .pane > .body > .pane > .body {
-    background-color: transparent;
-}
-
-#audit-result-view > .pane > .body > .pane .section {
-    margin-left: 16px;
-}
-
-#audit-result-view .section .header {
-    border: 0;
-    background-image: none;
-    background-color: transparent;
-}
-
-#audit-result-view .section .header > .title {
-    color: rgb(0, 0, 0);
-}
-
-#audit-result-view .section .section-content {
-    width: 100%;
-    padding-left: 18px;
-    display: none;
-}
-
-#audit-result-view .section.expanded .section-content {
-    display: block;
-}
-
-#audit-result-view .section.expanded .section-content > p:nth-of-type(1) {
-    margin-top: 0;
-}
-
-#audit-result-view .section.expanded .section-content > p:nth-of-type(1) > *:nth-child(1) {
-    margin-top: 0;
-}
-
-#audit-result-view .section .header::before {
-    content: url(Images/treeRightTriangleBlack.png);
-}
-
-#audit-result-view .section.expanded .header::before {
-    content: url(Images/treeDownTriangleBlack.png);
-}
-
-div.panel.audits .sidebar > ol.sidebar-tree > li:nth-child(1) {
-    height: 0px;
-    padding-top: 0;
-    padding-bottom: 0;
-}
-
 .audit-launcher-view {
     z-index: 1000;
     position: absolute;
@@ -270,3 +172,102 @@ body.inactive .audit-launcher-view button, .audit-launcher-view button:disabled
     background: url(Images/radioDot.png) center no-repeat,
                 -webkit-gradient(linear, left top, left bottom, from(rgb(252, 252, 252)), to(rgb(223, 223, 223)));
 }
+
+.audit-result-view {
+    overflow: auto;
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    display: none;
+}
+
+.audit-result-view.visible {
+    display: block;
+}
+
+.audit-result-view .severity-severe {
+    content: url(Images/errorRedDot.png);
+}
+
+.audit-result-view .severity-warning {
+    content: url(Images/warningOrangeDot.png);
+}
+
+.audit-result-view .severity-info {
+    content: url(Images/successGreenDot.png);
+}
+
+.audit-result-tree li.parent::before {
+    content: url(Images/treeRightTriangleBlack.png);
+    float: left;
+    width: 8px;
+    height: 8px;
+    margin-top: 1px;
+    padding-right: 2px;
+}
+
+.audit-result-tree {
+    font-size: 11px;
+    line-height: 14px;
+}
+
+.audit-result-tree > ol {
+    position: relative;
+    padding: 2px 6px !important;
+    margin: 0;
+    color: rgb(84, 84, 84);
+    cursor: default;
+    min-width: 100%;
+}
+
+.audit-result-tree, .audit-result-tree ol {
+    list-style-type: none;
+    -webkit-padding-start: 12px;
+    margin: 0;
+}
+
+.audit-result-tree li {
+    padding: 0 0 0 14px;
+    margin-top: 1px;
+    margin-bottom: 1px;
+    word-wrap: break-word;
+    text-indent: -2px;
+}
+
+.audit-result-tree li.parent {
+    text-indent: -12px
+}
+
+.audit-result-tree li.parent::before {
+    content: url(Images/treeRightTriangleBlack.png);
+    float: left;
+    width: 8px;
+    height: 8px;
+    margin-top: 0;
+    padding-right: 2px;
+}
+
+.audit-result-tree li.parent.expanded::before {
+    content: url(Images/treeDownTriangleBlack.png);
+}
+
+.audit-result-tree ol.children {
+    display: none;
+}
+
+.audit-result-tree ol.children.expanded {
+    display: block;
+}
+
+.audit-result {
+    font-weight: bold;
+    color: black;
+}
+
+.audit-result img {
+    float: left;
+    margin-left: -40px;
+    margin-top: -1px;
+}
diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js
index 2a50149..6859861 100644
--- a/WebCore/inspector/front-end/inspector.js
+++ b/WebCore/inspector/front-end/inspector.js
@@ -210,14 +210,10 @@ var WebInspector = {
             this.panels.profiles = new WebInspector.ProfilesPanel();
             this.panels.profiles.registerProfileType(new WebInspector.CPUProfileType());
         }
-
         if (hiddenPanels.indexOf("storage") === -1 && hiddenPanels.indexOf("databases") === -1)
             this.panels.storage = new WebInspector.StoragePanel();
-
-        // FIXME: Uncomment when ready.
-        // if (hiddenPanels.indexOf("audits") === -1)
-        //    this.panels.audits = new WebInspector.AuditsPanel();
-
+        if (Preferences.auditsPanelEnabled && hiddenPanels.indexOf("audits") === -1)
+            this.panels.audits = new WebInspector.AuditsPanel();
         if (hiddenPanels.indexOf("console") === -1)
             this.panels.console = new WebInspector.ConsolePanel();
     },
@@ -782,22 +778,6 @@ WebInspector.documentKeyDown = function(event)
 
             break;
 
-        case "U+0041": // A key
-            if (isMac)
-                var shouldShowAuditsPanel = event.metaKey && !event.shiftKey && !event.ctrlKey && event.altKey;
-            else
-                var shouldShowAuditsPanel = event.ctrlKey && !event.shiftKey && !event.metaKey && event.altKey;
-
-            if (shouldShowAuditsPanel) {
-                if (!this.panels.audits) {
-                    this.panels.audits = new WebInspector.AuditsPanel();
-                    var toolbarElement = document.getElementById("toolbar");
-                    WebInspector.addPanelToolbarIcon(toolbarElement, this.panels.audits, this.panels.console.toolbarItem);
-                }
-                this.currentPanel = this.panels.audits;
-            }
-
-            break;
         case "U+0052": // R key
             if ((event.metaKey && isMac) || (event.ctrlKey && !isMac))
                 InspectorBackend.reloadPage();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list