Diff
Modified: trunk/LayoutTests/ChangeLog (97958 => 97959)
--- trunk/LayoutTests/ChangeLog 2011-10-20 10:38:30 UTC (rev 97958)
+++ trunk/LayoutTests/ChangeLog 2011-10-20 11:03:02 UTC (rev 97959)
@@ -1,3 +1,13 @@
+2011-10-20 Vsevolod Vlasov <vse...@chromium.org>
+
+ Web Inspector: Enable support for advanced search in script's static content provider.
+ https://bugs.webkit.org/show_bug.cgi?id=70354
+
+ Reviewed by Pavel Feldman.
+
+ * http/tests/inspector/search/search-in-static-expected.txt: Added.
+ * http/tests/inspector/search/search-in-static.html: Added.
+
2011-10-20 Kentaro Hara <hara...@chromium.org>
Implement a MessageEvent constructor for V8
Added: trunk/LayoutTests/http/tests/inspector/search/search-in-static-expected.txt (0 => 97959)
--- trunk/LayoutTests/http/tests/inspector/search/search-in-static-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/search/search-in-static-expected.txt 2011-10-20 11:03:02 UTC (rev 97959)
@@ -0,0 +1,25 @@
+Tests static content provider search.
+
+Bug 70354
+http://127.0.0.1:8000/inspector/search/resources/search.js
+Search matches:
+lineNumber: 0, line: 'function searchTestUniqueString()'
+lineNumber: 3, line: ' // searchTestUniqueString two occurences on the same line searchTestUniqueString'
+lineNumber: 9, line: ' searchTestUniqueString();'
+
+Search matches:
+lineNumber: 0, line: 'function searchTestUniqueString()'
+lineNumber: 3, line: ' // searchTestUniqueString two occurences on the same line searchTestUniqueString'
+lineNumber: 9, line: ' searchTestUniqueString();'
+
+Search matches:
+lineNumber: 0, line: 'function searchTestUniqueString()'
+lineNumber: 3, line: ' // searchTestUniqueString two occurences on the same line searchTestUniqueString'
+lineNumber: 9, line: ' searchTestUniqueString();'
+
+Search matches:
+lineNumber: 0, line: 'function searchTestUniqueString()'
+lineNumber: 3, line: ' // searchTestUniqueString two occurences on the same line searchTestUniqueString'
+lineNumber: 9, line: ' searchTestUniqueString();'
+
+
Property changes on: trunk/LayoutTests/http/tests/inspector/search/search-in-static-expected.txt
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/http/tests/inspector/search/search-in-static.html (0 => 97959)
--- trunk/LayoutTests/http/tests/inspector/search/search-in-static.html (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/search/search-in-static.html 2011-10-20 11:03:02 UTC (rev 97959)
@@ -0,0 +1,67 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script src=""
+<script>
+function test()
+{
+ InspectorTest.runAfterResourcesAreFinished(["search.js"], step2);
+ var resource;
+ var staticContentProvider;
+
+ function step2()
+ {
+ resource = WebInspector.resourceForURL("http://127.0.0.1:8000/inspector/search/resources/search.js");
+ resource.requestContent(step3);
+ }
+
+ function step3()
+ {
+ staticContentProvider = new WebInspector.StaticContentProvider("text/plain", resource.content);
+ InspectorTest.addResult(resource.url);
+
+ var text = "searchTestUniqueString";
+ staticContentProvider.searchInContent(text, true, false, step4);
+ }
+
+ function step4(searchMatches)
+ {
+ InspectorTest.dumpSearchMatches(searchMatches);
+
+ var text = "searchTestUniqueString";
+ staticContentProvider.searchInContent(text, true, false, step5);
+ }
+
+ function step5(searchMatches)
+ {
+ InspectorTest.dumpSearchMatches(searchMatches);
+
+ var text = "[a-z]earchTestUniqueString";
+ staticContentProvider.searchInContent(text, false, true, step6);
+ }
+
+ function step6(searchMatches)
+ {
+ InspectorTest.dumpSearchMatches(searchMatches);
+
+ var text = "[a-z]earchTestUniqueString";
+ staticContentProvider.searchInContent(text, true, true, step7);
+ }
+
+ function step7(searchMatches)
+ {
+ InspectorTest.dumpSearchMatches(searchMatches);
+
+ InspectorTest.completeTest();
+ }
+}
+</script>
+</head>
+<body>
+<p>Tests static content provider search.</p>
+<a href="" 70354</a>
+
+<iframe src="" _onload_="runTest()">
+</body>
+</html>
Property changes on: trunk/LayoutTests/http/tests/inspector/search/search-in-static.html
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/Source/WebCore/ChangeLog (97958 => 97959)
--- trunk/Source/WebCore/ChangeLog 2011-10-20 10:38:30 UTC (rev 97958)
+++ trunk/Source/WebCore/ChangeLog 2011-10-20 11:03:02 UTC (rev 97959)
@@ -1,3 +1,29 @@
+2011-10-20 Vsevolod Vlasov <vse...@chromium.org>
+
+ Web Inspector: Enable support for advanced search in script's static content provider.
+ https://bugs.webkit.org/show_bug.cgi?id=70354
+
+ Reviewed by Pavel Feldman.
+
+ Test: http/tests/inspector/search/search-in-static.html
+
+ * inspector/front-end/AdvancedSearchController.js:
+ (WebInspector.FileBasedSearchResultsPane.prototype.addSearchResult):
+ * inspector/front-end/ConsolePanel.js:
+ (WebInspector.ConsolePanel.prototype.performSearch):
+ * inspector/front-end/ContentProviders.js:
+ (WebInspector.StaticContentProvider.prototype.searchInContent):
+ * inspector/front-end/ElementsTreeOutline.js:
+ ():
+ * inspector/front-end/NetworkPanel.js:
+ (WebInspector.NetworkLogView.prototype.performSearch):
+ * inspector/front-end/ScriptsPanel.js:
+ (WebInspector.ScriptsPanel.prototype._showSourceLine):
+ * inspector/front-end/SourceFrame.js:
+ (WebInspector.SourceFrame.createSearchRegex):
+ * inspector/front-end/utilities.js:
+ ():
+
2011-10-20 Raphael Kubo da Costa <k...@profusion.mobi>
[EFL] Do not manually set the frameRect in different places in ScrollbarEfl.
Modified: trunk/Source/WebCore/inspector/front-end/AdvancedSearchController.js (97958 => 97959)
--- trunk/Source/WebCore/inspector/front-end/AdvancedSearchController.js 2011-10-20 10:38:30 UTC (rev 97958)
+++ trunk/Source/WebCore/inspector/front-end/AdvancedSearchController.js 2011-10-20 11:03:02 UTC (rev 97959)
@@ -360,25 +360,6 @@
fileName: function(file) { },
/**
- * @return {RegExp}
- */
- _createSearchRegex: function()
- {
- var regexFlags = this._searchConfig.ignoreCase ? "gi" : "g";
- var regexObject;
- try {
- regexObject = new RegExp(this._searchConfig.query, regexFlags);
- } catch (e) {
- // Silent catch.
- }
-
- if (!regexObject)
- regexObject = createSearchRegex(this._searchConfig.query, regexFlags);
-
- return regexObject;
- },
-
- /**
* @param {Object} searchResult
*/
addSearchResult: function(searchResult)
@@ -391,7 +372,7 @@
// Expand first file with matches only.
var fileTreeElement = this._addFileTreeElement(fileName, searchMatches.length, this._searchResults.length === 1);
- var regexObject = this._createSearchRegex();
+ var regexObject = createSearchRegex(this._searchConfig.query, !this._searchConfig.ignoreCase, this._searchConfig.isRegex);
for (var i = 0; i < searchMatches.length; i++) {
var lineNumber = searchMatches[i].lineNumber;
Modified: trunk/Source/WebCore/inspector/front-end/ConsolePanel.js (97958 => 97959)
--- trunk/Source/WebCore/inspector/front-end/ConsolePanel.js 2011-10-20 10:38:30 UTC (rev 97958)
+++ trunk/Source/WebCore/inspector/front-end/ConsolePanel.js 2011-10-20 11:03:02 UTC (rev 97959)
@@ -82,7 +82,7 @@
{
WebInspector.searchController.updateSearchMatchesCount(0, this);
this.searchCanceled();
- this._searchRegex = createSearchRegex(query, "gi");
+ this._searchRegex = createPlainTextSearchRegex(query, "gi");
this._searchResults = [];
var messages = WebInspector.consoleView.messages;
Modified: trunk/Source/WebCore/inspector/front-end/ContentProviders.js (97958 => 97959)
--- trunk/Source/WebCore/inspector/front-end/ContentProviders.js 2011-10-20 10:38:30 UTC (rev 97958)
+++ trunk/Source/WebCore/inspector/front-end/ContentProviders.js 2011-10-20 11:03:02 UTC (rev 97959)
@@ -304,7 +304,27 @@
*/
searchInContent: function(query, caseSensitive, isRegex, callback)
{
- callback([]);
+ function performSearch()
+ {
+ var regex = createSearchRegex(query, caseSensitive, isRegex);
+
+ var result = [];
+ var lineEndings = this._content.lineEndings();
+ for (var i = 0; i < lineEndings.length; ++i) {
+ var lineStart = i > 0 ? lineEndings[i - 1] + 1 : 0;
+ var lineEnd = lineEndings[i];
+ var lineContent = this._content.substring(lineStart, lineEnd);
+ if (lineContent.length > 0 && lineContent.charAt(lineContent.length - 1) === "\r")
+ lineContent = lineContent.substring(0, lineContent.length - 1)
+
+ if (regex.exec(lineContent))
+ result.push(new WebInspector.ContentProvider.SearchMatch(i, lineContent));
+ }
+ callback(result);
+ }
+
+ // searchInContent should call back later.
+ window.setTimeout(performSearch.bind(this), 0);
}
}
Modified: trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js (97958 => 97959)
--- trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js 2011-10-20 10:38:30 UTC (rev 97958)
+++ trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js 2011-10-20 11:03:02 UTC (rev 97959)
@@ -1689,7 +1689,7 @@
}
var text = this.listItemElement.textContent;
- var regexObject = createSearchRegex(this._searchQuery, "gi");
+ var regexObject = createPlainTextSearchRegex(this._searchQuery, "gi");
var offset = 0;
var match = regexObject.exec(text);
Modified: trunk/Source/WebCore/inspector/front-end/NetworkPanel.js (97958 => 97959)
--- trunk/Source/WebCore/inspector/front-end/NetworkPanel.js 2011-10-20 10:38:30 UTC (rev 97958)
+++ trunk/Source/WebCore/inspector/front-end/NetworkPanel.js 2011-10-20 11:03:02 UTC (rev 97959)
@@ -1138,7 +1138,7 @@
currentMatchedRequestId = this._matchedResources[this._currentMatchedResourceIndex];
if (!sortOrFilterApplied)
- this._searchRegExp = createSearchRegex(searchQuery, "i");
+ this._searchRegExp = createPlainTextSearchRegex(searchQuery, "i");
this._clearSearchMatchedList();
Modified: trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js (97958 => 97959)
--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js 2011-10-20 10:38:30 UTC (rev 97958)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js 2011-10-20 11:03:02 UTC (rev 97959)
@@ -643,7 +643,7 @@
_showSourceLine: function(uiSourceCode, lineNumber)
{
var sourceFrame = this._showSourceFrameAndAddToHistory(uiSourceCode);
- if (lineNumber)
+ if (typeof lineNumber === "number")
sourceFrame.highlightLine(lineNumber);
},
Modified: trunk/Source/WebCore/inspector/front-end/SourceFrame.js (97958 => 97959)
--- trunk/Source/WebCore/inspector/front-end/SourceFrame.js 2011-10-20 10:38:30 UTC (rev 97958)
+++ trunk/Source/WebCore/inspector/front-end/SourceFrame.js 2011-10-20 11:03:02 UTC (rev 97959)
@@ -82,7 +82,7 @@
// Otherwise just do case-insensitive search.
if (!regex)
- regex = createSearchRegex(query, "i");
+ regex = createPlainTextSearchRegex(query, "i");
return regex;
}
Modified: trunk/Source/WebCore/inspector/front-end/utilities.js (97958 => 97959)
--- trunk/Source/WebCore/inspector/front-end/utilities.js 2011-10-20 10:38:30 UTC (rev 97958)
+++ trunk/Source/WebCore/inspector/front-end/utilities.js 2011-10-20 11:03:02 UTC (rev 97959)
@@ -976,10 +976,36 @@
}
/**
+ * @param {string} query
+ * @param {boolean} ignoreCase
+ * @param {boolean} isRegex
+ * @return {RegExp}
+ */
+function createSearchRegex(query, caseSensitive, isRegex)
+{
+ var regexFlags = caseSensitive ? "g" : "gi";
+ var regexObject;
+
+ if (isRegex) {
+ try {
+ regexObject = new RegExp(query, regexFlags);
+ } catch (e) {
+ // Silent catch.
+ }
+ }
+
+ if (!regexObject)
+ regexObject = createPlainTextSearchRegex(query, regexFlags);
+
+ return regexObject;
+}
+
+/**
+ * @param {string} query
* @param {string=} flags
* @return {RegExp}
*/
-function createSearchRegex(query, flags)
+function createPlainTextSearchRegex(query, flags)
{
// This should be kept the same as the one in ContentSearchUtils.cpp.
var regexSpecialCharacters = "[](){}+-*.,?\\^$|";