[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da
podivilov at chromium.org
podivilov at chromium.org
Wed Dec 22 18:24:27 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 036cf88c804f83f5a4194805a2d6bba6276766b3
Author: podivilov at chromium.org <podivilov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Dec 10 16:33:00 2010 +0000
2010-12-10 Pavel Podivilov <podivilov at chromium.org>
Reviewed by Pavel Feldman.
Web Inspector: eliminate SourceFrameDelegate by passing scripts to SourceFrame constructor.
https://bugs.webkit.org/show_bug.cgi?id=50679
* inspector/front-end/Script.js:
* inspector/front-end/ScriptView.js:
(WebInspector.ScriptView):
* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype.reset):
* inspector/front-end/SourceFrame.js:
(WebInspector.SourceFrame):
(WebInspector.SourceFrame.prototype._createViewerIfNeeded):
(WebInspector.SourceFrame.prototype._breakpointAdded):
(WebInspector.SourceFrame.prototype._doEditLine):
(WebInspector.SourceFrame.prototype._commitEditLine):
(WebInspector.SourceFrame.prototype._breakpoints):
(WebInspector.SourceFrame.prototype._sourceIDForLine):
* inspector/front-end/SourceView.js:
(WebInspector.SourceView):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73730 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 6d61018..1009fef 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,26 @@
+2010-12-10 Pavel Podivilov <podivilov at chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ Web Inspector: eliminate SourceFrameDelegate by passing scripts to SourceFrame constructor.
+ https://bugs.webkit.org/show_bug.cgi?id=50679
+
+ * inspector/front-end/Script.js:
+ * inspector/front-end/ScriptView.js:
+ (WebInspector.ScriptView):
+ * inspector/front-end/ScriptsPanel.js:
+ (WebInspector.ScriptsPanel.prototype.reset):
+ * inspector/front-end/SourceFrame.js:
+ (WebInspector.SourceFrame):
+ (WebInspector.SourceFrame.prototype._createViewerIfNeeded):
+ (WebInspector.SourceFrame.prototype._breakpointAdded):
+ (WebInspector.SourceFrame.prototype._doEditLine):
+ (WebInspector.SourceFrame.prototype._commitEditLine):
+ (WebInspector.SourceFrame.prototype._breakpoints):
+ (WebInspector.SourceFrame.prototype._sourceIDForLine):
+ * inspector/front-end/SourceView.js:
+ (WebInspector.SourceView):
+
2010-12-10 Andreas Kling <kling at webkit.org>
Reviewed by Eric Seidel.
diff --git a/WebCore/inspector/front-end/DebuggerModel.js b/WebCore/inspector/front-end/DebuggerModel.js
index a170018..a337f5c 100644
--- a/WebCore/inspector/front-end/DebuggerModel.js
+++ b/WebCore/inspector/front-end/DebuggerModel.js
@@ -66,7 +66,7 @@ WebInspector.DebuggerModel.prototype = {
this._setBreakpoint(sourceID, url, line, enabled, condition);
},
- findBreakpoints: function(filter)
+ queryBreakpoints: function(filter)
{
var breakpoints = [];
for (var id in this._breakpoints) {
diff --git a/WebCore/inspector/front-end/Script.js b/WebCore/inspector/front-end/Script.js
index ce14a59..184fe97 100644
--- a/WebCore/inspector/front-end/Script.js
+++ b/WebCore/inspector/front-end/Script.js
@@ -90,4 +90,3 @@ WebInspector.Script.prototype = {
}
WebInspector.Script.prototype.__proto__ = WebInspector.Object.prototype;
-
diff --git a/WebCore/inspector/front-end/ScriptView.js b/WebCore/inspector/front-end/ScriptView.js
index 1962fdf..39dae55 100644
--- a/WebCore/inspector/front-end/ScriptView.js
+++ b/WebCore/inspector/front-end/ScriptView.js
@@ -30,13 +30,11 @@ WebInspector.ScriptView = function(script)
this.element.addStyleClass("script-view");
this.script = script;
+ this.script.addEventListener(WebInspector.Script.Events.SourceChanged, this._scriptSourceChanged, this);
this._frameNeedsSetup = true;
this._sourceFrameSetup = false;
- var delegate = new WebInspector.ScriptFrameDelegateImpl(this.script);
- this.sourceFrame = new WebInspector.SourceFrame(this.element, delegate);
-
- this.script.addEventListener(WebInspector.Script.Events.SourceChanged, this._scriptSourceChanged, this);
+ this.sourceFrame = new WebInspector.SourceFrame(this.element, [script], WebInspector.panels.scripts.canEditScripts());
}
WebInspector.ScriptView.prototype = {
@@ -113,28 +111,3 @@ WebInspector.ScriptView.prototype = {
}
WebInspector.ScriptView.prototype.__proto__ = WebInspector.View.prototype;
-
-WebInspector.ScriptFrameDelegateImpl = function(script)
-{
- WebInspector.SourceFrameDelegate.call(this);
- this._script = script;
-}
-
-WebInspector.ScriptFrameDelegateImpl.prototype = {
- canEditScripts: function()
- {
- return WebInspector.panels.scripts.canEditScripts();
- },
-
- editLineComplete: function(revertEditLineCallback, newContent)
- {
- this._script.source = newContent;
- },
-
- scripts: function()
- {
- return [this._script];
- }
-}
-
-WebInspector.ScriptFrameDelegateImpl.prototype.__proto__ = WebInspector.SourceFrameDelegate.prototype;
diff --git a/WebCore/inspector/front-end/ScriptsPanel.js b/WebCore/inspector/front-end/ScriptsPanel.js
index 334798c..5aa4780 100644
--- a/WebCore/inspector/front-end/ScriptsPanel.js
+++ b/WebCore/inspector/front-end/ScriptsPanel.js
@@ -293,7 +293,7 @@ WebInspector.ScriptsPanel.prototype = {
return;
// Need to clear breakpoints and re-create them later when editing source.
- var breakpoints = WebInspector.debuggerModel.findBreakpoints(function(b) { return b.sourceID === editData.sourceID });
+ var breakpoints = WebInspector.debuggerModel.queryBreakpoints(function(b) { return b.sourceID === editData.sourceID });
for (var i = 0; i < breakpoints.length; ++i)
breakpoints[i].remove();
@@ -433,8 +433,10 @@ WebInspector.ScriptsPanel.prototype = {
if (this._sourceIDMap) {
for (var sourceID in this._sourceIDMap) {
var object = this._sourceIDMap[sourceID];
- if (object instanceof WebInspector.Resource)
+ if (object instanceof WebInspector.Resource) {
object.removeAllScripts();
+ delete object._resourcesView;
+ }
}
}
diff --git a/WebCore/inspector/front-end/SourceFrame.js b/WebCore/inspector/front-end/SourceFrame.js
index 8f101e2..557837d 100644
--- a/WebCore/inspector/front-end/SourceFrame.js
+++ b/WebCore/inspector/front-end/SourceFrame.js
@@ -28,10 +28,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-WebInspector.SourceFrame = function(parentElement, delegate)
+WebInspector.SourceFrame = function(parentElement, scripts, canEditScripts)
{
this._parentElement = parentElement;
- this._delegate = delegate;
+ this._scripts = {};
+ for (var i = 0; i < scripts.length; ++i)
+ this._scripts[scripts[i].sourceID] = scripts[i];
+ this._canEditScripts = canEditScripts;
this._textModel = new WebInspector.TextEditorModel();
this._textModel.replaceTabsWithSpaces = true;
@@ -221,7 +224,7 @@ WebInspector.SourceFrame.prototype = {
this._textViewer.endUpdates();
- if (this._delegate.canEditScripts())
+ if (this._canEditScripts)
this._textViewer.editCallback = this._editLine.bind(this);
},
@@ -415,7 +418,7 @@ WebInspector.SourceFrame.prototype = {
{
var breakpoint = event.data;
- if (this._shouldDisplayBreakpoint(breakpoint))
+ if (breakpoint.sourceID in this._scripts)
this._addBreakpoint(breakpoint);
},
@@ -797,10 +800,18 @@ WebInspector.SourceFrame.prototype = {
_doEditLine: function(editData, cancelEditingCallback)
{
var revertEditingCallback = this._revertEditLine.bind(this, editData);
- var commitEditingCallback = this._delegate.editLineComplete.bind(this._delegate, revertEditingCallback);
+ var commitEditingCallback = this._commitEditLine.bind(this, editData, revertEditingCallback);
WebInspector.panels.scripts.editScriptSource(editData, commitEditingCallback, cancelEditingCallback);
},
+ _commitEditLine: function(editData, revertEditLineCallback, newContent)
+ {
+ var script = this._scripts[editData.sourceID];
+ script.source = newContent;
+ if (script.resource)
+ script.resource.setContent(newContent, revertEditLineCallback);
+ },
+
_setBreakpoint: function(lineNumber)
{
var sourceID = this._sourceIDForLine(lineNumber);
@@ -811,15 +822,8 @@ WebInspector.SourceFrame.prototype = {
_breakpoints: function()
{
- var sourceIDs = {};
- var scripts = this._delegate.scripts();
- for (var i = 0; i < scripts.length; ++i)
- sourceIDs[scripts[i].sourceID] = true;
- function filter(breakpoint)
- {
- return breakpoint.sourceID in sourceIDs;
- }
- return WebInspector.debuggerModel.findBreakpoints(filter);
+ var scripts = this._scripts;
+ return WebInspector.debuggerModel.queryBreakpoints(function(b) { return b.sourceID in scripts; });
},
_findBreakpoint: function(lineNumber)
@@ -828,51 +832,19 @@ WebInspector.SourceFrame.prototype = {
return WebInspector.debuggerModel.findBreakpoint(sourceID, lineNumber);
},
- _shouldDisplayBreakpoint: function(breakpoint)
- {
- var scripts = this._delegate.scripts();
- for (var i = 0; i < scripts.length; ++i) {
- if (breakpoint.sourceID === scripts[i].sourceID)
- return true;
- }
- return false;
- },
-
_sourceIDForLine: function(lineNumber)
{
- var sourceID = null;
- var scripts = this._delegate.scripts();
+ var sourceIDForLine = null;
var closestStartingLine = 0;
- for (var i = 0; i < scripts.length; ++i) {
- var script = scripts[i];
+ for (var sourceID in this._scripts) {
+ var script = this._scripts[sourceID];
if (script.startingLine <= lineNumber && script.startingLine >= closestStartingLine) {
closestStartingLine = script.startingLine;
- sourceID = script.sourceID;
+ sourceIDForLine = sourceID;
}
}
- return sourceID;
+ return sourceIDForLine;
}
}
WebInspector.SourceFrame.prototype.__proto__ = WebInspector.Object.prototype;
-
-WebInspector.SourceFrameDelegate = function()
-{
-}
-
-WebInspector.SourceFrameDelegate.prototype = {
- canEditScripts: function()
- {
- // Implemented by subclasses.
- },
-
- editLineComplete: function(revertEditLineCallback, newContent)
- {
- // Implemented by subclasses.
- },
-
- scripts: function()
- {
- // Implemented by subclasses.
- }
-}
diff --git a/WebCore/inspector/front-end/SourceView.js b/WebCore/inspector/front-end/SourceView.js
index 8ccadd3..fe9a7e3 100644
--- a/WebCore/inspector/front-end/SourceView.js
+++ b/WebCore/inspector/front-end/SourceView.js
@@ -32,8 +32,8 @@ WebInspector.SourceView = function(resource)
this.element.addStyleClass("source");
- var delegate = new WebInspector.ResourceFrameDelegateImpl(this.resource);
- this.sourceFrame = new WebInspector.SourceFrame(this.element, delegate);
+ var canEditScripts = WebInspector.panels.scripts.canEditScripts() && resource.type === WebInspector.Resource.Type.Script;
+ this.sourceFrame = new WebInspector.SourceFrame(this.element, resource.scripts, canEditScripts);
resource.addEventListener("finished", this._resourceLoadingFinished, this);
this._frameNeedsSetup = true;
}
@@ -238,28 +238,3 @@ WebInspector.SourceView.prototype = {
}
WebInspector.SourceView.prototype.__proto__ = WebInspector.ResourceView.prototype;
-
-WebInspector.ResourceFrameDelegateImpl = function(resource)
-{
- WebInspector.SourceFrameDelegate.call(this);
- this._resource = resource;
-}
-
-WebInspector.ResourceFrameDelegateImpl.prototype = {
- canEditScripts: function()
- {
- return WebInspector.panels.scripts.canEditScripts() && this._resource.type === WebInspector.Resource.Type.Script;
- },
-
- editLineComplete: function(revertEditLineCallback, newContent)
- {
- this._resource.setContent(newContent, revertEditLineCallback);
- },
-
- scripts: function()
- {
- return this._resource.scripts;
- }
-}
-
-WebInspector.ResourceFrameDelegateImpl.prototype.__proto__ = WebInspector.SourceFrameDelegate.prototype;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list