Changeset 96604 in webkit


Ignore:
Timestamp:
Oct 4, 2011 10:19:04 AM (12 years ago)
Author:
pfeldman@chromium.org
Message:

Web Inspector: make SourceFrame compile.
https://bugs.webkit.org/show_bug.cgi?id=69345

Reviewed by Yury Semikhatsky.

  • inspector/compile-front-end.sh:
  • inspector/front-end/DOMAgent.js:

(WebInspector.DOMAgent.prototype.inspectElement):
(WebInspector.DOMDispatcher.prototype.inspectElementRequested):

  • inspector/front-end/ElementsPanel.js:

(WebInspector.ElementsPanel.prototype._inspectElementRequested):

  • inspector/front-end/ObjectPropertiesSection.js:

(WebInspector.ObjectPropertyTreeElement.prototype._contextMenuEventFired):
(WebInspector.ObjectPropertyTreeElement.prototype.startEditing):

  • inspector/front-end/ResourcesPanel.js:

(WebInspector.ResourcesPanel.prototype._applyDiffMarkup):

  • inspector/front-end/SourceFrame.js:

(WebInspector.SourceFrame.prototype._onShowPopover.showObjectPopover):
(WebInspector.SourceFrame.prototype._onShowPopover):
(WebInspector.SourceFrame.prototype._editBreakpointCondition):
(WebInspector.SourceFrame.prototype.startEditing):
(WebInspector.SourceFrame.prototype.commitEditing.didEditContent):
(WebInspector.SourceFrame.prototype.commitEditing):
(WebInspector.SourceFrameDelegate.prototype.requestContent):
(WebInspector.SourceFrameDelegate.prototype.debuggingSupported):
(WebInspector.SourceFrameDelegate.prototype.setBreakpoint):
(WebInspector.SourceFrameDelegate.prototype.removeBreakpoint):
(WebInspector.SourceFrameDelegate.prototype.updateBreakpoint):
(WebInspector.SourceFrameDelegate.prototype.findBreakpoint):
(WebInspector.SourceFrameDelegate.prototype.continueToLine):
(WebInspector.SourceFrameDelegate.prototype.canEditScriptSource):
(WebInspector.SourceFrameDelegate.prototype.setScriptSource):
(WebInspector.SourceFrameDelegate.prototype.setScriptSourceIsBeingEdited):
(WebInspector.SourceFrameDelegate.prototype.debuggerPaused):
(WebInspector.SourceFrameDelegate.prototype.evaluateInSelectedCallFrame):
(WebInspector.SourceFrameDelegate.prototype.releaseEvaluationResult):
(WebInspector.SourceFrameDelegate.prototype.suggestedFileName):

  • inspector/front-end/externs.js:

(WebInspector.log):

  • inspector/front-end/inspector.js:

(WebInspector.log.logMessage):
(WebInspector.log):

  • inspector/front-end/utilities.js:

():

Location:
trunk/Source/WebCore
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r96599 r96604  
     12011-10-04  Pavel Feldman  <pfeldman@google.com>
     2
     3        Web Inspector: make SourceFrame compile.
     4        https://bugs.webkit.org/show_bug.cgi?id=69345
     5
     6        Reviewed by Yury Semikhatsky.
     7
     8        * inspector/compile-front-end.sh:
     9        * inspector/front-end/DOMAgent.js:
     10        (WebInspector.DOMAgent.prototype.inspectElement):
     11        (WebInspector.DOMDispatcher.prototype.inspectElementRequested):
     12        * inspector/front-end/ElementsPanel.js:
     13        (WebInspector.ElementsPanel.prototype._inspectElementRequested):
     14        * inspector/front-end/ObjectPropertiesSection.js:
     15        (WebInspector.ObjectPropertyTreeElement.prototype._contextMenuEventFired):
     16        (WebInspector.ObjectPropertyTreeElement.prototype.startEditing):
     17        * inspector/front-end/ResourcesPanel.js:
     18        (WebInspector.ResourcesPanel.prototype._applyDiffMarkup):
     19        * inspector/front-end/SourceFrame.js:
     20        (WebInspector.SourceFrame.prototype._onShowPopover.showObjectPopover):
     21        (WebInspector.SourceFrame.prototype._onShowPopover):
     22        (WebInspector.SourceFrame.prototype._editBreakpointCondition):
     23        (WebInspector.SourceFrame.prototype.startEditing):
     24        (WebInspector.SourceFrame.prototype.commitEditing.didEditContent):
     25        (WebInspector.SourceFrame.prototype.commitEditing):
     26        (WebInspector.SourceFrameDelegate.prototype.requestContent):
     27        (WebInspector.SourceFrameDelegate.prototype.debuggingSupported):
     28        (WebInspector.SourceFrameDelegate.prototype.setBreakpoint):
     29        (WebInspector.SourceFrameDelegate.prototype.removeBreakpoint):
     30        (WebInspector.SourceFrameDelegate.prototype.updateBreakpoint):
     31        (WebInspector.SourceFrameDelegate.prototype.findBreakpoint):
     32        (WebInspector.SourceFrameDelegate.prototype.continueToLine):
     33        (WebInspector.SourceFrameDelegate.prototype.canEditScriptSource):
     34        (WebInspector.SourceFrameDelegate.prototype.setScriptSource):
     35        (WebInspector.SourceFrameDelegate.prototype.setScriptSourceIsBeingEdited):
     36        (WebInspector.SourceFrameDelegate.prototype.debuggerPaused):
     37        (WebInspector.SourceFrameDelegate.prototype.evaluateInSelectedCallFrame):
     38        (WebInspector.SourceFrameDelegate.prototype.releaseEvaluationResult):
     39        (WebInspector.SourceFrameDelegate.prototype.suggestedFileName):
     40        * inspector/front-end/externs.js:
     41        (WebInspector.log):
     42        * inspector/front-end/inspector.js:
     43        (WebInspector.log.logMessage):
     44        (WebInspector.log):
     45        * inspector/front-end/utilities.js:
     46        ():
     47
    1482011-10-04  Mikhail Naganov  <mnaganov@chromium.org>
    249
  • trunk/Source/WebCore/inspector/compile-front-end.sh

    r96597 r96604  
    9494        --js Source/WebCore/inspector/front-end/UIUtils.js \
    9595        --js Source/WebCore/inspector/front-end/View.js \
    96     --module jsmodule_inspector:4:jsmodule_sdk,jsmodule_ui \
     96    --module jsmodule_inspector:7:jsmodule_sdk,jsmodule_ui \
    9797        --js Source/WebCore/inspector/front-end/ConsoleMessage.js \
    9898        --js Source/WebCore/inspector/front-end/ConsoleView.js \
    9999        --js Source/WebCore/inspector/front-end/JavaScriptContextManager.js \
     100        --js Source/WebCore/inspector/front-end/ObjectPopoverHelper.js \
     101        --js Source/WebCore/inspector/front-end/ObjectPropertiesSection.js \
     102        --js Source/WebCore/inspector/front-end/SourceFrame.js \
    100103        --js Source/WebCore/inspector/front-end/TimelineManager.js
  • trunk/Source/WebCore/inspector/front-end/DOMAgent.js

    r96499 r96604  
    618618    },
    619619
    620     _inspectElementRequested: function(nodeId)
     620    inspectElement: function(nodeId)
    621621    {
    622622        var node = this._idToDOMNode[nodeId];
     
    705705    },
    706706
    707     inspectElementRequested: function(nodeId)
    708     {
    709         this._domAgent._inspectElementRequested(nodeId);
    710     },
    711 
    712707    searchResults: function(nodeIds)
    713708    {
  • trunk/Source/WebCore/inspector/front-end/ElementsPanel.js

    r96584 r96604  
    447447    },
    448448
    449     _inspectElementRequested: function(node)
    450     {
     449    _inspectElementRequested: function(event)
     450    {
     451        var node = event.data;
    451452        WebInspector.updateFocusedNode(node.id);
    452453    },
  • trunk/Source/WebCore/inspector/front-end/ObjectPopoverHelper.js

    r96599 r96604  
    2929 */
    3030
     31/**
     32 * @constructor
     33 * @extends {WebInspector.PopoverHelper}
     34 */
    3135WebInspector.ObjectPopoverHelper = function(panelElement, getAnchor, queryObject, onHide, disableOnClick)
    3236{
  • trunk/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js

    r94754 r96604  
    2525 */
    2626
     27/**
     28 * @constructor
     29 * @extends {WebInspector.PropertiesSection}
     30 * @param {string=} title
     31 * @param {string=} subtitle
     32 * @param {string=} emptyPlaceholder
     33 * @param {string=} ignoreHasOwnProperty
     34 * @param {Array.<WebInspector.RemoteObjectProperty>=} extraProperties
     35 * @param {function()=} treeElementConstructor
     36 */
    2737WebInspector.ObjectPropertiesSection = function(object, title, subtitle, emptyPlaceholder, ignoreHasOwnProperty, extraProperties, treeElementConstructor)
    2838{
     
    136146}
    137147
     148/**
     149 * @constructor
     150 * @extends {TreeElement}
     151 */
    138152WebInspector.ObjectPropertyTreeElement = function(property)
    139153{
     
    221235    },
    222236
    223     _contextMenuEventFired: function()
     237    _contextMenuEventFired: function(event)
    224238    {
    225239        function selectNode(nodeId)
    226240        {
    227             if (nodeId) {
    228                 WebInspector.panels.elements.switchToAndFocus(WebInspector.domAgent.nodeForId(nodeId));
    229             }
     241            if (nodeId)
     242                WebInspector.domAgent.inspectElement(nodeId);
    230243        }
    231244
     
    264277            this.valueElement.textContent = this.valueElement._originalTextContent;
    265278
    266         WebInspector.startEditing(this.valueElement, {
    267             context: context,
    268             commitHandler: this.editingCommitted.bind(this),
    269             cancelHandler: this.editingCancelled.bind(this)
    270         });
     279        var config = new WebInspector.EditingConfig();
     280        config.setContext(context);
     281        config.setCommitHandler(this.editingCommitted.bind(this));
     282        config.setCancelHandler(this.editingCancelled.bind(this));
     283        WebInspector.startEditing(this.valueElement, config);
    271284    },
    272285
  • trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js

    r96577 r96604  
    408408    },
    409409
    410     _applyDiffMarkup: function(view, baseContent, newContent) {
    411         var oldLines = baseContent.split(/\r?\n/);
    412         var newLines = newContent.split(/\r?\n/);
    413 
    414         var diff = Array.diff(oldLines, newLines);
    415 
    416         var diffData = {};
    417         diffData.added = [];
    418         diffData.removed = [];
    419         diffData.changed = [];
    420 
    421         var offset = 0;
    422         var right = diff.right;
    423         for (var i = 0; i < right.length; ++i) {
    424             if (typeof right[i] === "string") {
    425                 if (right.length > i + 1 && right[i + 1].row === i + 1 - offset)
    426                     diffData.changed.push(i);
    427                 else {
    428                     diffData.added.push(i);
    429                     offset++;
    430                 }
    431             } else
    432                 offset = i - right[i].row;
    433         }
     410    _applyDiffMarkup: function(view, baseContent, newContent)
     411    {
     412        var diffData = TextDiff.compute(baseContent, newContent);
    434413        view.markDiff(diffData);
    435414    },
  • trunk/Source/WebCore/inspector/front-end/SourceFrame.js

    r96599 r96604  
    2929 */
    3030
     31/**
     32 * @extends {WebInspector.View}
     33 * @constructor
     34 */
    3135WebInspector.SourceFrame = function(delegate, url)
    3236{
     
    128132    },
    129133
     134    /**
     135     * @param {TextDiff} diffData
     136     */
    130137    markDiff: function(diffData)
    131138    {
     
    442449    },
    443450
     451    /**
     452     * @param {boolean=} skipRevealLine
     453     */
    444454    setExecutionLine: function(lineNumber, skipRevealLine)
    445455    {
     
    761771        }
    762772
    763         WebInspector.startEditing(this._conditionEditorElement, {
    764             context: null,
    765             commitHandler: finishEditing.bind(this, true),
    766             cancelHandler: finishEditing.bind(this, false)
    767         });
     773        var config = new WebInspector.EditingConfig();
     774        config.setCommitHandler(finishEditing.bind(this, true));
     775        config.setCancelHandler(finishEditing.bind(this, false));
     776        WebInspector.startEditing(this._conditionEditorElement, config);
    768777        this._conditionEditorElement.value = condition;
    769778        this._conditionEditorElement.select();
     
    813822    },
    814823
    815     startEditing: function(lineNumber)
     824    startEditing: function()
    816825    {
    817826        if (!this.canEditSource())
     
    839848
    840849            if (error) {
    841                 if (error.message) {
    842                     WebInspector.log(error.message, WebInspector.ConsoleMessage.MessageLevel.Error);
    843                     WebInspector.showConsole();
    844                 }
     850                if (error.message)
     851                    WebInspector.log(error.message, WebInspector.ConsoleMessage.MessageLevel.Error, true);
    845852                return;
    846853            }
     
    896903
    897904
     905/**
     906 * @implements {WebInspector.TextViewerDelegate}
     907 * @constructor
     908 */
    898909WebInspector.TextViewerDelegateForSourceFrame = function(sourceFrame)
    899910{
     
    941952        return this._sourceFrame.suggestedFileName();
    942953    }
    943 };
     954}
    944955
    945956WebInspector.TextViewerDelegateForSourceFrame.prototype.__proto__ = WebInspector.TextViewerDelegate.prototype;
    946957
    947958
     959/**
     960 * @interface
     961 */
    948962WebInspector.SourceFrameDelegate = function()
    949963{
     
    951965
    952966WebInspector.SourceFrameDelegate.prototype = {
    953     requestContent: function(callback)
    954     {
    955         // Should be implemented by subclasses.
    956     },
    957 
    958     debuggingSupported: function()
    959     {
    960         return false;
    961     },
    962 
    963     setBreakpoint: function(lineNumber, condition, enabled)
    964     {
    965         // Should be implemented by subclasses.
    966     },
    967 
    968     removeBreakpoint: function(lineNumber)
    969     {
    970         // Should be implemented by subclasses.
    971     },
    972 
    973     updateBreakpoint: function(lineNumber, condition, enabled)
    974     {
    975         // Should be implemented by subclasses.
    976     },
    977 
    978     findBreakpoint: function(lineNumber)
    979     {
    980         // Should be implemented by subclasses.
    981     },
    982 
    983     continueToLine: function(lineNumber)
    984     {
    985         // Should be implemented by subclasses.
    986     },
    987 
    988     canEditScriptSource: function()
    989     {
    990         return false;
    991     },
    992 
    993     setScriptSource: function(text, callback)
    994     {
    995         // Should be implemented by subclasses.
    996     },
    997 
    998     setScriptSourceIsBeingEdited: function(inEditMode)
    999     {
    1000         // Should be implemented by subclasses.
    1001     },
    1002 
    1003     debuggerPaused: function()
    1004     {
    1005         // Should be implemented by subclasses.
    1006     },
    1007 
    1008     evaluateInSelectedCallFrame: function(string)
    1009     {
    1010         // Should be implemented by subclasses.
    1011     },
    1012 
    1013     releaseEvaluationResult: function()
    1014     {
    1015         // Should be implemented by subclasses.
    1016     },
    1017 
    1018     suggestedFileName: function()
    1019     {
    1020         // Should be implemented by subclasses.
    1021     }
     967    requestContent: function(callback) { },
     968
     969    debuggingSupported: function() { return false; },
     970
     971    setBreakpoint: function(lineNumber, condition, enabled) { },
     972
     973    removeBreakpoint: function(lineNumber) { },
     974
     975    updateBreakpoint: function(lineNumber, condition, enabled) { },
     976
     977    findBreakpoint: function(lineNumber) { },
     978
     979    continueToLine: function(lineNumber) { },
     980
     981    canEditScriptSource: function() { return false; },
     982
     983    setScriptSource: function(text, callback) { },
     984
     985    setScriptSourceIsBeingEdited: function(inEditMode) { },
     986
     987    debuggerPaused: function() { },
     988
     989    evaluateInSelectedCallFrame: function(string) { },
     990
     991    releaseEvaluationResult: function() { },
     992
     993    suggestedFileName: function() { }
    1022994}
  • trunk/Source/WebCore/inspector/front-end/externs.js

    r96597 r96604  
    106106/**
    107107 * @constructor
    108  */
    109 WebInspector.ObjectPropertiesSection = function(obj, title)
    110 {
    111     this.element = null;
    112 }
    113 
    114 /**
    115  * @constructor
    116108 * @extends {TreeOutline}
    117109 */
     
    201193 */
    202194Event.prototype.initWebKitWheelEvent = function(vararg) {}
     195
     196/**
     197 * @param {string=} messageLevel
     198 * @param {boolean=} showConsole
     199 */
     200WebInspector.log = function(message, messageLevel, showConsole) {}
  • trunk/Source/WebCore/inspector/front-end/inspector.js

    r96591 r96604  
    958958}
    959959
    960 WebInspector.log = function(message, messageLevel)
     960/**
     961 * @param {string=} messageLevel
     962 * @param {boolean=} showConsole
     963 */
     964WebInspector.log = function(message, messageLevel, showConsole)
    961965{
    962966    // remember 'this' for setInterval() callback
     
    10211025
    10221026        self.console.addMessage(msg);
     1027        if (showConsole)
     1028            WebInspector.showConsole();
    10231029    }
    10241030
  • trunk/Source/WebCore/inspector/front-end/utilities.js

    r96597 r96604  
    970970}
    971971
     972/**
     973 * @param {string=} extraFlags
     974 */
    972975function createSearchRegex(query, extraFlags)
    973976{
     
    996999    return result;
    9971000}
     1001
     1002/**
     1003 * @constructor
     1004 */
     1005function TextDiff()
     1006{
     1007    this.added = [];
     1008    this.removed = [];
     1009    this.changed = [];
     1010}
     1011
     1012/**
     1013 * @param {string} baseContent
     1014 * @param {string} newContent
     1015 * @return {TextDiff}
     1016 */
     1017TextDiff.compute = function(baseContent, newContent)
     1018{
     1019    var oldLines = baseContent.split(/\r?\n/);
     1020    var newLines = newContent.split(/\r?\n/);
     1021
     1022    var diff = Array.diff(oldLines, newLines);
     1023
     1024    var diffData = new TextDiff();
     1025
     1026    var offset = 0;
     1027    var right = diff.right;
     1028    for (var i = 0; i < right.length; ++i) {
     1029        if (typeof right[i] === "string") {
     1030            if (right.length > i + 1 && right[i + 1].row === i + 1 - offset)
     1031                diffData.changed.push(i);
     1032            else {
     1033                diffData.added.push(i);
     1034                offset++;
     1035            }
     1036        } else
     1037            offset = i - right[i].row;
     1038    }
     1039    return diffData;
     1040}
Note: See TracChangeset for help on using the changeset viewer.