Changeset 103682 in webkit


Ignore:
Timestamp:
Dec 26, 2011, 4:39:39 AM (14 years ago)
Author:
[email protected]
Message:

Web Inspector: Implement "Go to Function" dialog for JavaScript
https://bugs.webkit.org/show_bug.cgi?id=75092

Reviewed by Pavel Feldman.

  • English.lproj/localizedStrings.js:
  • WebCore.gypi:
  • WebCore.vcproj/WebCore.vcproj:
  • inspector/compile-front-end.sh:
  • inspector/front-end/JavaScriptOutlineDialog.js: Added.

(WebInspector.JavaScriptOutlineDialog.onMouseDown):
(WebInspector.JavaScriptOutlineDialog):
(WebInspector.JavaScriptOutlineDialog.didAddChunk):
(WebInspector.JavaScriptOutlineDialog.install):
(WebInspector.JavaScriptOutlineDialog._show):
(WebInspector.JavaScriptOutlineDialog.createShortcut):
(WebInspector.JavaScriptOutlineDialog.prototype._resizeWindow):
(WebInspector.JavaScriptOutlineDialog.prototype._appendItemElements):
(WebInspector.JavaScriptOutlineDialog.prototype._createSearchRegExp):
(WebInspector.JavaScriptOutlineDialog.prototype._filterFunctions):
(WebInspector.JavaScriptOutlineDialog.prototype._selectFirstItem):
(WebInspector.JavaScriptOutlineDialog.prototype._hide):
(WebInspector.JavaScriptOutlineDialog.prototype._onBlur):
(WebInspector.JavaScriptOutlineDialog.prototype._onKeyDown.previousItem):
(WebInspector.JavaScriptOutlineDialog.prototype._onKeyDown.nextItem):
(WebInspector.JavaScriptOutlineDialog.prototype._onKeyDown):
(WebInspector.JavaScriptOutlineDialog.prototype._scheduleFilter):
(WebInspector.JavaScriptOutlineDialog.prototype._updateSelection):
(WebInspector.JavaScriptOutlineDialog.prototype._onClick):
(WebInspector.JavaScriptOutlineDialog.prototype._onMouseMove):
(WebInspector.JavaScriptOutlineDialog.prototype._highlightFunctionLine):

  • inspector/front-end/JavaScriptSourceFrame.js:

(WebInspector.JavaScriptSourceFrame.prototype.get uiSourceCode):

  • inspector/front-end/ScriptsPanel.js:

(WebInspector.ScriptsPanel.prototype._didBuildOutlineChunk):
(WebInspector.ScriptsPanel.prototype._reset):
(WebInspector.ScriptsPanel.prototype.requestVisibleScriptOutline):
(WebInspector.ScriptsPanel.prototype._createEditorToolbar):

  • inspector/front-end/WebKit.qrc:
  • inspector/front-end/inspector.html:
  • inspector/front-end/javaScriptOutlineDialog.css: Added.

(.js-outline-dialog):
(.js-outline-dialog > input):
(.js-outline-dialog > div.progress):
(.js-outline-dialog > div.container):
(.js-outline-dialog > .container > div.item):
(.js-outline-dialog > .container > div.item.selected):

Location:
trunk/Source/WebCore
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r103681 r103682  
     12011-12-26  Alexander Pavlov  <[email protected]>
     2
     3        Web Inspector: Implement "Go to Function" dialog for JavaScript
     4        https://bugs.webkit.org/show_bug.cgi?id=75092
     5
     6        Reviewed by Pavel Feldman.
     7
     8        * English.lproj/localizedStrings.js:
     9        * WebCore.gypi:
     10        * WebCore.vcproj/WebCore.vcproj:
     11        * inspector/compile-front-end.sh:
     12        * inspector/front-end/JavaScriptOutlineDialog.js: Added.
     13        (WebInspector.JavaScriptOutlineDialog.onMouseDown):
     14        (WebInspector.JavaScriptOutlineDialog):
     15        (WebInspector.JavaScriptOutlineDialog.didAddChunk):
     16        (WebInspector.JavaScriptOutlineDialog.install):
     17        (WebInspector.JavaScriptOutlineDialog._show):
     18        (WebInspector.JavaScriptOutlineDialog.createShortcut):
     19        (WebInspector.JavaScriptOutlineDialog.prototype._resizeWindow):
     20        (WebInspector.JavaScriptOutlineDialog.prototype._appendItemElements):
     21        (WebInspector.JavaScriptOutlineDialog.prototype._createSearchRegExp):
     22        (WebInspector.JavaScriptOutlineDialog.prototype._filterFunctions):
     23        (WebInspector.JavaScriptOutlineDialog.prototype._selectFirstItem):
     24        (WebInspector.JavaScriptOutlineDialog.prototype._hide):
     25        (WebInspector.JavaScriptOutlineDialog.prototype._onBlur):
     26        (WebInspector.JavaScriptOutlineDialog.prototype._onKeyDown.previousItem):
     27        (WebInspector.JavaScriptOutlineDialog.prototype._onKeyDown.nextItem):
     28        (WebInspector.JavaScriptOutlineDialog.prototype._onKeyDown):
     29        (WebInspector.JavaScriptOutlineDialog.prototype._scheduleFilter):
     30        (WebInspector.JavaScriptOutlineDialog.prototype._updateSelection):
     31        (WebInspector.JavaScriptOutlineDialog.prototype._onClick):
     32        (WebInspector.JavaScriptOutlineDialog.prototype._onMouseMove):
     33        (WebInspector.JavaScriptOutlineDialog.prototype._highlightFunctionLine):
     34        * inspector/front-end/JavaScriptSourceFrame.js:
     35        (WebInspector.JavaScriptSourceFrame.prototype.get uiSourceCode):
     36        * inspector/front-end/ScriptsPanel.js:
     37        (WebInspector.ScriptsPanel.prototype._didBuildOutlineChunk):
     38        (WebInspector.ScriptsPanel.prototype._reset):
     39        (WebInspector.ScriptsPanel.prototype.requestVisibleScriptOutline):
     40        (WebInspector.ScriptsPanel.prototype._createEditorToolbar):
     41        * inspector/front-end/WebKit.qrc:
     42        * inspector/front-end/inspector.html:
     43        * inspector/front-end/javaScriptOutlineDialog.css: Added.
     44        (.js-outline-dialog):
     45        (.js-outline-dialog > input):
     46        (.js-outline-dialog > div.progress):
     47        (.js-outline-dialog > div.container):
     48        (.js-outline-dialog > .container > div.item):
     49        (.js-outline-dialog > .container > div.item.selected):
     50
    1512011-12-26  Pavel Feldman  <[email protected]>
    252
  • trunk/Source/WebCore/WebCore.gypi

    r103625 r103682  
    64326432            'inspector/front-end/inspector.js',
    64336433            'inspector/front-end/JavaScriptFormatter.js',
     6434            'inspector/front-end/JavaScriptOutlineDialog.js',
    64346435            'inspector/front-end/JavaScriptSourceFrame.js',
    64356436            'inspector/front-end/KeyboardShortcut.js',
     
    65156516            'inspector/front-end/WorkersSidebarPane.js',
    65166517            'inspector/front-end/goToLineDialog.css',
     6518            'inspector/front-end/javaScriptOutlineDialog.css',
    65176519            'inspector/front-end/helpScreen.css',
    65186520            'inspector/front-end/inspector.css',
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r103555 r103682  
    7174671746                                </File>
    7174771747                                <File
     71748                                        RelativePath="..\inspector\front-end\JavaScriptOutlineDialog.js"
     71749                                        >
     71750                                </File>
     71751                                <File
     71752                                        RelativePath="..\inspector\front-end\javaScriptOutlineDialog.css"
     71753                                        >
     71754                                </File>
     71755                                <File
    7174871756                                        RelativePath="..\inspector\front-end\JavaScriptSourceFrame.js"
    7174971757                                        >
  • trunk/Source/WebCore/inspector/compile-front-end.sh

    r103681 r103682  
    111111        --js Source/WebCore/inspector/front-end/View.js \
    112112        --js Source/WebCore/inspector/front-end/WelcomeView.js \
    113     --module jsmodule_components:15:jsmodule_sdk,jsmodule_ui \
     113    --module jsmodule_components:16:jsmodule_sdk,jsmodule_ui \
    114114        --js Source/WebCore/inspector/front-end/ConsoleMessage.js \
    115115        --js Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js \
     
    120120        --js Source/WebCore/inspector/front-end/GoToLineDialog.js \
    121121        --js Source/WebCore/inspector/front-end/JavaScriptContextManager.js \
     122        --js Source/WebCore/inspector/front-end/JavaScriptOutlineDialog.js \
    122123        --js Source/WebCore/inspector/front-end/ObjectPopoverHelper.js \
    123124        --js Source/WebCore/inspector/front-end/ObjectPropertiesSection.js \
  • trunk/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js

    r103541 r103682  
    5454
    5555WebInspector.JavaScriptSourceFrame.prototype = {
     56    get uiSourceCode()
     57    {
     58        return this._uiSourceCode;
     59    },
     60
    5661    // View events
    5762    willHide: function()
  • trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js

    r102756 r103682  
    4343    }
    4444    WebInspector.GoToLineDialog.install(this, viewGetter.bind(this));
     45    WebInspector.JavaScriptOutlineDialog.install(this, viewGetter.bind(this));
    4546
    4647    this.editorToolbar = this._createEditorToolbar();
     
    121122    helpSection.addKey(evaluateInConsoleShortcut.name, WebInspector.UIString("Evaluate selection in console"));
    122123    this.registerShortcut(evaluateInConsoleShortcut.key, this._evaluateSelectionInConsole.bind(this));
     124
     125    var scriptOutlineShortcut = WebInspector.JavaScriptOutlineDialog.createShortcut();
     126    helpSection.addKey(scriptOutlineShortcut.name, WebInspector.UIString("Go to Function"));
    123127
    124128    var panelEnablerHeading = WebInspector.UIString("You need to enable debugging before you can use the Scripts panel.");
     
    219223        if (!this.breakpointsActivated)
    220224            this._toggleBreakpointsClicked();
     225    },
     226
     227    _didBuildOutlineChunk: function(event)
     228    {
     229        WebInspector.JavaScriptOutlineDialog.didAddChunk(event.data);
     230        if (event.data.total === event.data.index) {
     231            if (this._outlineWorker) {
     232                this._outlineWorker.terminate();
     233                delete this._outlineWorker;
     234            }
     235        }
    221236    },
    222237
     
    519534        delete this._initialViewSelectionProcessed;
    520535
    521         this.functionsSelectElement.removeChildren();
    522536        this.visibleView = null;
    523537
     
    632646
    633647        return sourceFrame;
     648    },
     649
     650    requestVisibleScriptOutline: function()
     651    {
     652        function contentCallback(mimeType, content)
     653        {
     654            if (this._outlineWorker)
     655                this._outlineWorker.terminate();
     656            this._outlineWorker = new Worker("ScriptFormatterWorker.js");
     657            this._outlineWorker.onmessage = this._didBuildOutlineChunk.bind(this);
     658            const method = "outline";
     659            this._outlineWorker.postMessage({ method: method, params: { content: content, id: this.visibleView.uiSourceCode.id } });
     660        }
     661
     662        if (this.visibleView.uiSourceCode)
     663            this.visibleView.uiSourceCode.requestContent(contentCallback.bind(this));
    634664    },
    635665
     
    10291059        editorToolbar.appendChild(this._filesSelectElement);
    10301060
    1031         this.functionsSelectElement = document.createElement("select");
    1032         this.functionsSelectElement.className = "status-bar-item";
    1033         this.functionsSelectElement.id = "scripts-functions";
    1034 
    1035         // FIXME: append the functions select element to the top status bar when it
    1036         // is implemented.
    1037         // editorToolbar.appendChild(this.functionsSelectElement);
    1038        
    10391061        return editorToolbar;
    10401062    },
  • trunk/Source/WebCore/inspector/front-end/WebKit.qrc

    r103555 r103682  
    7373    <file>JavaScriptContextManager.js</file>
    7474    <file>JavaScriptFormatter.js</file>
     75    <file>JavaScriptOutlineDialog.js</file>
    7576    <file>JavaScriptSourceFrame.js</file>
    7677    <file>KeyboardShortcut.js</file>
     
    165166    <file>inspectorCommon.css</file>
    166167    <file>inspectorSyntaxHighlight.css</file>
     168    <file>javaScriptOutlineDialog.css</file>
    167169    <file>networkLogView.css</file>
    168170    <file>networkPanel.css</file>
  • trunk/Source/WebCore/inspector/front-end/inspector.html

    r102671 r103682  
    114114    <script type="text/javascript" src="SourceFrame.js"></script>
    115115    <script type="text/javascript" src="ResourceView.js"></script>
     116    <script type="text/javascript" src="JavaScriptOutlineDialog.js"></script>
    116117    <script type="text/javascript" src="JavaScriptSourceFrame.js"></script>
    117118    <script type="text/javascript" src="SplitView.js"></script>
Note: See TracChangeset for help on using the changeset viewer.