Title: [142138] trunk/Source/WebCore
Revision
142138
Author
[email protected]
Date
2013-02-07 09:17:26 -0800 (Thu, 07 Feb 2013)

Log Message

Web Inspector: [Regression] breakpoint condition not editable
https://bugs.webkit.org/show_bug.cgi?id=109183

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (142137 => 142138)


--- trunk/Source/WebCore/ChangeLog	2013-02-07 16:58:17 UTC (rev 142137)
+++ trunk/Source/WebCore/ChangeLog	2013-02-07 17:17:26 UTC (rev 142138)
@@ -1,3 +1,20 @@
+2013-02-07  Andrey Lushnikov  <[email protected]>
+
+        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  <[email protected]>
 
         [WK2][EFL][QT]REGRESSION(r142045): Scrolling is broken

Modified: trunk/Source/WebCore/inspector/front-end/DOMExtension.js (142137 => 142138)


--- trunk/Source/WebCore/inspector/front-end/DOMExtension.js	2013-02-07 16:58:17 UTC (rev 142137)
+++ trunk/Source/WebCore/inspector/front-end/DOMExtension.js	2013-02-07 17:17:26 UTC (rev 142138)
@@ -271,9 +271,13 @@
     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;

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


--- trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js	2013-02-07 16:58:17 UTC (rev 142137)
+++ trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js	2013-02-07 17:17:26 UTC (rev 142138)
@@ -2068,6 +2068,9 @@
         // 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);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to