Title: [129381] trunk/Source/WebCore
Revision
129381
Author
[email protected]
Date
2012-09-24 09:36:20 -0700 (Mon, 24 Sep 2012)

Log Message

Web Inspector: [TextEditor] conditional breakpoint popup not showing up the first time
https://bugs.webkit.org/show_bug.cgi?id=97442

Patch by Andrey Adaikin <[email protected]> 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (129380 => 129381)


--- trunk/Source/WebCore/ChangeLog	2012-09-24 16:32:05 UTC (rev 129380)
+++ trunk/Source/WebCore/ChangeLog	2012-09-24 16:36:20 UTC (rev 129381)
@@ -1,5 +1,28 @@
 2012-09-24  Andrey Adaikin  <[email protected]>
 
+        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  <[email protected]>
+
         Web Inspector: [Canvas] set CanvasAgent in InstrumentingAgents upon calling enable command
         https://bugs.webkit.org/show_bug.cgi?id=97331
 

Modified: trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js (129380 => 129381)


--- trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js	2012-09-24 16:32:05 UTC (rev 129380)
+++ trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js	2012-09-24 16:36:20 UTC (rev 129381)
@@ -1863,10 +1863,21 @@
             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 @@
                     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 @@
 
     /**
      * @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 @@
 
     /**
      * @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);

Modified: trunk/Source/WebCore/inspector/front-end/inspector.css (129380 => 129381)


--- trunk/Source/WebCore/inspector/front-end/inspector.css	2012-09-24 16:32:05 UTC (rev 129380)
+++ trunk/Source/WebCore/inspector/front-end/inspector.css	2012-09-24 16:36:20 UTC (rev 129381)
@@ -2348,6 +2348,7 @@
     -webkit-border-radius: 7px;
     border: 2px solid rgb(169, 172, 203);
     width: 90%;
+    pointer-events: auto;
 }
 
 .source-frame-breakpoint-message {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to