Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(676)

Side by Side Diff: Source/WebCore/inspector/front-end/utilities.js

Issue 8368025: Merge 97959 - Web Inspector: Enable support for advanced search in script's static content provider. (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/912/
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/WebCore/inspector/front-end/SourceFrame.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 entry.node.parentElement.removeChild(entry.node); 969 entry.node.parentElement.removeChild(entry.node);
970 break; 970 break;
971 case "changed": 971 case "changed":
972 entry.node.textContent = entry.oldText; 972 entry.node.textContent = entry.oldText;
973 break; 973 break;
974 } 974 }
975 } 975 }
976 } 976 }
977 977
978 /** 978 /**
979 * @param {string} query
980 * @param {boolean} ignoreCase
981 * @param {boolean} isRegex
982 * @return {RegExp}
983 */
984 function createSearchRegex(query, caseSensitive, isRegex)
985 {
986 var regexFlags = caseSensitive ? "g" : "gi";
987 var regexObject;
988
989 if (isRegex) {
990 try {
991 regexObject = new RegExp(query, regexFlags);
992 } catch (e) {
993 // Silent catch.
994 }
995 }
996
997 if (!regexObject)
998 regexObject = createPlainTextSearchRegex(query, regexFlags);
999
1000 return regexObject;
1001 }
1002
1003 /**
1004 * @param {string} query
979 * @param {string=} flags 1005 * @param {string=} flags
980 * @return {RegExp} 1006 * @return {RegExp}
981 */ 1007 */
982 function createSearchRegex(query, flags) 1008 function createPlainTextSearchRegex(query, flags)
983 { 1009 {
984 // This should be kept the same as the one in ContentSearchUtils.cpp. 1010 // This should be kept the same as the one in ContentSearchUtils.cpp.
985 var regexSpecialCharacters = "[](){}+-*.,?\\^$|"; 1011 var regexSpecialCharacters = "[](){}+-*.,?\\^$|";
986 var regex = ""; 1012 var regex = "";
987 for (var i = 0; i < query.length; ++i) { 1013 for (var i = 0; i < query.length; ++i) {
988 var c = query.charAt(i); 1014 var c = query.charAt(i);
989 if (regexSpecialCharacters.indexOf(c) != -1) 1015 if (regexSpecialCharacters.indexOf(c) != -1)
990 regex += "\\"; 1016 regex += "\\";
991 regex += c; 1017 regex += c;
992 } 1018 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 diffData.changed.push(i); 1082 diffData.changed.push(i);
1057 else { 1083 else {
1058 diffData.added.push(i); 1084 diffData.added.push(i);
1059 offset++; 1085 offset++;
1060 } 1086 }
1061 } else 1087 } else
1062 offset = i - right[i].row; 1088 offset = i - right[i].row;
1063 } 1089 }
1064 return diffData; 1090 return diffData;
1065 } 1091 }
OLDNEW
« no previous file with comments | « Source/WebCore/inspector/front-end/SourceFrame.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698