Web Inspector: start adding UI components to the compilation process.
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Oct 2011 11:37:25 +0000 (11:37 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Oct 2011 11:37:25 +0000 (11:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=69319

Patch by Pavel Feldman <pfeldman@google.com> on 2011-10-04
Reviewed by Yury Semikhatsky.

* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* inspector/compile-front-end.sh:
* inspector/front-end/Drawer.js:
(WebInspector.Drawer.prototype.show.animationFinished):
(WebInspector.Drawer.prototype.show):
(WebInspector.Drawer.prototype.resize):
* inspector/front-end/ElementsPanel.js:
(WebInspector.ElementsPanel.prototype.statusBarResized):
* inspector/front-end/EmptyView.js:
* inspector/front-end/Panel.js:
(WebInspector.Panel.prototype.set get toolbarItemLabel):
(WebInspector.Panel.prototype.get statusBarItems):
(WebInspector.Panel.prototype.updateMainViewWidth):
(WebInspector.Panel.prototype.statusBarResized):
* inspector/front-end/PropertiesSection.js:
* inspector/front-end/SearchController.js:
(WebInspector.SearchController.prototype._onKeyDown):
* inspector/front-end/Section.js:
(WebInspector.Section.prototype.set populated):
(WebInspector.Section.prototype.onpopulate):
(WebInspector.Section.prototype.expand):
* inspector/front-end/SidebarPane.js:
* inspector/front-end/Toolbar.js:
(WebInspector.Toolbar.createPanelToolbarItem):
(WebInspector.ToolbarDropdown.prototype.show):
* inspector/front-end/UIUtils.js: Added.
(WebInspector.elementDragStart):
(WebInspector.elementDragEnd):
(WebInspector.animateStyle):
(WebInspector.animateStyle.forceComplete):
(WebInspector.animateStyle.cancel):
* inspector/front-end/WebKit.qrc:
* inspector/front-end/externs.js:
(WebInspector.extensionServer.notifyPanelShown):
(WebInspector.extensionServer.notifyPanelHidden):
(WebInspector.currentPanel):
(WebInspector.setCurrentPanel):
* inspector/front-end/inspector.html:
* inspector/front-end/inspector.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@96584 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/inspector/compile-front-end.sh
Source/WebCore/inspector/front-end/Drawer.js
Source/WebCore/inspector/front-end/ElementsPanel.js
Source/WebCore/inspector/front-end/EmptyView.js
Source/WebCore/inspector/front-end/Panel.js
Source/WebCore/inspector/front-end/PropertiesSection.js
Source/WebCore/inspector/front-end/SearchController.js
Source/WebCore/inspector/front-end/Section.js
Source/WebCore/inspector/front-end/SidebarPane.js
Source/WebCore/inspector/front-end/Toolbar.js
Source/WebCore/inspector/front-end/UIUtils.js [new file with mode: 0644]
Source/WebCore/inspector/front-end/WebKit.qrc
Source/WebCore/inspector/front-end/externs.js
Source/WebCore/inspector/front-end/inspector.html
Source/WebCore/inspector/front-end/inspector.js

index 3f9c7d0..889c95c 100644 (file)
@@ -1,3 +1,51 @@
+2011-10-04  Pavel Feldman  <pfeldman@google.com>
+
+        Web Inspector: start adding UI components to the compilation process.
+        https://bugs.webkit.org/show_bug.cgi?id=69319
+
+        Reviewed by Yury Semikhatsky.
+
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * inspector/compile-front-end.sh:
+        * inspector/front-end/Drawer.js:
+        (WebInspector.Drawer.prototype.show.animationFinished):
+        (WebInspector.Drawer.prototype.show):
+        (WebInspector.Drawer.prototype.resize):
+        * inspector/front-end/ElementsPanel.js:
+        (WebInspector.ElementsPanel.prototype.statusBarResized):
+        * inspector/front-end/EmptyView.js:
+        * inspector/front-end/Panel.js:
+        (WebInspector.Panel.prototype.set get toolbarItemLabel):
+        (WebInspector.Panel.prototype.get statusBarItems):
+        (WebInspector.Panel.prototype.updateMainViewWidth):
+        (WebInspector.Panel.prototype.statusBarResized):
+        * inspector/front-end/PropertiesSection.js:
+        * inspector/front-end/SearchController.js:
+        (WebInspector.SearchController.prototype._onKeyDown):
+        * inspector/front-end/Section.js:
+        (WebInspector.Section.prototype.set populated):
+        (WebInspector.Section.prototype.onpopulate):
+        (WebInspector.Section.prototype.expand):
+        * inspector/front-end/SidebarPane.js:
+        * inspector/front-end/Toolbar.js:
+        (WebInspector.Toolbar.createPanelToolbarItem):
+        (WebInspector.ToolbarDropdown.prototype.show):
+        * inspector/front-end/UIUtils.js: Added.
+        (WebInspector.elementDragStart):
+        (WebInspector.elementDragEnd):
+        (WebInspector.animateStyle):
+        (WebInspector.animateStyle.forceComplete):
+        (WebInspector.animateStyle.cancel):
+        * inspector/front-end/WebKit.qrc:
+        * inspector/front-end/externs.js:
+        (WebInspector.extensionServer.notifyPanelShown):
+        (WebInspector.extensionServer.notifyPanelHidden):
+        (WebInspector.currentPanel):
+        (WebInspector.setCurrentPanel):
+        * inspector/front-end/inspector.html:
+        * inspector/front-end/inspector.js:
+
 2011-10-04  Kenichi Ishibashi  <bashi@chromium.org>
 
         [Chromium] Implement font shaping with font-feature-settings on Windows
index fa3f912..79d9b1e 100644 (file)
             'inspector/front-end/TopDownProfileDataGridTree.js',
             'inspector/front-end/treeoutline.js',
             'inspector/front-end/UISourceCode.js',
+            'inspector/front-end/UIUtils.js',
             'inspector/front-end/UserMetrics.js',
             'inspector/front-end/utilities.js',
             'inspector/front-end/View.js',
index fe9fbf5..0327d00 100755 (executable)
                                        >
                                </File>
                                <File
+                                       RelativePath="..\inspector\front-end\UIUtils.js"
+                                       >
+                               </File>
+                               <File
                                        RelativePath="..\inspector\front-end\UserMetrics.js"
                                        >
                                </File>
index afbeedc..ad3668c 100755 (executable)
@@ -44,7 +44,7 @@ java -jar ~/closure/compiler.jar --compilation_level SIMPLE_OPTIMIZATIONS --warn
         --js Source/WebCore/inspector/front-end/Object.js \
         --js Source/WebCore/inspector/front-end/Settings.js \
         --js Source/WebCore/inspector/front-end/UserMetrics.js \
-    --module jsmodule_sdk:16:jsmodule_common,jsmodule_host \
+    --module jsmodule_sdk:16:jsmodule_common \
         --js Source/WebCore/inspector/front-end/ConsoleModel.js \
         --js Source/WebCore/inspector/front-end/ContentProviders.js \
         --js Source/WebCore/inspector/front-end/CookieParser.js \
@@ -61,20 +61,30 @@ java -jar ~/closure/compiler.jar --compilation_level SIMPLE_OPTIMIZATIONS --warn
         --js Source/WebCore/inspector/front-end/Resource.js \
         --js Source/WebCore/inspector/front-end/NetworkManager.js \
         --js Source/WebCore/inspector/front-end/UISourceCode.js \
-    --module jsmodule_misc:16:jsmodule_sdk \
+    --module jsmodule_ui:21:jsmodule_common \
         --js Source/WebCore/inspector/front-end/Checkbox.js \
         --js Source/WebCore/inspector/front-end/ContextMenu.js \
-        --js Source/WebCore/inspector/front-end/ConsoleMessage.js \
-        --js Source/WebCore/inspector/front-end/ConsoleView.js \
+        --js Source/WebCore/inspector/front-end/Drawer.js \
+        --js Source/WebCore/inspector/front-end/EmptyView.js \
         --js Source/WebCore/inspector/front-end/HelpScreen.js \
         --js Source/WebCore/inspector/front-end/KeyboardShortcut.js \
-        --js Source/WebCore/inspector/front-end/JavaScriptContextManager.js \
-        --js Source/WebCore/inspector/front-end/View.js \
+        --js Source/WebCore/inspector/front-end/Panel.js \
         --js Source/WebCore/inspector/front-end/Placard.js \
         --js Source/WebCore/inspector/front-end/Popover.js \
-        --js Source/WebCore/inspector/front-end/SoftContextMenu.js \
+        --js Source/WebCore/inspector/front-end/PropertiesSection.js \
+        --js Source/WebCore/inspector/front-end/SearchController.js \
+        --js Source/WebCore/inspector/front-end/Section.js \
+        --js Source/WebCore/inspector/front-end/SidebarPane.js \
         --js Source/WebCore/inspector/front-end/ShortcutsScreen.js \
+        --js Source/WebCore/inspector/front-end/SoftContextMenu.js \
         --js Source/WebCore/inspector/front-end/StatusBarButton.js \
         --js Source/WebCore/inspector/front-end/TabbedPane.js \
         --js Source/WebCore/inspector/front-end/TextPrompt.js \
+        --js Source/WebCore/inspector/front-end/Toolbar.js \
+        --js Source/WebCore/inspector/front-end/UIUtils.js \
+        --js Source/WebCore/inspector/front-end/View.js \
+    --module jsmodule_inspector:4:jsmodule_sdk,jsmodule_ui \
+        --js Source/WebCore/inspector/front-end/ConsoleMessage.js \
+        --js Source/WebCore/inspector/front-end/ConsoleView.js \
+        --js Source/WebCore/inspector/front-end/JavaScriptContextManager.js \
         --js Source/WebCore/inspector/front-end/TimelineManager.js
index 78b0169..38bf330 100644 (file)
@@ -27,6 +27,9 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+/**
+ * @constructor
+ */
 WebInspector.Drawer = function()
 {
     this.element = document.getElementById("drawer");
@@ -100,8 +103,7 @@ WebInspector.Drawer.prototype = {
 
         function animationFinished()
         {
-            if ("updateStatusBarItems" in WebInspector.currentPanel())
-                WebInspector.currentPanel().updateStatusBarItems();
+            WebInspector.currentPanel().statusBarResized();
             if (this._view && this._view.afterShow)
                 this._view.afterShow();
             delete this._currentAnimation;
@@ -131,8 +133,7 @@ WebInspector.Drawer.prototype = {
         // like Elements in their updateStatusBarItems call will size things to fit the final location.
         this._mainStatusBar.style.setProperty("padding-left", (anchoredItems.offsetWidth - 1) + "px");
         document.body.removeStyleClass("drawer-visible");
-        if ("updateStatusBarItems" in WebInspector.currentPanel())
-            WebInspector.currentPanel().updateStatusBarItems();
+        WebInspector.currentPanel().statusBarResized();
         document.body.addStyleClass("drawer-visible");
 
         var animations = [
@@ -178,7 +179,7 @@ WebInspector.Drawer.prototype = {
             return;
 
         this._view.storeScrollPositions();
-        var height = this._constrainHeight(parseInt(this.element.style.height));
+        var height = this._constrainHeight(parseInt(this.element.style.height, 10));
         this._mainElement.style.bottom = height + "px";
         this.element.style.height = height + "px";
         this._view.doResize();
index be9218d..348b611 100644 (file)
@@ -140,7 +140,7 @@ WebInspector.ElementsPanel.prototype = {
         return this.treeOutline.element;
     },
 
-    updateStatusBarItems: function()
+    statusBarResized: function()
     {
         this.updateBreadcrumbSizes();
     },
index b08e068..41904ac 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+/**
+ * @constructor
+ * @extends {WebInspector.View}
+ */
 WebInspector.EmptyView = function(text)
 {
     WebInspector.View.call(this);
index 6eeede5..83b4877 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+/**
+ * @extends {WebInspector.View}
+ * @constructor
+ */
 WebInspector.Panel = function(name)
 {
     WebInspector.View.call(this);
@@ -227,9 +231,22 @@ WebInspector.Panel.prototype = {
         WebInspector.settings[this._sidebarWidthSettingName()].set(this.sidebarElement.offsetWidth);
     },
 
+    // Should be implemented by ancestors.
+
+    get toolbarItemLabel()
+    {
+    },
+
+    get statusBarItems()
+    {
+    },
+
     updateMainViewWidth: function(width)
     {
-        // Should be implemented by ancestors.
+    },
+
+    statusBarResized: function()
+    {
     },
 
     canShowAnchorLocation: function(anchor)
index 88cb1a2..d7ac0bc 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+/**
+ * @constructor
+ * @extends {WebInspector.Section}
+ */
 WebInspector.PropertiesSection = function(title, subtitle)
 {
     WebInspector.Section.call(this, title, subtitle);
index 0e85da8..a1822ee 100644 (file)
@@ -29,6 +29,9 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+/**
+ * @constructor
+ */
 WebInspector.SearchController = function()
 {
     this.element = document.getElementById("search");
@@ -130,7 +133,7 @@ WebInspector.SearchController.prototype = {
         if (!this._currentQuery)
             return;
 
-        panel = WebInspector.currentPanel();
+        var panel = WebInspector.currentPanel();
         if (panel.performSearch) {
             function performPanelSearch()
             {
@@ -148,6 +151,10 @@ WebInspector.SearchController.prototype = {
         }
     },
 
+    /**
+     * @param {?number=} matches
+     * @param {number=} currentMatchIndex
+     */
     _updateSearchMatchesCountAndCurrentMatchIndex: function(matches, currentMatchIndex)
     {
         if (matches == null) {
@@ -193,12 +200,12 @@ WebInspector.SearchController.prototype = {
             // If focus belongs here and text is empty - nothing to do, return unhandled.
             // When search was selected manually and is currently blank, we'd like Esc stay unhandled
             // and hit console drawer handler.
-            if (event.target.value === "" && this.currentFocusElement === this.previousFocusElement)
+            if (event.target.value === "" && WebInspector.currentFocusElement === WebInspector.previousFocusElement)
                 return;
             event.preventDefault();
             event.stopPropagation();
 
-            this.cancelSearch(event);
+            this.cancelSearch();
             WebInspector.currentFocusElement = WebInspector.previousFocusElement;
             if (WebInspector.currentFocusElement === event.target)
                 WebInspector.currentFocusElement.currentFocusElement.select();
@@ -227,6 +234,11 @@ WebInspector.SearchController.prototype = {
         this._performSearch(event.target.value, forceSearch, event.shiftKey, false);
     },
 
+    /**
+     * @param {boolean=} forceSearch
+     * @param {boolean=} isBackwardSearch
+     * @param {boolean=} repeatSearch
+     */
     _performSearch: function(query, forceSearch, isBackwardSearch, repeatSearch)
     {
         var isShortSearch = (query.length < 3);
@@ -285,3 +297,8 @@ WebInspector.SearchController.prototype = {
         currentPanel.performSearch(query);
     }
 }
+
+/**
+ * @type {?WebInspector.SearchController}
+ */
+WebInspector.searchController = null;
index 36a4420..855b7c1 100644 (file)
@@ -27,6 +27,9 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+/**
+ * @constructor
+ */
 WebInspector.Section = function(title, subtitle)
 {
     this.element = document.createElement("div");
@@ -118,12 +121,17 @@ WebInspector.Section.prototype = {
     set populated(x)
     {
         this._populated = x;
-        if (!x && this.onpopulate && this._expanded) {
-            this.onpopulate(this);
+        if (!x && this._expanded) {
+            this.onpopulate();
             this._populated = true;
         }
     },
 
+    onpopulate: function()
+    {
+        // Overriden by subclasses.
+    },
+
     get firstSibling()
     {
         var parent = this.element.parentElement;
@@ -183,8 +191,8 @@ WebInspector.Section.prototype = {
         this._expanded = true;
         this.element.addStyleClass("expanded");
 
-        if (!this._populated && this.onpopulate) {
-            this.onpopulate(this);
+        if (!this._populated) {
+            this.onpopulate();
             this._populated = true;
         }
     },
index ebc62db..b7fa747 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+/**
+ * @constructor
+ * @extends {WebInspector.Object}
+ */
 WebInspector.SidebarPane = function(title)
 {
     this.element = document.createElement("div");
index 8eb510a..0076d0d 100644 (file)
@@ -29,6 +29,9 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+/**
+ * @constructor
+ */
 WebInspector.Toolbar = function()
 {
     this.element = document.getElementById("toolbar");
@@ -142,7 +145,7 @@ WebInspector.Toolbar.prototype = {
         else
             this._dropdownButton.addStyleClass("hidden");
     }
-};
+}
 
 WebInspector.Toolbar.createPanelToolbarItem = function(panel)
 {
@@ -155,7 +158,7 @@ WebInspector.Toolbar.createPanelToolbarItem = function(panel)
         WebInspector.toolbar._updateDropdownButtonAndHideDropdown();
         WebInspector.setCurrentPanel(panel);
     }
-    toolbarItem.addEventListener("click", onToolbarItemClicked);
+    toolbarItem.addEventListener("click", onToolbarItemClicked, false);
 
     var iconElement = toolbarItem.createChild("div", "toolbar-icon");
 
@@ -168,6 +171,9 @@ WebInspector.Toolbar.createPanelToolbarItem = function(panel)
     return toolbarItem;
 }
 
+/**
+ * @constructor
+ */
 WebInspector.ToolbarDropdown = function()
 {
     this._toolbar = document.getElementById("toolbar");
@@ -193,7 +199,6 @@ WebInspector.ToolbarDropdown.prototype = {
         this.element.style.left = this._arrow.totalOffsetLeft() + "px";
         this._contentElement.style.maxHeight = window.innerHeight - top - 20 + "px";
         this._toolbar.appendChild(this.element);
-        WebInspector.currentFocusElement = this.contentElement;
     },
 
     hide: function()
@@ -227,4 +232,9 @@ WebInspector.ToolbarDropdown.prototype = {
         event.stopPropagation();
         this.hide();
     }
-};
+}
+
+/**
+ * @type {?WebInspector.Toolbar}
+ */
+WebInspector.toolbar = null;
diff --git a/Source/WebCore/inspector/front-end/UIUtils.js b/Source/WebCore/inspector/front-end/UIUtils.js
new file mode 100644 (file)
index 0000000..c49a542
--- /dev/null
@@ -0,0 +1,167 @@
+/*
+ * Copyright (C) 2011 Google Inc.  All rights reserved.
+ * Copyright (C) 2006, 2007, 2008 Apple Inc.  All rights reserved.
+ * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com).
+ * Copyright (C) 2009 Joseph Pecoraro
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.elementDragStart = function(element, dividerDrag, elementDragEnd, event, cursor)
+{
+    if (WebInspector._elementDraggingEventListener || WebInspector._elementEndDraggingEventListener)
+        WebInspector.elementDragEnd(event);
+
+    WebInspector._elementDraggingEventListener = dividerDrag;
+    WebInspector._elementEndDraggingEventListener = elementDragEnd;
+
+    var targetDocument = event.target.ownerDocument;
+    targetDocument.addEventListener("mousemove", dividerDrag, true);
+    targetDocument.addEventListener("mouseup", elementDragEnd, true);
+
+    targetDocument.body.style.cursor = cursor;
+
+    event.preventDefault();
+}
+
+WebInspector.elementDragEnd = function(event)
+{
+    var targetDocument = event.target.ownerDocument;
+    targetDocument.removeEventListener("mousemove", WebInspector._elementDraggingEventListener, true);
+    targetDocument.removeEventListener("mouseup", WebInspector._elementEndDraggingEventListener, true);
+
+    targetDocument.body.style.removeProperty("cursor");
+
+    delete WebInspector._elementDraggingEventListener;
+    delete WebInspector._elementEndDraggingEventListener;
+
+    event.preventDefault();
+}
+
+WebInspector.animateStyle = function(animations, duration, callback)
+{
+    var interval;
+    var complete = 0;
+    var hasCompleted = false;
+
+    const intervalDuration = (1000 / 30); // 30 frames per second.
+    const animationsLength = animations.length;
+    const propertyUnit = {opacity: ""};
+    const defaultUnit = "px";
+
+    function cubicInOut(t, b, c, d)
+    {
+        if ((t/=d/2) < 1) return c/2*t*t*t + b;
+        return c/2*((t-=2)*t*t + 2) + b;
+    }
+
+    // Pre-process animations.
+    for (var i = 0; i < animationsLength; ++i) {
+        var animation = animations[i];
+        var element = null, start = null, end = null, key = null;
+        for (key in animation) {
+            if (key === "element")
+                element = animation[key];
+            else if (key === "start")
+                start = animation[key];
+            else if (key === "end")
+                end = animation[key];
+        }
+
+        if (!element || !end)
+            continue;
+
+        if (!start) {
+            var computedStyle = element.ownerDocument.defaultView.getComputedStyle(element);
+            start = {};
+            for (key in end)
+                start[key] = parseInt(computedStyle.getPropertyValue(key), 10);
+            animation.start = start;
+        } else
+            for (key in start)
+                element.style.setProperty(key, start[key] + (key in propertyUnit ? propertyUnit[key] : defaultUnit));
+    }
+
+    function animateLoop()
+    {
+        if (hasCompleted)
+            return;
+        
+        // Advance forward.
+        complete += intervalDuration;
+        var next = complete + intervalDuration;
+
+        // Make style changes.
+        for (var i = 0; i < animationsLength; ++i) {
+            var animation = animations[i];
+            var element = animation.element;
+            var start = animation.start;
+            var end = animation.end;
+            if (!element || !end)
+                continue;
+
+            var style = element.style;
+            for (key in end) {
+                var endValue = end[key];
+                if (next < duration) {
+                    var startValue = start[key];
+                    var newValue = cubicInOut(complete, startValue, endValue - startValue, duration);
+                    style.setProperty(key, newValue + (key in propertyUnit ? propertyUnit[key] : defaultUnit));
+                } else
+                    style.setProperty(key, endValue + (key in propertyUnit ? propertyUnit[key] : defaultUnit));
+            }
+        }
+
+        // End condition.
+        if (complete >= duration) {
+            hasCompleted = true;
+            clearInterval(interval);
+            if (callback)
+                callback();
+        }
+    }
+
+    function forceComplete()
+    {
+        if (hasCompleted)
+            return;
+
+        complete = duration;
+        animateLoop();
+    }
+
+    function cancel()
+    {
+        hasCompleted = true;
+        clearInterval(interval);
+    }
+
+    interval = setInterval(animateLoop, intervalDuration);
+    return {
+        cancel: cancel,
+        forceComplete: forceComplete
+    };
+}
+
index 52ac934..d5bf9eb 100644 (file)
     <file>TopDownProfileDataGridTree.js</file>
     <file>treeoutline.js</file>
     <file>UISourceCode.js</file>
+    <file>UIUtils.js</file>
     <file>UserMetrics.js</file>
     <file>utilities.js</file>
     <file>View.js</file>
index efd0fe3..f9aae8b 100644 (file)
@@ -76,6 +76,8 @@ Array.prototype.remove = function(obj) {}
 
 WebInspector.extensionServer = {}
 WebInspector.extensionServer.notifyResourceContentCommitted = function(resource, content) {}
+WebInspector.extensionServer.notifyPanelShown = function(panel) {}
+WebInspector.extensionServer.notifyPanelHidden = function(panel) {}
 
 /**
  * @param {string} url
@@ -146,3 +148,28 @@ WebInspector.ScriptsPanel = function()
  * @type {?WebInspector.ScriptsPanel}
  */
 WebInspector.panels.scripts = null;
+
+/**
+ * @return {WebInspector.Panel} 
+ */
+WebInspector.currentPanel = function() {}
+
+/**
+ * @param {WebInspector.Panel} panel
+ */
+WebInspector.setCurrentPanel = function(panel) {}
+
+/**
+ * @type {?Element}
+ */
+WebInspector.currentFocusElement = null;
+
+/**
+ * @type {?Element}
+ */
+WebInspector.previousFocusElement = null;
+
+/**
+ * @type {string}
+ */
+WebInspector.platformFlavor = "";
index 85b17aa..b50a1b3 100644 (file)
@@ -44,6 +44,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     <script type="text/javascript" src="BinarySearch.js"></script>
     <script type="text/javascript" src="treeoutline.js"></script>
     <script type="text/javascript" src="inspector.js"></script>
+    <script type="text/javascript" src="UIUtils.js"></script>
     <script type="text/javascript" src="InspectorBackendStub.js"></script>
     <script type="text/javascript" src="InspectorFrontendHostStub.js"></script>
     <script type="text/javascript" src="ExtensionRegistryStub.js"></script>
index 8c271e8..351c52d 100644 (file)
@@ -889,142 +889,6 @@ WebInspector.contextMenuEventFired = function(event)
         event.preventDefault();
 }
 
-WebInspector.animateStyle = function(animations, duration, callback)
-{
-    var interval;
-    var complete = 0;
-    var hasCompleted = false;
-
-    const intervalDuration = (1000 / 30); // 30 frames per second.
-    const animationsLength = animations.length;
-    const propertyUnit = {opacity: ""};
-    const defaultUnit = "px";
-
-    function cubicInOut(t, b, c, d)
-    {
-        if ((t/=d/2) < 1) return c/2*t*t*t + b;
-        return c/2*((t-=2)*t*t + 2) + b;
-    }
-
-    // Pre-process animations.
-    for (var i = 0; i < animationsLength; ++i) {
-        var animation = animations[i];
-        var element = null, start = null, end = null, key = null;
-        for (key in animation) {
-            if (key === "element")
-                element = animation[key];
-            else if (key === "start")
-                start = animation[key];
-            else if (key === "end")
-                end = animation[key];
-        }
-
-        if (!element || !end)
-            continue;
-
-        if (!start) {
-            var computedStyle = element.ownerDocument.defaultView.getComputedStyle(element);
-            start = {};
-            for (key in end)
-                start[key] = parseInt(computedStyle.getPropertyValue(key));
-            animation.start = start;
-        } else
-            for (key in start)
-                element.style.setProperty(key, start[key] + (key in propertyUnit ? propertyUnit[key] : defaultUnit));
-    }
-
-    function animateLoop()
-    {
-        if (hasCompleted)
-            return;
-        
-        // Advance forward.
-        complete += intervalDuration;
-        var next = complete + intervalDuration;
-
-        // Make style changes.
-        for (var i = 0; i < animationsLength; ++i) {
-            var animation = animations[i];
-            var element = animation.element;
-            var start = animation.start;
-            var end = animation.end;
-            if (!element || !end)
-                continue;
-
-            var style = element.style;
-            for (key in end) {
-                var endValue = end[key];
-                if (next < duration) {
-                    var startValue = start[key];
-                    var newValue = cubicInOut(complete, startValue, endValue - startValue, duration);
-                    style.setProperty(key, newValue + (key in propertyUnit ? propertyUnit[key] : defaultUnit));
-                } else
-                    style.setProperty(key, endValue + (key in propertyUnit ? propertyUnit[key] : defaultUnit));
-            }
-        }
-
-        // End condition.
-        if (complete >= duration) {
-            hasCompleted = true;
-            clearInterval(interval);
-            if (callback)
-                callback();
-        }
-    }
-
-    function forceComplete()
-    {
-        if (hasCompleted)
-            return;
-
-        complete = duration;
-        animateLoop();
-    }
-
-    function cancel()
-    {
-        hasCompleted = true;
-        clearInterval(interval);
-    }
-
-    interval = setInterval(animateLoop, intervalDuration);
-    return {
-        cancel: cancel,
-        forceComplete: forceComplete
-    };
-}
-
-WebInspector.elementDragStart = function(element, dividerDrag, elementDragEnd, event, cursor)
-{
-    if (this._elementDraggingEventListener || this._elementEndDraggingEventListener)
-        this.elementDragEnd(event);
-
-    this._elementDraggingEventListener = dividerDrag;
-    this._elementEndDraggingEventListener = elementDragEnd;
-
-    var targetDocument = event.target.ownerDocument;
-    targetDocument.addEventListener("mousemove", dividerDrag, true);
-    targetDocument.addEventListener("mouseup", elementDragEnd, true);
-
-    targetDocument.body.style.cursor = cursor;
-
-    event.preventDefault();
-}
-
-WebInspector.elementDragEnd = function(event)
-{
-    var targetDocument = event.target.ownerDocument;
-    targetDocument.removeEventListener("mousemove", this._elementDraggingEventListener, true);
-    targetDocument.removeEventListener("mouseup", this._elementEndDraggingEventListener, true);
-
-    targetDocument.body.style.removeProperty("cursor");
-
-    delete this._elementDraggingEventListener;
-    delete this._elementEndDraggingEventListener;
-
-    event.preventDefault();
-}
-
 WebInspector.toggleSearchingForNode = function()
 {
     if (this.panels.elements) {