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

podivilov at chromium.org podivilov at chromium.org
Wed Dec 22 18:49:26 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 4cf9da08e78f34dc53399a60d6fc089b5266cb74
Author: podivilov at chromium.org <podivilov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Dec 20 16:42:29 2010 +0000

    2010-12-10  Pavel Podivilov  <podivilov at chromium.org>
    
            Reviewed by Yury Semikhatsky.
    
            Web Inspector: "Add conditional breakpoint" - create breakpoint only after condition is provided.
            https://bugs.webkit.org/show_bug.cgi?id=50813
    
            * inspector/front-end/SourceFrame.js:
            (WebInspector.SourceFrame.prototype._addBreakpoint):
            (WebInspector.SourceFrame.prototype._breakpointRemoved):
            (WebInspector.SourceFrame.prototype._breakpointChanged):
            (WebInspector.SourceFrame.prototype._setBreakpointDecoration):
            (WebInspector.SourceFrame.prototype._removeBreakpointDecoration):
            (WebInspector.SourceFrame.prototype._contextMenu.addConditionalBreakpoint.didEditBreakpointCondition):
            (WebInspector.SourceFrame.prototype._contextMenu.addConditionalBreakpoint):
            (WebInspector.SourceFrame.prototype._contextMenu.else.editBreakpointCondition.didEditBreakpointCondition):
            (WebInspector.SourceFrame.prototype._contextMenu.else.editBreakpointCondition):
            (WebInspector.SourceFrame.prototype._contextMenu):
            (WebInspector.SourceFrame.prototype._editBreakpointCondition.finishEditing):
            (WebInspector.SourceFrame.prototype._editBreakpointCondition):
            (WebInspector.SourceFrame.prototype._continueToLine):
            (WebInspector.SourceFrame.prototype._setBreakpoint):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74350 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 84c4413..d397f53 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,26 @@
+2010-12-10  Pavel Podivilov  <podivilov at chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: "Add conditional breakpoint" - create breakpoint only after condition is provided.
+        https://bugs.webkit.org/show_bug.cgi?id=50813
+
+        * inspector/front-end/SourceFrame.js:
+        (WebInspector.SourceFrame.prototype._addBreakpoint):
+        (WebInspector.SourceFrame.prototype._breakpointRemoved):
+        (WebInspector.SourceFrame.prototype._breakpointChanged):
+        (WebInspector.SourceFrame.prototype._setBreakpointDecoration):
+        (WebInspector.SourceFrame.prototype._removeBreakpointDecoration):
+        (WebInspector.SourceFrame.prototype._contextMenu.addConditionalBreakpoint.didEditBreakpointCondition):
+        (WebInspector.SourceFrame.prototype._contextMenu.addConditionalBreakpoint):
+        (WebInspector.SourceFrame.prototype._contextMenu.else.editBreakpointCondition.didEditBreakpointCondition):
+        (WebInspector.SourceFrame.prototype._contextMenu.else.editBreakpointCondition):
+        (WebInspector.SourceFrame.prototype._contextMenu):
+        (WebInspector.SourceFrame.prototype._editBreakpointCondition.finishEditing):
+        (WebInspector.SourceFrame.prototype._editBreakpointCondition):
+        (WebInspector.SourceFrame.prototype._continueToLine):
+        (WebInspector.SourceFrame.prototype._setBreakpoint):
+
 2010-12-20  Andrei Popescu  <andreip at google.com>
 
         Reviewed by Jeremy Orlow.
diff --git a/WebCore/inspector/front-end/SourceFrame.js b/WebCore/inspector/front-end/SourceFrame.js
index 0a05991..4bead8f 100644
--- a/WebCore/inspector/front-end/SourceFrame.js
+++ b/WebCore/inspector/front-end/SourceFrame.js
@@ -299,24 +299,6 @@ WebInspector.SourceFrame.prototype = {
         msg._resourceMessageRepeatCountElement.textContent = WebInspector.UIString(" (repeated %d times)", msg.repeatCount);
     },
 
-    _breakpointChanged: function(event)
-    {
-        var breakpoint = event.target;
-        var lineNumber = breakpoint.line - 1;
-        if (lineNumber >= this._textModel.linesCount)
-            return;
-
-        if (breakpoint.enabled)
-            this._textViewer.removeDecoration(lineNumber, "webkit-breakpoint-disabled");
-        else
-            this._textViewer.addDecoration(lineNumber, "webkit-breakpoint-disabled");
-
-        if (breakpoint.condition)
-            this._textViewer.addDecoration(lineNumber, "webkit-breakpoint-conditional");
-        else
-            this._textViewer.removeDecoration(lineNumber, "webkit-breakpoint-conditional");
-    },
-
     _updateExecutionLine: function(previousLine)
     {
         if (previousLine) {
@@ -429,23 +411,15 @@ WebInspector.SourceFrame.prototype = {
 
     _addBreakpoint: function(breakpoint)
     {
-        var lineNumber = breakpoint.line - 1;
-        if (lineNumber >= this._textModel.linesCount)
+        if (breakpoint.line > this._textModel.linesCount)
             return;
 
         breakpoint.addEventListener("enable-changed", this._breakpointChanged, this);
         breakpoint.addEventListener("condition-changed", this._breakpointChanged, this);
         breakpoint.addEventListener("removed", this._breakpointRemoved, this);
 
-        breakpoint.sourceText = this._textModel.line(lineNumber);
-
-        this._textViewer.beginUpdates();
-        this._textViewer.addDecoration(lineNumber, "webkit-breakpoint");
-        if (!breakpoint.enabled)
-            this._textViewer.addDecoration(lineNumber, "webkit-breakpoint-disabled");
-        if (breakpoint.condition)
-            this._textViewer.addDecoration(lineNumber, "webkit-breakpoint-conditional");
-        this._textViewer.endUpdates();
+        breakpoint.sourceText = this._textModel.line(breakpoint.line - 1);
+        this._setBreakpointDecoration(breakpoint.line, breakpoint.enabled, !!breakpoint.condition);
     },
 
     _breakpointRemoved: function(event)
@@ -456,7 +430,34 @@ WebInspector.SourceFrame.prototype = {
         breakpoint.removeEventListener("condition-changed", null, this);
         breakpoint.removeEventListener("removed", null, this);
 
-        var lineNumber = breakpoint.line - 1;
+        this._removeBreakpointDecoration(breakpoint.line);
+    },
+
+    _breakpointChanged: function(event)
+    {
+        var breakpoint = event.target;
+        this._setBreakpointDecoration(breakpoint.line, breakpoint.enabled, !!breakpoint.condition);
+    },
+
+    _setBreakpointDecoration: function(lineNumber, enabled, hasCondition)
+    {
+        lineNumber -= 1;
+        this._textViewer.beginUpdates();
+        this._textViewer.addDecoration(lineNumber, "webkit-breakpoint");
+        if (enabled)
+            this._textViewer.removeDecoration(lineNumber, "webkit-breakpoint-disabled");
+        else
+            this._textViewer.addDecoration(lineNumber, "webkit-breakpoint-disabled");
+        if (hasCondition)
+            this._textViewer.addDecoration(lineNumber, "webkit-breakpoint-conditional");
+        else
+            this._textViewer.removeDecoration(lineNumber, "webkit-breakpoint-conditional");
+        this._textViewer.endUpdates();
+    },
+
+    _removeBreakpointDecoration: function(lineNumber)
+    {
+        lineNumber -= 1;
         this._textViewer.beginUpdates();
         this._textViewer.removeDecoration(lineNumber, "webkit-breakpoint");
         this._textViewer.removeDecoration(lineNumber, "webkit-breakpoint-disabled");
@@ -485,17 +486,29 @@ WebInspector.SourceFrame.prototype = {
 
             function addConditionalBreakpoint()
             {
-                this._setBreakpoint(lineNumber);
-                var breakpoint = this._findBreakpoint(lineNumber);
-                if (breakpoint)
-                    this._editBreakpointCondition(breakpoint);
+                this._setBreakpointDecoration(lineNumber, true, true);
+                function didEditBreakpointCondition(committed, condition)
+                {
+                    this._removeBreakpointDecoration(lineNumber);
+                    if (committed)
+                        this._setBreakpoint(lineNumber, condition);
+                }
+                this._editBreakpointCondition(lineNumber, "", didEditBreakpointCondition.bind(this));
             }
-
             contextMenu.appendItem(WebInspector.UIString("Add Conditional Breakpoint…"), addConditionalBreakpoint.bind(this));
         } else {
             // This row has a breakpoint, we want to show edit and remove breakpoint, and either disable or enable.
             contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), breakpoint.remove.bind(breakpoint));
-            contextMenu.appendItem(WebInspector.UIString("Edit Breakpoint…"), this._editBreakpointCondition.bind(this, breakpoint));
+            function editBreakpointCondition()
+            {
+                function didEditBreakpointCondition(committed, condition)
+                {
+                    if (committed)
+                        breakpoint.condition = condition;
+                }
+                this._editBreakpointCondition(lineNumber, breakpoint.condition, didEditBreakpointCondition);
+            }
+            contextMenu.appendItem(WebInspector.UIString("Edit Breakpoint…"), editBreakpointCondition.bind(this));
             if (breakpoint.enabled)
                 contextMenu.appendItem(WebInspector.UIString("Disable Breakpoint"), function() { breakpoint.enabled = false; });
             else
@@ -689,42 +702,29 @@ WebInspector.SourceFrame.prototype = {
         WebInspector.panels.scripts.evaluateInSelectedCallFrame(element.textContent, false, this._popoverObjectGroup, evaluateCallback.bind(this));
     },
 
-    _editBreakpointCondition: function(breakpoint)
+    _editBreakpointCondition: function(lineNumber, condition, callback)
     {
-        this._showBreakpointConditionPopup(breakpoint.line);
-
-        function committed(element, newText)
-        {
-            breakpoint.condition = newText;
-            dismissed.call(this);
-        }
+        lineNumber -= 1;
+        this._conditionElement = this._createConditionElement(lineNumber);
+        this._textViewer.addDecoration(lineNumber, this._conditionElement);
 
-        function dismissed()
+        function finishEditing(committed, element, newText)
         {
-            if (this._conditionElement)
-                this._textViewer.removeDecoration(breakpoint.line - 1, this._conditionElement);
+            this._textViewer.removeDecoration(lineNumber, this._conditionElement);
             delete this._conditionEditorElement;
             delete this._conditionElement;
+            callback(committed, newText);
         }
 
-        var dismissedHandler = dismissed.bind(this);
-        this._conditionEditorElement.addEventListener("blur", dismissedHandler, false);
-
         WebInspector.startEditing(this._conditionEditorElement, {
             context: null,
-            commitHandler: committed.bind(this),
-            cancelHandler: dismissedHandler
+            commitHandler: finishEditing.bind(this, true),
+            cancelHandler: finishEditing.bind(this, false)
         });
-        this._conditionEditorElement.value = breakpoint.condition;
+        this._conditionEditorElement.value = condition;
         this._conditionEditorElement.select();
     },
 
-    _showBreakpointConditionPopup: function(lineNumber)
-    {
-        this._conditionElement = this._createConditionElement(lineNumber);
-        this._textViewer.addDecoration(lineNumber - 1, this._conditionElement);
-    },
-
     _createConditionElement: function(lineNumber)
     {
         var conditionElement = document.createElement("div");
@@ -773,6 +773,8 @@ WebInspector.SourceFrame.prototype = {
     _continueToLine: function(lineNumber)
     {
         var sourceID = this._sourceIDForLine(lineNumber);
+        if (!sourceID)
+            return;
         WebInspector.panels.scripts.continueToLine(sourceID, lineNumber);
     },
 
@@ -821,10 +823,12 @@ WebInspector.SourceFrame.prototype = {
             script.resource.setContent(newContent, revertEditLineCallback);
     },
 
-    _setBreakpoint: function(lineNumber)
+    _setBreakpoint: function(lineNumber, condition)
     {
         var sourceID = this._sourceIDForLine(lineNumber);
-        WebInspector.debuggerModel.setBreakpoint(sourceID, lineNumber, true, "");
+        if (!sourceID)
+            return;
+        WebInspector.debuggerModel.setBreakpoint(sourceID, lineNumber, true, condition);
         if (!WebInspector.panels.scripts.breakpointsActivated)
             WebInspector.panels.scripts.toggleBreakpointsClicked();
     },

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list