Commit 82ce94c1 authored by timothy@apple.com's avatar timothy@apple.com

Fixes the regression where the error and warning counts did not show up in the Resources

sidebar next to resources.

https://bugs.webkit.org/show_bug.cgi?id=18494

Reviewed by Adam Roben.

* page/inspector/ResourcesPanel.js:
(WebInspector.ResourcesPanel.prototype.addMessageToResource): Increment errors or warnings
on the resource. Set the bubbleText to the total of the errors and warnings. Add a error
or warning class to the bubble.
(WebInspector.ResourcesPanel.prototype.clearMessages): Zero out the errors and warnings
properties on each resource. Set the bubbleText back to an empty string.
* page/inspector/SidebarTreeElement.js:
(WebInspector.SidebarTreeElement): Create a statusElement.
(WebInspector.SidebarTreeElement.prototype.get bubbleText): Return _bubbleText.
(WebInspector.SidebarTreeElement.prototype.set bubbleText): Create bubbleElement if needed.
Assign the value to _bubbleText and bubbleElement.textContent.
(WebInspector.SidebarTreeElement.prototype.onattach): Append statusElement to _listItemNode.
* page/inspector/inspector.css: Style rules for bubbles and status elements.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@31910 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3bf4826f
2008-04-15 Timothy Hatcher <timothy@apple.com>
Fixes the regression where the error and warning counts did not show up in the Resources
sidebar next to resources.
https://bugs.webkit.org/show_bug.cgi?id=18494
Reviewed by Adam Roben.
* page/inspector/ResourcesPanel.js:
(WebInspector.ResourcesPanel.prototype.addMessageToResource): Increment errors or warnings
on the resource. Set the bubbleText to the total of the errors and warnings. Add a error
or warning class to the bubble.
(WebInspector.ResourcesPanel.prototype.clearMessages): Zero out the errors and warnings
properties on each resource. Set the bubbleText back to an empty string.
* page/inspector/SidebarTreeElement.js:
(WebInspector.SidebarTreeElement): Create a statusElement.
(WebInspector.SidebarTreeElement.prototype.get bubbleText): Return _bubbleText.
(WebInspector.SidebarTreeElement.prototype.set bubbleText): Create bubbleElement if needed.
Assign the value to _bubbleText and bubbleElement.textContent.
(WebInspector.SidebarTreeElement.prototype.onattach): Append statusElement to _listItemNode.
* page/inspector/inspector.css: Style rules for bubbles and status elements.
2008-04-15 Timothy Hatcher <timothy@apple.com>
Fixes the regression where error and warning bubbles would not be added
......@@ -265,6 +265,23 @@ WebInspector.ResourcesPanel.prototype = {
if (!resource)
return;
var bubbleClass;
switch (msg.level) {
case WebInspector.ConsoleMessage.MessageLevel.Warning:
++resource.warnings;
bubbleClass = "warning";
break;
case WebInspector.ConsoleMessage.MessageLevel.Error:
++resource.errors;
bubbleClass = "error";
break;
}
resource._resourcesTreeElement.bubbleText = (resource.warnings + resource.errors);
if (bubbleClass)
resource._resourcesTreeElement.bubbleElement.addStyleClass(bubbleClass);
var view = this._resourceView(resource);
if (view.addMessage)
view.addMessage(msg);
......@@ -275,6 +292,13 @@ WebInspector.ResourcesPanel.prototype = {
var resourcesLength = this._resources.length;
for (var i = 0; i < resourcesLength; ++i) {
var resource = this._resources[i];
resource.warnings = 0;
resource.errors = 0;
resource._resourcesTreeElement.bubbleText = "";
resource._resourcesTreeElement.bubbleElement.removeStyleClass("error");
resource._resourcesTreeElement.bubbleElement.removeStyleClass("warning");
var view = resource._resourcesView;
if (!view || !view.clearMessages)
continue;
......
......@@ -54,6 +54,9 @@ WebInspector.SidebarTreeElement = function(className, title, subtitle, represent
this.disclosureButton.className = "disclosure-button";
}
this.statusElement = document.createElement("div");
this.statusElement.className = "status";
this.titlesElement = document.createElement("div");
this.titlesElement.className = "titles";
......@@ -93,6 +96,23 @@ WebInspector.SidebarTreeElement.prototype = {
this.refreshTitles();
},
get bubbleText()
{
return this._bubbleText;
},
set bubbleText(x)
{
if (!this.bubbleElement) {
this.bubbleElement = document.createElement("div");
this.bubbleElement.className = "bubble";
this.statusElement.appendChild(this.bubbleElement);
}
this._bubbleText = x;
this.bubbleElement.textContent = x;
},
refreshTitles: function()
{
var mainTitle = this.mainTitle;
......@@ -125,8 +145,9 @@ WebInspector.SidebarTreeElement.prototype = {
var iconElement = document.createElement("img");
iconElement.className = "icon";
this._listItemNode.appendChild(iconElement);
this._listItemNode.appendChild(iconElement);
this._listItemNode.appendChild(this.statusElement);
this._listItemNode.appendChild(this.titlesElement);
},
......
......@@ -1641,9 +1641,56 @@ body.inactive .sidebar-tree-item .disclosure-button:active {
margin-right: 3px;
}
.sidebar-tree-item .status {
float: right;
height: 16px;
margin-top: 10px;
margin-left: 4px;
line-height: 1em;
}
.sidebar-tree-item .status:empty {
display: none;
}
.sidebar-tree-item .status .bubble {
display: inline-block;
height: 14px;
min-width: 16px;
margin-top: 1px;
background-color: rgb(128, 151, 189);
vertical-align: middle;
white-space: nowrap;
padding: 1px 4px;
text-align: center;
font-size: 11px;
font-family: Helvetia, Arial, sans-serif;
font-weight: bold;
text-shadow: none;
color: white;
-webkit-border-radius: 7px;
}
.sidebar-tree-item .status .bubble:empty {
display: none;
}
.sidebar-tree-item.selected .status .bubble {
background-color: white !important;
color: rgb(132, 154, 190) !important;
}
.focused .sidebar-tree-item.selected .status .bubble {
color: rgb(36, 98, 172) !important;
}
body.inactive .sidebar-tree-item.selected .status .bubble {
color: rgb(159, 159, 159) !important;
}
.sidebar-tree.small .sidebar-tree-item, .sidebar-tree .children.small .sidebar-tree-item, .sidebar-tree-item.small {
height: 20px;
.sidebar-tree-itemne-height: 18px;
line-height: 18px;
}
.sidebar-tree.small .sidebar-tree-item .icon, .sidebar-tree .children.small .sidebar-tree-item .icon, .sidebar-tree-item.small .icon {
......@@ -1651,6 +1698,10 @@ body.inactive .sidebar-tree-item .disclosure-button:active {
height: 16px;
}
.sidebar-tree.small .sidebar-tree-item .status, .sidebar-tree .children.small .sidebar-tree-item .status, .sidebar-tree-item.small .status {
margin-top: 2px;
}
.sidebar-tree-item.selected {
color: white;
background-image: url(Images/sidebarSelectionBackground.png);
......@@ -1806,3 +1857,11 @@ body.inactive .sidebar-tree.small .sidebar-tree-item.selected, body.inactive .si
.children.small .resource-sidebar-tree-item.resources-category-scripts .icon {
content: url(Images/resourceDocumentIconSmall.png);
}
.resource-sidebar-tree-item .bubble.warning {
background-color: rgb(232, 164, 0);
}
.resource-sidebar-tree-item .bubble.error {
background-color: rgb(216, 35, 35);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment