Commit 689fbde1 authored by commit-queue@webkit.org's avatar commit-queue@webkit.org
Browse files

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 <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: http://svn.webkit.org/repository/webkit/trunk@129381 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 64a1b1fc
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
......@@ -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);
......
......@@ -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 {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment