Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (182661 => 182662)
--- trunk/Source/WebInspectorUI/ChangeLog 2015-04-11 19:43:34 UTC (rev 182661)
+++ trunk/Source/WebInspectorUI/ChangeLog 2015-04-11 20:55:25 UTC (rev 182662)
@@ -1,3 +1,67 @@
+2015-04-11 Jono Wells <jonowe...@apple.com>
+
+ Web Inspector: Debugger sidebar should show errors underneath scripts
+ https://bugs.webkit.org/show_bug.cgi?id=143464
+
+ Reviewed by Timothy Hatcher.
+
+ Add a new tree element called IssueTreeElement. This shows warnings and errors in the debugger sidebar. These
+ can be clicked to jump to the line of source code for which the error was thrown. BreakpointTreeElement and
+ IssueTreeElement now inherit from DebuggerTreeElement to support any needed commonalities among the interfaces
+ of elements in the debugger sidebar panel.
+
+ * Localizations/en.lproj/localizedStrings.js: Updated.
+ * UserInterface/Main.html: Add new files.
+
+ * UserInterface/Models/IssueMessage.js:
+ (WebInspector.IssueMessage):
+ (WebInspector.IssueMessage.prototype.get source):
+ (WebInspector.IssueMessage.prototype.get lineNumber):
+ (WebInspector.IssueMessage.prototype.get columnNumber):
+ (WebInspector.IssueMessage.prototype.get displayLineNumber):
+ (WebInspector.IssueMessage.prototype.get displayColumnNumber):
+ (WebInspector.IssueMessage.prototype.get sourceCodeLocation):
+ (WebInspector.IssueMessage.prototype.saveIdentityToCookie):
+ (WebInspector.IssueMessage.prototype._sourceCodeLocationDisplayLocationChanged):
+ Convert to use a backing SourceCodeLocation. Expand API.
+
+ * UserInterface/Views/BreakpointTreeElement.js: Inherits now from DebuggerTreeElement.
+
+ * UserInterface/Views/DebuggerSidebarPanel.js:
+ (WebInspector.DebuggerSidebarPanel.showResourcesWithBreakpointsOnlyFilterFunction):
+ (WebInspector.DebuggerSidebarPanel.showResourcesWithIssuesOnlyFilterFunction):
+ (WebInspector.DebuggerSidebarPanel):
+ (WebInspector.DebuggerSidebarPanel.prototype._addBreakpoint):
+ (WebInspector.DebuggerSidebarPanel.prototype._breakpointRemoved):
+ (WebInspector.DebuggerSidebarPanel.prototype._handleDebuggerObjectDisplayLocationDidChange):
+ (WebInspector.DebuggerSidebarPanel.prototype._removeDebuggerTreeElement):
+ (WebInspector.DebuggerSidebarPanel.prototype._treeElementSelected):
+ (WebInspector.DebuggerSidebarPanel.prototype._compareDebuggerTreeElements):
+ (WebInspector.DebuggerSidebarPanel.prototype._addDebuggerObject):
+ (WebInspector.DebuggerSidebarPanel.prototype._addIssue):
+ (WebInspector.DebuggerSidebarPanel.prototype._handleIssueAdded):
+ (WebInspector.DebuggerSidebarPanel.prototype._handleIssuesCleared):
+ (WebInspector.DebuggerSidebarPanel.prototype._breakpointDisplayLocationDidChange): Deleted.
+ (WebInspector.DebuggerSidebarPanel.prototype._removeBreakpointTreeElement): Deleted.
+ (WebInspector.DebuggerSidebarPanel.prototype._compareBreakpointTreeElements): Deleted.
+ Add IssueTreeElements to the sidebar whenever a warning or error corresponding to a line of code is found.
+ Add a filter function and button to filter down to just these. Ensure issue and breakpoint elements can be
+ properly compared.
+
+ * UserInterface/Views/DebuggerTreeElement.js: Added.
+ (WebInspector.DebuggerTreeElement):
+ (WebInspector.DebuggerTreeElement.prototype.get debuggerObject):
+
+ * UserInterface/Views/IssueTreeElement.css: Added.
+ (.issue .icon):
+ (.issue.error .icon):
+ (.navigation-sidebar-panel-content-tree-outline .item.small.issue .icon):
+
+ * UserInterface/Views/IssueTreeElement.js: Added.
+ (WebInspector.IssueTreeElement):
+ (WebInspector.IssueTreeElement.prototype.get issueMessage):
+ (WebInspector.IssueTreeElement.prototype._updateTitles):
+
2015-04-11 Matt Baker <mattba...@apple.com>
Web Inspector: create content view and details sidebar for Frames timeline
Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (182661 => 182662)
--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2015-04-11 19:43:34 UTC (rev 182661)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2015-04-11 20:55:25 UTC (rev 182662)
@@ -434,7 +434,9 @@
localizedStrings["Show console (%s)"] = "Show console (%s)";
localizedStrings["Show full-height console"] = "Show full-height console";
localizedStrings["Show only resources with breakpoints."] = "Show only resources with breakpoints.";
+localizedStrings["Show only resources with issues."] = "Show only resources with issues.";
localizedStrings["Show resources with and without breakpoints."] = "Show resources with and without breakpoints.";
+localizedStrings["Show resources with and without issues."] = "Show resources with and without issues.";
localizedStrings["Show shadow DOM nodes"] = "Show shadow DOM nodes";
localizedStrings["Show split console"] = "Show split console";
localizedStrings["Show the %s details sidebar"] = "Show the %s details sidebar";
Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (182661 => 182662)
--- trunk/Source/WebInspectorUI/UserInterface/Main.html 2015-04-11 19:43:34 UTC (rev 182661)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html 2015-04-11 20:55:25 UTC (rev 182662)
@@ -89,6 +89,7 @@
<link rel="stylesheet" href=""
<link rel="stylesheet" href=""
<link rel="stylesheet" href=""
+ <link rel="stylesheet" href=""
<link rel="stylesheet" href=""
<link rel="stylesheet" href=""
<link rel="stylesheet" href=""
@@ -333,6 +334,7 @@
<script src=""
<script src=""
+ <script src=""
<script src=""
<script src=""
@@ -422,6 +424,7 @@
<script src=""
<script src=""
<script src=""
+ <script src=""
<script src=""
<script src=""
<script src=""
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/IssueMessage.js (182661 => 182662)
--- trunk/Source/WebInspectorUI/UserInterface/Models/IssueMessage.js 2015-04-11 19:43:34 UTC (rev 182661)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/IssueMessage.js 2015-04-11 20:55:25 UTC (rev 182662)
@@ -31,9 +31,8 @@
this._level = level;
this._text = text;
+ this._source = source;
- // FIXME: Move to a SourceCodeLocation.
-
// FIXME <http://webkit.org/b/76404>: Remove the string equality checks for undefined
// once we don't get that value anymore from WebCore.
@@ -41,12 +40,9 @@
if (url && url !== "undefined")
this._url = url;
- if (typeof lineNumber === "number" && lineNumber >= 0)
- this._lineNumber = lineNumber;
+ if (typeof lineNumber === "number" && lineNumber >= 0 && this._url)
+ this._sourceCodeLocation = new WebInspector.SourceCodeLocation(WebInspector.frameResourceManager.resourceForURL(url), lineNumber, columnNumber);
- if (typeof columnNumber === "number" && columnNumber >= 0)
- this._columnNumber = columnNumber;
-
// FIXME: <https://webkit.org/b/142553> Web Inspector: Merge IssueMessage/ConsoleMessage - both attempt to modify the Console Messages parameter independently
if (parameters && parameters !== "undefined") {
@@ -99,6 +95,9 @@
console.error("Unknown issue source:", source);
this._type = WebInspector.IssueMessage.Type.OtherIssue;
}
+
+ if (this._sourceCodeLocation)
+ this._sourceCodeLocation.addEventListener(WebInspector.SourceCodeLocation.Event.DisplayLocationChanged, this._sourceCodeLocationDisplayLocationChanged, this);
}
// Static
@@ -145,6 +144,11 @@
return this._text;
}
+ get source()
+ {
+ return this._source;
+ }
+
get url()
{
return this._url;
@@ -152,14 +156,40 @@
get lineNumber()
{
- return this._lineNumber;
+ if (this._sourceCodeLocation)
+ return this._sourceCodeLocation.lineNumber;
}
get columnNumber()
{
- return this._columnNumber;
+ if (this._sourceCodeLocation)
+ return this._sourceCodeLocation.columnNumber;
}
+ get displayLineNumber()
+ {
+ if (this._sourceCodeLocation)
+ return this._sourceCodeLocation.displayLineNumber;
+ }
+
+ get displayColumnNumber()
+ {
+ if (this._sourceCodeLocation)
+ return this._sourceCodeLocation.displayColumnNumber;
+ }
+
+ get sourceCodeLocation()
+ {
+ return this._sourceCodeLocation;
+ }
+
+ saveIdentityToCookie(cookie)
+ {
+ cookie[WebInspector.IssueMessage.URLCookieKey] = this.url;
+ cookie[WebInspector.IssueMessage.LineNumberCookieKey] = this.sourceCodeLocation.lineNumber;
+ cookie[WebInspector.IssueMessage.ColumnNumberCookieKey] = this.sourceCodeLocation.columnNumber;
+ }
+
// Private
_formatTextIfNecessary()
@@ -196,6 +226,11 @@
this._text = resultText;
}
+
+ _sourceCodeLocationDisplayLocationChanged(event)
+ {
+ this.dispatchEventToListeners(WebInspector.IssueMessage.Event.DisplayLocationDidChange, event.data);
+ }
};
WebInspector.IssueMessage.Level = {
@@ -214,6 +249,16 @@
OtherIssue: "issue-message-type-other-issue"
};
+WebInspector.IssueMessage.TypeIdentifier = "issue-message";
+WebInspector.IssueMessage.URLCookieKey = "issue-message-url";
+WebInspector.IssueMessage.LineNumberCookieKey = "issue-message-line-number";
+WebInspector.IssueMessage.ColumnNumberCookieKey = "issue-message-column-number";
+
+WebInspector.IssueMessage.Event = {
+ LocationDidChange: "issue-message-location-did-change",
+ DisplayLocationDidChange: "issue-message-display-location-did-change"
+};
+
WebInspector.IssueMessage.Type._prefixTypeMap = {
"SyntaxError": WebInspector.IssueMessage.Type.SemanticIssue,
"URIError": WebInspector.IssueMessage.Type.SemanticIssue,
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js (182661 => 182662)
--- trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js 2015-04-11 19:43:34 UTC (rev 182661)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js 2015-04-11 20:55:25 UTC (rev 182662)
@@ -23,7 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-WebInspector.BreakpointTreeElement = class BreakpointTreeElement extends WebInspector.GeneralTreeElement
+WebInspector.BreakpointTreeElement = class BreakpointTreeElement extends WebInspector.DebuggerTreeElement
{
constructor(breakpoint, className, title)
{
@@ -237,7 +237,6 @@
}.bind(this), WebInspector.BreakpointTreeElement.ProbeDataUpdatedAnimationDuration);
}
-
_breakpointLocationDidChange(event)
{
console.assert(event.target === this._breakpoint);
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js (182661 => 182662)
--- trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js 2015-04-11 19:43:34 UTC (rev 182661)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js 2015-04-11 20:55:25 UTC (rev 182662)
@@ -105,8 +105,8 @@
this.filterBar.placeholder = WebInspector.UIString("Filter Breakpoint List");
var showResourcesWithBreakpointsOnlyFilterFunction = function(treeElement)
{
- // Keep breakpoints and other elements that aren't resources.
- if (!treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.BreakpointTreeElement)
+ // Keep breakpoints.
+ if (treeElement instanceof WebInspector.BreakpointTreeElement)
return true;
// Keep resources with breakpoints.
@@ -119,8 +119,25 @@
return false;
};
- this.filterBar.addFilterBarButton("debugger-show-resources-with-children-only", showResourcesWithBreakpointsOnlyFilterFunction, true, WebInspector.UIString("Show only resources with breakpoints."), WebInspector.UIString("Show resources with and without breakpoints."), platformImagePath("Breakpoints.svg"), 15, 15);
+ var showResourcesWithIssuesOnlyFilterFunction = function(treeElement)
+ {
+ // Keep issues.
+ if (treeElement instanceof WebInspector.IssueTreeElement)
+ return true;
+ // Keep resources with issues.
+ if (treeElement.hasChildren) {
+ for (var child of treeElement.children) {
+ if (child instanceof WebInspector.IssueTreeElement)
+ return true;
+ }
+ }
+ return false;
+ };
+
+ this.filterBar.addFilterBarButton("debugger-show-resources-with-breakpoints-only", showResourcesWithBreakpointsOnlyFilterFunction, true, WebInspector.UIString("Show only resources with breakpoints."), WebInspector.UIString("Show resources with and without breakpoints."), platformImagePath("Breakpoints.svg"), 15, 15);
+ this.filterBar.addFilterBarButton("debugger-show-resources-with-issues-only", showResourcesWithIssuesOnlyFilterFunction, true, WebInspector.UIString("Show only resources with issues."), WebInspector.UIString("Show resources with and without issues."), platformImagePath("Errors.svg"), 15, 15);
+
this._breakpointsContentTreeOutline = this.contentTreeOutline;
this._breakpointsContentTreeOutline._onselect_ = this._treeElementSelected.bind(this);
this._breakpointsContentTreeOutline._ondelete_ = this._breakpointTreeOutlineDeleteTreeElement.bind(this);
@@ -155,7 +172,10 @@
this._pauseReasonSection = new WebInspector.DetailsSection("paused-reason", null, [this._pauseReasonGroup], this._pauseReasonLinkContainerElement);
this._pauseReasonSection.title = WebInspector.UIString("Pause Reason");
- WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.DisplayLocationDidChange, this._breakpointDisplayLocationDidChange, this);
+ WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.DisplayLocationDidChange, this._handleDebuggerObjectDisplayLocationDidChange, this);
+ WebInspector.IssueMessage.addEventListener(WebInspector.IssueMessage.Event.DisplayLocationDidChange, this._handleDebuggerObjectDisplayLocationDidChange, this);
+ WebInspector.issueManager.addEventListener(WebInspector.IssueManager.Event.IssueWasAdded, this._handleIssueAdded, this);
+ WebInspector.issueManager.addEventListener(WebInspector.IssueManager.Event.Cleared, this._handleIssuesCleared, this);
}
// Public
@@ -296,7 +316,7 @@
breakpoint.resolved = true;
var breakpointTreeElement = new WebInspector.BreakpointTreeElement(breakpoint);
- parentTreeElement.insertChild(breakpointTreeElement, insertionIndexForObjectInListSortedByFunction(breakpointTreeElement, parentTreeElement.children, this._compareBreakpointTreeElements));
+ parentTreeElement.insertChild(breakpointTreeElement, insertionIndexForObjectInListSortedByFunction(breakpointTreeElement, parentTreeElement.children, this._compareDebuggerTreeElements));
if (parentTreeElement.children.length === 1)
parentTreeElement.expand();
return breakpointTreeElement;
@@ -403,35 +423,36 @@
if (!breakpointTreeElement)
return;
- this._removeBreakpointTreeElement(breakpointTreeElement);
+ this._removeDebuggerTreeElement(breakpointTreeElement);
}
- _breakpointDisplayLocationDidChange(event)
+ _handleDebuggerObjectDisplayLocationDidChange(event)
{
- var breakpoint = event.target;
- if (event.data.oldDisplaySourceCode === breakpoint.displaySourceCode)
+ var debuggerObject = event.target;
+
+ if (event.data.oldDisplaySourceCode === debuggerObject.sourceCodeLocation.displaySourceCode)
return;
- var breakpointTreeElement = this._breakpointsContentTreeOutline.getCachedTreeElement(breakpoint);
- if (!breakpointTreeElement)
+ var debuggerTreeElement = this._breakpointsContentTreeOutline.getCachedTreeElement(debuggerObject);
+ if (!debuggerTreeElement)
return;
- // A known breakpoint moved between resources, remove the old tree element
+ // A known debugger object (breakpoint, issueMessage, etc.) moved between resources, remove the old tree element
// and create a new tree element with the updated file.
- var wasSelected = breakpointTreeElement.selected;
+ var wasSelected = debuggerTreeElement.selected;
- this._removeBreakpointTreeElement(breakpointTreeElement);
- var newBreakpointTreeElement = this._addBreakpoint(breakpoint);
+ this._removeDebuggerTreeElement(debuggerTreeElement);
+ var newDebuggerTreeElement = this._addDebuggerObject(debuggerObject);
- if (newBreakpointTreeElement && wasSelected)
- newBreakpointTreeElement.revealAndSelect(true, false, true, true);
+ if (newDebuggerTreeElement && wasSelected)
+ newDebuggerTreeElement.revealAndSelect(true, false, true, true);
}
- _removeBreakpointTreeElement(breakpointTreeElement)
+ _removeDebuggerTreeElement(debuggerTreeElement)
{
- var parentTreeElement = breakpointTreeElement.parent;
- parentTreeElement.removeChild(breakpointTreeElement);
+ var parentTreeElement = debuggerTreeElement.parent;
+ parentTreeElement.removeChild(debuggerTreeElement);
console.assert(parentTreeElement.parent === this._breakpointsContentTreeOutline);
}
@@ -607,6 +628,13 @@
return;
}
+ if (treeElement instanceof WebInspector.IssueTreeElement) {
+ deselectCallStackContentTreeElements.call(this);
+ deselectPauseReasonContentTreeElements.call(this);
+ WebInspector.resourceSidebarPanel.showSourceCodeLocation(treeElement.issueMessage.sourceCodeLocation);
+ return;
+ }
+
if (!(treeElement instanceof WebInspector.BreakpointTreeElement) || treeElement.parent.constructor === WebInspector.FolderTreeElement)
return;
@@ -644,10 +672,13 @@
return a.mainTitle.localeCompare(b.mainTitle);
}
- _compareBreakpointTreeElements(a, b)
+ _compareDebuggerTreeElements(a, b)
{
- var aLocation = a.breakpoint.sourceCodeLocation;
- var bLocation = b.breakpoint.sourceCodeLocation;
+ if (!a.debuggerObject || !b.debuggerObject)
+ return 0;
+
+ var aLocation = a.debuggerObject.sourceCodeLocation;
+ var bLocation = b.debuggerObject.sourceCodeLocation;
var comparisonResult = aLocation.displayLineNumber - bLocation.displayLineNumber;
if (comparisonResult !== 0)
@@ -752,6 +783,55 @@
var linkElement = WebInspector.createSourceCodeLocationLink(sourceCodeLocation, false, true);
this._pauseReasonLinkContainerElement.appendChild(linkElement);
}
+
+ _addDebuggerObject(debuggerObject)
+ {
+ if (debuggerObject instanceof WebInspector.Breakpoint)
+ return this._addBreakpoint(debuggerObject);
+
+ if (debuggerObject instanceof WebInspector.IssueMessage)
+ return this._addIssue(debuggerObject);
+ }
+
+ _addIssue(issueMessage)
+ {
+ var parentTreeElement = this._addTreeElementForSourceCodeToContentTreeOutline(issueMessage.sourceCodeLocation.sourceCode);
+ var issueTreeElement = new WebInspector.IssueTreeElement(issueMessage);
+
+ parentTreeElement.insertChild(issueTreeElement, insertionIndexForObjectInListSortedByFunction(issueTreeElement, parentTreeElement.children, this._compareDebuggerTreeElements));
+ if (parentTreeElement.children.length === 1)
+ parentTreeElement.expand();
+
+ return issueTreeElement;
+ }
+
+ _handleIssueAdded(event)
+ {
+ var issue = event.data.issue;
+
+ // We only want to show issues originating from _javascript_ source code.
+ if (!issue.lineNumber || (issue.source !== "_javascript_" && issue.source !== "console-api"))
+ return;
+
+ this._addIssue(issue);
+ }
+
+ _handleIssuesCleared(event)
+ {
+ var currentTreeElement = this._contentTreeOutline.children[0];
+ var issueTreeElements = [];
+
+ while (currentTreeElement && !currentTreeElement.root) {
+ if (currentTreeElement instanceof WebInspector.IssueTreeElement) {
+ issueTreeElements.push(currentTreeElement);
+ }
+ currentTreeElement = currentTreeElement.traverseNextTreeElement(false, null, true);
+ }
+
+ for (var issueTreeElement of issueTreeElements) {
+ issueTreeElement.parent.removeChild(issueTreeElement);
+ }
+ }
};
WebInspector.DebuggerSidebarPanel.OffsetSectionsStyleClassName = "offset-sections";
Added: trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerTreeElement.js (0 => 182662)
--- trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerTreeElement.js (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerTreeElement.js 2015-04-11 20:55:25 UTC (rev 182662)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.DebuggerTreeElement = class DebuggerTreeElement extends WebInspector.GeneralTreeElement
+{
+ constructor(classNames, title, subtitle, representedObject, hasChildren)
+ {
+ super(classNames, title, subtitle, representedObject, hasChildren);
+ }
+
+ // Public
+
+ get debuggerObject()
+ {
+ return this.representedObject;
+ }
+};
Added: trunk/Source/WebInspectorUI/UserInterface/Views/IssueTreeElement.css (0 => 182662)
--- trunk/Source/WebInspectorUI/UserInterface/Views/IssueTreeElement.css (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/IssueTreeElement.css 2015-04-11 20:55:25 UTC (rev 182662)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+.issue .icon {
+ background-image: url(../Images/Warning.svg);
+ content: '';
+}
+
+.issue.error .icon {
+ background-image: url(../Images/Error.svg);
+}
+
+.navigation-sidebar-panel-content-tree-outline.small .item.issue .icon,
+.navigation-sidebar-panel-content-tree-outline .children.small .item.issue .icon,
+.navigation-sidebar-panel-content-tree-outline .item.small.issue .icon {
+ background-position: center;
+ background-repeat: no-repeat;
+ background-size: 14px;
+}
Added: trunk/Source/WebInspectorUI/UserInterface/Views/IssueTreeElement.js (0 => 182662)
--- trunk/Source/WebInspectorUI/UserInterface/Views/IssueTreeElement.js (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/IssueTreeElement.js 2015-04-11 20:55:25 UTC (rev 182662)
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.IssueTreeElement = class IssueTreeElement extends WebInspector.DebuggerTreeElement
+{
+ constructor(issueMessage)
+ {
+ var levelStyleClassName;
+ switch (issueMessage.level) {
+ case "error":
+ levelStyleClassName = WebInspector.IssueTreeElement.ErrorStyleClassName;
+ break;
+ case "warning":
+ levelStyleClassName = WebInspector.IssueTreeElement.WarningStyleClassName;
+ break;
+ }
+
+ super([WebInspector.IssueTreeElement.StyleClassName, levelStyleClassName], null, null, issueMessage, false);
+
+ this.small = true;
+ this._issueMessage = issueMessage;
+ this._updateTitles();
+
+ this._issueMessage.addEventListener(WebInspector.IssueMessage.Event.DisplayLocationDidChange, this._updateTitles, this);
+ }
+
+ // Public
+
+ get issueMessage()
+ {
+ return this._issueMessage;
+ }
+
+ // Private
+
+ _updateTitles()
+ {
+ var displayLineNumber = this._issueMessage.displayLineNumber;
+ var displayColumnNumber = this._issueMessage.displayColumnNumber;
+ var title;
+ if (displayColumnNumber > 0)
+ title = WebInspector.UIString("Line %d:%d").format(displayLineNumber + 1, displayColumnNumber + 1); // The user visible line and column numbers are 1-based.
+ else
+ title = WebInspector.UIString("Line %d").format(displayLineNumber + 1); // The user visible line number is 1-based.
+
+ this.mainTitle = title + " " + this._issueMessage.text;
+ }
+};
+
+WebInspector.IssueTreeElement.StyleClassName = "issue";
+WebInspector.IssueTreeElement.ErrorStyleClassName = "error";
+WebInspector.IssueTreeElement.WarningStyleClassName = "warning";