Title: [136703] trunk
Revision
136703
Author
[email protected]
Date
2012-12-05 09:41:01 -0800 (Wed, 05 Dec 2012)

Log Message

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.

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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (136702 => 136703)


--- trunk/LayoutTests/ChangeLog	2012-12-05 17:34:04 UTC (rev 136702)
+++ trunk/LayoutTests/ChangeLog	2012-12-05 17:41:01 UTC (rev 136703)
@@ -1,3 +1,16 @@
+2012-12-05  Pavel Feldman  <[email protected]>
+
+        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  <[email protected]>
 
         Unreviewed GTK gardening.

Modified: trunk/LayoutTests/inspector/editor/editor-test.js (136702 => 136703)


--- trunk/LayoutTests/inspector/editor/editor-test.js	2012-12-05 17:34:04 UTC (rev 136702)
+++ trunk/LayoutTests/inspector/editor/editor-test.js	2012-12-05 17:41:01 UTC (rev 136703)
@@ -50,4 +50,9 @@
     }
 };
 
+InspectorTest.getLineElement = function(textEditor, lineNumber)
+{
+    return textEditor._mainPanel.chunkForLine(lineNumber).expandedLineRow(lineNumber);
+};
+
 }

Added: trunk/LayoutTests/inspector/editor/text-editor-type-over-decoration-expected.txt (0 => 136703)


--- trunk/LayoutTests/inspector/editor/text-editor-type-over-decoration-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/editor/text-editor-type-over-decoration-expected.txt	2012-12-05 17:41:01 UTC (rev 136703)
@@ -0,0 +1,26 @@
+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>
+

Added: trunk/LayoutTests/inspector/editor/text-editor-type-over-decoration.html (0 => 136703)


--- trunk/LayoutTests/inspector/editor/text-editor-type-over-decoration.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/editor/text-editor-type-over-decoration.html	2012-12-05 17:41:01 UTC (rev 136703)
@@ -0,0 +1,35 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<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>

Modified: trunk/Source/WebCore/ChangeLog (136702 => 136703)


--- trunk/Source/WebCore/ChangeLog	2012-12-05 17:34:04 UTC (rev 136702)
+++ trunk/Source/WebCore/ChangeLog	2012-12-05 17:41:01 UTC (rev 136703)
@@ -1,3 +1,15 @@
+2012-12-05  Pavel Feldman  <[email protected]>
+
+        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  <[email protected]>
 
         IndexedDB: Replace use of ScriptExecutionContext::Task (Part 2)

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


--- trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js	2012-12-05 17:34:04 UTC (rev 136702)
+++ trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js	2012-12-05 17:41:01 UTC (rev 136703)
@@ -2492,8 +2492,12 @@
         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");
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to