Web Inspector: [TextEditor] conditional breakpoint popup not showing up the first...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Sep 2012 16:36:20 +0000 (16:36 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Sep 2012 16:36:20 +0000 (16:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=97442

Patch by Andrey Adaikin <aandrey@chromium.org> on 2012-09-24
Reviewed by Pavel Feldman.

1) The conditional breakpoint popup may not show up the first time we click on the gutter.
This was the case because the popup decoration element would be deleted from the line while
it was being highlighted and appended afterwards. Now we do not remove decorations from the
DOM while highlighting.

2) Also the popup will close itself on any mouse click event, even if it's targeted to the
input box itself. This was due to pointer-events: none; CSS style for the parent element.
Now we just override this style for the input box.

* inspector/front-end/DefaultTextEditor.js:
(WebInspector.TextEditorMainPanel.prototype._paintLine):
(WebInspector.TextEditorMainPanel.prototype._insertSpanBefore):
(WebInspector.TextEditorMainPanel.prototype._insertTextNodeBefore):
* inspector/front-end/inspector.css:
(.source-frame-breakpoint-condition):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@129381 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/inspector/front-end/DefaultTextEditor.js
Source/WebCore/inspector/front-end/inspector.css

index dc1a34b..0b1f4d7 100644 (file)
@@ -1,5 +1,28 @@
 2012-09-24  Andrey Adaikin  <aandrey@chromium.org>
 
+        Web Inspector: [TextEditor] conditional breakpoint popup not showing up the first time
+        https://bugs.webkit.org/show_bug.cgi?id=97442
+
+        Reviewed by Pavel Feldman.
+
+        1) The conditional breakpoint popup may not show up the first time we click on the gutter.
+        This was the case because the popup decoration element would be deleted from the line while
+        it was being highlighted and appended afterwards. Now we do not remove decorations from the
+        DOM while highlighting.
+
+        2) Also the popup will close itself on any mouse click event, even if it's targeted to the
+        input box itself. This was due to pointer-events: none; CSS style for the parent element.
+        Now we just override this style for the input box.
+
+        * inspector/front-end/DefaultTextEditor.js:
+        (WebInspector.TextEditorMainPanel.prototype._paintLine):
+        (WebInspector.TextEditorMainPanel.prototype._insertSpanBefore):
+        (WebInspector.TextEditorMainPanel.prototype._insertTextNodeBefore):
+        * inspector/front-end/inspector.css:
+        (.source-frame-breakpoint-condition):
+
+2012-09-24  Andrey Adaikin  <aandrey@chromium.org>
+
         Web Inspector: [Canvas] set CanvasAgent in InstrumentingAgents upon calling enable command
         https://bugs.webkit.org/show_bug.cgi?id=97331
 
index f90b902..69c87ce 100644 (file)
@@ -1863,10 +1863,21 @@ WebInspector.TextEditorMainPanel.prototype = {
             if (!highlight)
                 return;
 
-            lineRow.removeChildren();
+            var decorationsElement = lineRow.decorationsElement;
+            if (!decorationsElement)
+                lineRow.removeChildren();
+            else {
+                while (true) {
+                    var child = lineRow.firstChild;
+                    if (!child || child === decorationsElement)
+                        break;
+                    lineRow.removeChild(child);
+                }
+            }
+
             var line = this._textModel.line(lineNumber);
             if (!line)
-                lineRow.appendChild(document.createElement("br"));
+                lineRow.insertBefore(document.createElement("br"), decorationsElement);
 
             var plainTextStart = -1;
             for (var j = 0; j < line.length;) {
@@ -1883,21 +1894,19 @@ WebInspector.TextEditorMainPanel.prototype = {
                     j++;
                 } else {
                     if (plainTextStart !== -1) {
-                        this._appendTextNode(lineRow, line.substring(plainTextStart, j));
+                        this._insertTextNodeBefore(lineRow, decorationsElement, line.substring(plainTextStart, j));
                         plainTextStart = -1;
                         --this._paintLinesOperationsCredit;
                     }
-                    this._appendSpan(lineRow, line.substring(j, j + attribute.length), attribute.tokenType);
+                    this._insertSpanBefore(lineRow, decorationsElement, line.substring(j, j + attribute.length), attribute.tokenType);
                     j += attribute.length;
                     --this._paintLinesOperationsCredit;
                 }
             }
             if (plainTextStart !== -1) {
-                this._appendTextNode(lineRow, line.substring(plainTextStart, line.length));
+                this._insertTextNodeBefore(lineRow, decorationsElement, line.substring(plainTextStart, line.length));
                 --this._paintLinesOperationsCredit;
             }
-            if (lineRow.decorationsElement)
-                lineRow.appendChild(lineRow.decorationsElement);
         } finally {
             if (this._rangeToMark && this._rangeToMark.startLine === lineNumber)
                 this._markedRangeElement = WebInspector.highlightSearchResult(lineRow, this._rangeToMark.startColumn, this._rangeToMark.endColumn - this._rangeToMark.startColumn);
@@ -2050,20 +2059,21 @@ WebInspector.TextEditorMainPanel.prototype = {
 
     /**
      * @param {Element} element
+     * @param {Element} oldChild
      * @param {string} content
      * @param {string} className
      */
-    _appendSpan: function(element, content, className)
+    _insertSpanBefore: function(element, oldChild, content, className)
     {
         if (className === "html-resource-link" || className === "html-external-link") {
-            element.appendChild(this._createLink(content, className === "html-external-link"));
+            element.insertBefore(this._createLink(content, className === "html-external-link"), oldChild);
             return;
         }
 
         var span = this._cachedSpans.pop() || document.createElement("span");
         span.className = "webkit-" + className;
         span.textContent = content;
-        element.appendChild(span);
+        element.insertBefore(span, oldChild);
         if (!("spans" in element))
             element.spans = [];
         element.spans.push(span);
@@ -2071,16 +2081,17 @@ WebInspector.TextEditorMainPanel.prototype = {
 
     /**
      * @param {Element} element
+     * @param {Element} oldChild
      * @param {string} text
      */
-    _appendTextNode: function(element, text)
+    _insertTextNodeBefore: function(element, oldChild, text)
     {
         var textNode = this._cachedTextNodes.pop();
         if (textNode)
             textNode.nodeValue = text;
         else
             textNode = document.createTextNode(text);
-        element.appendChild(textNode);
+        element.insertBefore(textNode, oldChild);
         if (!("textNodes" in element))
             element.textNodes = [];
         element.textNodes.push(textNode);
index d5b1309..1c126ea 100644 (file)
@@ -2348,6 +2348,7 @@ li.breakpoint-hit .breakpoint-hit-marker {
     -webkit-border-radius: 7px;
     border: 2px solid rgb(169, 172, 203);
     width: 90%;
+    pointer-events: auto;
 }
 
 .source-frame-breakpoint-message {