Diff
Modified: trunk/LayoutTests/ChangeLog (110433 => 110434)
--- trunk/LayoutTests/ChangeLog 2012-03-12 15:50:27 UTC (rev 110433)
+++ trunk/LayoutTests/ChangeLog 2012-03-12 15:56:06 UTC (rev 110434)
@@ -1,3 +1,20 @@
+2012-03-12 Pavel Podivilov <podivi...@chromium.org>
+
+ Web Inspector: DebuggerModel.Location should have scriptId property.
+ https://bugs.webkit.org/show_bug.cgi?id=80830
+
+ Reviewed by Vsevolod Vlasov.
+
+ * http/tests/inspector/compiler-source-mapping.html:
+ * http/tests/inspector/debugger-test.js:
+ (initialize_DebuggerTest):
+ * http/tests/inspector/search/search-in-concatenated-script.html:
+ * http/tests/inspector/search/search-in-script.html:
+ * inspector/debugger/debugger-scripts.html:
+ * inspector/debugger/linkifier.html:
+ * inspector/debugger/raw-source-code.html:
+ * inspector/debugger/script-formatter.html:
+
2012-03-12 Csaba Osztrogonác <o...@webkit.org>
[Qt] REGRESSION(r110401): fast/table/table-row-compositing-repaint-crash.html asserts
Modified: trunk/LayoutTests/http/tests/inspector/compiler-source-mapping.html (110433 => 110434)
--- trunk/LayoutTests/http/tests/inspector/compiler-source-mapping.html 2012-03-12 15:50:27 UTC (rev 110433)
+++ trunk/LayoutTests/http/tests/inspector/compiler-source-mapping.html 2012-03-12 15:56:06 UTC (rev 110434)
@@ -17,8 +17,8 @@
function checkReverseMapping(compiledLineNumber, compiledColumnNumber, sourceURL, sourceLineNumber, mapping)
{
var compiledLocation = mapping.sourceLocationToCompiledLocation(sourceURL, sourceLineNumber);
- InspectorTest.assertEquals(compiledLineNumber, compiledLocation.lineNumber);
- InspectorTest.assertEquals(compiledColumnNumber, compiledLocation.columnNumber);
+ InspectorTest.assertEquals(compiledLineNumber, compiledLocation[0]);
+ InspectorTest.assertEquals(compiledColumnNumber, compiledLocation[1]);
}
InspectorTest.runTestSuite([
Modified: trunk/LayoutTests/http/tests/inspector/debugger-test.js (110433 => 110434)
--- trunk/LayoutTests/http/tests/inspector/debugger-test.js 2012-03-12 15:50:27 UTC (rev 110433)
+++ trunk/LayoutTests/http/tests/inspector/debugger-test.js 2012-03-12 15:56:06 UTC (rev 110434)
@@ -271,4 +271,15 @@
InspectorTest._quiet = quiet;
};
+InspectorTest.queryScripts = function(filter)
+{
+ var scripts = [];
+ for (var scriptId in WebInspector.debuggerModel._scripts) {
+ var script = WebInspector.debuggerModel._scripts[scriptId];
+ if (filter(script))
+ scripts.push(script);
+ }
+ return scripts;
};
+
+};
Modified: trunk/LayoutTests/http/tests/inspector/search/search-in-concatenated-script.html (110433 => 110434)
--- trunk/LayoutTests/http/tests/inspector/search/search-in-concatenated-script.html 2012-03-12 15:50:27 UTC (rev 110433)
+++ trunk/LayoutTests/http/tests/inspector/search/search-in-concatenated-script.html 2012-03-12 15:56:06 UTC (rev 110434)
@@ -24,7 +24,7 @@
function step3()
{
var url = ""
- var scripts = WebInspector.debuggerModel.scriptsForURL(url);
+ var scripts = InspectorTest.queryScripts(function(s) { return s.sourceURL === url; });
var contentProvider = new WebInspector.ConcatenatedScriptsContentProvider(scripts);
InspectorTest.addResult(url);
contentProvider.searchInContent(text, false, false, step4);
Modified: trunk/LayoutTests/http/tests/inspector/search/search-in-script.html (110433 => 110434)
--- trunk/LayoutTests/http/tests/inspector/search/search-in-script.html 2012-03-12 15:50:27 UTC (rev 110433)
+++ trunk/LayoutTests/http/tests/inspector/search/search-in-script.html 2012-03-12 15:56:06 UTC (rev 110434)
@@ -22,7 +22,8 @@
function step3()
{
- var scripts = WebInspector.debuggerModel.scriptsForURL("http://127.0.0.1:8000/inspector/search/resources/search.js");
+ var url = ""
+ var scripts = InspectorTest.queryScripts(function(s) { return s.sourceURL === url; });
script = scripts[0];
InspectorTest.addResult(script.sourceURL);
Modified: trunk/LayoutTests/inspector/debugger/debugger-scripts.html (110433 => 110434)
--- trunk/LayoutTests/inspector/debugger/debugger-scripts.html 2012-03-12 15:50:27 UTC (rev 110433)
+++ trunk/LayoutTests/inspector/debugger/debugger-scripts.html 2012-03-12 15:56:06 UTC (rev 110434)
@@ -11,7 +11,7 @@
function step1()
{
- WebInspector.debuggerModel.queryScripts(function(script) { step2({ data: script }) });
+ InspectorTest.queryScripts(function(script) { step2({ data: script }) });
WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ParsedScriptSource, step2);
}
Modified: trunk/LayoutTests/inspector/debugger/linkifier.html (110433 => 110434)
--- trunk/LayoutTests/inspector/debugger/linkifier.html 2012-03-12 15:50:27 UTC (rev 110433)
+++ trunk/LayoutTests/inspector/debugger/linkifier.html 2012-03-12 15:56:06 UTC (rev 110434)
@@ -26,7 +26,7 @@
}
}
- WebInspector.debuggerModel.queryScripts(function(script) { scriptAdded({ data: script }) });
+ InspectorTest.queryScripts(function(script) { scriptAdded({ data: script }) });
WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ParsedScriptSource, scriptAdded);
}
Modified: trunk/LayoutTests/inspector/debugger/raw-source-code.html (110433 => 110434)
--- trunk/LayoutTests/inspector/debugger/raw-source-code.html 2012-03-12 15:50:27 UTC (rev 110433)
+++ trunk/LayoutTests/inspector/debugger/raw-source-code.html 2012-03-12 15:56:06 UTC (rev 110434)
@@ -11,8 +11,9 @@
var lineCount = source.lineEndings().length;
var endLine = startLine + lineCount - 1;
var endColumn = lineCount === 1 ? startColumn + source.length : source.length - source.lineEndings()[lineCount - 2];
- var script = new WebInspector.Script(null, url, startLine, startColumn, endLine, endColumn, isContentScript);
+ var script = new WebInspector.Script(1, url, startLine, startColumn, endLine, endColumn, isContentScript);
script.requestSource = function(callback) { callback(source); };
+ WebInspector.debuggerModel._scripts[1] = script;
return script;
}
@@ -32,25 +33,12 @@
function createScriptFormatterMock()
{
- var rawSourceCode = {
- originalToFormatted: function(location)
- {
- var formattedLocation = {};
- formattedLocation.lineNumber = location.lineNumber * 2;
- formattedLocation.columnNumber = location.columnNumber * 2;
- return formattedLocation;
- },
-
- formattedToOriginal: function(location)
- {
- var originalLocation = {};
- originalLocation.lineNumber = Math.floor(location.lineNumber / 2);
- originalLocation.columnNumber = Math.floor(location.columnNumber / 2);
- return originalLocation;
- }
+ var mapping = {
+ originalToFormatted: function(lineNumber, columnNumber) { return [lineNumber * 2, columnNumber * 2]; },
+ formattedToOriginal: function(lineNumber, columnNumber) { return [Math.floor(lineNumber / 2), Math.floor(columnNumber / 2)]; }
};
var formatter = {
- formatContent: function(mimeType, content, callback) { formatter._callback = callback.bind(null, "<formatted> " + content, rawSourceCode); },
+ formatContent: function(mimeType, content, callback) { formatter._callback = callback.bind(null, "<formatted> " + content, mapping); },
finish: function() { formatter._callback(); }
};
return formatter;
@@ -338,8 +326,8 @@
sourceLocationToCompiledLocation: function(sourceURL, lineNumber)
{
if (sourceURL === "source1.js")
- return { lineNumber: Math.floor(lineNumber / 2), columnNumber: 0 };
- return { lineNumber: Math.floor(lineNumber / 2) + 10, columnNumber: 0 };
+ return [Math.floor(lineNumber / 2), 0];
+ return [Math.floor(lineNumber / 2) + 10, 0];
},
sources: function() { return ["source1.js", "source2.js"]; },
load: function() { return true; },
Modified: trunk/LayoutTests/inspector/debugger/script-formatter.html (110433 => 110434)
--- trunk/LayoutTests/inspector/debugger/script-formatter.html 2012-03-12 15:50:27 UTC (rev 110433)
+++ trunk/LayoutTests/inspector/debugger/script-formatter.html 2012-03-12 15:56:06 UTC (rev 110434)
@@ -49,8 +49,8 @@
var originalPosition = source.indexOf(string);
InspectorTest.assertTrue(originalPosition !== -1);
var originalLocation = WebInspector.ScriptFormatter.positionToLocation(source.lineEndings(), originalPosition);
- var formattedLocation = mapping.originalToFormatted(originalLocation);
- var formattedPosition = WebInspector.ScriptFormatter.locationToPosition(formattedSource.lineEndings(), formattedLocation);
+ var formattedLocation = mapping.originalToFormatted(originalLocation[0], originalLocation[1]);
+ var formattedPosition = WebInspector.ScriptFormatter.locationToPosition(formattedSource.lineEndings(), formattedLocation[0], formattedLocation[1]);
var expectedFormattedPosition = formattedSource.indexOf(string);
InspectorTest.assertEquals(expectedFormattedPosition, formattedPosition, "wrong mapping for <" + string + ">");
}
Modified: trunk/Source/WebCore/ChangeLog (110433 => 110434)
--- trunk/Source/WebCore/ChangeLog 2012-03-12 15:50:27 UTC (rev 110433)
+++ trunk/Source/WebCore/ChangeLog 2012-03-12 15:56:06 UTC (rev 110434)
@@ -1,3 +1,36 @@
+2012-03-12 Pavel Podivilov <podivi...@chromium.org>
+
+ Web Inspector: DebuggerModel.Location should have scriptId property.
+ https://bugs.webkit.org/show_bug.cgi?id=80830
+
+ Reviewed by Vsevolod Vlasov.
+
+ * inspector/front-end/CompilerSourceMapping.js:
+ (WebInspector.ClosureCompilerSourceMapping.prototype.sourceLocationToCompiledLocation):
+ * inspector/front-end/ConsoleMessage.js:
+ (WebInspector.ConsoleMessageImpl.prototype.location):
+ * inspector/front-end/DebuggerModel.js:
+ (WebInspector.DebuggerModel.Location):
+ (WebInspector.DebuggerModel.prototype._failedToParseScriptSource):
+ (WebInspector.DebuggerModel.prototype.createRawLocation):
+ (WebInspector.DebuggerModel.prototype.createRawLocationByURL):
+ * inspector/front-end/DebuggerPresentationModel.js:
+ (WebInspector.DebuggerPresentationModel.prototype._consoleMessageAdded):
+ (WebInspector.DebuggerPresentationModel.prototype._addConsoleMessageToScript):
+ (WebInspector.DebuggerPresentationModel.prototype._addPendingConsoleMessagesToScript):
+ (WebInspector.DebuggerPresentationModelResourceBinding.prototype._uiSourceCodeForResource):
+ (WebInspector.DebuggerPresentationModel.Linkifier.prototype.linkifyLocation):
+ * inspector/front-end/RawSourceCode.js:
+ (WebInspector.RawSourceCode.PlainSourceMapping.prototype.uiLocationToRawLocation):
+ (WebInspector.RawSourceCode.FormattedSourceMapping.prototype.rawLocationToUILocation):
+ (WebInspector.RawSourceCode.FormattedSourceMapping.prototype.uiLocationToRawLocation):
+ (WebInspector.RawSourceCode.CompilerSourceMapping.prototype.uiLocationToRawLocation):
+ * inspector/front-end/ScriptFormatter.js:
+ (WebInspector.ScriptFormatter.locationToPosition):
+ (WebInspector.ScriptFormatter.positionToLocation):
+ (WebInspector.FormattedSourceMapping.prototype.originalToFormatted):
+ (WebInspector.FormattedSourceMapping.prototype.formattedToOriginal):
+
2012-03-12 Dana Jansens <dan...@chromium.org>
[chromium] A couple early-outs for occlusion tracker
Modified: trunk/Source/WebCore/inspector/front-end/CompilerSourceMapping.js (110433 => 110434)
--- trunk/Source/WebCore/inspector/front-end/CompilerSourceMapping.js 2012-03-12 15:50:27 UTC (rev 110433)
+++ trunk/Source/WebCore/inspector/front-end/CompilerSourceMapping.js 2012-03-12 15:56:06 UTC (rev 110434)
@@ -46,7 +46,7 @@
/**
* @param {string} sourceURL
* @param {number} lineNumber
- * @return {DebuggerAgent.Location}
+ * @return {Array.<number>}
*/
sourceLocationToCompiledLocation: function(sourceURL, lineNumber) { },
@@ -124,7 +124,7 @@
for ( ; lineNumber < mappings.length; ++lineNumber) {
var mapping = mappings[lineNumber];
if (mapping)
- return { lineNumber: mapping[0], columnNumber: mapping[1] };
+ return [mapping[0], mapping[1]];
}
},
Modified: trunk/Source/WebCore/inspector/front-end/ConsoleMessage.js (110433 => 110434)
--- trunk/Source/WebCore/inspector/front-end/ConsoleMessage.js 2012-03-12 15:50:27 UTC (rev 110433)
+++ trunk/Source/WebCore/inspector/front-end/ConsoleMessage.js 2012-03-12 15:56:06 UTC (rev 110434)
@@ -594,12 +594,12 @@
return this._messageText;
},
- get location()
+ location: function()
{
// FIXME(62725): stack trace line/column numbers are one-based.
var lineNumber = this.stackTrace ? this.stackTrace[0].lineNumber - 1 : this.line - 1;
var columnNumber = this.stackTrace ? this.stackTrace[0].columnNumber - 1 : 0;
- return new WebInspector.DebuggerModel.Location(lineNumber, columnNumber);
+ return WebInspector.debuggerModel.createRawLocationByURL(this.url, lineNumber, columnNumber);
},
isEqual: function(msg)
Modified: trunk/Source/WebCore/inspector/front-end/DebuggerModel.js (110433 => 110434)
--- trunk/Source/WebCore/inspector/front-end/DebuggerModel.js 2012-03-12 15:50:27 UTC (rev 110433)
+++ trunk/Source/WebCore/inspector/front-end/DebuggerModel.js 2012-03-12 15:56:06 UTC (rev 110434)
@@ -61,11 +61,13 @@
/**
* @constructor
* @extends {DebuggerAgent.Location}
+ * @param {WebInspector.Script} script
* @param {number} lineNumber
* @param {number} columnNumber
*/
-WebInspector.DebuggerModel.Location = function(lineNumber, columnNumber)
+WebInspector.DebuggerModel.Location = function(script, lineNumber, columnNumber)
{
+ this.scriptId = script.scriptId;
this.lineNumber = lineNumber;
this.columnNumber = columnNumber;
}
@@ -242,28 +244,6 @@
},
/**
- * @param {string} url
- */
- scriptsForURL: function(url)
- {
- return this.queryScripts(function(s) { return s.sourceURL === url; });
- },
-
- /**
- * @param {function(WebInspector.Script):boolean} filter
- */
- queryScripts: function(filter)
- {
- var scripts = [];
- for (var scriptId in this._scripts) {
- var script = this._scripts[scriptId];
- if (filter(script))
- scripts.push(script);
- }
- return scripts;
- },
-
- /**
* @param {DebuggerAgent.ScriptId} scriptId
* @param {string} newSource
* @param {function(?Protocol.Error)} callback
@@ -288,7 +268,7 @@
},
/**
- * @return {Array.<DebuggerAgent.CallFrame>}
+ * @return {Array.<DebuggerAgent.CallFrame>}
*/
get callFrames()
{
@@ -296,7 +276,7 @@
},
/**
- * @return {?WebInspector.DebuggerPausedDetails}
+ * @return {?WebInspector.DebuggerPausedDetails}
*/
get debuggerPausedDetails()
{
@@ -347,6 +327,44 @@
{
var script = new WebInspector.Script("", sourceURL, startingLine, 0, 0, 0, false);
this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.FailedToParseScriptSource, script);
+ },
+
+ /**
+ * @param {WebInspector.Script} script
+ * @param {number} lineNumber
+ * @param {number} columnNumber
+ * @return {DebuggerAgent.Location}
+ */
+ createRawLocation: function(script, lineNumber, columnNumber)
+ {
+ if (script.sourceURL)
+ return this.createRawLocationByURL(script.sourceURL, lineNumber, columnNumber)
+ return new WebInspector.DebuggerModel.Location(script, lineNumber, columnNumber);
+ },
+
+ /**
+ * @param {string} sourceURL
+ * @param {number} lineNumber
+ * @param {number} columnNumber
+ * @return {DebuggerAgent.Location}
+ */
+ createRawLocationByURL: function(sourceURL, lineNumber, columnNumber)
+ {
+ var closestScript = null;
+ for (var scriptId in this._scripts) {
+ var script = this._scripts[scriptId];
+ if (script.sourceURL !== sourceURL)
+ continue;
+ if (!closestScript)
+ closestScript = script;
+ if (script.lineOffset > lineNumber || (script.lineOffset === lineNumber && script.columnOffset > columnNumber))
+ continue;
+ if (script.endLine < lineNumber || (script.endLine === lineNumber && script.endColumn <= columnNumber))
+ continue;
+ closestScript = script;
+ break;
+ }
+ return closestScript ? new WebInspector.DebuggerModel.Location(closestScript, lineNumber, columnNumber) : null;
}
}
Modified: trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js (110433 => 110434)
--- trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js 2012-03-12 15:50:27 UTC (rev 110433)
+++ trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js 2012-03-12 15:56:06 UTC (rev 110434)
@@ -286,18 +286,18 @@
if (!message.url || !message.isErrorOrWarning())
return;
- var script = this._scriptForURLAndLocation(message.url, message.location);
- if (script)
- this._addConsoleMessageToScript(message, script);
+ var rawLocation = message.location();
+ if (rawLocation)
+ this._addConsoleMessageToScript(message, rawLocation);
else
this._addPendingConsoleMessage(message);
},
/**
* @param {WebInspector.ConsoleMessage} message
- * @param {WebInspector.Script} script
+ * @param {DebuggerAgent.Location} rawLocation
*/
- _addConsoleMessageToScript: function(message, script)
+ _addConsoleMessageToScript: function(message, rawLocation)
{
function updateLocation(uiLocation)
{
@@ -305,8 +305,6 @@
this._presentationConsoleMessages.push(presentationMessage);
this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.ConsoleMessageAdded, presentationMessage);
}
- var rawLocation = new WebInspector.DebuggerModel.Location(message.location.lineNumber, message.location.columnNumber);
- rawLocation.scriptId = script.scriptId;
var liveLocation = this.createLiveLocation(rawLocation, updateLocation.bind(this));
liveLocation.init();
this._consoleMessageLiveLocations.push(liveLocation);
@@ -334,8 +332,9 @@
var pendingMessages = [];
for (var i = 0; i < messages.length; i++) {
var message = messages[i];
- if (script === this._scriptForURLAndLocation(message.url, message.location))
- this._addConsoleMessageToScript(messages, script);
+ var rawLocation = message.location();
+ if (script.scriptId === rawLocation.scriptId)
+ this._addConsoleMessageToScript(messages, rawLocation);
else
pendingMessages.push(message);
}
@@ -579,25 +578,6 @@
}
},
- /**
- * @param {string} url
- * @param {DebuggerAgent.Location} rawLocation
- * @return {WebInspector.Script}
- */
- _scriptForURLAndLocation: function(url, rawLocation)
- {
- var scripts = WebInspector.debuggerModel.scriptsForURL(url);
- for (var i = 0; i < scripts.length; ++i) {
- var script = scripts[i];
- if (script.lineOffset > rawLocation.lineNumber || (script.lineOffset === rawLocation.lineNumber && script.columnOffset > rawLocation.columnNumber))
- continue;
- if (script.endLine < rawLocation.lineNumber || (script.endLine === rawLocation.lineNumber && script.endColumn <= rawLocation.columnNumber))
- continue;
- return script;
- }
- return null;
- },
-
_debuggerReset: function()
{
this._scriptMapping.reset();
@@ -788,11 +768,9 @@
*/
_uiSourceCodeForResource: function(resource)
{
- var script = WebInspector.debuggerModel.scriptsForURL(resource.url)[0];
- if (!script)
+ var rawLocation = WebInspector.debuggerModel.createRawLocationByURL(resource.url, 0, 0);
+ if (!rawLocation)
return null;
- var rawLocation = new WebInspector.DebuggerModel.Location(0, 0);
- rawLocation.scriptId = script.scriptId;
var uiLocation = this._presentationModel.rawLocationToUILocation(rawLocation);
return uiLocation ? uiLocation.uiSourceCode : null;
},
@@ -887,16 +865,14 @@
*/
linkifyLocation: function(sourceURL, lineNumber, columnNumber, classes)
{
- var rawLocation = new WebInspector.DebuggerModel.Location(lineNumber, columnNumber || 0);
- var script = this._model._scriptForURLAndLocation(sourceURL, rawLocation);
- if (!script)
+ var rawLocation = WebInspector.debuggerModel.createRawLocationByURL(sourceURL, lineNumber, columnNumber || 0);
+ if (!rawLocation)
return WebInspector.linkifyResourceAsNode(sourceURL, lineNumber, classes);
- rawLocation.scriptId = script.scriptId;
return this.linkifyRawLocation(rawLocation, classes);
},
/**
- * @param {WebInspector.DebuggerModel.Location} rawLocation
+ * @param {DebuggerAgent.Location} rawLocation
* @param {string=} classes
*/
linkifyRawLocation: function(rawLocation, classes)
Modified: trunk/Source/WebCore/inspector/front-end/RawSourceCode.js (110433 => 110434)
--- trunk/Source/WebCore/inspector/front-end/RawSourceCode.js 2012-03-12 15:50:27 UTC (rev 110433)
+++ trunk/Source/WebCore/inspector/front-end/RawSourceCode.js 2012-03-12 15:56:06 UTC (rev 110434)
@@ -129,25 +129,6 @@
},
/**
- * @param {number} lineNumber
- * @param {number=} columnNumber
- * @return {WebInspector.Script}
- */
- _scriptForRawLocation: function(lineNumber, columnNumber)
- {
- var closestScript = this._scripts[0];
- for (var i = 1; i < this._scripts.length; ++i) {
- var script = this._scripts[i];
- if (script.lineOffset > lineNumber || (script.lineOffset === lineNumber && script.columnOffset > columnNumber))
- continue;
- if (script.lineOffset > closestScript.lineOffset ||
- (script.lineOffset === closestScript.lineOffset && script.columnOffset > closestScript.columnOffset))
- closestScript = script;
- }
- return closestScript;
- },
-
- /**
* @param {WebInspector.Script} script
*/
forceUpdateSourceMapping: function(script)
@@ -332,9 +313,7 @@
uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber)
{
console.assert(uiSourceCode === this._uiSourceCodeList[0]);
- var rawLocation = { lineNumber: lineNumber, columnNumber: columnNumber };
- rawLocation.scriptId = this._rawSourceCode._scriptForRawLocation(rawLocation.lineNumber, rawLocation.columnNumber).scriptId;
- return /** @type {DebuggerAgent.Location} */ rawLocation;
+ return WebInspector.debuggerModel.createRawLocation(this._rawSourceCode._scripts[0], lineNumber, columnNumber);
},
/**
@@ -366,8 +345,8 @@
*/
rawLocationToUILocation: function(rawLocation)
{
- var location = this._mapping.originalToFormatted(rawLocation);
- return new WebInspector.UILocation(this._uiSourceCodeList[0], location.lineNumber, location.columnNumber || 0);
+ var location = this._mapping.originalToFormatted(rawLocation.lineNumber, rawLocation.columnNumber);
+ return new WebInspector.UILocation(this._uiSourceCodeList[0], location[0], location[1]);
},
/**
@@ -379,9 +358,8 @@
uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber)
{
console.assert(uiSourceCode === this._uiSourceCodeList[0]);
- var rawLocation = this._mapping.formattedToOriginal(new WebInspector.DebuggerModel.Location(lineNumber, columnNumber));
- rawLocation.scriptId = this._rawSourceCode._scriptForRawLocation(rawLocation.lineNumber, rawLocation.columnNumber).scriptId;
- return rawLocation;
+ var location = this._mapping.formattedToOriginal(lineNumber, columnNumber);
+ return WebInspector.debuggerModel.createRawLocation(this._rawSourceCode._scripts[0], location[0], location[1]);
},
/**
@@ -429,9 +407,8 @@
*/
uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber)
{
- var rawLocation = this._mapping.sourceLocationToCompiledLocation(uiSourceCode.url, lineNumber);
- rawLocation.scriptId = this._rawSourceCode._scriptForRawLocation(rawLocation.lineNumber, rawLocation.columnNumber).scriptId;
- return rawLocation;
+ var location = this._mapping.sourceLocationToCompiledLocation(uiSourceCode.url, lineNumber);
+ return WebInspector.debuggerModel.createRawLocation(this._rawSourceCode._scripts[0], location[0], location[1]);
},
/**
Modified: trunk/Source/WebCore/inspector/front-end/ScriptFormatter.js (110433 => 110434)
--- trunk/Source/WebCore/inspector/front-end/ScriptFormatter.js 2012-03-12 15:50:27 UTC (rev 110433)
+++ trunk/Source/WebCore/inspector/front-end/ScriptFormatter.js 2012-03-12 15:56:06 UTC (rev 110434)
@@ -38,19 +38,20 @@
/**
* @param {Array.<number>} lineEndings
- * @param {DebuggerAgent.Location} location
+ * @param {number} lineNumber
+ * @param {number} columnNumber
* @return {number}
*/
-WebInspector.ScriptFormatter.locationToPosition = function(lineEndings, location)
+WebInspector.ScriptFormatter.locationToPosition = function(lineEndings, lineNumber, columnNumber)
{
- var position = location.lineNumber ? lineEndings[location.lineNumber - 1] + 1 : 0;
- return position + location.columnNumber;
+ var position = lineNumber ? lineEndings[lineNumber - 1] + 1 : 0;
+ return position + columnNumber;
}
/**
* @param {Array.<number>} lineEndings
* @param {number} position
- * @return {DebuggerAgent.Location}
+ * @return {Array.<number>}
*/
WebInspector.ScriptFormatter.positionToLocation = function(lineEndings, position)
{
@@ -59,7 +60,7 @@
var columnNumber = position;
else
var columnNumber = position - lineEndings[lineNumber - 1] - 1;
- return new WebInspector.DebuggerModel.Location(lineNumber, columnNumber);
+ return [lineNumber, columnNumber];
}
WebInspector.ScriptFormatter.prototype = {
@@ -127,23 +128,25 @@
WebInspector.FormattedSourceMapping.prototype = {
/**
- * @param {DebuggerAgent.Location} location
- * @return {DebuggerAgent.Location}
+ * @param {number} lineNumber
+ * @param {number} columnNumber
+ * @return {Array.<number>}
*/
- originalToFormatted: function(location)
+ originalToFormatted: function(lineNumber, columnNumber)
{
- var originalPosition = WebInspector.ScriptFormatter.locationToPosition(this._originalLineEndings, location);
+ var originalPosition = WebInspector.ScriptFormatter.locationToPosition(this._originalLineEndings, lineNumber, columnNumber);
var formattedPosition = this._convertPosition(this._mapping.original, this._mapping.formatted, originalPosition);
return WebInspector.ScriptFormatter.positionToLocation(this._formattedLineEndings, formattedPosition);
},
/**
- * @param {DebuggerAgent.Location} location
- * @return {DebuggerAgent.Location}
+ * @param {number} lineNumber
+ * @param {number} columnNumber
+ * @return {Array.<number>}
*/
- formattedToOriginal: function(location)
+ formattedToOriginal: function(lineNumber, columnNumber)
{
- var formattedPosition = WebInspector.ScriptFormatter.locationToPosition(this._formattedLineEndings, location);
+ var formattedPosition = WebInspector.ScriptFormatter.locationToPosition(this._formattedLineEndings, lineNumber, columnNumber);
var originalPosition = this._convertPosition(this._mapping.formatted, this._mapping.original, formattedPosition);
return WebInspector.ScriptFormatter.positionToLocation(this._originalLineEndings, originalPosition);
},