Title: [126210] trunk/Source/WebCore
Revision
126210
Author
[email protected]
Date
2012-08-21 16:19:11 -0700 (Tue, 21 Aug 2012)

Log Message

Web Inspector: remove DOMNodeRemoved listener from the DefaultTextEditor
https://bugs.webkit.org/show_bug.cgi?id=94592

Reviewed by Yury Semikhatsky.

It seems to be not necessary.

* inspector/front-end/DefaultTextEditor.js:
(WebInspector.TextEditorMainPanel):
(WebInspector.TextEditorMainPanel.prototype._handleDOMUpdates):
(WebInspector.TextEditorMainChunk):
(WebInspector.TextEditorMainChunk.prototype.set expanded):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (126209 => 126210)


--- trunk/Source/WebCore/ChangeLog	2012-08-21 23:16:52 UTC (rev 126209)
+++ trunk/Source/WebCore/ChangeLog	2012-08-21 23:19:11 UTC (rev 126210)
@@ -1,3 +1,18 @@
+2012-08-21  Pavel Feldman  <[email protected]>
+
+        Web Inspector: remove DOMNodeRemoved listener from the DefaultTextEditor
+        https://bugs.webkit.org/show_bug.cgi?id=94592
+
+        Reviewed by Yury Semikhatsky.
+
+        It seems to be not necessary.
+
+        * inspector/front-end/DefaultTextEditor.js:
+        (WebInspector.TextEditorMainPanel):
+        (WebInspector.TextEditorMainPanel.prototype._handleDOMUpdates):
+        (WebInspector.TextEditorMainChunk):
+        (WebInspector.TextEditorMainChunk.prototype.set expanded):
+
 2012-08-21  Thiago Marcos P. Santos  <[email protected]>
 
         CodeGeneratorInspector.py: Generate guards for type validators

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


--- trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js	2012-08-21 23:16:52 UTC (rev 126209)
+++ trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js	2012-08-21 23:19:11 UTC (rev 126210)
@@ -1236,11 +1236,6 @@
     this.element.addEventListener("scroll", this._scroll.bind(this), false);
     this.element.addEventListener("focus", this._handleElementFocus.bind(this), false);
 
-    // In WebKit the DOMNodeRemoved event is fired AFTER the node is removed, thus it should be
-    // attached to all DOM nodes that we want to track. Instead, we attach the DOMNodeRemoved
-    // listeners only on the line rows, and use DOMSubtreeModified to track node removals inside
-    // the line rows. For more info see: https://bugs.webkit.org/show_bug.cgi?id=55666
-    //
     // OPTIMIZATION. It is very expensive to listen to the DOM mutation events, thus we remove the
     // listeners whenever we do any internal DOM manipulations (such as expand/collapse line rows)
     // and set the listeners back when we are finished.
@@ -1653,18 +1648,6 @@
         }
     },
 
-    /**
-     * @param {Element} lineRow
-     * @param {boolean} enable
-     */
-    _enableDOMNodeRemovedListener: function(lineRow, enable)
-    {
-        if (enable)
-            lineRow.addEventListener("DOMNodeRemoved", this._handleDOMUpdatesCallback, false);
-        else
-            lineRow.removeEventListener("DOMNodeRemoved", this._handleDOMUpdatesCallback, false);
-    },
-
     _buildChunks: function()
     {
         for (var i = 0; i < this._textModel.linesCount; ++i)
@@ -2173,11 +2156,6 @@
             }
         }
 
-        if (target === lineRow && e.type === "DOMNodeRemoved") {
-            // Now this will no longer be valid.
-            delete lineRow.lineNumber;
-        }
-
         if (this._dirtyLines) {
             this._dirtyLines.start = Math.min(this._dirtyLines.start, startLine);
             this._dirtyLines.end = Math.max(this._dirtyLines.end, endLine);
@@ -2544,7 +2522,6 @@
     this.element = document.createElement("div");
     this.element.lineNumber = startLine;
     this.element.className = "webkit-line-content";
-    this._chunkedPanel._enableDOMNodeRemovedListener(this.element, true);
 
     this._startLine = startLine;
     endLine = Math.min(this._textModel.linesCount, endLine);
@@ -2651,24 +2628,20 @@
             var parentElement = this.element.parentElement;
             for (var i = this.startLine; i < this.startLine + this.linesCount; ++i) {
                 var lineRow = this._createRow(i);
-                this._chunkedPanel._enableDOMNodeRemovedListener(lineRow, true);
                 this._updateElementReadOnlyState(lineRow);
                 parentElement.insertBefore(lineRow, this.element);
                 this._expandedLineRows.push(lineRow);
             }
-            this._chunkedPanel._enableDOMNodeRemovedListener(this.element, false);
             parentElement.removeChild(this.element);
             this._chunkedPanel._paintLines(this.startLine, this.startLine + this.linesCount);
         } else {
             var elementInserted = false;
             for (var i = 0; i < this._expandedLineRows.length; ++i) {
                 var lineRow = this._expandedLineRows[i];
-                this._chunkedPanel._enableDOMNodeRemovedListener(lineRow, false);
                 var parentElement = lineRow.parentElement;
                 if (parentElement) {
                     if (!elementInserted) {
                         elementInserted = true;
-                        this._chunkedPanel._enableDOMNodeRemovedListener(this.element, true);
                         parentElement.insertBefore(this.element, lineRow);
                     }
                     parentElement.removeChild(lineRow);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to