[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198
podivilov at chromium.org
podivilov at chromium.org
Sun Feb 20 23:26:08 UTC 2011
The following commit has been merged in the webkit-1.3 branch:
commit 48a73855ab95cb6711045ef9f16f55bd631787aa
Author: podivilov at chromium.org <podivilov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Jan 20 14:47:00 2011 +0000
2011-01-19 Pavel Podivilov <podivilov at chromium.org>
Reviewed by Yury Semikhatsky.
Web Inspector: implement JavaScriptBreakpointsSidebarPane based on events from debugger model.
https://bugs.webkit.org/show_bug.cgi?id=52723
Extract all breakpoints-related presentation code from debugger model to JavaScriptBreakpointSidebarPane.
* inspector/front-end/Breakpoint.js:
(WebInspector.Breakpoint):
(WebInspector.Breakpoint.prototype.get data):
(WebInspector.Breakpoint.prototype.remove):
* inspector/front-end/BreakpointsSidebarPane.js:
(WebInspector.JavaScriptBreakpointsSidebarPane):
(WebInspector.JavaScriptBreakpointsSidebarPane.prototype._breakpointAdded):
(WebInspector.JavaScriptBreakpointsSidebarPane.prototype._breakpointRemoved):
(WebInspector.JavaScriptBreakpointsSidebarPane.prototype._breakpointEnableChanged):
(WebInspector.JavaScriptBreakpointsSidebarPane.prototype._breakpointItemCheckboxClicked):
(WebInspector.JavaScriptBreakpointsSidebarPane.prototype._contextMenuEventFired):
(WebInspector.JavaScriptBreakpointsSidebarPane.prototype._debuggerPaused):
(WebInspector.JavaScriptBreakpointsSidebarPane.prototype._debuggerResumed):
(WebInspector.JavaScriptBreakpointsSidebarPane.prototype._addListElement):
(WebInspector.JavaScriptBreakpointsSidebarPane.prototype._removeListElement):
(WebInspector.JavaScriptBreakpointsSidebarPane.prototype._projectChanged):
(WebInspector.JavaScriptBreakpointsSidebarPane.prototype._compare):
(WebInspector.JavaScriptBreakpointsSidebarPane.prototype._compareBreakpoints):
(WebInspector.JavaScriptBreakpointsSidebarPane.prototype._setupBreakpointElement.didGetSourceLine):
(WebInspector.JavaScriptBreakpointsSidebarPane.prototype._setupBreakpointElement):
(WebInspector.JavaScriptBreakpointsSidebarPane.prototype._breakpointIdForDebuggerPausedEvent):
(WebInspector.JavaScriptBreakpointsSidebarPane.prototype._setBreakpointEnabled):
(WebInspector.JavaScriptBreakpointsSidebarPane.prototype._removeBreakpoint):
(WebInspector.NativeBreakpointsSidebarPane):
(WebInspector.XHRBreakpointsSidebarPane.prototype.addBreakpointItem):
* inspector/front-end/DebuggerModel.js:
(WebInspector.DebuggerModel.prototype.removeBreakpoint):
(WebInspector.DebuggerModel.prototype.breakpointForId):
(WebInspector.DebuggerModel.prototype._pausedScript):
(WebInspector.DebuggerModel.prototype._resumedScript):
* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel):
* inspector/front-end/inspector.js:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76239 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 5c14b4b..ceb4c5f 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,46 @@
+2011-01-19 Pavel Podivilov <podivilov at chromium.org>
+
+ Reviewed by Yury Semikhatsky.
+
+ Web Inspector: implement JavaScriptBreakpointsSidebarPane based on events from debugger model.
+ https://bugs.webkit.org/show_bug.cgi?id=52723
+
+ Extract all breakpoints-related presentation code from debugger model to JavaScriptBreakpointSidebarPane.
+
+ * inspector/front-end/Breakpoint.js:
+ (WebInspector.Breakpoint):
+ (WebInspector.Breakpoint.prototype.get data):
+ (WebInspector.Breakpoint.prototype.remove):
+ * inspector/front-end/BreakpointsSidebarPane.js:
+ (WebInspector.JavaScriptBreakpointsSidebarPane):
+ (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._breakpointAdded):
+ (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._breakpointRemoved):
+ (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._breakpointEnableChanged):
+ (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._breakpointItemCheckboxClicked):
+ (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._contextMenuEventFired):
+ (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._debuggerPaused):
+ (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._debuggerResumed):
+ (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._addListElement):
+ (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._removeListElement):
+ (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._projectChanged):
+ (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._compare):
+ (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._compareBreakpoints):
+ (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._setupBreakpointElement.didGetSourceLine):
+ (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._setupBreakpointElement):
+ (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._breakpointIdForDebuggerPausedEvent):
+ (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._setBreakpointEnabled):
+ (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._removeBreakpoint):
+ (WebInspector.NativeBreakpointsSidebarPane):
+ (WebInspector.XHRBreakpointsSidebarPane.prototype.addBreakpointItem):
+ * inspector/front-end/DebuggerModel.js:
+ (WebInspector.DebuggerModel.prototype.removeBreakpoint):
+ (WebInspector.DebuggerModel.prototype.breakpointForId):
+ (WebInspector.DebuggerModel.prototype._pausedScript):
+ (WebInspector.DebuggerModel.prototype._resumedScript):
+ * inspector/front-end/ScriptsPanel.js:
+ (WebInspector.ScriptsPanel):
+ * inspector/front-end/inspector.js:
+
2011-01-20 Dirk Schulze <krit at webkit.org>
Reviewed by Andreas Kling.
diff --git a/Source/WebCore/inspector/front-end/Breakpoint.js b/Source/WebCore/inspector/front-end/Breakpoint.js
index e5e1768..aa600a7 100644
--- a/Source/WebCore/inspector/front-end/Breakpoint.js
+++ b/Source/WebCore/inspector/front-end/Breakpoint.js
@@ -37,7 +37,6 @@ WebInspector.Breakpoint = function(debuggerModel, breakpointId, sourceID, url, l
this.sourceID = sourceID;
this._enabled = enabled;
this._condition = condition || "";
- this._hit = false;
this._debuggerModel = debuggerModel;
}
@@ -60,52 +59,14 @@ WebInspector.Breakpoint.prototype = {
return this._condition;
},
- get hit()
+ get data()
{
- return this._hit;
- },
-
- set hit(hit)
- {
- this._hit = hit;
- this.dispatchEventToListeners("hit-state-changed");
- },
-
- click: function(event)
- {
- WebInspector.panels.scripts.showSourceLine(this.url, this.line);
- },
-
- compareTo: function(other)
- {
- if (this.url != other.url)
- return this.url < other.url ? -1 : 1;
- if (this.line != other.line)
- return this.line < other.line ? -1 : 1;
- return 0;
- },
-
- populateLabelElement: function(element)
- {
- function didGetSourceLine(text)
- {
- var displayName = this.url ? WebInspector.displayNameForURL(this.url) : WebInspector.UIString("(program)");
- var labelElement = document.createTextNode(displayName + ":" + this.line);
- element.appendChild(labelElement);
-
- var sourceTextElement = document.createElement("div");
- sourceTextElement.textContent = text;
- sourceTextElement.className = "source-text monospace";
- element.appendChild(sourceTextElement);
- }
- var script = this._debuggerModel.scriptForSourceID(this.sourceID);
- script.sourceLine(this.line, didGetSourceLine.bind(this));
+ return { id: this.id, url: this.url, sourceID: this.sourceID, lineNumber: this.line, condition: this.condition };
},
remove: function()
{
this._debuggerModel.removeBreakpoint(this.id);
- this.dispatchEventToListeners("removed");
this.removeAllListeners();
delete this._debuggerModel;
}
diff --git a/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js b/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js
index 408c5ba..b237ca2 100644
--- a/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js
+++ b/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js
@@ -23,7 +23,213 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-WebInspector.BreakpointsSidebarPane = function(title)
+WebInspector.JavaScriptBreakpointsSidebarPane = function(title)
+{
+ WebInspector.SidebarPane.call(this, WebInspector.UIString("Breakpoints"));
+
+ this.listElement = document.createElement("ol");
+ this.listElement.className = "breakpoint-list";
+
+ this.emptyElement = document.createElement("div");
+ this.emptyElement.className = "info";
+ this.emptyElement.textContent = WebInspector.UIString("No Breakpoints");
+
+ this.bodyElement.appendChild(this.emptyElement);
+
+ this._items = {};
+
+ WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointAdded, this._breakpointAdded, this);
+ WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointRemoved, this._breakpointRemoved, this);
+ WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this);
+ WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerResumed, this._debuggerResumed, this);
+ WebInspector.breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.ProjectChanged, this._projectChanged, this);
+}
+
+WebInspector.JavaScriptBreakpointsSidebarPane.prototype = {
+ _breakpointAdded: function(event)
+ {
+ var breakpoint = event.data;
+ var breakpointId = breakpoint.id;
+ var data = breakpoint.data;
+
+ var element = document.createElement("li");
+
+ var checkbox = document.createElement("input");
+ checkbox.className = "checkbox-elem";
+ checkbox.type = "checkbox";
+ checkbox.checked = breakpoint.enabled;
+ checkbox.addEventListener("click", this._breakpointItemCheckboxClicked.bind(this, breakpointId), false);
+ element.appendChild(checkbox);
+
+ var label = document.createElement("span");
+ element.appendChild(label);
+
+ element._data = data;
+ var currentElement = this.listElement.firstChild;
+ while (currentElement) {
+ if (currentElement._data && this._compareBreakpoints(currentElement._data, element._data) > 0)
+ break;
+ currentElement = currentElement.nextSibling;
+ }
+ this._addListElement(element, currentElement);
+
+ element.addEventListener("contextmenu", this._contextMenuEventFired.bind(this, breakpointId), true);
+
+ this._setupBreakpointElement(data, element);
+
+ var breakpointItem = {};
+ breakpointItem.data = data;
+ breakpointItem.element = element;
+ breakpointItem.checkbox = checkbox;
+ this._items[breakpointId] = breakpointItem;
+
+ if (!this.expanded)
+ this.expanded = true;
+ },
+
+ _breakpointRemoved: function(event)
+ {
+ var breakpointId = event.data;
+ var breakpointItem = this._items[breakpointId];
+ if (breakpointItem) {
+ delete this._items[breakpointId];
+ this._removeListElement(breakpointItem.element);
+ }
+ },
+
+ _breakpointEnableChanged: function(enabled, event)
+ {
+ var breakpointId = event.data;
+ var breakpointItem = this._items[breakpointId];
+ if (breakpointItem)
+ breakpointItem.checkbox.checked = enabled;
+ },
+
+ _breakpointItemCheckboxClicked: function(breakpointId, event)
+ {
+ this._setBreakpointEnabled(breakpointId, event.target.checked);
+
+ // Breakpoint element may have it's own click handler.
+ event.stopPropagation();
+ },
+
+ _contextMenuEventFired: function(breakpointId, event)
+ {
+ var contextMenu = new WebInspector.ContextMenu();
+ contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), this._removeBreakpoint.bind(this, breakpointId));
+ contextMenu.show(event);
+ },
+
+ _debuggerPaused: function(event)
+ {
+ var breakpointId = this._breakpointIdForDebuggerPausedEvent(event.data);
+ if (!breakpointId)
+ return;
+ var breakpointItem = this._items[breakpointId];
+ if (!breakpointItem)
+ return;
+ breakpointItem.element.addStyleClass("breakpoint-hit");
+ this._lastHitBreakpointItem = breakpointItem;
+ },
+
+ _debuggerResumed: function()
+ {
+ if (this._lastHitBreakpointItem) {
+ this._lastHitBreakpointItem.element.removeStyleClass("breakpoint-hit");
+ delete this._lastHitBreakpointItem;
+ }
+ },
+
+ _addListElement: function(element, beforeElement)
+ {
+ if (beforeElement)
+ this.listElement.insertBefore(element, beforeElement);
+ else {
+ if (!this.listElement.firstChild) {
+ this.bodyElement.removeChild(this.emptyElement);
+ this.bodyElement.appendChild(this.listElement);
+ }
+ this.listElement.appendChild(element);
+ }
+ },
+
+ _removeListElement: function(element)
+ {
+ this.listElement.removeChild(element);
+ if (!this.listElement.firstChild) {
+ this.bodyElement.removeChild(this.listElement);
+ this.bodyElement.appendChild(this.emptyElement);
+ }
+ },
+
+ _projectChanged: function()
+ {
+ this.listElement.removeChildren();
+ if (this.listElement.parentElement) {
+ this.bodyElement.removeChild(this.listElement);
+ this.bodyElement.appendChild(this.emptyElement);
+ }
+ this._items = {};
+ },
+
+ _compare: function(x, y)
+ {
+ if (x !== y)
+ return x < y ? -1 : 1;
+ return 0;
+ },
+
+ _compareBreakpoints: function(b1, b2)
+ {
+ return this._compare(b1.url, b2.url) || this._compare(b1.lineNumber, b2.lineNumber);
+ },
+
+ _setupBreakpointElement: function(data, element)
+ {
+ var displayName = data.url ? WebInspector.displayNameForURL(data.url) : WebInspector.UIString("(program)");
+ var labelElement = document.createTextNode(displayName + ":" + data.lineNumber);
+ element.appendChild(labelElement);
+
+ var sourceTextElement = document.createElement("div");
+ sourceTextElement.className = "source-text monospace";
+ element.appendChild(sourceTextElement);
+
+ function didGetSourceLine(text)
+ {
+ sourceTextElement.textContent = text;
+ }
+ var script = WebInspector.debuggerModel.scriptForSourceID(data.sourceID);
+ script.sourceLine(data.lineNumber, didGetSourceLine.bind(this));
+
+ element.addStyleClass("cursor-pointer");
+ var clickHandler = WebInspector.panels.scripts.showSourceLine.bind(WebInspector.panels.scripts, data.url, data.lineNumber);
+ element.addEventListener("click", clickHandler, false);
+ },
+
+ _breakpointIdForDebuggerPausedEvent: function(details)
+ {
+ var callFrame = details.callFrames[0];
+ var breakpoint = WebInspector.debuggerModel.findBreakpoint(callFrame.sourceID, callFrame.line);
+ if (breakpoint)
+ return breakpoint.id;
+ },
+
+ _setBreakpointEnabled: function(breakpointId, enabled)
+ {
+ var breakpoint = WebInspector.debuggerModel.breakpointForId(breakpointId);
+ WebInspector.debuggerModel.removeBreakpoint(breakpointId);
+ WebInspector.debuggerModel.setBreakpoint(breakpoint.sourceID, breakpoint.line, enabled, breakpoint.condition);
+ },
+
+ _removeBreakpoint: function(breakpointId)
+ {
+ WebInspector.debuggerModel.removeBreakpoint(breakpointId);
+ }
+}
+
+WebInspector.JavaScriptBreakpointsSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
+
+WebInspector.NativeBreakpointsSidebarPane = function(title)
{
WebInspector.SidebarPane.call(this, title);
@@ -39,7 +245,7 @@ WebInspector.BreakpointsSidebarPane = function(title)
WebInspector.breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.ProjectChanged, this._projectChanged, this);
}
-WebInspector.BreakpointsSidebarPane.prototype = {
+WebInspector.NativeBreakpointsSidebarPane.prototype = {
addBreakpointItem: function(breakpointItem)
{
var element = breakpointItem.element;
@@ -102,11 +308,11 @@ WebInspector.BreakpointsSidebarPane.prototype = {
}
}
-WebInspector.BreakpointsSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
+WebInspector.NativeBreakpointsSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
WebInspector.XHRBreakpointsSidebarPane = function()
{
- WebInspector.BreakpointsSidebarPane.call(this, WebInspector.UIString("XHR Breakpoints"));
+ WebInspector.NativeBreakpointsSidebarPane.call(this, WebInspector.UIString("XHR Breakpoints"));
function addButtonClicked(event)
{
@@ -123,7 +329,7 @@ WebInspector.XHRBreakpointsSidebarPane = function()
WebInspector.XHRBreakpointsSidebarPane.prototype = {
addBreakpointItem: function(breakpointItem)
{
- WebInspector.BreakpointsSidebarPane.prototype.addBreakpointItem.call(this, breakpointItem);
+ WebInspector.NativeBreakpointsSidebarPane.prototype.addBreakpointItem.call(this, breakpointItem);
breakpointItem._labelElement.addEventListener("dblclick", this._startEditingBreakpoint.bind(this, breakpointItem), false);
},
@@ -166,7 +372,7 @@ WebInspector.XHRBreakpointsSidebarPane.prototype = {
}
}
-WebInspector.XHRBreakpointsSidebarPane.prototype.__proto__ = WebInspector.BreakpointsSidebarPane.prototype;
+WebInspector.XHRBreakpointsSidebarPane.prototype.__proto__ = WebInspector.NativeBreakpointsSidebarPane.prototype;
WebInspector.BreakpointItem = function(breakpoint)
{
diff --git a/Source/WebCore/inspector/front-end/DebuggerModel.js b/Source/WebCore/inspector/front-end/DebuggerModel.js
index fbceb25..e01f8bd 100644
--- a/Source/WebCore/inspector/front-end/DebuggerModel.js
+++ b/Source/WebCore/inspector/front-end/DebuggerModel.js
@@ -84,6 +84,7 @@ WebInspector.DebuggerModel.prototype = {
delete this._breakpoints[breakpointId];
delete this._sourceIDAndLineToBreakpointId[this._encodeSourceIDAndLine(breakpoint.sourceID, breakpoint.line)];
this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.BreakpointRemoved, breakpointId);
+ breakpoint.dispatchEventToListeners("removed");
},
_breakpointSetOnBackend: function(breakpointId, sourceID, lineNumber, condition, enabled, originalLineNumber, restored)
@@ -103,6 +104,11 @@ WebInspector.DebuggerModel.prototype = {
this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.BreakpointAdded, breakpoint);
},
+ breakpointForId: function(breakpointId)
+ {
+ return this._breakpoints[breakpointId];
+ },
+
queryBreakpoints: function(filter)
{
var breakpoints = [];
@@ -164,26 +170,12 @@ WebInspector.DebuggerModel.prototype = {
delete this._continueToLineBreakpointId;
}
this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.DebuggerPaused, details);
-
- if (details.eventType === WebInspector.DebuggerEventTypes.JavaScriptPause || details.eventType === WebInspector.DebuggerEventTypes.NativeBreakpoint)
- return;
-
- var breakpoint = this.findBreakpoint(details.callFrames[0].sourceID, details.callFrames[0].line);
- if (!breakpoint)
- return;
- breakpoint.hit = true;
- this._lastHitBreakpoint = breakpoint;
},
_resumedScript: function()
{
this._paused = false;
this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.DebuggerResumed);
-
- if (!this._lastHitBreakpoint)
- return;
- this._lastHitBreakpoint.hit = false;
- delete this._lastHitBreakpoint;
},
_parsedScriptSource: function(sourceID, sourceURL, lineOffset, columnOffset, length, scriptWorldType)
diff --git a/Source/WebCore/inspector/front-end/ScriptsPanel.js b/Source/WebCore/inspector/front-end/ScriptsPanel.js
index 3e1b14d..c3a7c4d 100644
--- a/Source/WebCore/inspector/front-end/ScriptsPanel.js
+++ b/Source/WebCore/inspector/front-end/ScriptsPanel.js
@@ -140,7 +140,7 @@ WebInspector.ScriptsPanel = function()
this.sidebarPanes.watchExpressions = new WebInspector.WatchExpressionsSidebarPane();
this.sidebarPanes.callstack = new WebInspector.CallStackSidebarPane();
this.sidebarPanes.scopechain = new WebInspector.ScopeChainSidebarPane();
- this.sidebarPanes.jsBreakpoints = WebInspector.createJSBreakpointsSidebarPane();
+ this.sidebarPanes.jsBreakpoints = new WebInspector.JavaScriptBreakpointsSidebarPane();
if (Preferences.nativeInstrumentationEnabled) {
this.sidebarPanes.domBreakpoints = WebInspector.createDOMBreakpointsSidebarPane();
this.sidebarPanes.xhrBreakpoints = WebInspector.createXHRBreakpointsSidebarPane();
diff --git a/Source/WebCore/inspector/front-end/inspector.js b/Source/WebCore/inspector/front-end/inspector.js
index 9096d01..77abe78 100644
--- a/Source/WebCore/inspector/front-end/inspector.js
+++ b/Source/WebCore/inspector/front-end/inspector.js
@@ -185,20 +185,9 @@ var WebInspector = {
}
},
- createJSBreakpointsSidebarPane: function()
- {
- var pane = new WebInspector.BreakpointsSidebarPane(WebInspector.UIString("Breakpoints"));
- function breakpointAdded(event)
- {
- pane.addBreakpointItem(new WebInspector.BreakpointItem(event.data));
- }
- WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointAdded, breakpointAdded);
- return pane;
- },
-
createDOMBreakpointsSidebarPane: function()
{
- var pane = new WebInspector.BreakpointsSidebarPane(WebInspector.UIString("DOM Breakpoints"));
+ var pane = new WebInspector.NativeBreakpointsSidebarPane(WebInspector.UIString("DOM Breakpoints"));
function breakpointAdded(event)
{
pane.addBreakpointItem(new WebInspector.BreakpointItem(event.data));
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list