Web Inspector: [Regression] breakpoint condition not editable
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Feb 2013 17:17:26 +0000 (17:17 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Feb 2013 17:17:26 +0000 (17:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=109183

Patch by Andrey Lushnikov <lushnikov@chromium.org> on 2013-02-07
Reviewed by Vsevolod Vlasov.

Improve TextEditorMainPanel.selection() method to return null if the
selection is set inside of decoration element.

No new tests.

* inspector/front-end/DOMExtension.js:
(Node.prototype.enclosingNodeOrSelfWithClass): Improve to add iteration boundary.
* inspector/front-end/DefaultTextEditor.js:
(WebInspector.TextEditorMainPanel.prototype.selection):

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

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

index 1fee3f5d9ddbf5e504124b71e9a4a1bfd1416559..dd2a655ec15fe9700240dfe5e2fc17e202fa05b7 100644 (file)
@@ -1,3 +1,20 @@
+2013-02-07  Andrey Lushnikov  <lushnikov@chromium.org>
+
+        Web Inspector: [Regression] breakpoint condition not editable
+        https://bugs.webkit.org/show_bug.cgi?id=109183
+
+        Reviewed by Vsevolod Vlasov.
+
+        Improve TextEditorMainPanel.selection() method to return null if the
+        selection is set inside of decoration element.
+
+        No new tests.
+
+        * inspector/front-end/DOMExtension.js:
+        (Node.prototype.enclosingNodeOrSelfWithClass): Improve to add iteration boundary.
+        * inspector/front-end/DefaultTextEditor.js:
+        (WebInspector.TextEditorMainPanel.prototype.selection):
+
 2013-02-07  Mikhail Pozdnyakov  <mikhail.pozdnyakov@intel.com>
 
         [WK2][EFL][QT]REGRESSION(r142045): Scrolling is broken
index 318ff3bc44f16f02bce0af7a4b17ac963d39a4b0..769e97406996f7ae8b7043781272c41741a381b7 100644 (file)
@@ -271,9 +271,13 @@ Node.prototype.enclosingNodeOrSelfWithNodeName = function(nodeName)
     return this.enclosingNodeOrSelfWithNodeNameInArray([nodeName]);
 }
 
-Node.prototype.enclosingNodeOrSelfWithClass = function(className)
+/**
+ * @param {string} className
+ * @param {Element=} stayWithin
+ */
+Node.prototype.enclosingNodeOrSelfWithClass = function(className, stayWithin)
 {
-    for (var node = this; node && node !== this.ownerDocument; node = node.parentNode)
+    for (var node = this; node && node !== stayWithin && node !== this.ownerDocument; node = node.parentNode)
         if (node.nodeType === Node.ELEMENT_NODE && node.hasStyleClass(className))
             return node;
     return null;
index 05b8e1b1fdf58ae83893425c55a9af65a5aebfe2..2ae81de2e402f478d697d79e06286a8d556a3dc5 100644 (file)
@@ -2068,6 +2068,9 @@ WebInspector.TextEditorMainPanel.prototype = {
         // Selection may be outside of the editor.
         if (!this._container.isAncestor(selection.anchorNode) || !this._container.isAncestor(selection.focusNode))
             return null;
+        // Selection may be inside one of decorations.
+        if (selection.focusNode.enclosingNodeOrSelfWithClass("webkit-line-decorations", this._container))
+            return null;
         var start = this._selectionToPosition(selection.anchorNode, selection.anchorOffset, lastUndamagedLineRow);
         var end = selection.isCollapsed ? start : this._selectionToPosition(selection.focusNode, selection.focusOffset, lastUndamagedLineRow);
         return new WebInspector.TextRange(start.line, start.column, end.line, end.column);