Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
2011-01-21 Pavel Podivilov <podivilov@chromium.org>
        Reviewed by Pavel Feldman.

        Web Inspector: eliminate SourceView and ScriptView classes.
        https://bugs.webkit.org/show_bug.cgi?id=52896

        SourceView and ScriptView delegate everything to SourceFrame and should be eliminated.

        * WebCore.gypi:
        * WebCore.vcproj/WebCore.vcproj:
        * inspector/front-end/GoToLineDialog.js:
        (WebInspector.GoToLineDialog.prototype._highlightSelectedLine):
        * inspector/front-end/ResourceView.js:
        (WebInspector.ResourceView.createResourceView):
        (WebInspector.ResourceView.resourceViewTypeMatchesResource):
        (WebInspector.SourceFrameContentProviderForResource):  Moved from SourceView.
        * inspector/front-end/ResourcesPanel.js:
        (WebInspector.ResourcesPanel.prototype.show):
        (WebInspector.ResourcesPanel.prototype._applyDiffMarkup):
        (WebInspector.FrameResourceTreeElement.prototype._errorsWarningsUpdated):
        * inspector/front-end/ScriptView.js: Removed.
        * inspector/front-end/ScriptsPanel.js:
        (WebInspector.ScriptsPanel.prototype._scriptSourceChanged):
        (WebInspector.ScriptsPanel.prototype._sourceFrameForScriptOrResource):
        (WebInspector.ScriptsPanel.prototype._showScriptOrResource):
        (WebInspector.ScriptsPanel.prototype._setPauseOnExceptions):
        (WebInspector.ScriptsPanel.prototype._formatScript):
        (WebInspector.SourceFrameContentProviderForScript): Moved from ScriptView.
        * inspector/front-end/SourceFrame.js:
        (WebInspector.SourceFrame):
        (WebInspector.SourceFrame.prototype.show):
        (WebInspector.SourceFrame.prototype.hide):
        (WebInspector.SourceFrame.prototype.hasContent):
        (WebInspector.SourceFrame.prototype._createTextViewer):
        (WebInspector.SourceFrame.prototype.performSearch.doFindSearchMatches):
        (WebInspector.SourceFrame.prototype.performSearch):
        * inspector/front-end/SourceView.js: Removed.
        * inspector/front-end/WebKit.qrc:
        * inspector/front-end/inspector.html:

Canonical link: https://commits.webkit.org/66730@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@76497 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Pavel Podivilov committed Jan 24, 2011
1 parent e07dadf commit c0989bb
Show file tree
Hide file tree
Showing 12 changed files with 180 additions and 358 deletions.
41 changes: 41 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,44 @@
2011-01-21 Pavel Podivilov <podivilov@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: eliminate SourceView and ScriptView classes.
https://bugs.webkit.org/show_bug.cgi?id=52896

SourceView and ScriptView delegate everything to SourceFrame and should be eliminated.

* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* inspector/front-end/GoToLineDialog.js:
(WebInspector.GoToLineDialog.prototype._highlightSelectedLine):
* inspector/front-end/ResourceView.js:
(WebInspector.ResourceView.createResourceView):
(WebInspector.ResourceView.resourceViewTypeMatchesResource):
(WebInspector.SourceFrameContentProviderForResource): Moved from SourceView.
* inspector/front-end/ResourcesPanel.js:
(WebInspector.ResourcesPanel.prototype.show):
(WebInspector.ResourcesPanel.prototype._applyDiffMarkup):
(WebInspector.FrameResourceTreeElement.prototype._errorsWarningsUpdated):
* inspector/front-end/ScriptView.js: Removed.
* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype._scriptSourceChanged):
(WebInspector.ScriptsPanel.prototype._sourceFrameForScriptOrResource):
(WebInspector.ScriptsPanel.prototype._showScriptOrResource):
(WebInspector.ScriptsPanel.prototype._setPauseOnExceptions):
(WebInspector.ScriptsPanel.prototype._formatScript):
(WebInspector.SourceFrameContentProviderForScript): Moved from ScriptView.
* inspector/front-end/SourceFrame.js:
(WebInspector.SourceFrame):
(WebInspector.SourceFrame.prototype.show):
(WebInspector.SourceFrame.prototype.hide):
(WebInspector.SourceFrame.prototype.hasContent):
(WebInspector.SourceFrame.prototype._createTextViewer):
(WebInspector.SourceFrame.prototype.performSearch.doFindSearchMatches):
(WebInspector.SourceFrame.prototype.performSearch):
* inspector/front-end/SourceView.js: Removed.
* inspector/front-end/WebKit.qrc:
* inspector/front-end/inspector.html:

2011-01-24 Andras Becsi <abecsi@webkit.org>

Reviewed by Csaba Osztrogonác.
Expand Down
2 changes: 0 additions & 2 deletions Source/WebCore/WebCore.gypi
Expand Up @@ -4716,7 +4716,6 @@
'inspector/front-end/ScriptFormatter.js',
'inspector/front-end/ScriptFormatterWorker.js',
'inspector/front-end/ScriptsPanel.js',
'inspector/front-end/ScriptView.js',
'inspector/front-end/ShortcutsHelp.js',
'inspector/front-end/Section.js',
'inspector/front-end/Settings.js',
Expand All @@ -4727,7 +4726,6 @@
'inspector/front-end/SourceHTMLTokenizer.js',
'inspector/front-end/SourceJavaScriptTokenizer.js',
'inspector/front-end/SourceTokenizer.js',
'inspector/front-end/SourceView.js',
'inspector/front-end/StatusBarButton.js',
'inspector/front-end/StylesSidebarPane.js',
'inspector/front-end/SummaryBar.js',
Expand Down
8 changes: 0 additions & 8 deletions Source/WebCore/WebCore.vcproj/WebCore.vcproj
Expand Up @@ -65700,10 +65700,6 @@
RelativePath="..\inspector\front-end\ScriptsPanel.js"
>
</File>
<File
RelativePath="..\inspector\front-end\ScriptView.js"
>
</File>
<File
RelativePath="..\inspector\front-end\Section.js"
>
Expand Down Expand Up @@ -65744,10 +65740,6 @@
RelativePath="..\inspector\front-end\SourceTokenizer.js"
>
</File>
<File
RelativePath="..\inspector\front-end\SourceView.js"
>
</File>
<File
RelativePath="..\inspector\front-end\StatusBarButton.js"
>
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/inspector/front-end/GoToLineDialog.js
Expand Up @@ -45,7 +45,7 @@ WebInspector.GoToLineDialog = function(view)
this._input = dialogWindow.createChild("input");
this._input.setAttribute("type", "text");
this._input.setAttribute("size", 6);
var linesCount = view.sourceFrame.textModel.linesCount;
var linesCount = view.textModel.linesCount;
if (linesCount)
this._input.setAttribute("title", WebInspector.UIString("1 - %d", linesCount));
var blurHandler = this._onBlur.bind(this);
Expand Down Expand Up @@ -120,7 +120,7 @@ WebInspector.GoToLineDialog.prototype = {
var value = this._input.value;
var lineNumber = parseInt(value, 10);
if (!isNaN(lineNumber) && lineNumber > 0) {
lineNumber = Math.min(lineNumber, this._view.sourceFrame.textModel.linesCount);
lineNumber = Math.min(lineNumber, this._view.textModel.linesCount);
this._view.highlightLine(lineNumber);
}
}
Expand Down
42 changes: 40 additions & 2 deletions Source/WebCore/inspector/front-end/ResourceView.js
Expand Up @@ -50,7 +50,11 @@ WebInspector.ResourceView.createResourceView = function(resource)
case WebInspector.resourceCategories.stylesheets:
case WebInspector.resourceCategories.scripts:
case WebInspector.resourceCategories.xhr:
return new WebInspector.SourceView(resource);
var contentProvider = new WebInspector.SourceFrameContentProviderForResource(resource);
var isScript = resource.type === WebInspector.Resource.Type.Script;
var view = new WebInspector.SourceFrame(contentProvider, resource.url, isScript);
view.resource = resource;
return view;
case WebInspector.resourceCategories.images:
return new WebInspector.ImageView(resource);
case WebInspector.resourceCategories.fonts:
Expand All @@ -68,7 +72,7 @@ WebInspector.ResourceView.resourceViewTypeMatchesResource = function(resource)
case WebInspector.resourceCategories.stylesheets:
case WebInspector.resourceCategories.scripts:
case WebInspector.resourceCategories.xhr:
return resourceView.__proto__ === WebInspector.SourceView.prototype;
return resourceView.__proto__ === WebInspector.SourceFrame.prototype;
case WebInspector.resourceCategories.images:
return resourceView.__proto__ === WebInspector.ImageView.prototype;
case WebInspector.resourceCategories.fonts:
Expand Down Expand Up @@ -115,3 +119,37 @@ WebInspector.ResourceView.existingResourceViewForResource = function(resource)
return null;
return resource._resourcesView;
}


WebInspector.SourceFrameContentProviderForResource = function(resource)
{
WebInspector.SourceFrameContentProvider.call(this);
this._resource = resource;
}

//This is a map from resource.type to mime types
//found in WebInspector.SourceTokenizer.Registry.
WebInspector.SourceFrameContentProviderForResource.DefaultMIMETypeForResourceType = {
0: "text/html",
1: "text/css",
4: "text/javascript"
}

WebInspector.SourceFrameContentProviderForResource.prototype = {
requestContent: function(callback)
{
function contentLoaded(content)
{
var mimeType = WebInspector.SourceFrameContentProviderForResource.DefaultMIMETypeForResourceType[this._resource.type] || this._resource.mimeType;
callback(mimeType, content);
}
this._resource.requestContent(contentLoaded.bind(this));
},

scripts: function()
{
return WebInspector.debuggerModel.scriptsForURL(this._resource.url);
}
}

WebInspector.SourceFrameContentProviderForResource.prototype.__proto__ = WebInspector.SourceFrameContentProvider.prototype;
10 changes: 5 additions & 5 deletions Source/WebCore/inspector/front-end/ResourcesPanel.js
Expand Up @@ -102,7 +102,7 @@ WebInspector.ResourcesPanel.prototype = {
{
WebInspector.Panel.prototype.show.call(this);

if (this.visibleView instanceof WebInspector.ResourceView)
if (this.visibleView.resource)
this._showResourceView(this.visibleView.resource);

if (this._initializedDefaultSelection)
Expand Down Expand Up @@ -378,7 +378,7 @@ WebInspector.ResourcesPanel.prototype = {
var view = WebInspector.ResourceView.resourceViewForResource(resource);

// Consider rendering diff markup here.
if (resource.baseRevision && view instanceof WebInspector.SourceView) {
if (resource.baseRevision && view instanceof WebInspector.SourceFrame) {
function callback(baseContent)
{
if (baseContent)
Expand Down Expand Up @@ -413,7 +413,7 @@ WebInspector.ResourcesPanel.prototype = {
} else
offset = i - right[i].row;
}
view.sourceFrame.markDiff(diffData);
view.markDiff(diffData);
},

showDatabase: function(database, tableName)
Expand Down Expand Up @@ -690,7 +690,7 @@ WebInspector.ResourcesPanel.prototype = {
var views = [];

const visibleView = this.visibleView;
if (visibleView instanceof WebInspector.ResourceView && visibleView.performSearch)
if (visibleView.performSearch)
views.push(visibleView);

function callback(resourceTreeElement)
Expand Down Expand Up @@ -1076,7 +1076,7 @@ WebInspector.FrameResourceTreeElement.prototype = {

_errorsWarningsUpdated: function()
{
// FIXME: move to the Script/SourceView.
// FIXME: move to the SourceFrame.
if (!this._resource.warnings && !this._resource.errors) {
var view = WebInspector.ResourceView.existingResourceViewForResource(this._resource);
if (view && view.clearMessages)
Expand Down
96 changes: 0 additions & 96 deletions Source/WebCore/inspector/front-end/ScriptView.js

This file was deleted.

0 comments on commit c0989bb

Please sign in to comment.