[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198
podivilov at chromium.org
podivilov at chromium.org
Sun Feb 20 23:41:13 UTC 2011
The following commit has been merged in the webkit-1.3 branch:
commit ca4146104c9f9db9b04d4b446a63be89f4c0924f
Author: podivilov at chromium.org <podivilov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Jan 24 08:44:20 2011 +0000
2011-01-21 Pavel Podivilov <podivilov at chromium.org>
Reviewed by Pavel Feldman.
Web Inspector: move search functions from SourceView to SourceFrame.
https://bugs.webkit.org/show_bug.cgi?id=52895
This is the last step before eliminating SourceView and ScriptView since
this classes just delegate everything to SourceFrame.
* inspector/front-end/SourceFrame.js:
(WebInspector.SourceFrame.prototype.set visible):
(WebInspector.SourceFrame.prototype._clearLineHighlight):
(WebInspector.SourceFrame.prototype._createTextViewer):
(WebInspector.SourceFrame.prototype.performSearch.doFindSearchMatches):
(WebInspector.SourceFrame.prototype.performSearch):
(WebInspector.SourceFrame.prototype.searchCanceled):
(WebInspector.SourceFrame.prototype.jumpToFirstSearchResult):
(WebInspector.SourceFrame.prototype.jumpToLastSearchResult):
(WebInspector.SourceFrame.prototype.jumpToNextSearchResult):
(WebInspector.SourceFrame.prototype.jumpToPreviousSearchResult):
(WebInspector.SourceFrame.prototype.showingFirstSearchResult):
(WebInspector.SourceFrame.prototype.showingLastSearchResult):
(WebInspector.SourceFrame.prototype._jumpToSearchResult):
* inspector/front-end/SourceView.js:
(WebInspector.SourceView.prototype.hide):
(WebInspector.SourceView.prototype.searchCanceled):
(WebInspector.SourceView.prototype.performSearch):
(WebInspector.SourceView.prototype.jumpToFirstSearchResult):
(WebInspector.SourceView.prototype.jumpToLastSearchResult):
(WebInspector.SourceView.prototype.jumpToNextSearchResult):
(WebInspector.SourceView.prototype.jumpToPreviousSearchResult):
(WebInspector.SourceView.prototype.showingFirstSearchResult):
(WebInspector.SourceView.prototype.showingLastSearchResult):
(WebInspector.SourceView.prototype.clearMessages):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76488 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 0b11a73..57bd594 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,39 @@
+2011-01-21 Pavel Podivilov <podivilov at chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ Web Inspector: move search functions from SourceView to SourceFrame.
+ https://bugs.webkit.org/show_bug.cgi?id=52895
+
+ This is the last step before eliminating SourceView and ScriptView since
+ this classes just delegate everything to SourceFrame.
+
+ * inspector/front-end/SourceFrame.js:
+ (WebInspector.SourceFrame.prototype.set visible):
+ (WebInspector.SourceFrame.prototype._clearLineHighlight):
+ (WebInspector.SourceFrame.prototype._createTextViewer):
+ (WebInspector.SourceFrame.prototype.performSearch.doFindSearchMatches):
+ (WebInspector.SourceFrame.prototype.performSearch):
+ (WebInspector.SourceFrame.prototype.searchCanceled):
+ (WebInspector.SourceFrame.prototype.jumpToFirstSearchResult):
+ (WebInspector.SourceFrame.prototype.jumpToLastSearchResult):
+ (WebInspector.SourceFrame.prototype.jumpToNextSearchResult):
+ (WebInspector.SourceFrame.prototype.jumpToPreviousSearchResult):
+ (WebInspector.SourceFrame.prototype.showingFirstSearchResult):
+ (WebInspector.SourceFrame.prototype.showingLastSearchResult):
+ (WebInspector.SourceFrame.prototype._jumpToSearchResult):
+ * inspector/front-end/SourceView.js:
+ (WebInspector.SourceView.prototype.hide):
+ (WebInspector.SourceView.prototype.searchCanceled):
+ (WebInspector.SourceView.prototype.performSearch):
+ (WebInspector.SourceView.prototype.jumpToFirstSearchResult):
+ (WebInspector.SourceView.prototype.jumpToLastSearchResult):
+ (WebInspector.SourceView.prototype.jumpToNextSearchResult):
+ (WebInspector.SourceView.prototype.jumpToPreviousSearchResult):
+ (WebInspector.SourceView.prototype.showingFirstSearchResult):
+ (WebInspector.SourceView.prototype.showingLastSearchResult):
+ (WebInspector.SourceView.prototype.clearMessages):
+
2011-01-24 Sheriff Bot <webkit.review.bot at gmail.com>
Unreviewed, rolling out r76463.
diff --git a/Source/WebCore/inspector/front-end/SourceFrame.js b/Source/WebCore/inspector/front-end/SourceFrame.js
index eb89f24..933f548 100644
--- a/Source/WebCore/inspector/front-end/SourceFrame.js
+++ b/Source/WebCore/inspector/front-end/SourceFrame.js
@@ -64,6 +64,7 @@ WebInspector.SourceFrame.prototype = {
this._textViewer.resize();
} else {
this._hidePopup();
+ this._clearLineHighlight();
if (this._textViewer) {
this._scrollTop = this._textViewer.element.scrollTop;
this._scrollLeft = this._textViewer.element.scrollLeft;
@@ -144,7 +145,7 @@ WebInspector.SourceFrame.prototype = {
this._lineToHighlight = line;
},
- clearLineHighlight: function()
+ _clearLineHighlight: function()
{
if (this._textViewer)
this._textViewer.clearLineHighlight();
@@ -177,12 +178,6 @@ WebInspector.SourceFrame.prototype = {
delete this._lineNumberToReveal;
}
- if (this._pendingMarkRange) {
- var range = this._pendingMarkRange;
- this.markAndRevealRange(range);
- delete this._pendingMarkRange;
- }
-
if (this._lineToHighlight) {
this.highlightLine(this._lineToHighlight);
delete this._lineToHighlight;
@@ -223,35 +218,85 @@ WebInspector.SourceFrame.prototype = {
this._textViewer.endUpdates();
},
- findSearchMatches: function(query, finishedCallback)
+ performSearch: function(query, callback)
{
- function doFindSearchMatches()
+ // Call searchCanceled since it will reset everything we need before doing a new search.
+ this.searchCanceled();
+
+ function doFindSearchMatches(query)
{
- var ranges = [];
+ this._currentSearchResultIndex = -1;
+ this._searchResults = [];
// First do case-insensitive search.
var regexObject = createSearchRegex(query);
- this._collectRegexMatches(regexObject, ranges);
+ this._collectRegexMatches(regexObject, this._searchResults);
// Then try regex search if user knows the / / hint.
try {
if (/^\/.*\/$/.test(query))
- this._collectRegexMatches(new RegExp(query.substring(1, query.length - 1)), ranges);
+ this._collectRegexMatches(new RegExp(query.substring(1, query.length - 1)), this._searchResults);
} catch (e) {
// Silent catch.
}
- finishedCallback(ranges);
+
+ callback(this._searchResults.length);
}
if (this._textViewer)
- doFindSearchMatches.call(this);
+ doFindSearchMatches.call(this, query);
else
- this._delayedFindSearchMatches = doFindSearchMatches.bind(this);
+ this._delayedFindSearchMatches = doFindSearchMatches.bind(this, query);
+
},
- cancelFindSearchMatches: function()
+ searchCanceled: function()
{
delete this._delayedFindSearchMatches;
+ if (!this._textViewer)
+ return;
+
+ this._currentSearchResultIndex = -1;
+ this._searchResults = [];
+ this._textViewer.markAndRevealRange(null);
+ },
+
+ jumpToFirstSearchResult: function()
+ {
+ this._jumpToSearchResult(0);
+ },
+
+ jumpToLastSearchResult: function()
+ {
+ this._jumpToSearchResult(this._searchResults.length - 1);
+ },
+
+ jumpToNextSearchResult: function()
+ {
+ this._jumpToSearchResult(this._currentSearchResultIndex + 1);
+ },
+
+ jumpToPreviousSearchResult: function()
+ {
+ this._jumpToSearchResult(this._currentSearchResultIndex - 1);
+ },
+
+ showingFirstSearchResult: function()
+ {
+ return this._searchResults.length && this._currentSearchResultIndex === 0;
+ },
+
+ showingLastSearchResult: function()
+ {
+ return this._searchResults.length && this._currentSearchResultIndex === (this._searchResults.length - 1);
+ },
+
+ _jumpToSearchResult: function(index)
+ {
+ if (!this._textViewer || !this._searchResults.length)
+ return;
+ this._currentSearchResultIndex = (index + this._searchResults.length) % this._searchResults.length;
+ this._textViewer.markAndRevealRange(this._searchResults[this._currentSearchResultIndex]);
},
_collectRegexMatches: function(regexObject, ranges)
@@ -271,22 +316,6 @@ WebInspector.SourceFrame.prototype = {
return ranges;
},
- markAndRevealRange: function(range)
- {
- if (this._textViewer)
- this._textViewer.markAndRevealRange(range);
- else
- this._pendingMarkRange = range;
- },
-
- clearMarkedRange: function()
- {
- if (this._textViewer) {
- this._textViewer.markAndRevealRange(null);
- } else
- delete this._pendingMarkRange;
- },
-
_incrementMessageRepeatCount: function(msg, repeatDelta)
{
if (!msg._resourceMessageLineElement)
diff --git a/Source/WebCore/inspector/front-end/SourceView.js b/Source/WebCore/inspector/front-end/SourceView.js
index 37caabb..a2e7982 100644
--- a/Source/WebCore/inspector/front-end/SourceView.js
+++ b/Source/WebCore/inspector/front-end/SourceView.js
@@ -47,9 +47,7 @@ WebInspector.SourceView.prototype = {
hide: function()
{
this.sourceFrame.visible = false;
- this.sourceFrame.clearLineHighlight();
WebInspector.View.prototype.hide.call(this);
- this._currentSearchResultIndex = -1;
},
resize: function()
@@ -77,68 +75,42 @@ WebInspector.SourceView.prototype = {
searchCanceled: function()
{
- this._currentSearchResultIndex = -1;
- this._searchResults = [];
- this.sourceFrame.clearMarkedRange();
- this.sourceFrame.cancelFindSearchMatches();
+ this.sourceFrame.searchCanceled();
},
performSearch: function(query, finishedCallback)
{
- // Call searchCanceled since it will reset everything we need before doing a new search.
- this.searchCanceled();
-
- function didFindSearchMatches(searchResults)
- {
- this._searchResults = searchResults;
- if (this._searchResults)
- finishedCallback(this, this._searchResults.length);
- }
- this.sourceFrame.findSearchMatches(query, didFindSearchMatches.bind(this));
+ this.sourceFrame.performSearch(query, finishedCallback.bind(null, this));
},
jumpToFirstSearchResult: function()
{
- if (!this._searchResults || !this._searchResults.length)
- return;
- this._currentSearchResultIndex = 0;
- this._jumpToSearchResult(this._currentSearchResultIndex);
+ this.sourceFrame.jumpToFirstSearchResult();
},
jumpToLastSearchResult: function()
{
- if (!this._searchResults || !this._searchResults.length)
- return;
- this._currentSearchResultIndex = (this._searchResults.length - 1);
- this._jumpToSearchResult(this._currentSearchResultIndex);
+ this.sourceFrame.jumpToLastSearchResult();
},
jumpToNextSearchResult: function()
{
- if (!this._searchResults || !this._searchResults.length)
- return;
- if (++this._currentSearchResultIndex >= this._searchResults.length)
- this._currentSearchResultIndex = 0;
- this._jumpToSearchResult(this._currentSearchResultIndex);
+ this.sourceFrame.jumpToNextSearchResult();
},
jumpToPreviousSearchResult: function()
{
- if (!this._searchResults || !this._searchResults.length)
- return;
- if (--this._currentSearchResultIndex < 0)
- this._currentSearchResultIndex = (this._searchResults.length - 1);
- this._jumpToSearchResult(this._currentSearchResultIndex);
+ this.sourceFrame.jumpToPreviousSearchResult();
},
showingFirstSearchResult: function()
{
- return (this._currentSearchResultIndex === 0);
+ this.sourceFrame.showingFirstSearchResult();
},
showingLastSearchResult: function()
{
- return (this._searchResults && this._currentSearchResultIndex === (this._searchResults.length - 1));
+ this.sourceFrame.showingLastSearchResult();
},
revealLine: function(lineNumber)
@@ -159,15 +131,6 @@ WebInspector.SourceView.prototype = {
clearMessages: function()
{
this.sourceFrame.clearMessages();
- },
-
- _jumpToSearchResult: function(index)
- {
- var foundRange = this._searchResults[index];
- if (!foundRange)
- return;
-
- this.sourceFrame.markAndRevealRange(foundRange);
}
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list