Title: [126430] trunk/Source/WebCore
Revision
126430
Author
[email protected]
Date
2012-08-23 08:36:45 -0700 (Thu, 23 Aug 2012)

Log Message

Web Inspector: make treeoutline.js compiler-friendly
https://bugs.webkit.org/show_bug.cgi?id=94818

Reviewed by Alexander Pavlov.

This change declares base methods on TreeElement so that we did not need to check for their existence.

* inspector/front-end/AdvancedSearchController.js:
(WebInspector.FileBasedSearchResultsPane.prototype._appendShowMoreMatchesElement):
(WebInspector.FileBasedSearchResultsPane.prototype._addFileTreeElement):
* inspector/front-end/ElementsTreeOutline.js:
(WebInspector.ElementsTreeElement.prototype.onselect):
* inspector/front-end/SidebarPane.js:
(WebInspector.SidebarPane.prototype.expand):
(WebInspector.SidebarPane.prototype.onexpand):
(WebInspector.SidebarPane.prototype.collapse):
* inspector/front-end/treeoutline.js:
(TreeOutline.prototype._treeKeyDown):
(TreeOutline.prototype._searchInputKeyDown):
(TreeElement.prototype._fireDidChange):
(TreeElement.prototype._attach):
(TreeElement.treeElementDoubleClicked):
(TreeElement.prototype.collapse):
(TreeElement.prototype.expand):
(TreeElement.prototype.reveal):
(TreeElement.prototype.select):
(TreeElement.prototype.deselect):
(TreeElement.prototype.onpopulate):
(TreeElement.prototype.onenter):
(TreeElement.prototype.ondelete):
(TreeElement.prototype.onspace):
(TreeElement.prototype.onattach):
(TreeElement.prototype.onexpand):
(TreeElement.prototype.oncollapse):
(TreeElement.prototype.ondblclick):
(TreeElement.prototype.onreveal):
(TreeElement.prototype.onselect):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (126429 => 126430)


--- trunk/Source/WebCore/ChangeLog	2012-08-23 15:34:14 UTC (rev 126429)
+++ trunk/Source/WebCore/ChangeLog	2012-08-23 15:36:45 UTC (rev 126430)
@@ -1,3 +1,43 @@
+2012-08-23  Pavel Feldman  <[email protected]>
+
+        Web Inspector: make treeoutline.js compiler-friendly
+        https://bugs.webkit.org/show_bug.cgi?id=94818
+
+        Reviewed by Alexander Pavlov.
+
+        This change declares base methods on TreeElement so that we did not need to check for their existence.
+
+        * inspector/front-end/AdvancedSearchController.js:
+        (WebInspector.FileBasedSearchResultsPane.prototype._appendShowMoreMatchesElement):
+        (WebInspector.FileBasedSearchResultsPane.prototype._addFileTreeElement):
+        * inspector/front-end/ElementsTreeOutline.js:
+        (WebInspector.ElementsTreeElement.prototype.onselect):
+        * inspector/front-end/SidebarPane.js:
+        (WebInspector.SidebarPane.prototype.expand):
+        (WebInspector.SidebarPane.prototype.onexpand):
+        (WebInspector.SidebarPane.prototype.collapse):
+        * inspector/front-end/treeoutline.js:
+        (TreeOutline.prototype._treeKeyDown):
+        (TreeOutline.prototype._searchInputKeyDown):
+        (TreeElement.prototype._fireDidChange):
+        (TreeElement.prototype._attach):
+        (TreeElement.treeElementDoubleClicked):
+        (TreeElement.prototype.collapse):
+        (TreeElement.prototype.expand):
+        (TreeElement.prototype.reveal):
+        (TreeElement.prototype.select):
+        (TreeElement.prototype.deselect):
+        (TreeElement.prototype.onpopulate):
+        (TreeElement.prototype.onenter):
+        (TreeElement.prototype.ondelete):
+        (TreeElement.prototype.onspace):
+        (TreeElement.prototype.onattach):
+        (TreeElement.prototype.onexpand):
+        (TreeElement.prototype.oncollapse):
+        (TreeElement.prototype.ondblclick):
+        (TreeElement.prototype.onreveal):
+        (TreeElement.prototype.onselect):
+
 2012-08-23  Yury Semikhatsky  <[email protected]>
 
         Web Inspector: use temporary directory for modules generated by compile-front-end.py

Modified: trunk/Source/WebCore/inspector/front-end/AdvancedSearchController.js (126429 => 126430)


--- trunk/Source/WebCore/inspector/front-end/AdvancedSearchController.js	2012-08-23 15:34:14 UTC (rev 126429)
+++ trunk/Source/WebCore/inspector/front-end/AdvancedSearchController.js	2012-08-23 15:36:45 UTC (rev 126430)
@@ -585,7 +585,7 @@
         var showMoreMatchesElement = new TreeElement(showMoreMatchesText, null, false);
         fileTreeElement.appendChild(showMoreMatchesElement);
         showMoreMatchesElement.listItemElement.addStyleClass("show-more-matches");
-        showMoreMatchesElement._onselect_ = this._showMoreMatchesElementSelected.bind(this, searchResult, startMatchIndex);
+        showMoreMatchesElement._onselect_ = this._showMoreMatchesElementSelected.bind(this, searchResult, startMatchIndex, showMoreMatchesElement);
     },
 
     /**
@@ -629,7 +629,7 @@
         fileTreeElement.listItemElement.appendChild(matchesCountSpan);
         
         var searchResult = this._searchResults[searchResultIndex];
-        fileTreeElement._onexpand_ = this._fileTreeElementExpanded.bind(this, searchResult);
+        fileTreeElement._onexpand_ = this._fileTreeElementExpanded.bind(this, searchResult, fileTreeElement);
 
         // Expand until at least certain amount of matches is expanded.
         if (this._matchesExpandedCount < WebInspector.FileBasedSearchResultsPane.matchesExpandedByDefaultCount)

Modified: trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js (126429 => 126430)


--- trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js	2012-08-23 15:34:14 UTC (rev 126429)
+++ trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js	2012-08-23 15:36:45 UTC (rev 126430)
@@ -1042,7 +1042,7 @@
         }
     },
 
-    onselect: function(treeElement, selectedByUser)
+    onselect: function(selectedByUser)
     {
         this.treeOutline.suppressRevealAndSelect = true;
         this.treeOutline.selectDOMNode(this.representedObject, selectedByUser);

Modified: trunk/Source/WebCore/inspector/front-end/EventListenersSidebarPane.js (126429 => 126430)


--- trunk/Source/WebCore/inspector/front-end/EventListenersSidebarPane.js	2012-08-23 15:34:14 UTC (rev 126429)
+++ trunk/Source/WebCore/inspector/front-end/EventListenersSidebarPane.js	2012-08-23 15:36:45 UTC (rev 126430)
@@ -175,7 +175,7 @@
  */
 WebInspector.EventListenerBar = function(eventListener, nodeId, linkifier)
 {
-    WebInspector.ObjectPropertiesSection.call(this);
+    WebInspector.ObjectPropertiesSection.call(this, WebInspector.RemoteObject.fromPrimitiveValue(""));
 
     this.eventListener = eventListener;
     this._nodeId = nodeId;

Modified: trunk/Source/WebCore/inspector/front-end/SidebarPane.js (126429 => 126430)


--- trunk/Source/WebCore/inspector/front-end/SidebarPane.js	2012-08-23 15:34:14 UTC (rev 126429)
+++ trunk/Source/WebCore/inspector/front-end/SidebarPane.js	2012-08-23 15:36:45 UTC (rev 126430)
@@ -108,18 +108,19 @@
             return;
         this._expanded = true;
         this.element.addStyleClass("expanded");
-        if (this.onexpand)
-            this.onexpand(this);
+        this.onexpand();
     },
 
+    onexpand: function()
+    {
+    },
+
     collapse: function()
     {
         if (!this._expanded)
             return;
         this._expanded = false;
         this.element.removeStyleClass("expanded");
-        if (this.oncollapse)
-            this.oncollapse(this);
     },
 
     toggleExpanded: function()

Modified: trunk/Source/WebCore/inspector/front-end/treeoutline.js (126429 => 126430)


--- trunk/Source/WebCore/inspector/front-end/treeoutline.js	2012-08-23 15:34:14 UTC (rev 126429)
+++ trunk/Source/WebCore/inspector/front-end/treeoutline.js	2012-08-23 15:36:45 UTC (rev 126430)
@@ -122,9 +122,6 @@
     }
 
     child._attach();
-
-    if (this.treeOutline.onadd)
-        this.treeOutline.onadd(child);
 }
 
 TreeOutline.prototype.removeChildAtIndex = function(childIndex)
@@ -286,15 +283,6 @@
     return this.getCachedTreeElement(representedObject);
 }
 
-TreeOutline.prototype._treeElementDidChange = function(treeElement)
-{
-    if (treeElement.treeOutline !== this)
-        return;
-
-    if (this.onchange)
-        this.onchange(treeElement);
-}
-
 TreeOutline.prototype.treeElementFromPoint = function(x, y)
 {
     var node = this._childrenListNode.ownerDocument.elementFromPoint(x, y);
@@ -376,16 +364,12 @@
                     this.selectedTreeElement.expand();
             }
         }
-    } else if (event.keyCode === 8 /* Backspace */ || event.keyCode === 46 /* Delete */) {
-        if (this.selectedTreeElement.ondelete)
-            handled = this.selectedTreeElement.ondelete();
-    } else if (isEnterKey(event)) {
-        if (this.selectedTreeElement.onenter)
-            handled = this.selectedTreeElement.onenter();
-    } else if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Space.code) {
-        if (this.selectedTreeElement.onspace)
-            handled = this.selectedTreeElement.onspace();
-    }
+    } else if (event.keyCode === 8 /* Backspace */ || event.keyCode === 46 /* Delete */)
+        handled = this.selectedTreeElement.ondelete();
+    else if (isEnterKey(event))
+        handled = this.selectedTreeElement.onenter();
+    else if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Space.code)
+        handled = this.selectedTreeElement.onspace();
 
     if (nextSelectedElement) {
         nextSelectedElement.reveal();
@@ -505,8 +489,7 @@
     } else if (isEnterKey(event)) {
         var lastSearchMatchElement = this._currentSearchMatchElement;
         this._searchFinished();
-        if (lastSearchMatchElement && lastSearchMatchElement.onenter)
-            lastSearchMatchElement.onenter();
+        lastSearchMatchElement.onenter();
         handled = true;
     }
 
@@ -713,9 +696,6 @@
     _fireDidChange: function()
     {
         delete this._didChangeTimeoutIdentifier;
-
-        if (this.treeOutline)
-            this.treeOutline._treeElementDidChange(this);
     },
 
     didChange: function()
@@ -773,8 +753,7 @@
         this._listItemNode.addEventListener("click", TreeElement.treeElementToggled, false);
         this._listItemNode.addEventListener("dblclick", TreeElement.treeElementDoubleClicked, false);
 
-        if (this.onattach)
-            this.onattach(this);
+        this.onattach();
     }
 
     var nextSibling = null;
@@ -840,11 +819,10 @@
     if (!element || !element.treeElement)
         return;
 
-    if (element.treeElement.ondblclick) {
-        var handled = element.treeElement.ondblclick.call(element.treeElement, event);
-        if (handled)
-            return;
-    } else if (element.treeElement.hasChildren && !element.treeElement.expanded)
+    var handled = element.treeElement.ondblclick.call(element.treeElement, event);
+    if (handled)
+        return;
+    if (element.treeElement.hasChildren && !element.treeElement.expanded)
         element.treeElement.expand();
 }
 
@@ -860,8 +838,7 @@
     if (this.treeOutline)
         this.treeOutline._expandedStateMap.put(this.representedObject, false);
 
-    if (this.oncollapse)
-        this.oncollapse(this);
+    this.oncollapse();
 }
 
 TreeElement.prototype.collapseRecursively = function()
@@ -879,9 +856,9 @@
     if (!this.hasChildren || (this.expanded && !this._shouldRefreshChildren && this._childrenListNode))
         return;
 
-    // Set this before onpopulate. Since onpopulate can add elements and call onadd, this makes
+    // Set this before onpopulate. Since onpopulate can add elements, this makes
     // sure the expanded flag is true before calling those functions. This prevents the possibility
-    // of an infinite loop if onpopulate or onadd were to call expand.
+    // of an infinite loop if onpopulate were to call expand.
 
     this.expanded = true;
     if (this.treeOutline)
@@ -915,8 +892,7 @@
     if (this._childrenListNode)
         this._childrenListNode.classList.add("expanded");
 
-    if (this.onexpand)
-        this.onexpand(this);
+    this.onexpand();
 }
 
 TreeElement.prototype.expandRecursively = function(maxDepth)
@@ -962,8 +938,7 @@
         currentAncestor = currentAncestor.parent;
     }
 
-    if (this.onreveal)
-        this.onreveal(this);
+    this.onreveal(this);
 }
 
 TreeElement.prototype.revealed = function()
@@ -1009,9 +984,7 @@
     if (this._listItemNode)
         this._listItemNode.classList.add("selected");
 
-    if (this.onselect)
-        return this.onselect(this, selectedByUser);
-    return false;
+    return this.onselect(selectedByUser);
 }
 
 /**
@@ -1035,16 +1008,21 @@
     this.treeOutline.selectedTreeElement = null;
     if (this._listItemNode)
         this._listItemNode.classList.remove("selected");
-
-    if (this.ondeselect && !supressOnDeselect)
-        this.ondeselect(this);
     return true;
 }
 
-TreeElement.prototype._onpopulate_ = function()
-{
-    // Overriden by subclasses.
-}
+// Overridden by subclasses.
+TreeElement.prototype._onpopulate_ = function() { }
+TreeElement.prototype._onenter_ = function() { }
+TreeElement.prototype._ondelete_ = function() { }
+TreeElement.prototype._onspace_ = function() { }
+TreeElement.prototype._onattach_ = function() { }
+TreeElement.prototype._onexpand_ = function() { }
+TreeElement.prototype._oncollapse_ = function() { }
+TreeElement.prototype._ondblclick_ = function() { }
+TreeElement.prototype._onreveal_ = function() { }
+/** @param {boolean} selectedByUser */
+TreeElement.prototype._onselect_ = function(selectedByUser) { }
 
 /**
  * @param {boolean} skipUnrevealed
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to