https://bugs.webkit.org/show_bug.cgi?id=103932
Reviewed by Alexander Pavlov.
Source/WebCore:
Skip entire decoration content when collecting dirty regions.
* inspector/front-end/DefaultTextEditor.js:
(WebInspector.TextEditorMainPanel.prototype._collectLinesFromDOM):
LayoutTests:
* inspector/editor/editor-test.js:
(initialize_EditorTests.InspectorTest.getLineElement):
(initialize_EditorTests):
* inspector/editor/text-editor-type-over-decoration-expected.txt: Added.
* inspector/editor/text-editor-type-over-decoration.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@136703
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-12-05 Pavel Feldman <pfeldman@chromium.org>
+
+ Web Inspector: Don't include error message text in the editor buffer.
+ https://bugs.webkit.org/show_bug.cgi?id=103932
+
+ Reviewed by Alexander Pavlov.
+
+ * inspector/editor/editor-test.js:
+ (initialize_EditorTests.InspectorTest.getLineElement):
+ (initialize_EditorTests):
+ * inspector/editor/text-editor-type-over-decoration-expected.txt: Added.
+ * inspector/editor/text-editor-type-over-decoration.html: Added.
+
2012-12-05 Zan Dobersek <zandobersek@gmail.com>
Unreviewed GTK gardening.
}
};
+InspectorTest.getLineElement = function(textEditor, lineNumber)
+{
+ return textEditor._mainPanel.chunkForLine(lineNumber).expandedLineRow(lineNumber);
+};
+
}
--- /dev/null
+This test checks that typing over the decoration does not collect decoration text as a part of damaged DOM.
+
+Chunk model
+Chunk [0] 0:10 (expanded)
+Editor DOM
+[0] <div class="webkit-line-content">0</div>
+[1] <div class="webkit-line-content">1</div>
+[2] <div class="webkit-line-content">2</div>
+[3] <div class="webkit-line-content">3</div>
+[4] <div class="webkit-line-content">4</div>
+[5:6] <div class="webkit-line-content">5<div class="webkit-line-decorations"><span>Decoration content</span></div></div>
+[6] <div class="webkit-line-content">6</div>
+[7] <div class="webkit-line-content">7</div>
+[8] <div class="webkit-line-content">8</div>
+[9] <div class="webkit-line-content">9</div>
+Editor DOM
+[0] <div class="webkit-line-content">0</div>
+[1] <div class="webkit-line-content">1</div>
+[2] <div class="webkit-line-content">2</div>
+[3] <div class="webkit-line-content">3</div>
+[4] <div class="webkit-line-content">4a5</div>
+[5] <div class="webkit-line-content">6</div>
+[6] <div class="webkit-line-content">7</div>
+[7] <div class="webkit-line-content">8</div>
+[8] <div class="webkit-line-content">9</div>
+
--- /dev/null
+<html>
+<head>
+<script src="../../http/tests/inspector/inspector-test.js"></script>
+<script src="editor-test.js?foo=143"></script>
+<script>
+
+function test()
+{
+ var textEditor = InspectorTest.createTestEditor(10);
+ var textModel = textEditor._textModel;
+
+ InspectorTest.dumpEditorChunks(textEditor);
+ var decorationElement = document.createElement("span");
+ decorationElement.textContent = "Decoration content";
+ textEditor.addDecoration(5, decorationElement);
+ InspectorTest.dumpEditorDOM(textEditor);
+
+ // Insert Enter before the decoration
+ var lineRowElement = InspectorTest.getLineElement(textEditor, 5);
+ lineRowElement.parentElement.insertBefore(document.createTextNode("a"), lineRowElement);
+ textEditor._mainPanel._applyDomUpdates({start:4, end:5});
+ InspectorTest.dumpEditorDOM(textEditor);
+ InspectorTest.completeTest();
+}
+
+</script>
+</head>
+
+<body onload="runTest()">
+<p>
+This test checks that typing over the decoration does not collect decoration text as a part of damaged DOM.
+</p>
+
+</body>
+</html>
+2012-12-05 Pavel Feldman <pfeldman@chromium.org>
+
+ Web Inspector: Don't include error message text in the editor buffer.
+ https://bugs.webkit.org/show_bug.cgi?id=103932
+
+ Reviewed by Alexander Pavlov.
+
+ Skip entire decoration content when collecting dirty regions.
+
+ * inspector/front-end/DefaultTextEditor.js:
+ (WebInspector.TextEditorMainPanel.prototype._collectLinesFromDOM):
+
2012-12-05 Joshua Bell <jsbell@chromium.org>
IndexedDB: Replace use of ScriptExecutionContext::Task (Part 2)
var textContents = [];
var hasContent = false;
for (var node = from ? from.nextSibling : this._container; node && node !== to; node = node.traverseNextNode(this._container)) {
- if (node._isDecorationsElement)
- continue;
+ if (node._isDecorationsElement) {
+ // Skip all children of the decoration container.
+ node = node.nextSibling;
+ if (!node || node === to)
+ break;
+ }
hasContent = true;
if (node.nodeName.toLowerCase() === "br")
textContents.push("\n");