Changeset 86589 in webkit


Ignore:
Timestamp:
May 16, 2011 10:54:22 AM (13 years ago)
Author:
podivilov@chromium.org
Message:

2011-05-16 Pavel Podivilov <podivilov@chromium.org>

Reviewed by Yury Semikhatsky.

Web Inspector: merge ConsoleView into ConsolePanel.
https://bugs.webkit.org/show_bug.cgi?id=54670

  • http/tests/inspector/inspector-test.js: (initialize_InspectorTest.InspectorTest.evaluateInConsole): (initialize_InspectorTest.InspectorTest.waitUntilConsoleMessageAdded):
  • inspector/console/console-assert.html:
  • inspector/console/console-trace-in-eval.html:
  • inspector/console/console-trace.html:
  • inspector/console/console-uncaught-exception.html:
  • inspector/debugger/debugger-autocontinue-on-syntax-error.html:
  • inspector/styles/styles-iframe.html:
  • inspector/timeline/timeline-network-resource.html:
  • inspector/timeline/timeline-script-tag-1.html:
  • inspector/timeline/timeline-script-tag-2.html:

2011-05-16 Pavel Podivilov <podivilov@chromium.org>

Reviewed by Yury Semikhatsky.

Web Inspector: merge ConsoleView into ConsolePanel.
https://bugs.webkit.org/show_bug.cgi?id=54670

Console view in drawer looks exactly the same as console panel. Merging ConsoleView and ConsolePanel together
will allow us to reuse panel's functionality (e.g. resizable sidebar) even when console is docked.

  • inspector/front-end/ConsoleView.js: (WebInspector.ConsolePanel.prototype.get toolbarItemLabel): (WebInspector.ConsolePanel.prototype.show): (WebInspector.ConsolePanel.prototype.hide): (WebInspector.ConsolePanel.prototype.showInDrawer): (WebInspector.ConsolePanel.prototype.afterShowInDrawer): (WebInspector.ConsolePanel.prototype.hideInDrawer): (WebInspector.ConsolePanel.prototype.addMessage): (WebInspector.ConsolePanel.prototype.clearMessages):
  • inspector/front-end/DebuggerPresentationModel.js: (WebInspector.DebuggerPresentationModel):
  • inspector/front-end/Drawer.js: (WebInspector.Drawer.prototype.set visibleView): (WebInspector.Drawer.prototype.show.animationFinished): (WebInspector.Drawer.prototype.show):
  • inspector/front-end/Panel.js: (WebInspector.Panel):
  • inspector/front-end/ResourceTreeModel.js: (WebInspector.ResourceTreeModel):
  • inspector/front-end/inspector.html:
  • inspector/front-end/inspector.js: (WebInspector._createPanels):
Location:
trunk
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r86587 r86589  
     12011-05-16  Pavel Podivilov  <podivilov@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: merge ConsoleView into ConsolePanel.
     6        https://bugs.webkit.org/show_bug.cgi?id=54670
     7
     8        * http/tests/inspector/inspector-test.js:
     9        (initialize_InspectorTest.InspectorTest.evaluateInConsole):
     10        (initialize_InspectorTest.InspectorTest.waitUntilConsoleMessageAdded):
     11        * inspector/console/console-assert.html:
     12        * inspector/console/console-trace-in-eval.html:
     13        * inspector/console/console-trace.html:
     14        * inspector/console/console-uncaught-exception.html:
     15        * inspector/debugger/debugger-autocontinue-on-syntax-error.html:
     16        * inspector/styles/styles-iframe.html:
     17        * inspector/timeline/timeline-network-resource.html:
     18        * inspector/timeline/timeline-script-tag-1.html:
     19        * inspector/timeline/timeline-script-tag-2.html:
     20
    1212011-05-16  Balazs Kelemen  <kbalazs@webkit.org>
    222
  • trunk/LayoutTests/http/tests/inspector/inspector-test.js

    r85321 r86589  
    2727    event.initKeyboardEvent("keydown", true, true, null, "Enter", "");
    2828    WebInspector.console.promptElement.dispatchEvent(event);
    29     InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage",
     29    InspectorTest.waitUntilConsoleMessageAdded(
    3030        function(commandResult) {
    3131            callback(commandResult.toMessageElement().textContent);
     
    4343    }
    4444    InspectorTest.evaluateInConsole(code, mycallback);
     45}
     46
     47InspectorTest.waitUntilConsoleMessageAdded = function(callback, sticky)
     48{
     49    InspectorTest.addSniffer(WebInspector.ConsolePanel.prototype, "addMessage", callback, sticky);
    4550}
    4651
  • trunk/LayoutTests/inspector/console/console-assert.html

    r82713 r86589  
    2828    }
    2929    InspectorTest.evaluateInPage("setTimeout(a, 0)");
    30     InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", callback, true);
     30    InspectorTest.waitUntilConsoleMessageAdded(callback, true);
    3131}
    3232
  • trunk/LayoutTests/inspector/console/console-trace-in-eval.html

    r82713 r86589  
    3636    }
    3737    InspectorTest.evaluateInPage("doEvalSource()");
    38     InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", callback);
     38    InspectorTest.waitUntilConsoleMessageAdded(callback);
    3939}
    4040
  • trunk/LayoutTests/inspector/console/console-trace.html

    r82713 r86589  
    2323    }
    2424    InspectorTest.evaluateInPage("setTimeout(a, 0)");
    25     InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", callback);
     25    InspectorTest.waitUntilConsoleMessageAdded(callback);
    2626}
    2727
  • trunk/LayoutTests/inspector/console/console-uncaught-exception.html

    r82713 r86589  
    77function test()
    88{
    9     InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", addMessage, true);
     9    InspectorTest.waitUntilConsoleMessageAdded(addMessage, true);
    1010    InspectorTest.evaluateInPage("loadIframe()");
    1111    function addMessage(message)
  • trunk/LayoutTests/inspector/debugger/debugger-autocontinue-on-syntax-error.html

    r82847 r86589  
    2020    {
    2121        DebuggerAgent.setPauseOnExceptions(WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnUncaughtExceptions);
    22         InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
     22        InspectorTest.waitUntilConsoleMessageAdded(step2);
    2323        InspectorTest.evaluateInPage("loadIframe()");
    2424    }
  • trunk/LayoutTests/inspector/styles/styles-iframe.html

    r82713 r86589  
    2020{
    2121    InspectorTest.evaluateInPage("loadIframe()");
    22     InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step0);
     22    InspectorTest.waitUntilConsoleMessageAdded(step0);
    2323
    2424    function step0()
  • trunk/LayoutTests/inspector/timeline/timeline-network-resource.html

    r80416 r86589  
    2424    {
    2525        InspectorTest.evaluateInPage("performActions()");
    26         InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
     26        InspectorTest.waitUntilConsoleMessageAdded(step2);
    2727    }
    2828
  • trunk/LayoutTests/inspector/timeline/timeline-script-tag-1.html

    r80416 r86589  
    1717    function step1()
    1818    {
    19         InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
     19        InspectorTest.waitUntilConsoleMessageAdded(step2);
    2020        InspectorTest.evaluateInPage("performActions()");
    2121    }
  • trunk/LayoutTests/inspector/timeline/timeline-script-tag-2.html

    r80416 r86589  
    1717    function step1()
    1818    {
    19         InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
     19        InspectorTest.waitUntilConsoleMessageAdded(step2);
    2020        InspectorTest.evaluateInPage("performActions()");
    2121    }
  • trunk/Source/WebCore/ChangeLog

    r86588 r86589  
     12011-05-16  Pavel Podivilov  <podivilov@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: merge ConsoleView into ConsolePanel.
     6        https://bugs.webkit.org/show_bug.cgi?id=54670
     7
     8        Console view in drawer looks exactly the same as console panel. Merging ConsoleView and ConsolePanel together
     9        will allow us to reuse panel's functionality (e.g. resizable sidebar) even when console is docked.
     10
     11        * inspector/front-end/ConsoleView.js:
     12        (WebInspector.ConsolePanel.prototype.get toolbarItemLabel):
     13        (WebInspector.ConsolePanel.prototype.show):
     14        (WebInspector.ConsolePanel.prototype.hide):
     15        (WebInspector.ConsolePanel.prototype.showInDrawer):
     16        (WebInspector.ConsolePanel.prototype.afterShowInDrawer):
     17        (WebInspector.ConsolePanel.prototype.hideInDrawer):
     18        (WebInspector.ConsolePanel.prototype.addMessage):
     19        (WebInspector.ConsolePanel.prototype.clearMessages):
     20        * inspector/front-end/DebuggerPresentationModel.js:
     21        (WebInspector.DebuggerPresentationModel):
     22        * inspector/front-end/Drawer.js:
     23        (WebInspector.Drawer.prototype.set visibleView):
     24        (WebInspector.Drawer.prototype.show.animationFinished):
     25        (WebInspector.Drawer.prototype.show):
     26        * inspector/front-end/Panel.js:
     27        (WebInspector.Panel):
     28        * inspector/front-end/ResourceTreeModel.js:
     29        (WebInspector.ResourceTreeModel):
     30        * inspector/front-end/inspector.html:
     31        * inspector/front-end/inspector.js:
     32        (WebInspector._createPanels):
     33
    1342011-05-13  Jer Noble  <jer.noble@apple.com>
    235
  • trunk/Source/WebCore/inspector/front-end/ConsoleView.js

    r86539 r86589  
    3030const ExpressionStopCharacters = " =:[({;,!+-*/&|^<>";
    3131
    32 WebInspector.ConsoleView = function(drawer)
     32WebInspector.ConsolePanel = function(drawer)
    3333{
    34     WebInspector.View.call(this, document.getElementById("console-view"));
     34    WebInspector.Panel.call(this, "console", document.getElementById("console-view"));
    3535
    3636    this.messages = [];
     
    102102}
    103103
    104 WebInspector.ConsoleView.Events = {
     104WebInspector.ConsolePanel.Events = {
    105105  ConsoleCleared: "console-cleared",
    106106  EntryAdded: "console-entry-added",
     
    108108}
    109109
    110 WebInspector.ConsoleView.prototype = {
     110WebInspector.ConsolePanel.prototype = {
    111111    _registerConsoleDomainDispatcher: function() {
    112112        var console = this;
     
    243243    },
    244244
     245    get toolbarItemLabel()
     246    {
     247        return WebInspector.UIString("Console");
     248    },
     249
    245250    show: function()
    246251    {
     252        WebInspector.Panel.prototype.show.call(this);
     253
     254        this._previousConsoleState = WebInspector.drawer.state;
     255        WebInspector.drawer.enterPanelMode();
     256        WebInspector.showConsole();
     257
     258        // Move the scope bar to the top of the messages, like the resources filter.
     259        var scopeBar = document.getElementById("console-filter");
     260        var consoleMessages = document.getElementById("console-messages");
     261
     262        scopeBar.parentNode.removeChild(scopeBar);
     263        document.getElementById("console-view").insertBefore(scopeBar, consoleMessages);
     264
     265        // Update styles, and give console-messages a top margin so it doesn't overwrite the scope bar.
     266        scopeBar.addStyleClass("console-filter-top");
     267        scopeBar.removeStyleClass("status-bar-item");
     268
     269        consoleMessages.addStyleClass("console-filter-top");
     270    },
     271
     272    hide: function()
     273    {
     274        if (this._previousConsoleState === WebInspector.Drawer.State.Hidden) {
     275            WebInspector.Panel.prototype.hide.call(this);
     276            WebInspector.drawer.immediatelyExitPanelMode();
     277        } else {
     278            if ("_toolbarItem" in this)
     279                this._toolbarItem.removeStyleClass("toggled-on");
     280            WebInspector.drawer.exitPanelMode();
     281        }
     282        delete this._previousConsoleState;
     283
     284        // Move the scope bar back to the bottom bar, next to Clear Console.
     285        var scopeBar = document.getElementById("console-filter");
     286
     287        scopeBar.parentNode.removeChild(scopeBar);
     288        document.getElementById("other-drawer-status-bar-items").appendChild(scopeBar);
     289
     290        // Update styles, and remove the top margin on console-messages.
     291        scopeBar.removeStyleClass("console-filter-top");
     292        scopeBar.addStyleClass("status-bar-item");
     293
     294        document.getElementById("console-messages").removeStyleClass("console-filter-top");
     295    },
     296
     297    showInDrawer: function()
     298    {
     299        WebInspector.View.prototype.show.call(this);
    247300        this.toggleConsoleButton.addStyleClass("toggled-on");
    248301        this.toggleConsoleButton.title = WebInspector.UIString("Hide console.");
     
    251304    },
    252305
    253     afterShow: function()
     306    afterShowInDrawer: function()
    254307    {
    255308        WebInspector.currentFocusElement = this.promptElement;
    256309    },
    257310
    258     hide: function()
     311    hideInDrawer: function()
    259312    {
    260313        this.toggleConsoleButton.removeStyleClass("toggled-on");
     
    281334        if (msg instanceof WebInspector.ConsoleMessage && !(msg instanceof WebInspector.ConsoleCommandResult)) {
    282335            this._incrementErrorWarningCount(msg);
    283             this.dispatchEventToListeners(WebInspector.ConsoleView.Events.MessageAdded, msg);
     336            this.dispatchEventToListeners(WebInspector.ConsolePanel.Events.MessageAdded, msg);
    284337            this.commandSincePreviousMessage = false;
    285338            this.previousMessage = msg;
     
    310363            this._scheduleScrollIntoView();
    311364
    312         this.dispatchEventToListeners(WebInspector.ConsoleView.Events.EntryAdded, msg);
     365        this.dispatchEventToListeners(WebInspector.ConsolePanel.Events.EntryAdded, msg);
    313366    },
    314367
     
    332385    clearMessages: function()
    333386    {
    334         this.dispatchEventToListeners(WebInspector.ConsoleView.Events.ConsoleCleared);
     387        this.dispatchEventToListeners(WebInspector.ConsolePanel.Events.ConsoleCleared);
    335388
    336389        this.messages = [];
     
    678731}
    679732
    680 WebInspector.ConsoleView.prototype.__proto__ = WebInspector.View.prototype;
     733WebInspector.ConsolePanel.prototype.__proto__ = WebInspector.Panel.prototype;
    681734
    682735WebInspector.ConsoleMessage = function(source, type, level, line, url, repeatCount, message, parameters, stackTrace, requestId)
  • trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js

    r86539 r86589  
    4747    WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.Reset, this._debuggerReset, this);
    4848
    49     WebInspector.console.addEventListener(WebInspector.ConsoleView.Events.MessageAdded, this._consoleMessageAdded, this);
    50     WebInspector.console.addEventListener(WebInspector.ConsoleView.Events.ConsoleCleared, this._consoleCleared, this);
     49    WebInspector.console.addEventListener(WebInspector.ConsolePanel.Events.MessageAdded, this._consoleMessageAdded, this);
     50    WebInspector.console.addEventListener(WebInspector.ConsolePanel.Events.ConsoleCleared, this._consoleCleared, this);
    5151
    5252    new WebInspector.DebuggerPresentationModelResourceBinding(this);
  • trunk/Source/WebCore/inspector/front-end/Drawer.js

    r78343 r86589  
    6262        var firstTime = !this._visibleView;
    6363        if (this._visibleView)
    64             this._visibleView.hide();
     64            this._visibleView.hideInDrawer();
    6565
    6666        this._visibleView = x;
     
    7070            this._viewStatusBar.removeChildren(); // optimize this? call old.detach()
    7171            x.attach(this.element, this._viewStatusBar);
    72             x.show();
     72            x.showInDrawer();
    7373            this.visible = true;
    7474        }
     
    9393
    9494        if (this.visibleView)
    95             this.visibleView.show();
     95            this.visibleView.showInDrawer();
    9696
    9797        WebInspector.View.prototype.show.call(this);
     
    125125            if ("updateStatusBarItems" in WebInspector.currentPanel)
    126126                WebInspector.currentPanel.updateStatusBarItems();
    127             if (this.visibleView.afterShow)
    128                 this.visibleView.afterShow();
     127            if (this.visibleView.afterShowInDrawer)
     128                this.visibleView.afterShowInDrawer();
    129129            delete this._animating;
    130130            delete this._currentAnimation;
     
    145145
    146146        if (this.visibleView)
    147             this.visibleView.hide();
     147            this.visibleView.hideInDrawer();
    148148
    149149        this._animating = true;
  • trunk/Source/WebCore/inspector/front-end/Panel.js

    r84484 r86589  
    2727 */
    2828
    29 WebInspector.Panel = function(name)
     29WebInspector.Panel = function(name, element)
    3030{
    31     WebInspector.View.call(this);
     31    WebInspector.View.call(this, element);
    3232
    3333    this.element.addStyleClass("panel");
  • trunk/Source/WebCore/inspector/front-end/ResourceTreeModel.js

    r86539 r86589  
    3636    WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceFinished, this._onResourceUpdated, this);
    3737
    38     WebInspector.console.addEventListener(WebInspector.ConsoleView.Events.MessageAdded, this._consoleMessageAdded, this);
    39     WebInspector.console.addEventListener(WebInspector.ConsoleView.Events.ConsoleCleared, this._consoleCleared, this);
     38    WebInspector.console.addEventListener(WebInspector.ConsolePanel.Events.MessageAdded, this._consoleMessageAdded, this);
     39    WebInspector.console.addEventListener(WebInspector.ConsolePanel.Events.ConsoleCleared, this._consoleCleared, this);
    4040
    4141    this.frontendReused();
  • trunk/Source/WebCore/inspector/front-end/inspector.html

    r84780 r86589  
    5858    <script type="text/javascript" src="View.js"></script>
    5959    <script type="text/javascript" src="Drawer.js"></script>
    60     <script type="text/javascript" src="ConsoleView.js"></script>
    6160    <script type="text/javascript" src="Panel.js"></script>
    6261    <script type="text/javascript" src="TimelineGrid.js"></script>   
     
    108107    <script type="text/javascript" src="ResourcesPanel.js"></script>
    109108    <script type="text/javascript" src="ProfilesPanel.js"></script>
    110     <script type="text/javascript" src="ConsolePanel.js"></script>
     109    <script type="text/javascript" src="ConsoleView.js"></script>
    111110    <script type="text/javascript" src="ExtensionAPI.js"></script>
    112111    <script type="text/javascript" src="ExtensionAuditCategory.js"></script>
  • trunk/Source/WebCore/inspector/front-end/inspector.js

    r85847 r86589  
    152152    },
    153153
    154     _createPanels: function()
     154    _createPanels: function(hiddenPanels)
    155155    {
    156156        if (WebInspector.WorkerManager.isWorkerFrontend()) {
     
    159159            return;
    160160        }
    161         var hiddenPanels = (InspectorFrontendHost.hiddenPanels() || "").split(',');
    162161        if (hiddenPanels.indexOf("elements") === -1)
    163162            this.panels.elements = new WebInspector.ElementsPanel();
     
    174173        if (hiddenPanels.indexOf("audits") === -1)
    175174            this.panels.audits = new WebInspector.AuditsPanel();
    176         if (hiddenPanels.indexOf("console") === -1)
    177             this.panels.console = new WebInspector.ConsolePanel();
    178175    },
    179176
     
    418415
    419416    this.drawer = new WebInspector.Drawer();
    420     this.console = new WebInspector.ConsoleView(this.drawer);
     417    this.console = new WebInspector.ConsolePanel(this.drawer);
    421418    this.drawer.visibleView = this.console;
    422419    this.networkManager = new WebInspector.NetworkManager();
     
    443440    this.domBreakpointsSidebarPane = new WebInspector.DOMBreakpointsSidebarPane();
    444441
     442    var hiddenPanels = (InspectorFrontendHost.hiddenPanels() || "").split(',');
    445443    this.panels = {};
    446     this._createPanels();
     444    this._createPanels(hiddenPanels);
     445    if (hiddenPanels.indexOf("console") === -1)
     446        this.panels.console = this.console;
     447
    447448    this._panelHistory = new WebInspector.PanelHistory();
    448449    this.toolbar = new WebInspector.Toolbar();
Note: See TracChangeset for help on using the changeset viewer.