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

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

Issue 7218041: Merge 89666 - 2011-06-23 Mikhail Naganov <mnaganov@chromium.org> (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/782/
Patch Set: Created 9 years, 5 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/DetailedHeapshotView.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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 String.prototype.escapeHTML = function() 444 String.prototype.escapeHTML = function()
445 { 445 {
446 return this.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt; ").replace(/"/g, "&quot;"); 446 return this.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt; ").replace(/"/g, "&quot;");
447 } 447 }
448 448
449 String.prototype.collapseWhitespace = function() 449 String.prototype.collapseWhitespace = function()
450 { 450 {
451 return this.replace(/[\s\xA0]+/g, " "); 451 return this.replace(/[\s\xA0]+/g, " ");
452 } 452 }
453 453
454 String.prototype.trimMiddle = function(maxLength)
455 {
456 if (this.length <= maxLength)
457 return this;
458 var leftHalf = maxLength >> 1;
459 var rightHalf = maxLength - leftHalf - 1;
460 return this.substr(0, leftHalf) + "\u2026" + this.substr(this.length - right Half, rightHalf);
461 }
462
454 String.prototype.trimURL = function(baseURLDomain) 463 String.prototype.trimURL = function(baseURLDomain)
455 { 464 {
456 var result = this.replace(/^(https|http|file):\/\//i, ""); 465 var result = this.replace(/^(https|http|file):\/\//i, "");
457 if (baseURLDomain) 466 if (baseURLDomain)
458 result = result.replace(new RegExp("^" + baseURLDomain.escapeForRegExp() , "i"), ""); 467 result = result.replace(new RegExp("^" + baseURLDomain.escapeForRegExp() , "i"), "");
459 return result; 468 return result;
460 } 469 }
461 470
462 String.prototype.removeURLFragment = function() 471 String.prototype.removeURLFragment = function()
463 { 472 {
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 var text = content; 1068 var text = content;
1060 var result = 0; 1069 var result = 0;
1061 var match; 1070 var match;
1062 while (text && (match = regex.exec(text))) { 1071 while (text && (match = regex.exec(text))) {
1063 if (match[0].length > 0) 1072 if (match[0].length > 0)
1064 ++result; 1073 ++result;
1065 text = text.substring(match.index + 1); 1074 text = text.substring(match.index + 1);
1066 } 1075 }
1067 return result; 1076 return result;
1068 } 1077 }
OLDNEW
« no previous file with comments | « Source/WebCore/inspector/front-end/DetailedHeapshotView.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698