Changeset 64973 in webkit


Ignore:
Timestamp:
Aug 9, 2010 4:26:02 AM (14 years ago)
Author:
loislo@chromium.org
Message:

2010-08-09 Ilya Tikhonovsky <loislo@chromium.org>

Reviewed by Yury Semikhatsky.

WebInspector: Current implementation of showPanel is a bit complicated.
It is using internal enum for all the panels and this is the problem because
we should change a lot of code for a new panel.
https://bugs.webkit.org/show_bug.cgi?id=43711

  • WebCore.exp.in:
  • inspector/Inspector.idl:
  • inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): (WebCore::InspectorController::storeLastActivePanel): (WebCore::InspectorController::connectFrontend): (WebCore::InspectorController::showPanel): (WebCore::InspectorController::disconnectFrontend):
  • inspector/InspectorController.h:
  • inspector/InspectorFrontend.cpp:
  • inspector/InspectorFrontend.h:
  • inspector/front-end/ElementsTreeOutline.js: (WebInspector.ElementsTreeElement.prototype.selectOnMouseDown):
  • inspector/front-end/ExtensionServer.js: (WebInspector.ExtensionServer.prototype._onRevealAndSelectResource):
  • inspector/front-end/inspector.js: (WebInspector.documentClick.followLink): (WebInspector.documentClick): (WebInspector.toggleSearchingForNode): (WebInspector.showPanel): (WebInspector.selectDatabase): (WebInspector.selectDOMStorage): (WebInspector.showProfileForURL):

2010-08-09 Ilya Tikhonovsky <loislo@chromium.org>

Reviewed by Yury Semikhatsky.

WebInspector: Current implementation of showPanel is a bit complicated.
It is using internal enum for all the panels and this is the problem because
we should change a lot of code for a new panel.
https://bugs.webkit.org/show_bug.cgi?id=43711

  • inspector/debugger-breakpoints-not-activated-on-reload.html:
  • inspector/debugger-cyclic-ref.html:
  • inspector/debugger-eval-while-paused.html:
  • inspector/debugger-no-nested-pause.html:
  • inspector/debugger-pause-in-eval-script.html:
  • inspector/debugger-pause-on-debugger-statement.html:
  • inspector/debugger-proto-property.html:
  • inspector/elements-panel-limited-children.html:
Location:
trunk
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r64970 r64973  
     12010-08-09  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        WebInspector: Current implementation of showPanel is a bit complicated.
     6        It is using internal enum for all the panels and this is the problem because
     7        we should change a lot of code for a new panel.
     8        https://bugs.webkit.org/show_bug.cgi?id=43711
     9
     10        * inspector/debugger-breakpoints-not-activated-on-reload.html:
     11        * inspector/debugger-cyclic-ref.html:
     12        * inspector/debugger-eval-while-paused.html:
     13        * inspector/debugger-no-nested-pause.html:
     14        * inspector/debugger-pause-in-eval-script.html:
     15        * inspector/debugger-pause-on-debugger-statement.html:
     16        * inspector/debugger-proto-property.html:
     17        * inspector/elements-panel-limited-children.html:
     18
    1192010-08-09  Shinichiro Hamaji  <hamaji@chromium.org>
    220
  • trunk/LayoutTests/inspector/debugger-breakpoints-not-activated-on-reload.html

    r64133 r64973  
    2222    testController.waitUntilDone();
    2323
    24     WebInspector.showScriptsPanel();
     24    WebInspector.showPanel("scripts");
    2525    frontend_ensureDebuggerEnabled(debuggerWasEnabledCallback);
    2626
  • trunk/LayoutTests/inspector/debugger-cyclic-ref.html

    r64747 r64973  
    2222    testController.waitUntilDone();
    2323
    24     WebInspector.showScriptsPanel();
     24    WebInspector.showPanel("scripts");
    2525    frontend_ensureDebuggerEnabled(debuggerWasEnabledCallback);
    2626
  • trunk/LayoutTests/inspector/debugger-eval-while-paused.html

    r62773 r64973  
    2626    testController.waitUntilDone();
    2727
    28     WebInspector.showScriptsPanel();
     28    WebInspector.showPanel("scripts");
    2929    frontend_ensureDebuggerEnabled(debuggerWasEnabledCallback);
    3030
  • trunk/LayoutTests/inspector/debugger-no-nested-pause.html

    r62772 r64973  
    2121    testController.waitUntilDone();
    2222
    23     WebInspector.showScriptsPanel();
     23    WebInspector.showPanel("scripts");
    2424    frontend_ensureDebuggerEnabled(debuggerWasEnabledCallback);
    2525
  • trunk/LayoutTests/inspector/debugger-pause-in-eval-script.html

    r63811 r64973  
    1414    testController.waitUntilDone();
    1515
    16     WebInspector.showScriptsPanel();
     16    WebInspector.showPanel("scripts");
    1717
    1818    var scriptToEvaluate = "function testFunction() {\n" +
  • trunk/LayoutTests/inspector/debugger-pause-on-debugger-statement.html

    r62769 r64973  
    1818    testController.waitUntilDone();
    1919
    20     WebInspector.showScriptsPanel();
     20    WebInspector.showPanel("scripts");
    2121    frontend_ensureDebuggerEnabled(debuggerWasEnabledCallback);
    2222
  • trunk/LayoutTests/inspector/debugger-proto-property.html

    r62769 r64973  
    2626    testController.waitUntilDone();
    2727
    28     WebInspector.showScriptsPanel();
     28    WebInspector.showPanel("scripts");
    2929    frontend_ensureDebuggerEnabled(debuggerWasEnabledCallback);
    3030
  • trunk/LayoutTests/inspector/elements-panel-limited-children.html

    r61617 r64973  
    126126function frontend_loadDOM(testController)
    127127{
     128    WebInspector.showPanel("elements");
    128129    testController.waitUntilDone();
    129130    // Need test to be async to expand whole the tree first.
  • trunk/WebCore/ChangeLog

    r64971 r64973  
     12010-08-09  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        WebInspector: Current implementation of showPanel is a bit complicated.
     6        It is using internal enum for all the panels and this is the problem because
     7        we should change a lot of code for a new panel.
     8        https://bugs.webkit.org/show_bug.cgi?id=43711
     9
     10        * WebCore.exp.in:
     11        * inspector/Inspector.idl:
     12        * inspector/InspectorController.cpp:
     13        (WebCore::InspectorController::InspectorController):
     14        (WebCore::InspectorController::storeLastActivePanel):
     15        (WebCore::InspectorController::connectFrontend):
     16        (WebCore::InspectorController::showPanel):
     17        (WebCore::InspectorController::disconnectFrontend):
     18        * inspector/InspectorController.h:
     19        * inspector/InspectorFrontend.cpp:
     20        * inspector/InspectorFrontend.h:
     21        * inspector/front-end/ElementsTreeOutline.js:
     22        (WebInspector.ElementsTreeElement.prototype.selectOnMouseDown):
     23        * inspector/front-end/ExtensionServer.js:
     24        (WebInspector.ExtensionServer.prototype._onRevealAndSelectResource):
     25        * inspector/front-end/inspector.js:
     26        (WebInspector.documentClick.followLink):
     27        (WebInspector.documentClick):
     28        (WebInspector.toggleSearchingForNode):
     29        (WebInspector.showPanel):
     30        (WebInspector.selectDatabase):
     31        (WebInspector.selectDOMStorage):
     32        (WebInspector.showProfileForURL):
     33
    1342010-08-09  Ariya Hidayat  <ariya@sencha.com>
    235
  • trunk/WebCore/WebCore.exp.in

    r64963 r64973  
    423423__ZN7WebCore19BackForwardListImplC1EPNS_4PageE
    424424__ZN7WebCore19CSSStyleDeclaration11setPropertyERKNS_6StringES3_Ri
     425__ZN7WebCore19InspectorController12ConsolePanelE
     426__ZN7WebCore19InspectorController12ScriptsPanelE
     427__ZN7WebCore19InspectorController13ProfilesPanelE
    425428__ZN7WebCore19InspectorController34inspectorStartsAttachedSettingNameEv
     429__ZN7WebCore19InspectorController9showPanelERKNS_6StringE
    426430__ZN7WebCore19ResourceRequestBase11setHTTPBodyEN3WTF10PassRefPtrINS_8FormDataEEE
    427431__ZN7WebCore19ResourceRequestBase13setHTTPMethodERKNS_6StringE
     
    12011205__ZN7WebCore19InspectorController5closeEv
    12021206__ZN7WebCore19InspectorController7inspectEPNS_4NodeE
    1203 __ZN7WebCore19InspectorController9showPanelENS0_13SpecialPanelsE
    12041207__ZN7WebCore28InspectorFrontendClientLocal12moveWindowByEff
    12051208__ZN7WebCore28InspectorFrontendClientLocal14frontendLoadedEv
  • trunk/WebCore/inspector/Inspector.idl

    r64951 r64973  
    6161        [notify] void setDetachedRoot(out Object root);
    6262        [notify] void setDocument(out Value root);
     63        [notify] void showPanel(out String panel);
    6364        [notify] void timelineProfilerWasStarted();
    6465        [notify] void timelineProfilerWasStopped();
  • trunk/WebCore/inspector/InspectorController.cpp

    r64951 r64973  
    120120static const char* const profilerEnabledSettingName = "profilerEnabled";
    121121static const char* const inspectorAttachedHeightName = "inspectorAttachedHeight";
    122 static const char* const lastActivePanelSettingName = "lastActivePanel";
     122static const char* const lastActivePanel = "lastActivePanel";
     123const char* const InspectorController::ElementsPanel = "elements";
     124const char* const InspectorController::ConsolePanel = "console";
     125const char* const InspectorController::ScriptsPanel = "scripts";
     126const char* const InspectorController::ProfilesPanel = "profiles";
     127
    123128static const char* const monitoringXHRSettingName = "xhrMonitor";
    124129
     
    151156    , m_cssStore(new InspectorCSSStore(this))
    152157    , m_expiredConsoleMessageCount(0)
    153     , m_showAfterVisible(CurrentPanel)
     158    , m_showAfterVisible(lastActivePanel)
    154159    , m_sessionSettings(InspectorObject::create())
    155160    , m_groupLevel(0)
     
    382387void InspectorController::storeLastActivePanel(const String& panelName)
    383388{
    384     setSetting(lastActivePanelSettingName, panelName);
     389    setSetting(lastActivePanel, panelName);
    385390}
    386391
     
    498503#endif
    499504
    500     if (m_showAfterVisible == CurrentPanel) {
    501         String lastActivePanelSetting = setting(lastActivePanelSettingName);
    502         m_showAfterVisible = specialPanelForJSName(lastActivePanelSetting);
    503     }
     505    if (m_showAfterVisible == lastActivePanel)
     506        m_showAfterVisible = setting(lastActivePanel);
    504507
    505508    if (m_nodeToFocus)
     
    532535}
    533536
    534 void InspectorController::showPanel(SpecialPanels panel)
     537void InspectorController::showPanel(const String& panel)
    535538{
    536539    if (!enabled())
     
    544547    }
    545548
    546     if (panel == CurrentPanel)
    547         return;
    548 
    549     m_frontend->showPanel(panel);
     549    if (panel == lastActivePanel)
     550        return;
     551
     552    m_remoteFrontend->showPanel(panel);
    550553}
    551554
     
    580583    stopTimelineProfiler();
    581584
    582     m_showAfterVisible = CurrentPanel;
     585    m_showAfterVisible = lastActivePanel;
    583586
    584587    hideHighlight();
     
    18931896}
    18941897
    1895 InspectorController::SpecialPanels InspectorController::specialPanelForJSName(const String& panelName)
    1896 {
    1897     if (panelName == "elements")
    1898         return ElementsPanel;
    1899     if (panelName == "resources")
    1900         return ResourcesPanel;
    1901     if (panelName == "scripts")
    1902         return ScriptsPanel;
    1903     if (panelName == "timeline")
    1904         return TimelinePanel;
    1905     if (panelName == "profiles")
    1906         return ProfilesPanel;
    1907     if (panelName == "storage" || panelName == "databases")
    1908         return StoragePanel;
    1909     if (panelName == "audits")
    1910         return AuditsPanel;
    1911     if (panelName == "console")
    1912         return ConsolePanel;
    1913     return ElementsPanel;
    1914 }
    1915 
    19161898InjectedScript InspectorController::injectedScriptForNodeId(long id)
    19171899{
  • trunk/WebCore/inspector/InspectorController.h

    r64846 r64973  
    9595    typedef HashMap<int, RefPtr<InspectorDOMStorageResource> > DOMStorageResourcesMap;
    9696
    97     typedef enum {
    98         AuditsPanel,
    99         CurrentPanel,
    100         ConsolePanel,
    101         ElementsPanel,
    102         ResourcesPanel,
    103         ScriptsPanel,
    104         TimelinePanel,
    105         ProfilesPanel,
    106         StoragePanel
    107     } SpecialPanels;
     97    static const char* const ConsolePanel;
     98    static const char* const ElementsPanel;
     99    static const char* const ProfilesPanel;
     100    static const char* const ScriptsPanel;
    108101
    109102    InspectorController(Page*, InspectorClient*);
     
    135128
    136129    void show();
    137     void showPanel(SpecialPanels);
     130    void showPanel(const String&);
    138131    void close();
    139132
     
    323316
    324317    bool isMainResourceLoader(DocumentLoader* loader, const KURL& requestUrl);
    325 
    326     SpecialPanels specialPanelForJSName(const String& panelName);
    327318
    328319    void didEvaluateForTestInFrontend(long callId, const String& jsonResult);
     
    364355    DOMStorageResourcesMap m_domStorageResources;
    365356#endif
    366     SpecialPanels m_showAfterVisible;
     357    String m_showAfterVisible;
    367358    RefPtr<Node> m_highlightedNode;
    368359#if ENABLE(INSPECTOR)
  • trunk/WebCore/inspector/InspectorFrontend.cpp

    r64951 r64973  
    5858}
    5959
    60 void InspectorFrontend::showPanel(int panel)
    61 {
    62     const char* showFunctionName;
    63     switch (panel) {
    64         case InspectorController::AuditsPanel:
    65             showFunctionName = "showAuditsPanel";
    66             break;
    67         case InspectorController::ConsolePanel:
    68             showFunctionName = "showConsolePanel";
    69             break;
    70         case InspectorController::ElementsPanel:
    71             showFunctionName = "showElementsPanel";
    72             break;
    73         case InspectorController::ResourcesPanel:
    74             showFunctionName = "showResourcesPanel";
    75             break;
    76         case InspectorController::TimelinePanel:
    77             showFunctionName = "showTimelinePanel";
    78             break;
    79         case InspectorController::ProfilesPanel:
    80             showFunctionName = "showProfilesPanel";
    81             break;
    82         case InspectorController::ScriptsPanel:
    83             showFunctionName = "showScriptsPanel";
    84             break;
    85         case InspectorController::StoragePanel:
    86             showFunctionName = "showStoragePanel";
    87             break;
    88         default:
    89             ASSERT_NOT_REACHED();
    90             showFunctionName = 0;
    91     }
    92 
    93     if (showFunctionName)
    94         callSimpleFunction(showFunctionName);
    95 }
    96 
    9760void InspectorFrontend::callSimpleFunction(const String& functionName)
    9861{
  • trunk/WebCore/inspector/InspectorFrontend.h

    r64951 r64973  
    4848
    4949        void close();
    50         void showPanel(int panel);
    5150        ScriptState* scriptState() const { return m_webInspector.scriptState(); }
    5251    private:
  • trunk/WebCore/inspector/front-end/ElementsTreeOutline.js

    r64267 r64973  
    684684
    685685        if (this.treeOutline.showInElementsPanelEnabled) {
    686             WebInspector.showElementsPanel();
     686            WebInspector.showPanel("elements");
    687687            WebInspector.panels.elements.focusedDOMNode = this.representedObject;
    688688        }
  • trunk/WebCore/inspector/front-end/ExtensionServer.js

    r64558 r64973  
    214214            return this._status.E_NOTFOUND(typeof id + ": " + id);
    215215        WebInspector.panels.resources.showResource(resource, message.line);
    216         WebInspector.showResourcesPanel();
     216        WebInspector.showPanel("resources");
    217217    },
    218218
  • trunk/WebCore/inspector/front-end/inspector.js

    r64770 r64973  
    692692        }
    693693
    694         WebInspector.showResourcesPanel();
     694        WebInspector.showPanel("resources");
    695695    }
    696696
     
    10821082{
    10831083    if (this.panels.elements) {
    1084         this.showElementsPanel();
     1084        this.showPanel("elements");
    10851085        this.panels.elements.toggleSearchingForNode();
    10861086    }
     
    10971097}
    10981098
    1099 WebInspector.showElementsPanel = function()
    1100 {
    1101     this.currentPanel = this.panels.elements;
    1102 }
    1103 
    1104 WebInspector.showResourcesPanel = function()
    1105 {
    1106     this.currentPanel = this.panels.resources;
    1107 }
    1108 
    1109 WebInspector.showScriptsPanel = function()
    1110 {
    1111     this.currentPanel = this.panels.scripts;
    1112 }
    1113 
    1114 WebInspector.showTimelinePanel = function()
    1115 {
    1116     this.currentPanel = this.panels.timeline;
    1117 }
    1118 
    1119 WebInspector.showProfilesPanel = function()
    1120 {
    1121     this.currentPanel = this.panels.profiles;
    1122 }
    1123 
    1124 WebInspector.showStoragePanel = function()
    1125 {
    1126     this.currentPanel = this.panels.storage;
    1127 }
    1128 
    1129 WebInspector.showConsolePanel = function()
    1130 {
    1131     this.currentPanel = this.panels.console;
    1132 }
    1133 
    1134 WebInspector.showAuditsPanel = function()
    1135 {
    1136     this.currentPanel = this.panels.audits;
     1099WebInspector.showPanel = function(panel)
     1100{
     1101    if (!(panel in this.panels)) {
     1102        console.error("Unable to show %s panel.", panel);
     1103        panel = "elements";
     1104    }
     1105    this.currentPanel = this.panels[panel];
    11371106}
    11381107
    11391108WebInspector.selectDatabase = function(o)
    11401109{
    1141     WebInspector.showStoragePanel();
     1110    WebInspector.showPanel("storage");
    11421111    WebInspector.panels.storage.selectDatabase(o);
    11431112}
     
    11451114WebInspector.selectDOMStorage = function(o)
    11461115{
    1147     WebInspector.showStoragePanel();
     1116    WebInspector.showPanel("storage");
    11481117    WebInspector.panels.storage.selectDOMStorage(o);
    11491118}
     
    17431712WebInspector.showProfileForURL = function(url)
    17441713{
    1745     WebInspector.showProfilesPanel();
     1714    WebInspector.showPanel("profiles");
    17461715    WebInspector.panels.profiles.showProfileForURL(url);
    17471716}
Note: See TracChangeset for help on using the changeset viewer.