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
+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
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;
// 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);