Commit 3bf4826f authored by timothy@apple.com's avatar timothy@apple.com

Fixes the regression where error and warning bubbles would not be added

to the source view of a resource.

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

Reviewed by Adam Roben.

* css/view-source.css:
(.webkit-html-message-bubble): Add a min-height to make sure the border-radius
has enough room to apply.
* page/inspector/Console.js:
(WebInspector.Console.prototype.addMessage): Removed code that added messages
to resource panels and incremented error and warning counts on resources.
Now just call ResourcesPanel.addMessageToResource after assigning the resource
to the console message.
(WebInspector.Console.prototype.clearMessages): Removed code that cleared error
and warning counts from resources an call ResourcesPanel.clearMessages.
* page/inspector/ResourcesPanel.js:
(WebInspector.ResourcesPanel.prototype.addMessageToResource): Call addMessage
on the resource's view, if it is implemented.
(WebInspector.ResourcesPanel.prototype.clearMessages): Call clearMessages
on all the resource views for the ones that implement it.
(WebInspector.ResourcesPanel.prototype.refreshResource): Call _resourceView
to make the resource's view if needed. Use a local view variable.
(WebInspector.ResourcesPanel.prototype._resourceView): Added helper function
to create a resource view if needed.
* page/inspector/SourceView.js:
(WebInspector.SourceView.prototype.setupSourceFrameIfNeeded): Delete the
_frameNeedsSetup property at the beginning to prevent recursion. Get the
length of the messages array when assigning the local length variable.
(WebInspector.SourceView.prototype.addMessage): Renamed from addMessageToSource.
(WebInspector.SourceView.prototype.clearMessages): Added. Clear all the message
bubbles that might be sprinkled in the source. Also clears the messages array.
(WebInspector.SourceView.prototype._addMessageToSource): Create the image
element in the Inspector's document so we can use relative image URLs. Then
adopt the image element into the frame's document.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@31909 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b61999d6
2008-04-15 Timothy Hatcher <timothy@apple.com>
Fixes the regression where error and warning bubbles would not be added
to the source view of a resource.
https://bugs.webkit.org/show_bug.cgi?id=18495
Reviewed by Adam Roben.
* css/view-source.css:
(.webkit-html-message-bubble): Add a min-height to make sure the border-radius
has enough room to apply.
* page/inspector/Console.js:
(WebInspector.Console.prototype.addMessage): Removed code that added messages
to resource panels and incremented error and warning counts on resources.
Now just call ResourcesPanel.addMessageToResource after assigning the resource
to the console message.
(WebInspector.Console.prototype.clearMessages): Removed code that cleared error
and warning counts from resources an call ResourcesPanel.clearMessages.
* page/inspector/ResourcesPanel.js:
(WebInspector.ResourcesPanel.prototype.addMessageToResource): Call addMessage
on the resource's view, if it is implemented.
(WebInspector.ResourcesPanel.prototype.clearMessages): Call clearMessages
on all the resource views for the ones that implement it.
(WebInspector.ResourcesPanel.prototype.refreshResource): Call _resourceView
to make the resource's view if needed. Use a local view variable.
(WebInspector.ResourcesPanel.prototype._resourceView): Added helper function
to create a resource view if needed.
* page/inspector/SourceView.js:
(WebInspector.SourceView.prototype.setupSourceFrameIfNeeded): Delete the
_frameNeedsSetup property at the beginning to prevent recursion. Get the
length of the messages array when assigning the local length variable.
(WebInspector.SourceView.prototype.addMessage): Renamed from addMessageToSource.
(WebInspector.SourceView.prototype.clearMessages): Added. Clear all the message
bubbles that might be sprinkled in the source. Also clears the messages array.
(WebInspector.SourceView.prototype._addMessageToSource): Create the image
element in the Inspector's document so we can use relative image URLs. Then
adopt the image element into the frame's document.
2008-04-15 Brady Eidson <beidson@apple.com>
Reviewed by Anders
......@@ -123,6 +123,7 @@ td {
-webkit-box-shadow: black 0px 2px 5px;
-webkit-border-radius: 9px;
-webkit-border-fit: lines;
min-height: 13px;
font-size: 9px;
font-family: Lucida Grande;
font-weight: bold;
......
......@@ -135,24 +135,10 @@ WebInspector.Console.prototype = {
addMessage: function(msg)
{
/*
FIXME: Re-implement addMessageToSource in SourceView and ResourcesPanel.
if (msg.url in WebInspector.resourceURLMap) {
msg.resource = WebInspector.resourceURLMap[msg.url];
switch (msg.level) {
case WebInspector.ConsoleMessage.MessageLevel.Warning:
++msg.resource.warnings;
if (msg.resource.panel.addMessageToSource)
msg.resource.panel.addMessageToSource(msg);
break;
case WebInspector.ConsoleMessage.MessageLevel.Error:
++msg.resource.errors;
if (msg.resource.panel.addMessageToSource)
msg.resource.panel.addMessageToSource(msg);
break;
}
WebInspector.panels.resources.addMessageToResource(msg.resource, msg);
}
*/
this.messages.push(msg);
......@@ -163,13 +149,7 @@ WebInspector.Console.prototype = {
clearMessages: function()
{
for (var i = 0; i < this.messages.length; ++i) {
var resource = this.messages[i].resource;
if (!resource)
continue;
resource.errors = 0;
resource.warnings = 0;
}
WebInspector.panels.resources.clearMessages();
this.messages = [];
......
......@@ -260,6 +260,28 @@ WebInspector.ResourcesPanel.prototype = {
this.refreshResource(resource);
},
addMessageToResource: function(resource, msg)
{
if (!resource)
return;
var view = this._resourceView(resource);
if (view.addMessage)
view.addMessage(msg);
},
clearMessages: function()
{
var resourcesLength = this._resources.length;
for (var i = 0; i < resourcesLength; ++i) {
var resource = this._resources[i];
var view = resource._resourcesView;
if (!view || !view.clearMessages)
continue;
view.clearMessages();
}
},
refreshResource: function(resource, skipBoundaryUpdate, skipSort, immediate)
{
if (!this.visible) {
......@@ -308,12 +330,11 @@ WebInspector.ResourcesPanel.prototype = {
if (this.visibleResource && this.visibleResource._resourcesView)
this.visibleResource._resourcesView.hide();
if (!resource._resourcesView)
resource._resourcesView = this._createResourceView(resource);
resource._resourcesView.show();
var view = this._resourceView(resource);
view.show();
if (line && resource._resourcesView.showLine)
resource._resourcesView.showLine(line);
if (line && view.showLine)
view.showLine(line);
if (resource._resourcesTreeElement) {
resource._resourcesTreeElement.reveal();
......@@ -848,6 +869,15 @@ WebInspector.ResourcesPanel.prototype = {
this.sortingFunction = selectedOption.sortingFunction;
},
_resourceView: function(resource)
{
if (!resource)
return null;
if (!resource._resourcesView)
resource._resourcesView = this._createResourceView(resource);
return resource._resourcesView;
},
_createResourceView: function(resource)
{
if (resource.finished && !resource.failed) {
......
......@@ -51,16 +51,16 @@ WebInspector.SourceView.prototype = {
setupSourceFrameIfNeeded: function()
{
if (this._frameNeedsSetup) {
delete this._frameNeedsSetup;
this.attach();
InspectorController.addSourceToFrame(this.resource.identifier, this.frameElement);
WebInspector.addMainEventListeners(this.frameElement.contentDocument);
var length = this.messages;
var length = this.messages.length;
for (var i = 0; i < length; ++i)
this._addMessageToSource(this.messages[i]);
delete this._frameNeedsSetup;
}
},
......@@ -90,13 +90,30 @@ WebInspector.SourceView.prototype = {
row.scrollIntoViewIfNeeded(true);
},
addMessageToSource: function(msg)
addMessage: function(msg)
{
this.messages.push(msg);
if (!this._frameNeedsSetup)
this._addMessageToSource(msg);
},
clearMessages: function()
{
this.messages = [];
if (this._frameNeedsSetup)
return;
var bubbles = this.frameElement.contentDocument.querySelectorAll(".webkit-html-message-bubble");
if (!bubbles)
return;
for (var i = 0; i < bubbles.length; ++i) {
var bubble = bubbles[i];
bubble.parentNode.removeChild(bubble);
}
},
_addMessageToSource: function(msg)
{
var row = this.sourceRow(msg.line);
......@@ -129,9 +146,13 @@ WebInspector.SourceView.prototype = {
lineDiv.className = "webkit-html-message-line";
errorDiv.appendChild(lineDiv);
var image = doc.createElement("img");
// Create the image element in the Inspector's document so we can use relative image URLs.
var image = document.createElement("img");
image.src = imageURL;
image.className = "webkit-html-message-icon";
// Adopt the image element since it wasn't created in doc.
image = doc.adoptNode(image);
lineDiv.appendChild(image);
lineDiv.appendChild(doc.createTextNode(msg.message));
......
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