[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 12:25:58 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 8acac65b5e08ae4b6a1d066e82dbd2e84a69ca10
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Aug 23 14:40:57 2010 +0000

    2010-08-23  Pavel Podivilov  <podivilov at chromium.org>
    
            Reviewed by Pavel Feldman.
    
            Web Inspector: remove javascript breakpoint specific code from BreakpointSidebarPane
            https://bugs.webkit.org/show_bug.cgi?id=44327
    
            * inspector/front-end/BreakpointManager.js:
            (WebInspector.BreakpointManager.prototype.setBreakpoint):
            (WebInspector.BreakpointManager.prototype.restoredBreakpoint):
            (WebInspector.BreakpointManager.prototype._setBreakpoint):
            (WebInspector.BreakpointManager.prototype._removeBreakpoint):
            (WebInspector.BreakpointManager.prototype._setBreakpointOnBackend):
            (WebInspector.Breakpoint):
            * inspector/front-end/BreakpointsSidebarPane.js:
            (WebInspector.BreakpointsSidebarPane):
            (WebInspector.BreakpointsSidebarPane.prototype.addBreakpoint):
            (WebInspector.BreakpointsSidebarPane.prototype._breakpointRemoved):
            (WebInspector.JSBreakpointItem):
            (WebInspector.JSBreakpointItem.prototype.compareTo):
            (WebInspector.JSBreakpointItem.prototype.element):
            (WebInspector.JSBreakpointItem.prototype._breakpointClicked):
            (WebInspector.JSBreakpointItem.prototype._checkboxClicked):
            (WebInspector.JSBreakpointItem.prototype._enableChanged):
            (WebInspector.JSBreakpointItem.prototype._textChanged):
            (WebInspector.JSBreakpointItem.prototype._removed):
            * inspector/front-end/ScriptsPanel.js:
            (WebInspector.ScriptsPanel):
            (WebInspector.ScriptsPanel.prototype._breakpointAdded):
            (WebInspector.ScriptsPanel.prototype._breakpointRemoved):
            * inspector/front-end/SourceFrame.js:
            (WebInspector.SourceFrame.prototype.addBreakpoint):
            (WebInspector.SourceFrame.prototype._addBreakpointToSource):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65810 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 3069b9b..4393564 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,37 @@
+2010-08-23  Pavel Podivilov  <podivilov at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: remove javascript breakpoint specific code from BreakpointSidebarPane
+        https://bugs.webkit.org/show_bug.cgi?id=44327
+
+        * inspector/front-end/BreakpointManager.js:
+        (WebInspector.BreakpointManager.prototype.setBreakpoint):
+        (WebInspector.BreakpointManager.prototype.restoredBreakpoint):
+        (WebInspector.BreakpointManager.prototype._setBreakpoint):
+        (WebInspector.BreakpointManager.prototype._removeBreakpoint):
+        (WebInspector.BreakpointManager.prototype._setBreakpointOnBackend):
+        (WebInspector.Breakpoint):
+        * inspector/front-end/BreakpointsSidebarPane.js:
+        (WebInspector.BreakpointsSidebarPane):
+        (WebInspector.BreakpointsSidebarPane.prototype.addBreakpoint):
+        (WebInspector.BreakpointsSidebarPane.prototype._breakpointRemoved):
+        (WebInspector.JSBreakpointItem):
+        (WebInspector.JSBreakpointItem.prototype.compareTo):
+        (WebInspector.JSBreakpointItem.prototype.element):
+        (WebInspector.JSBreakpointItem.prototype._breakpointClicked):
+        (WebInspector.JSBreakpointItem.prototype._checkboxClicked):
+        (WebInspector.JSBreakpointItem.prototype._enableChanged):
+        (WebInspector.JSBreakpointItem.prototype._textChanged):
+        (WebInspector.JSBreakpointItem.prototype._removed):
+        * inspector/front-end/ScriptsPanel.js:
+        (WebInspector.ScriptsPanel):
+        (WebInspector.ScriptsPanel.prototype._breakpointAdded):
+        (WebInspector.ScriptsPanel.prototype._breakpointRemoved):
+        * inspector/front-end/SourceFrame.js:
+        (WebInspector.SourceFrame.prototype.addBreakpoint):
+        (WebInspector.SourceFrame.prototype._addBreakpointToSource):
+
 2010-08-23  Ilya Tikhonovsky  <loislo at chromium.org>
 
         Reviewed by Yury Semikhatsky.
diff --git a/WebCore/inspector/front-end/BreakpointManager.js b/WebCore/inspector/front-end/BreakpointManager.js
index 21fa6a4..2aff87f 100644
--- a/WebCore/inspector/front-end/BreakpointManager.js
+++ b/WebCore/inspector/front-end/BreakpointManager.js
@@ -50,16 +50,16 @@ WebInspector.BreakpointManager.prototype = {
         }
     },
 
-    setBreakpoint: function(sourceID, sourceURL, line, enabled, condition)
+    setBreakpoint: function(sourceID, url, line, enabled, condition)
     {
-        var breakpoint = this._setBreakpoint(sourceID, sourceURL, line, enabled, condition);
+        var breakpoint = this._setBreakpoint(sourceID, url, line, enabled, condition);
         if (breakpoint)
             this._setBreakpointOnBackend(breakpoint);
     },
 
-    restoredBreakpoint: function(sourceID, sourceURL, line, enabled, condition)
+    restoredBreakpoint: function(sourceID, url, line, enabled, condition)
     {
-        this._setBreakpoint(sourceID, sourceURL, line, enabled, condition);
+        this._setBreakpoint(sourceID, url, line, enabled, condition);
     },
 
     removeBreakpoint: function(breakpoint)
@@ -94,9 +94,9 @@ WebInspector.BreakpointManager.prototype = {
         delete this._oneTimeBreakpoint;
     },
 
-    _setBreakpoint: function(sourceID, sourceURL, line, enabled, condition)
+    _setBreakpoint: function(sourceID, url, line, enabled, condition)
     {
-        var breakpoint = new WebInspector.Breakpoint(this, sourceID, sourceURL, line, enabled, condition);
+        var breakpoint = new WebInspector.Breakpoint(this, sourceID, url, line, enabled, condition);
         if (this._breakpoints[breakpoint.id])
             return;
         if (this._oneTimeBreakpoint && (this._oneTimeBreakpoint.id == breakpoint.id))
@@ -110,10 +110,10 @@ WebInspector.BreakpointManager.prototype = {
     {
         if (!(breakpoint.id in this._breakpoints))
             return false;
+        breakpoint.dispatchEventToListeners("removed");
         breakpoint.removeAllListeners();
         delete breakpoint._breakpointManager;
         delete this._breakpoints[breakpoint.id];
-        this.dispatchEventToListeners("breakpoint-removed", breakpoint);
         return true;
     },
 
@@ -131,7 +131,7 @@ WebInspector.BreakpointManager.prototype = {
             } else {
                 this._removeBreakpoint(breakpoint);
                 if (success)
-                    this._setBreakpoint(breakpoint.sourceID, breakpoint.sourceURL, line, breakpoint.enabled, breakpoint.condition);
+                    this._setBreakpoint(breakpoint.sourceID, breakpoint.url, line, breakpoint.enabled, breakpoint.condition);
             }
         }
         var callbackId = WebInspector.Callback.wrap(didSetBreakpoint.bind(this));
@@ -141,9 +141,9 @@ WebInspector.BreakpointManager.prototype = {
 
 WebInspector.BreakpointManager.prototype.__proto__ = WebInspector.Object.prototype;
 
-WebInspector.Breakpoint = function(breakpointManager, sourceID, sourceURL, line, enabled, condition)
+WebInspector.Breakpoint = function(breakpointManager, sourceID, url, line, enabled, condition)
 {
-    this.url = sourceURL;
+    this.url = url;
     this.line = line;
     this.sourceID = sourceID;
     this._enabled = enabled;
@@ -182,12 +182,6 @@ WebInspector.Breakpoint.prototype = {
         this.dispatchEventToListeners("text-changed");
     },
 
-    get label()
-    {
-        var displayName = (this.url ? WebInspector.displayNameForURL(this.url) : WebInspector.UIString("(program)"));
-        return displayName + ":" + this.line;
-    },
-
     get id()
     {
         return this.sourceID + ":" + this.line;
@@ -212,4 +206,3 @@ WebInspector.Breakpoint.prototype = {
 }
 
 WebInspector.Breakpoint.prototype.__proto__ = WebInspector.Object.prototype;
-
diff --git a/WebCore/inspector/front-end/BreakpointsSidebarPane.js b/WebCore/inspector/front-end/BreakpointsSidebarPane.js
index a4daa2d..d88024d 100644
--- a/WebCore/inspector/front-end/BreakpointsSidebarPane.js
+++ b/WebCore/inspector/front-end/BreakpointsSidebarPane.js
@@ -35,9 +35,6 @@ WebInspector.BreakpointsSidebarPane = function()
     this.emptyElement.textContent = WebInspector.UIString("No Breakpoints");
 
     this.bodyElement.appendChild(this.emptyElement);
-
-    WebInspector.breakpointManager.addEventListener("breakpoint-added", this._breakpointAdded, this);
-    WebInspector.breakpointManager.addEventListener("breakpoint-removed", this._breakpointRemoved, this);    
 }
 
 WebInspector.BreakpointsSidebarPane.prototype = {
@@ -50,15 +47,23 @@ WebInspector.BreakpointsSidebarPane.prototype = {
         }
     },
 
-    _breakpointAdded: function(event)
+    addBreakpoint: function(breakpoint)
     {
-        var breakpoint = event.data;
+        breakpoint.addEventListener("removed", this._breakpointRemoved, this);
 
-        breakpoint.addEventListener("enabled", this._breakpointEnableChanged, this);
-        breakpoint.addEventListener("disabled", this._breakpointEnableChanged, this);
-        breakpoint.addEventListener("text-changed", this._breakpointTextChanged, this);
+        var breakpointElement = breakpoint.element();
+        breakpointElement._breakpointObject = breakpoint;
 
-        this._appendBreakpointElement(breakpoint);
+        var currentElement = this.listElement.firstChild;
+        while (currentElement) {
+             if (currentElement._breakpointObject.compareTo(breakpointElement._breakpointObject) > 0) {
+                this.listElement.insertBefore(breakpointElement, currentElement);
+                break;
+            }
+            currentElement = currentElement.nextSibling;
+        }
+        if (!currentElement)
+            this.listElement.appendChild(breakpointElement);
 
         if (this.emptyElement.parentElement) {
             this.bodyElement.removeChild(this.emptyElement);
@@ -66,88 +71,91 @@ WebInspector.BreakpointsSidebarPane.prototype = {
         }
     },
 
-    _appendBreakpointElement: function(breakpoint)
+    _breakpointRemoved: function(event)
     {
-        function checkboxClicked(event)
-        {
-            breakpoint.enabled = !breakpoint.enabled;
-
-            // without this, we'd switch to the source of the clicked breakpoint
-            event.stopPropagation();
-        }
-
-        function breakpointClicked()
-        {
-            WebInspector.panels.scripts.showSourceLine(breakpoint.url, breakpoint.line);
+        this.listElement.removeChild(event.target.element());
+        if (!this.listElement.firstChild) {
+            this.bodyElement.removeChild(this.listElement);
+            this.bodyElement.appendChild(this.emptyElement);
         }
+    }
+}
 
-        var breakpointElement = document.createElement("li");
-        breakpoint._breakpointListElement = breakpointElement;
-        breakpointElement._breakpointObject = breakpoint;
-        breakpointElement.addEventListener("click", breakpointClicked, false);
-
-        var checkboxElement = document.createElement("input");
-        checkboxElement.className = "checkbox-elem";
-        checkboxElement.type = "checkbox";
-        checkboxElement.checked = breakpoint.enabled;
-        checkboxElement.addEventListener("click", checkboxClicked, false);
-        breakpointElement.appendChild(checkboxElement);
-
-        var labelElement = document.createTextNode(breakpoint.label);
-        breakpointElement.appendChild(labelElement);
+WebInspector.BreakpointsSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
 
-        var sourceTextElement = document.createElement("div");
-        sourceTextElement.textContent = breakpoint.sourceText;
-        sourceTextElement.className = "source-text monospace";
-        breakpointElement.appendChild(sourceTextElement);
+WebInspector.JSBreakpointItem = function(breakpoint)
+{
+    this._breakpoint = breakpoint;
+
+    this._element = document.createElement("li");
+    this._element.addEventListener("click", this._breakpointClicked.bind(this), false);
+
+    var checkboxElement = document.createElement("input");
+    checkboxElement.className = "checkbox-elem";
+    checkboxElement.type = "checkbox";
+    checkboxElement.checked = this._breakpoint.enabled;
+    checkboxElement.addEventListener("click", this._checkboxClicked.bind(this), false);
+    this._element.appendChild(checkboxElement);
+
+    var displayName = this._breakpoint.url ? WebInspector.displayNameForURL(this._breakpoint.url) : WebInspector.UIString("(program)");
+    var labelElement = document.createTextNode(displayName + ":" + this._breakpoint.line);
+    this._element.appendChild(labelElement);
+
+    var sourceTextElement = document.createElement("div");
+    sourceTextElement.textContent = this._breakpoint.sourceText;
+    sourceTextElement.className = "source-text monospace";
+    this._element.appendChild(sourceTextElement);
+
+    this._breakpoint.addEventListener("enabled", this._enableChanged, this);
+    this._breakpoint.addEventListener("disabled", this._enableChanged, this);
+    this._breakpoint.addEventListener("text-changed", this._textChanged, this);
+    this._breakpoint.addEventListener("removed", this._removed, this);
+}
 
-        var currentElement = this.listElement.firstChild;
-        while (currentElement) {
-            var currentBreak = currentElement._breakpointObject;
-            if (currentBreak.url > breakpoint.url) {
-                this.listElement.insertBefore(breakpointElement, currentElement);
-                return;
-            } else if (currentBreak.url == breakpoint.url && currentBreak.line > breakpoint.line) {
-                this.listElement.insertBefore(breakpointElement, currentElement);
-                return;
-            }
-            currentElement = currentElement.nextSibling;
-        }
-        this.listElement.appendChild(breakpointElement);
+WebInspector.JSBreakpointItem.prototype = {
+    compareTo: function(other)
+    {
+        if (this._breakpoint.url != other._breakpoint.url)
+            return this._breakpoint.url < other._breakpoint.url ? -1 : 1;
+        if (this._breakpoint.line != other._breakpoint.line)
+            return this._breakpoint.line < other._breakpoint.line ? -1 : 1;
+        return 0;
     },
 
-    _breakpointRemoved: function(event)
+    element: function()
     {
-        var breakpoint = event.data;
+        return this._element;
+    },
 
-        breakpoint.removeEventListener("enabled", null, this);
-        breakpoint.removeEventListener("disabled", null, this);
-        breakpoint.removeEventListener("text-changed", null, this);
+    _breakpointClicked: function()
+    {
+        WebInspector.panels.scripts.showSourceLine(this._breakpoint.url, this._breakpoint.line);
+    },
 
-        var element = breakpoint._breakpointListElement;
-        element.parentElement.removeChild(element);
+    _checkboxClicked: function(event)
+    {
+        this._breakpoint.enabled = !this._breakpoint.enabled;
 
-        if (!this.listElement.firstChild) {
-            this.bodyElement.removeChild(this.listElement);
-            this.bodyElement.appendChild(this.emptyElement);
-        }
+        // without this, we'd switch to the source of the clicked breakpoint
+        event.stopPropagation();
     },
 
-    _breakpointEnableChanged: function(event)
+    _enableChanged: function()
     {
-        var breakpoint = event.target;
-
-        var checkbox = breakpoint._breakpointListElement.firstChild;
-        checkbox.checked = breakpoint.enabled;
+        var checkbox = this._element.firstChild;
+        checkbox.checked = this._breakpoint.enabled;
     },
 
-    _breakpointTextChanged: function(event)
+    _textChanged: function()
     {
-        var breakpoint = event.target;
+        var sourceTextElement = this._element.firstChild.nextSibling.nextSibling;
+        sourceTextElement.textContent = this._breakpoint.sourceText;
+    },
 
-        var sourceTextElement = breakpoint._breakpointListElement.firstChild.nextSibling.nextSibling;
-        sourceTextElement.textContent = breakpoint.sourceText;
+    _removed: function()
+    {
+        this.dispatchEventToListeners("removed");
     }
 }
 
-WebInspector.BreakpointsSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
+WebInspector.JSBreakpointItem.prototype.__proto__ = WebInspector.Object.prototype;
\ No newline at end of file
diff --git a/WebCore/inspector/front-end/ScriptsPanel.js b/WebCore/inspector/front-end/ScriptsPanel.js
index 8675f79..faed7c6 100644
--- a/WebCore/inspector/front-end/ScriptsPanel.js
+++ b/WebCore/inspector/front-end/ScriptsPanel.js
@@ -171,7 +171,6 @@ WebInspector.ScriptsPanel = function()
     this._debuggerEnabled = Preferences.debuggerAlwaysEnabled;
 
     WebInspector.breakpointManager.addEventListener("breakpoint-added", this._breakpointAdded, this);
-    WebInspector.breakpointManager.addEventListener("breakpoint-removed", this._breakpointRemoved, this);
 
     this.reset();
 }
@@ -296,6 +295,9 @@ WebInspector.ScriptsPanel.prototype = {
     {
         var breakpoint = event.data;
 
+        breakpoint.addEventListener("removed", this._breakpointRemoved, this);
+        this.sidebarPanes.breakpoints.addBreakpoint(new WebInspector.JSBreakpointItem(event.data));
+
         var sourceFrame;
         if (breakpoint.url) {
             var resource = WebInspector.resourceURLMap[breakpoint.url];
@@ -314,7 +316,7 @@ WebInspector.ScriptsPanel.prototype = {
 
     _breakpointRemoved: function(event)
     {
-        var breakpoint = event.data;
+        var breakpoint = event.target;
 
         var sourceFrame;
         if (breakpoint.url) {
diff --git a/WebCore/inspector/front-end/SourceFrame.js b/WebCore/inspector/front-end/SourceFrame.js
index 01a8ec2..bd46c62 100644
--- a/WebCore/inspector/front-end/SourceFrame.js
+++ b/WebCore/inspector/front-end/SourceFrame.js
@@ -99,9 +99,6 @@ WebInspector.SourceFrame.prototype = {
     addBreakpoint: function(breakpoint)
     {
         this.breakpoints.push(breakpoint);
-        breakpoint.addEventListener("enabled", this._breakpointChanged, this);
-        breakpoint.addEventListener("disabled", this._breakpointChanged, this);
-        breakpoint.addEventListener("condition-changed", this._breakpointChanged, this);
         if (this._textViewer)
             this._addBreakpointToSource(breakpoint);
     },
@@ -384,6 +381,10 @@ WebInspector.SourceFrame.prototype = {
 
     _addBreakpointToSource: function(breakpoint)
     {
+        breakpoint.addEventListener("enabled", this._breakpointChanged, this);
+        breakpoint.addEventListener("disabled", this._breakpointChanged, this);
+        breakpoint.addEventListener("condition-changed", this._breakpointChanged, this);
+
         var lineNumber = breakpoint.line - 1;
         if (lineNumber >= this._textModel.linesCount)
             return;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list