Changeset 96597 in webkit


Ignore:
Timestamp:
Oct 4, 2011 9:11:59 AM (13 years ago)
Author:
pfeldman@chromium.org
Message:

Web Inspector: compile text editor.
https://bugs.webkit.org/show_bug.cgi?id=69339

Drive-by compilation for color, database and dom storage entities.

Reviewed by Yury Semikhatsky.

  • inspector/Inspector.json:
  • inspector/compile-front-end.sh:
  • inspector/front-end/Color.js:

(WebInspector.Color.prototype._individualRGBValueToFloatValue):

  • inspector/front-end/KeyboardShortcut.js:

(WebInspector.KeyboardShortcut.makeKey):
(WebInspector.KeyboardShortcut.makeKeyFromEvent):
(WebInspector.KeyboardShortcut.makeDescriptor):

  • inspector/front-end/SourceCSSTokenizer.js:
  • inspector/front-end/SourceCSSTokenizer.re2js:
  • inspector/front-end/SourceHTMLTokenizer.js:
  • inspector/front-end/SourceHTMLTokenizer.re2js:
  • inspector/front-end/SourceJavaScriptTokenizer.js:
  • inspector/front-end/SourceJavaScriptTokenizer.re2js:
  • inspector/front-end/SourceTokenizer.js:

(WebInspector.SourceTokenizer.prototype._charAt):
(WebInspector.SourceTokenizer.prototype.createInitialCondition):
(WebInspector.SourceTokenizer.prototype.nextToken):

  • inspector/front-end/TextEditorHighlighter.js:

(WebInspector.TextEditorHighlighter.prototype.highlight):
(WebInspector.TextEditorHighlighter.prototype._highlightLines):

  • inspector/front-end/TextEditorModel.js:
  • inspector/front-end/TextViewer.js:

(WebInspector.TextViewerDelegate.prototype.doubleClick):
(WebInspector.TextViewerDelegate.prototype.beforeTextChanged):
(WebInspector.TextViewerDelegate.prototype.afterTextChanged):
(WebInspector.TextViewerDelegate.prototype.commitEditing):
(WebInspector.TextViewerDelegate.prototype.cancelEditing):
(WebInspector.TextViewerDelegate.prototype.populateLineGutterContextMenu):
(WebInspector.TextViewerDelegate.prototype.populateTextAreaContextMenu):
(WebInspector.TextViewerDelegate.prototype.suggestedFileName):
(WebInspector.TextEditorMainPanel.prototype._enclosingLineRowOrSelf):
(WebInspector.TextEditorMainPanel.prototype._createLink):
(WebInspector.TextEditorMainPanel.prototype._applyDomUpdates):
(WebInspector.TextEditorMainPanel.prototype._updateChunksForRanges):

  • inspector/front-end/externs.js:

(WebInspector.completeURL):
(window.getComputedStyle):
(Event.prototype.initWebKitWheelEvent):

  • inspector/front-end/utilities.js:
Location:
trunk/Source/WebCore
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r96596 r96597  
     12011-10-04  Pavel Feldman  <pfeldman@google.com>
     2
     3        Web Inspector: compile text editor.
     4        https://bugs.webkit.org/show_bug.cgi?id=69339
     5
     6        Drive-by compilation for color, database and dom storage entities.
     7
     8        Reviewed by Yury Semikhatsky.
     9
     10        * inspector/Inspector.json:
     11        * inspector/compile-front-end.sh:
     12        * inspector/front-end/Color.js:
     13        (WebInspector.Color.prototype._individualRGBValueToFloatValue):
     14        * inspector/front-end/KeyboardShortcut.js:
     15        (WebInspector.KeyboardShortcut.makeKey):
     16        (WebInspector.KeyboardShortcut.makeKeyFromEvent):
     17        (WebInspector.KeyboardShortcut.makeDescriptor):
     18        * inspector/front-end/SourceCSSTokenizer.js:
     19        * inspector/front-end/SourceCSSTokenizer.re2js:
     20        * inspector/front-end/SourceHTMLTokenizer.js:
     21        * inspector/front-end/SourceHTMLTokenizer.re2js:
     22        * inspector/front-end/SourceJavaScriptTokenizer.js:
     23        * inspector/front-end/SourceJavaScriptTokenizer.re2js:
     24        * inspector/front-end/SourceTokenizer.js:
     25        (WebInspector.SourceTokenizer.prototype._charAt):
     26        (WebInspector.SourceTokenizer.prototype.createInitialCondition):
     27        (WebInspector.SourceTokenizer.prototype.nextToken):
     28        * inspector/front-end/TextEditorHighlighter.js:
     29        (WebInspector.TextEditorHighlighter.prototype.highlight):
     30        (WebInspector.TextEditorHighlighter.prototype._highlightLines):
     31        * inspector/front-end/TextEditorModel.js:
     32        * inspector/front-end/TextViewer.js:
     33        (WebInspector.TextViewerDelegate.prototype.doubleClick):
     34        (WebInspector.TextViewerDelegate.prototype.beforeTextChanged):
     35        (WebInspector.TextViewerDelegate.prototype.afterTextChanged):
     36        (WebInspector.TextViewerDelegate.prototype.commitEditing):
     37        (WebInspector.TextViewerDelegate.prototype.cancelEditing):
     38        (WebInspector.TextViewerDelegate.prototype.populateLineGutterContextMenu):
     39        (WebInspector.TextViewerDelegate.prototype.populateTextAreaContextMenu):
     40        (WebInspector.TextViewerDelegate.prototype.suggestedFileName):
     41        (WebInspector.TextEditorMainPanel.prototype._enclosingLineRowOrSelf):
     42        (WebInspector.TextEditorMainPanel.prototype._createLink):
     43        (WebInspector.TextEditorMainPanel.prototype._applyDomUpdates):
     44        (WebInspector.TextEditorMainPanel.prototype._updateChunksForRanges):
     45        * inspector/front-end/externs.js:
     46        (WebInspector.completeURL):
     47        (window.getComputedStyle):
     48        (Event.prototype.initWebKitWheelEvent):
     49        * inspector/front-end/utilities.js:
     50
    1512011-10-04  Vsevolod Vlasov  <vsevik@chromium.org>
    252
  • trunk/Source/WebCore/inspector/Inspector.json

    r96576 r96597  
    764764                "id": "Database",
    765765                "type": "object",
    766                 "description": "Database object."
     766                "description": "Database object.",
     767                "hidden": true,
     768                "properties": [
     769                    { "name": "id", "type": "string", "description": "Database ID." },
     770                    { "name": "domain", "type": "string", "description": "Database domain." },
     771                    { "name": "name", "type": "string", "description": "Database name." },
     772                    { "name": "version", "type": "string", "description": "Database version." }
     773                ]
    767774            },
    768775            {
  • trunk/Source/WebCore/inspector/compile-front-end.sh

    r96591 r96597  
    4545        --js Source/WebCore/inspector/front-end/Settings.js \
    4646        --js Source/WebCore/inspector/front-end/UserMetrics.js \
    47     --module jsmodule_sdk:18:jsmodule_common \
     47    --module jsmodule_sdk:20:jsmodule_common \
    4848        --js Source/WebCore/inspector/front-end/CompilerSourceMapping.js \
    4949        --js Source/WebCore/inspector/front-end/CompilerSourceMappingProvider.js \
     
    5252        --js Source/WebCore/inspector/front-end/CookieParser.js \
    5353        --js Source/WebCore/inspector/front-end/BreakpointManager.js \
     54        --js Source/WebCore/inspector/front-end/Database.js \
    5455        --js Source/WebCore/inspector/front-end/DOMAgent.js \
     56        --js Source/WebCore/inspector/front-end/DOMStorage.js \
    5557        --js Source/WebCore/inspector/front-end/DebuggerModel.js \
    5658        --js Source/WebCore/inspector/front-end/DebuggerPresentationModel.js \
     
    6466        --js Source/WebCore/inspector/front-end/NetworkManager.js \
    6567        --js Source/WebCore/inspector/front-end/UISourceCode.js \
    66     --module jsmodule_ui:22:jsmodule_common \
     68    --module jsmodule_ui:27:jsmodule_common \
    6769        --js Source/WebCore/inspector/front-end/Checkbox.js \
     70        --js Source/WebCore/inspector/front-end/Color.js \
    6871        --js Source/WebCore/inspector/front-end/ContextMenu.js \
    6972        --js Source/WebCore/inspector/front-end/DataGrid.js \
     
    8184        --js Source/WebCore/inspector/front-end/ShortcutsScreen.js \
    8285        --js Source/WebCore/inspector/front-end/SoftContextMenu.js \
     86        --js Source/WebCore/inspector/front-end/SourceTokenizer.js \
    8387        --js Source/WebCore/inspector/front-end/StatusBarButton.js \
    8488        --js Source/WebCore/inspector/front-end/TabbedPane.js \
     89        --js Source/WebCore/inspector/front-end/TextEditorModel.js \
     90        --js Source/WebCore/inspector/front-end/TextEditorHighlighter.js \
    8591        --js Source/WebCore/inspector/front-end/TextPrompt.js \
     92        --js Source/WebCore/inspector/front-end/TextViewer.js \
    8693        --js Source/WebCore/inspector/front-end/Toolbar.js \
    8794        --js Source/WebCore/inspector/front-end/UIUtils.js \
  • trunk/Source/WebCore/inspector/front-end/Color.js

    r96543 r96597  
    2828 */
    2929
     30/**
     31 * @constructor
     32 */
    3033WebInspector.Color = function(str)
    3134{
     
    3437}
    3538
     39/**
     40 * @param {number=} a
     41 */
    3642WebInspector.Color.fromRGBA = function(r, g, b, a)
    3743{
     
    202208
    203209        if (rgbValue.indexOf("%") === -1) {
    204             var intValue = parseInt(rgbValue);
     210            var intValue = parseInt(rgbValue, 10);
    205211            return this._clamp(rgbValue, 0, 255);
    206212        }
  • trunk/Source/WebCore/inspector/front-end/KeyboardShortcut.js

    r96575 r96597  
    9494 * It is useful for matching pressed keys.
    9595 * keyCode is the Code of the key, or a character "a-z" which is converted to a keyCode value.
    96  * optModifiers is an Optional list of modifiers passed as additional paramerters.
     96 * @param {number=} modifiers Optional list of modifiers passed as additional paramerters.
    9797 */
    98 WebInspector.KeyboardShortcut.makeKey = function(keyCode, optModifiers)
     98WebInspector.KeyboardShortcut.makeKey = function(keyCode, modifiers)
    9999{
    100100    if (typeof keyCode === "string")
    101101        keyCode = keyCode.charCodeAt(0) - 32;
    102     var modifiers = WebInspector.KeyboardShortcut.Modifiers.None;
    103     for (var i = 1; i < arguments.length; i++)
    104         modifiers |= arguments[i];
     102    modifiers = modifiers || WebInspector.KeyboardShortcut.Modifiers.None;
    105103    return WebInspector.KeyboardShortcut._makeKeyFromCodeAndModifiers(keyCode, modifiers);
    106 };
     104}
    107105
    108106WebInspector.KeyboardShortcut.makeKeyFromEvent = function(keyboardEvent)
     
    118116        modifiers |= WebInspector.KeyboardShortcut.Modifiers.Meta;
    119117    return WebInspector.KeyboardShortcut._makeKeyFromCodeAndModifiers(keyboardEvent.keyCode, modifiers);
    120 };
     118}
    121119
    122 WebInspector.KeyboardShortcut.makeDescriptor = function(key, optModifiers)
     120WebInspector.KeyboardShortcut.makeDescriptor = function(key, modifiers)
    123121{
    124     var modifiers = 0;
    125     for (var i = 1; i < arguments.length; i++)
    126         modifiers |= arguments[i];
    127 
    128122    return {
    129123        key: WebInspector.KeyboardShortcut.makeKey(typeof key === "string" ? key : key.code, modifiers),
  • trunk/Source/WebCore/inspector/front-end/SourceCSSTokenizer.js

    r94754 r96597  
    4242// | sed 's|var\ yych|case 1: case 1: var yych|'
    4343
     44/**
     45 * @constructor
     46 * @extends {WebInspector.SourceTokenizer}
     47 */
    4448WebInspector.SourceCSSTokenizer = function()
    4549{
  • trunk/Source/WebCore/inspector/front-end/SourceCSSTokenizer.re2js

    r91777 r96597  
    4141// | sed 's|var\ yych|case 1: var yych|'
    4242
     43/**
     44 * @constructor
     45 * @extends {WebInspector.SourceTokenizer}
     46 */
    4347WebInspector.SourceCSSTokenizer = function()
    4448{
  • trunk/Source/WebCore/inspector/front-end/SourceHTMLTokenizer.js

    r94754 r96597  
    4242// | sed 's|var\ yych|case 1: case 1: var yych|'
    4343
     44/**
     45 * @constructor
     46 * @extends {WebInspector.SourceTokenizer}
     47 */
    4448WebInspector.SourceHTMLTokenizer = function()
    4549{
  • trunk/Source/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js

    r86430 r96597  
    4141// | sed 's|var\ yych|case 1: var yych|'
    4242
     43/**
     44 * @constructor
     45 * @extends {WebInspector.SourceTokenizer}
     46 */
    4347WebInspector.SourceHTMLTokenizer = function()
    4448{
  • trunk/Source/WebCore/inspector/front-end/SourceJavaScriptTokenizer.js

    r94754 r96597  
    4343// | sed 's|var\ yych|case 1: case 1: var yych|'
    4444
     45/**
     46 * @constructor
     47 * @extends {WebInspector.SourceTokenizer}
     48 */
    4549WebInspector.SourceJavaScriptTokenizer = function()
    4650{
  • trunk/Source/WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js

    r86554 r96597  
    4242// | sed 's|var\ yych|case 1: var yych|'
    4343
     44/**
     45 * @constructor
     46 * @extends {WebInspector.SourceTokenizer}
     47 */
    4448WebInspector.SourceJavaScriptTokenizer = function()
    4549{
  • trunk/Source/WebCore/inspector/front-end/SourceTokenizer.js

    r86430 r96597  
    3030 */
    3131
     32/**
     33 * @constructor
     34 */
    3235WebInspector.SourceTokenizer = function()
    3336{
     
    6265    {
    6366        return cursor < this._line.length ? this._line.charAt(cursor) : "\n";
     67    },
     68
     69    createInitialCondition: function()
     70    {
     71    },
     72
     73    nextToken: function(cursor)
     74    {
    6475    }
    6576}
    6677
    67 
     78/**
     79 * @constructor
     80 */
    6881WebInspector.SourceTokenizer.Registry = function() {
    6982    this._tokenizers = {};
  • trunk/Source/WebCore/inspector/front-end/TextEditorHighlighter.js

    r86430 r96597  
    3030 */
    3131
     32/**
     33 * @constructor
     34 */
    3235WebInspector.TextEditorHighlighter = function(textModel, damageCallback)
    3336{
     
    5154    },
    5255
    53     highlight: function(endLine, opt_forceRun)
     56    /**
     57     * @param {boolean=} forceRun
     58     */
     59    highlight: function(endLine, forceRun)
    5460    {
    5561        // First check if we have work to do.
     
    6268        this._requestedEndLine = endLine;
    6369
    64         if (this._highlightTimer && !opt_forceRun) {
     70        if (this._highlightTimer && !forceRun) {
    6571            // There is a timer scheduled, it will catch the new job based on the new endLine set.
    6672            return;
     
    7076        var startLine = endLine;
    7177        while (startLine > 0) {
    72             var state = this._textModel.getAttribute(startLine - 1, "highlight");
     78            state = this._textModel.getAttribute(startLine - 1, "highlight");
    7379            if (state && state.postConditionStringified)
    7480                break;
     
    146152        var tokensCount = 0;
    147153        for (var lineNumber = startLine; lineNumber < endLine; ++lineNumber) {
    148             var state = this._selectHighlightState(lineNumber, postConditionStringified);
     154            state = this._selectHighlightState(lineNumber, postConditionStringified);
    149155            if (state.postConditionStringified) {
    150156                // This line is already highlighted.
     
    194200                // Advance the "pointer" to the last highlighted line within the given chunk.
    195201                for (; lineNumber < endLine; ++lineNumber) {
    196                     var state = this._textModel.getAttribute(lineNumber, "highlight");
     202                    state = this._textModel.getAttribute(lineNumber, "highlight");
    197203                    if (!state || !state.postConditionStringified)
    198204                        break;
  • trunk/Source/WebCore/inspector/front-end/TextEditorModel.js

    r94754 r96597  
    2929 */
    3030
     31/**
     32 * @constructor
     33 */
    3134WebInspector.TextRange = function(startLine, startColumn, endLine, endColumn)
    3235{
     
    5457}
    5558
     59/**
     60 * @constructor
     61 */
    5662WebInspector.TextEditorModel = function()
    5763{
  • trunk/Source/WebCore/inspector/front-end/TextViewer.js

    r96219 r96597  
    3030 */
    3131
     32/**
     33 * @extends {WebInspector.View}
     34 * @constructor
     35 */
    3236WebInspector.TextViewer = function(textModel, platform, url, delegate)
    3337{
     
    324328WebInspector.TextViewer.prototype.__proto__ = WebInspector.View.prototype;
    325329
     330/**
     331 * @interface
     332 */
    326333WebInspector.TextViewerDelegate = function()
    327334{
     
    329336
    330337WebInspector.TextViewerDelegate.prototype = {
    331     doubleClick: function(lineNumber)
    332     {
    333         // Should be implemented by subclasses.
    334     },
    335 
    336     beforeTextChanged: function()
    337     {
    338         // Should be implemented by subclasses.
    339     },
    340 
    341     afterTextChanged: function(oldRange, newRange)
    342     {
    343         // Should be implemented by subclasses.
    344     },
    345 
    346     commitEditing: function()
    347     {
    348         // Should be implemented by subclasses.
    349     },
    350 
    351     cancelEditing: function()
    352     {
    353         // Should be implemented by subclasses.
    354     },
    355 
    356     populateLineGutterContextMenu: function(lineNumber, contextMenu)
    357     {
    358         // Should be implemented by subclasses.
    359     },
    360 
    361     populateTextAreaContextMenu: function(contextMenu)
    362     {
    363         // Should be implemented by subclasses.
    364     },
    365 
    366     suggestedFileName: function()
    367     {
    368         // Should be implemented by subclasses.
    369     }
     338    doubleClick: function(lineNumber) { },
     339
     340    beforeTextChanged: function() { },
     341
     342    afterTextChanged: function(oldRange, newRange) { },
     343
     344    commitEditing: function() { },
     345
     346    cancelEditing: function() { },
     347
     348    populateLineGutterContextMenu: function(lineNumber, contextMenu) { },
     349
     350    populateTextAreaContextMenu: function(contextMenu) { },
     351
     352    suggestedFileName: function() { }
    370353}
    371354
    372 WebInspector.TextViewerDelegate.prototype.__proto__ = WebInspector.Object.prototype;
    373 
     355/**
     356 * @constructor
     357 */
    374358WebInspector.TextEditorChunkedPanel = function(textModel)
    375359{
     
    644628}
    645629
     630/**
     631 * @constructor
     632 * @extends {WebInspector.TextEditorChunkedPanel}
     633 */
    646634WebInspector.TextEditorGutterPanel = function(textModel, syncDecorationsForLineListener, syncLineHeightListener)
    647635{
     
    728716WebInspector.TextEditorGutterPanel.prototype.__proto__ = WebInspector.TextEditorChunkedPanel.prototype;
    729717
     718/**
     719 * @constructor
     720 */
    730721WebInspector.TextEditorGutterChunk = function(textViewer, startLine, endLine)
    731722{
     
    850841}
    851842
     843/**
     844 * @constructor
     845 * @extends {WebInspector.TextEditorChunkedPanel}
     846 */
    852847WebInspector.TextEditorMainPanel = function(textModel, url, syncScrollListener, syncDecorationsForLineListener, enterTextChangeMode, exitTextChangeMode)
    853848{
     
    12231218    },
    12241219
     1220    /**
     1221     * @param {boolean=} restoreSelection
     1222     */
    12251223    _paintLines: function(fromLine, toLine, restoreSelection)
    12261224    {
     
    13711369    },
    13721370
     1371    /**
     1372     * @param {boolean=} scrollIntoView
     1373     */
    13731374    _restoreSelection: function(range, scrollIntoView)
    13741375    {
     
    14601461        if (lineRow)
    14611462            return lineRow;
    1462         for (var lineRow = element; lineRow; lineRow = lineRow.parentElement) {
     1463
     1464        for (lineRow = element; lineRow; lineRow = lineRow.parentElement) {
    14631465            if (lineRow.parentElement === this._container)
    14641466                return lineRow;
     
    15041506            quote = null;
    15051507
    1506         var a = WebInspector.linkifyURLAsNode(this._rewriteHref(content), content, null, isExternal);
     1508        var a = WebInspector.linkifyURLAsNode(this._rewriteHref(content), content, undefined, isExternal);
    15071509        var span = document.createElement("span");
    15081510        span.className = "webkit-html-attribute-value";
     
    15151517    },
    15161518
     1519    /**
     1520     * @param {boolean=} isExternal
     1521     */
    15171522    _rewriteHref: function(hrefValue, isExternal)
    15181523    {
     
    16511656            lines[0] = line2.substring(startColumn);
    16521657
    1653             var line1 = this._textModel.line(endLine - 1);
    1654             var line2 = lines[lines.length - 1];
     1658            line1 = this._textModel.line(endLine - 1);
     1659            line2 = lines[lines.length - 1];
    16551660            for (var i = 0; i < endColumn && i < line2.length; ++i) {
    16561661                if (startLine === endLine - 1 && endColumn - i <= startColumn)
     
    17781783        // Delete all DOM elements that were either controlled by the old chunks, or have just been inserted.
    17791784        var firstUnmodifiedLineRow = null;
    1780         var chunk = this._textChunks[lastChunkNumber + 1];
    1781         if (chunk) {
     1785        chunk = this._textChunks[lastChunkNumber + 1];
     1786        if (chunk)
    17821787            firstUnmodifiedLineRow = chunk.expanded ? chunk.getExpandedLineRow(chunk.startLine) : chunk.element;
    1783         }
     1788
    17841789        while (firstLineRow && firstLineRow !== firstUnmodifiedLineRow) {
    17851790            var lineRow = firstLineRow;
     
    18581863WebInspector.TextEditorMainPanel.prototype.__proto__ = WebInspector.TextEditorChunkedPanel.prototype;
    18591864
     1865/**
     1866 * @constructor
     1867 */
    18601868WebInspector.TextEditorMainChunk = function(textViewer, startLine, endLine)
    18611869{
  • trunk/Source/WebCore/inspector/front-end/externs.js

    r96591 r96597  
    6262
    6363/**
     64 * @param {string} url
     65 * @param {string} href
     66 */
     67WebInspector.completeURL = function(url, href) {}
     68
     69/**
    6470 * @param {string} str
    6571 * @param {...*} varArgs
     
    184190
    185191/** @param {Element} element */
    186 window.getComputedStyle = function(element)
    187 {
    188 }
     192window.getComputedStyle = function(element) {}
    189193
    190194/**
     
    192196 */
    193197Event.prototype.isMetaOrCtrlForTest = false;
     198
     199/**
     200 * @param {...*} vararg
     201 */
     202Event.prototype.initWebKitWheelEvent = function(vararg) {}
  • trunk/Source/WebCore/inspector/front-end/utilities.js

    r96575 r96597  
    839839}
    840840
     841/**
     842 * @param {Array.<Object>=} domChanges
     843 */
    841844function highlightSearchResult(element, offset, length, domChanges)
    842845{
Note: See TracChangeset for help on using the changeset viewer.