Diff
Modified: trunk/Source/WebCore/ChangeLog (96603 => 96604)
--- trunk/Source/WebCore/ChangeLog 2011-10-04 16:59:53 UTC (rev 96603)
+++ trunk/Source/WebCore/ChangeLog 2011-10-04 17:19:04 UTC (rev 96604)
@@ -1,3 +1,50 @@
+2011-10-04 Pavel Feldman <[email protected]>
+
+ 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:
+ ():
+
2011-10-04 Mikhail Naganov <[email protected]>
Web Inspector: Factor out object properties popup.
Modified: trunk/Source/WebCore/inspector/compile-front-end.sh (96603 => 96604)
--- trunk/Source/WebCore/inspector/compile-front-end.sh 2011-10-04 16:59:53 UTC (rev 96603)
+++ trunk/Source/WebCore/inspector/compile-front-end.sh 2011-10-04 17:19:04 UTC (rev 96604)
@@ -93,8 +93,11 @@
--js Source/WebCore/inspector/front-end/Toolbar.js \
--js Source/WebCore/inspector/front-end/UIUtils.js \
--js Source/WebCore/inspector/front-end/View.js \
- --module jsmodule_inspector:4:jsmodule_sdk,jsmodule_ui \
+ --module jsmodule_inspector:7:jsmodule_sdk,jsmodule_ui \
--js Source/WebCore/inspector/front-end/ConsoleMessage.js \
--js Source/WebCore/inspector/front-end/ConsoleView.js \
--js Source/WebCore/inspector/front-end/_javascript_ContextManager.js \
+ --js Source/WebCore/inspector/front-end/ObjectPopoverHelper.js \
+ --js Source/WebCore/inspector/front-end/ObjectPropertiesSection.js \
+ --js Source/WebCore/inspector/front-end/SourceFrame.js \
--js Source/WebCore/inspector/front-end/TimelineManager.js
Modified: trunk/Source/WebCore/inspector/front-end/DOMAgent.js (96603 => 96604)
--- trunk/Source/WebCore/inspector/front-end/DOMAgent.js 2011-10-04 16:59:53 UTC (rev 96603)
+++ trunk/Source/WebCore/inspector/front-end/DOMAgent.js 2011-10-04 17:19:04 UTC (rev 96604)
@@ -617,7 +617,7 @@
delete this._idToDOMNode[nodeId];
},
- _inspectElementRequested: function(nodeId)
+ inspectElement: function(nodeId)
{
var node = this._idToDOMNode[nodeId];
if (node)
@@ -704,11 +704,6 @@
this._domAgent._childNodeRemoved(parentId, nodeId);
},
- inspectElementRequested: function(nodeId)
- {
- this._domAgent._inspectElementRequested(nodeId);
- },
-
searchResults: function(nodeIds)
{
if (this._domAgent._searchResultCollector)
Modified: trunk/Source/WebCore/inspector/front-end/ElementsPanel.js (96603 => 96604)
--- trunk/Source/WebCore/inspector/front-end/ElementsPanel.js 2011-10-04 16:59:53 UTC (rev 96603)
+++ trunk/Source/WebCore/inspector/front-end/ElementsPanel.js 2011-10-04 17:19:04 UTC (rev 96604)
@@ -446,8 +446,9 @@
treeElement.hasChildren = event.data.hasChildNodes();
},
- _inspectElementRequested: function(node)
+ _inspectElementRequested: function(event)
{
+ var node = event.data;
WebInspector.updateFocusedNode(node.id);
},
Modified: trunk/Source/WebCore/inspector/front-end/ObjectPopoverHelper.js (96603 => 96604)
--- trunk/Source/WebCore/inspector/front-end/ObjectPopoverHelper.js 2011-10-04 16:59:53 UTC (rev 96603)
+++ trunk/Source/WebCore/inspector/front-end/ObjectPopoverHelper.js 2011-10-04 17:19:04 UTC (rev 96604)
@@ -28,6 +28,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * @constructor
+ * @extends {WebInspector.PopoverHelper}
+ */
WebInspector.ObjectPopoverHelper = function(panelElement, getAnchor, queryObject, onHide, disableOnClick)
{
WebInspector.PopoverHelper.call(this, panelElement, getAnchor, this._showObjectPopover.bind(this), onHide, disableOnClick);
Modified: trunk/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js (96603 => 96604)
--- trunk/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js 2011-10-04 16:59:53 UTC (rev 96603)
+++ trunk/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js 2011-10-04 17:19:04 UTC (rev 96604)
@@ -24,6 +24,16 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * @constructor
+ * @extends {WebInspector.PropertiesSection}
+ * @param {string=} title
+ * @param {string=} subtitle
+ * @param {string=} emptyPlaceholder
+ * @param {string=} ignoreHasOwnProperty
+ * @param {Array.<WebInspector.RemoteObjectProperty>=} extraProperties
+ * @param {function()=} treeElementConstructor
+ */
WebInspector.ObjectPropertiesSection = function(object, title, subtitle, emptyPlaceholder, ignoreHasOwnProperty, extraProperties, treeElementConstructor)
{
this.emptyPlaceholder = (emptyPlaceholder || WebInspector.UIString("No Properties"));
@@ -135,6 +145,10 @@
return diff;
}
+/**
+ * @constructor
+ * @extends {TreeElement}
+ */
WebInspector.ObjectPropertyTreeElement = function(property)
{
this.property = property;
@@ -220,13 +234,12 @@
this.hasChildren = this.property.value.hasChildren && !this.property.wasThrown;
},
- _contextMenuEventFired: function()
+ _contextMenuEventFired: function(event)
{
function selectNode(nodeId)
{
- if (nodeId) {
- WebInspector.panels.elements.switchToAndFocus(WebInspector.domAgent.nodeForId(nodeId));
- }
+ if (nodeId)
+ WebInspector.domAgent.inspectElement(nodeId);
}
function revealElement()
@@ -263,11 +276,11 @@
if (typeof this.valueElement._originalTextContent === "string")
this.valueElement.textContent = this.valueElement._originalTextContent;
- WebInspector.startEditing(this.valueElement, {
- context: context,
- commitHandler: this.editingCommitted.bind(this),
- cancelHandler: this.editingCancelled.bind(this)
- });
+ var config = new WebInspector.EditingConfig();
+ config.setContext(context);
+ config.setCommitHandler(this.editingCommitted.bind(this));
+ config.setCancelHandler(this.editingCancelled.bind(this));
+ WebInspector.startEditing(this.valueElement, config);
},
editingEnded: function(context)
Modified: trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js (96603 => 96604)
--- trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js 2011-10-04 16:59:53 UTC (rev 96603)
+++ trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js 2011-10-04 17:19:04 UTC (rev 96604)
@@ -407,30 +407,9 @@
}
},
- _applyDiffMarkup: function(view, baseContent, newContent) {
- var oldLines = baseContent.split(/\r?\n/);
- var newLines = newContent.split(/\r?\n/);
-
- var diff = Array.diff(oldLines, newLines);
-
- var diffData = {};
- diffData.added = [];
- diffData.removed = [];
- diffData.changed = [];
-
- var offset = 0;
- var right = diff.right;
- for (var i = 0; i < right.length; ++i) {
- if (typeof right[i] === "string") {
- if (right.length > i + 1 && right[i + 1].row === i + 1 - offset)
- diffData.changed.push(i);
- else {
- diffData.added.push(i);
- offset++;
- }
- } else
- offset = i - right[i].row;
- }
+ _applyDiffMarkup: function(view, baseContent, newContent)
+ {
+ var diffData = TextDiff.compute(baseContent, newContent);
view.markDiff(diffData);
},
Modified: trunk/Source/WebCore/inspector/front-end/SourceFrame.js (96603 => 96604)
--- trunk/Source/WebCore/inspector/front-end/SourceFrame.js 2011-10-04 16:59:53 UTC (rev 96603)
+++ trunk/Source/WebCore/inspector/front-end/SourceFrame.js 2011-10-04 17:19:04 UTC (rev 96604)
@@ -28,6 +28,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ * @extends {WebInspector.View}
+ * @constructor
+ */
WebInspector.SourceFrame = function(delegate, url)
{
WebInspector.View.call(this);
@@ -127,6 +131,9 @@
this._delegate.requestContent(callback);
},
+ /**
+ * @param {TextDiff} diffData
+ */
markDiff: function(diffData)
{
if (this._diffLines && this.loaded)
@@ -441,6 +448,9 @@
return ranges;
},
+ /**
+ * @param {boolean=} skipRevealLine
+ */
setExecutionLine: function(lineNumber, skipRevealLine)
{
this._executionLineNumber = lineNumber;
@@ -760,11 +770,10 @@
callback(committed, newText);
}
- WebInspector.startEditing(this._conditionEditorElement, {
- context: null,
- commitHandler: finishEditing.bind(this, true),
- cancelHandler: finishEditing.bind(this, false)
- });
+ var config = new WebInspector.EditingConfig();
+ config.setCommitHandler(finishEditing.bind(this, true));
+ config.setCancelHandler(finishEditing.bind(this, false));
+ WebInspector.startEditing(this._conditionEditorElement, config);
this._conditionEditorElement.value = condition;
this._conditionEditorElement.select();
},
@@ -812,7 +821,7 @@
return this._delegate.canEditScriptSource();
},
- startEditing: function(lineNumber)
+ startEditing: function()
{
if (!this.canEditSource())
return false;
@@ -838,10 +847,8 @@
this._textViewer.readOnly = false;
if (error) {
- if (error.message) {
- WebInspector.log(error.message, WebInspector.ConsoleMessage.MessageLevel.Error);
- WebInspector.showConsole();
- }
+ if (error.message)
+ WebInspector.log(error.message, WebInspector.ConsoleMessage.MessageLevel.Error, true);
return;
}
@@ -895,6 +902,10 @@
WebInspector.SourceFrame.prototype.__proto__ = WebInspector.View.prototype;
+/**
+ * @implements {WebInspector.TextViewerDelegate}
+ * @constructor
+ */
WebInspector.TextViewerDelegateForSourceFrame = function(sourceFrame)
{
this._sourceFrame = sourceFrame;
@@ -940,83 +951,44 @@
{
return this._sourceFrame.suggestedFileName();
}
-};
+}
WebInspector.TextViewerDelegateForSourceFrame.prototype.__proto__ = WebInspector.TextViewerDelegate.prototype;
+/**
+ * @interface
+ */
WebInspector.SourceFrameDelegate = function()
{
}
WebInspector.SourceFrameDelegate.prototype = {
- requestContent: function(callback)
- {
- // Should be implemented by subclasses.
- },
+ requestContent: function(callback) { },
- debuggingSupported: function()
- {
- return false;
- },
+ debuggingSupported: function() { return false; },
- setBreakpoint: function(lineNumber, condition, enabled)
- {
- // Should be implemented by subclasses.
- },
+ setBreakpoint: function(lineNumber, condition, enabled) { },
- removeBreakpoint: function(lineNumber)
- {
- // Should be implemented by subclasses.
- },
+ removeBreakpoint: function(lineNumber) { },
- updateBreakpoint: function(lineNumber, condition, enabled)
- {
- // Should be implemented by subclasses.
- },
+ updateBreakpoint: function(lineNumber, condition, enabled) { },
- findBreakpoint: function(lineNumber)
- {
- // Should be implemented by subclasses.
- },
+ findBreakpoint: function(lineNumber) { },
- continueToLine: function(lineNumber)
- {
- // Should be implemented by subclasses.
- },
+ continueToLine: function(lineNumber) { },
- canEditScriptSource: function()
- {
- return false;
- },
+ canEditScriptSource: function() { return false; },
- setScriptSource: function(text, callback)
- {
- // Should be implemented by subclasses.
- },
+ setScriptSource: function(text, callback) { },
- setScriptSourceIsBeingEdited: function(inEditMode)
- {
- // Should be implemented by subclasses.
- },
+ setScriptSourceIsBeingEdited: function(inEditMode) { },
- debuggerPaused: function()
- {
- // Should be implemented by subclasses.
- },
+ debuggerPaused: function() { },
- evaluateInSelectedCallFrame: function(string)
- {
- // Should be implemented by subclasses.
- },
+ evaluateInSelectedCallFrame: function(string) { },
- releaseEvaluationResult: function()
- {
- // Should be implemented by subclasses.
- },
+ releaseEvaluationResult: function() { },
- suggestedFileName: function()
- {
- // Should be implemented by subclasses.
- }
+ suggestedFileName: function() { }
}
Modified: trunk/Source/WebCore/inspector/front-end/externs.js (96603 => 96604)
--- trunk/Source/WebCore/inspector/front-end/externs.js 2011-10-04 16:59:53 UTC (rev 96603)
+++ trunk/Source/WebCore/inspector/front-end/externs.js 2011-10-04 17:19:04 UTC (rev 96604)
@@ -105,14 +105,6 @@
/**
* @constructor
- */
-WebInspector.ObjectPropertiesSection = function(obj, title)
-{
- this.element = null;
-}
-
-/**
- * @constructor
* @extends {TreeOutline}
*/
WebInspector.ElementsTreeOutline = function()
@@ -200,3 +192,9 @@
* @param {...*} vararg
*/
Event.prototype.initWebKitWheelEvent = function(vararg) {}
+
+/**
+ * @param {string=} messageLevel
+ * @param {boolean=} showConsole
+ */
+WebInspector.log = function(message, messageLevel, showConsole) {}
Modified: trunk/Source/WebCore/inspector/front-end/inspector.js (96603 => 96604)
--- trunk/Source/WebCore/inspector/front-end/inspector.js 2011-10-04 16:59:53 UTC (rev 96603)
+++ trunk/Source/WebCore/inspector/front-end/inspector.js 2011-10-04 17:19:04 UTC (rev 96604)
@@ -957,7 +957,11 @@
workersPane.removeWorker.apply(workersPane, arguments);
}
-WebInspector.log = function(message, messageLevel)
+/**
+ * @param {string=} messageLevel
+ * @param {boolean=} showConsole
+ */
+WebInspector.log = function(message, messageLevel, showConsole)
{
// remember 'this' for setInterval() callback
var self = this;
@@ -1020,6 +1024,8 @@
null);
self.console.addMessage(msg);
+ if (showConsole)
+ WebInspector.showConsole();
}
// if we can't log the message, queue it
Modified: trunk/Source/WebCore/inspector/front-end/utilities.js (96603 => 96604)
--- trunk/Source/WebCore/inspector/front-end/utilities.js 2011-10-04 16:59:53 UTC (rev 96603)
+++ trunk/Source/WebCore/inspector/front-end/utilities.js 2011-10-04 17:19:04 UTC (rev 96604)
@@ -969,6 +969,9 @@
}
}
+/**
+ * @param {string=} extraFlags
+ */
function createSearchRegex(query, extraFlags)
{
// This should be kept the same as the one in ContentSearchUtils.cpp.
@@ -995,3 +998,43 @@
}
return result;
}
+
+/**
+ * @constructor
+ */
+function TextDiff()
+{
+ this.added = [];
+ this.removed = [];
+ this.changed = [];
+}
+
+/**
+ * @param {string} baseContent
+ * @param {string} newContent
+ * @return {TextDiff}
+ */
+TextDiff.compute = function(baseContent, newContent)
+{
+ var oldLines = baseContent.split(/\r?\n/);
+ var newLines = newContent.split(/\r?\n/);
+
+ var diff = Array.diff(oldLines, newLines);
+
+ var diffData = new TextDiff();
+
+ var offset = 0;
+ var right = diff.right;
+ for (var i = 0; i < right.length; ++i) {
+ if (typeof right[i] === "string") {
+ if (right.length > i + 1 && right[i + 1].row === i + 1 - offset)
+ diffData.changed.push(i);
+ else {
+ diffData.added.push(i);
+ offset++;
+ }
+ } else
+ offset = i - right[i].row;
+ }
+ return diffData;
+}