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

Side by Side Diff: chrome_linux64/resources/inspector/ScriptFormatterWorker.js

Issue 310483004: Roll reference builds to 35.0.1916.114. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/reference_builds/
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 Object.isEmpty=function(obj) 1 Object.isEmpty=function(obj)
2 {for(var i in obj) 2 {for(var i in obj)
3 return false;return true;} 3 return false;return true;}
4 Object.values=function(obj) 4 Object.values=function(obj)
5 {var result=Object.keys(obj);var length=result.length;for(var i=0;i<length;++i) 5 {var result=Object.keys(obj);var length=result.length;for(var i=0;i<length;++i)
6 result[i]=obj[result[i]];return result;} 6 result[i]=obj[result[i]];return result;}
7 String.prototype.findAll=function(string) 7 String.prototype.findAll=function(string)
8 {var matches=[];var i=this.indexOf(string);while(i!==-1){matches.push(i);i=this. indexOf(string,i+string.length);} 8 {var matches=[];var i=this.indexOf(string);while(i!==-1){matches.push(i);i=this. indexOf(string,i+string.length);}
9 return matches;} 9 return matches;}
10 String.prototype.lineEndings=function() 10 String.prototype.lineEndings=function()
11 {if(!this._lineEndings){this._lineEndings=this.findAll("\n");this._lineEndings.p ush(this.length);} 11 {if(!this._lineEndings){this._lineEndings=this.findAll("\n");this._lineEndings.p ush(this.length);}
12 return this._lineEndings;} 12 return this._lineEndings;}
13 String.prototype.lineCount=function()
14 {var lineEndings=this.lineEndings();return lineEndings.length;}
15 String.prototype.lineAt=function(lineNumber)
16 {var lineEndings=this.lineEndings();var lineStart=lineNumber>0?lineEndings[lineN umber-1]+1:0;var lineEnd=lineEndings[lineNumber];var lineContent=this.substring( lineStart,lineEnd);if(lineContent.length>0&&lineContent.charAt(lineContent.lengt h-1)==="\r")
17 lineContent=lineContent.substring(0,lineContent.length-1);return lineContent;}
13 String.prototype.escapeCharacters=function(chars) 18 String.prototype.escapeCharacters=function(chars)
14 {var foundChar=false;for(var i=0;i<chars.length;++i){if(this.indexOf(chars.charA t(i))!==-1){foundChar=true;break;}} 19 {var foundChar=false;for(var i=0;i<chars.length;++i){if(this.indexOf(chars.charA t(i))!==-1){foundChar=true;break;}}
15 if(!foundChar) 20 if(!foundChar)
16 return String(this);var result="";for(var i=0;i<this.length;++i){if(chars.indexO f(this.charAt(i))!==-1) 21 return String(this);var result="";for(var i=0;i<this.length;++i){if(chars.indexO f(this.charAt(i))!==-1)
17 result+="\\";result+=this.charAt(i);} 22 result+="\\";result+=this.charAt(i);}
18 return result;} 23 return result;}
19 String.regexSpecialCharacters=function() 24 String.regexSpecialCharacters=function()
20 {return"^[]{}()\\.$*+?|-,";} 25 {return"^[]{}()\\.^$*+?|-,";}
21 String.prototype.escapeForRegExp=function() 26 String.prototype.escapeForRegExp=function()
22 {return this.escapeCharacters(String.regexSpecialCharacters());} 27 {return this.escapeCharacters(String.regexSpecialCharacters());}
23 String.prototype.escapeHTML=function() 28 String.prototype.escapeHTML=function()
24 {return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").rep lace(/"/g,"&quot;");} 29 {return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").rep lace(/"/g,"&quot;");}
25 String.prototype.collapseWhitespace=function() 30 String.prototype.collapseWhitespace=function()
26 {return this.replace(/[\s\xA0]+/g," ");} 31 {return this.replace(/[\s\xA0]+/g," ");}
27 String.prototype.trimMiddle=function(maxLength) 32 String.prototype.trimMiddle=function(maxLength)
28 {if(this.length<=maxLength) 33 {if(this.length<=maxLength)
29 return String(this);var leftHalf=maxLength>>1;var rightHalf=maxLength-leftHalf-1 ;return this.substr(0,leftHalf)+"\u2026"+this.substr(this.length-rightHalf,right Half);} 34 return String(this);var leftHalf=maxLength>>1;var rightHalf=maxLength-leftHalf-1 ;return this.substr(0,leftHalf)+"\u2026"+this.substr(this.length-rightHalf,right Half);}
30 String.prototype.trimEnd=function(maxLength) 35 String.prototype.trimEnd=function(maxLength)
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 return value;var number=Number(value);return number%1?number.toFixed(3):String(n umber);} 81 return value;var number=Number(value);return number%1?number.toFixed(3):String(n umber);}
77 Date.prototype.toISO8601Compact=function() 82 Date.prototype.toISO8601Compact=function()
78 {function leadZero(x) 83 {function leadZero(x)
79 {return(x>9?"":"0")+x;} 84 {return(x>9?"":"0")+x;}
80 return this.getFullYear()+ 85 return this.getFullYear()+
81 leadZero(this.getMonth()+1)+ 86 leadZero(this.getMonth()+1)+
82 leadZero(this.getDate())+"T"+ 87 leadZero(this.getDate())+"T"+
83 leadZero(this.getHours())+ 88 leadZero(this.getHours())+
84 leadZero(this.getMinutes())+ 89 leadZero(this.getMinutes())+
85 leadZero(this.getSeconds());} 90 leadZero(this.getSeconds());}
86 Object.defineProperty(Array.prototype,"remove",{value:function(value,onlyFirst) 91 Date.prototype.toConsoleTime=function()
87 {if(onlyFirst){var index=this.indexOf(value);if(index!==-1) 92 {function leadZero2(x)
88 this.splice(index,1);return;} 93 {return(x>9?"":"0")+x;}
89 var length=this.length;for(var i=0;i<length;++i){if(this[i]===value) 94 function leadZero3(x)
90 this.splice(i,1);}}});Object.defineProperty(Array.prototype,"keySet",{value:func tion() 95 {return(Array(4-x.toString().length)).join('0')+x;}
96 return this.getFullYear()+"-"+
97 leadZero2(this.getMonth()+1)+"-"+
98 leadZero2(this.getDate())+" "+
99 leadZero2(this.getHours())+":"+
100 leadZero2(this.getMinutes())+":"+
101 leadZero2(this.getSeconds())+"."+
102 leadZero3(this.getMilliseconds());}
103 Object.defineProperty(Array.prototype,"remove",{value:function(value,firstOnly)
104 {var index=this.indexOf(value);if(index===-1)
105 return;if(firstOnly){this.splice(index,1);return;}
106 for(var i=index+1,n=this.length;i<n;++i){if(this[i]!==value)
107 this[index++]=this[i];}
108 this.length=index;}});Object.defineProperty(Array.prototype,"keySet",{value:func tion()
91 {var keys={};for(var i=0;i<this.length;++i) 109 {var keys={};for(var i=0;i<this.length;++i)
92 keys[this[i]]=true;return keys;}});Object.defineProperty(Array.prototype,"rotate ",{value:function(index) 110 keys[this[i]]=true;return keys;}});Object.defineProperty(Array.prototype,"rotate ",{value:function(index)
93 {var result=[];for(var i=index;i<index+this.length;++i) 111 {var result=[];for(var i=index;i<index+this.length;++i)
94 result.push(this[i%this.length]);return result;}});Object.defineProperty(Uint32A rray.prototype,"sort",{value:Array.prototype.sort});(function(){var partition={v alue:function(comparator,left,right,pivotIndex) 112 result.push(this[i%this.length]);return result;}});Object.defineProperty(Uint32A rray.prototype,"sort",{value:Array.prototype.sort});(function(){var partition={v alue:function(comparator,left,right,pivotIndex)
95 {function swap(array,i1,i2) 113 {function swap(array,i1,i2)
96 {var temp=array[i1];array[i1]=array[i2];array[i2]=temp;} 114 {var temp=array[i1];array[i1]=array[i2];array[i2]=temp;}
97 var pivotValue=this[pivotIndex];swap(this,right,pivotIndex);var storeIndex=left; for(var i=left;i<right;++i){if(comparator(this[i],pivotValue)<0){swap(this,store Index,i);++storeIndex;}} 115 var pivotValue=this[pivotIndex];swap(this,right,pivotIndex);var storeIndex=left; for(var i=left;i<right;++i){if(comparator(this[i],pivotValue)<0){swap(this,store Index,i);++storeIndex;}}
98 swap(this,right,storeIndex);return storeIndex;}};Object.defineProperty(Array.pro totype,"partition",partition);Object.defineProperty(Uint32Array.prototype,"parti tion",partition);var sortRange={value:function(comparator,leftBound,rightBound,s ortWindowLeft,sortWindowRight) 116 swap(this,right,storeIndex);return storeIndex;}};Object.defineProperty(Array.pro totype,"partition",partition);Object.defineProperty(Uint32Array.prototype,"parti tion",partition);var sortRange={value:function(comparator,leftBound,rightBound,s ortWindowLeft,sortWindowRight)
99 {function quickSortRange(array,comparator,left,right,sortWindowLeft,sortWindowRi ght) 117 {function quickSortRange(array,comparator,left,right,sortWindowLeft,sortWindowRi ght)
100 {if(right<=left) 118 {if(right<=left)
(...skipping 11 matching lines...) Expand all
112 {var result=comparator(self[a],self[b]);return result?result:a-b;} 130 {var result=comparator(self[a],self[b]);return result?result:a-b;}
113 indices.sort(indexComparator);for(var i=0;i<this.length;++i){if(indices[i]<0||i= ==indices[i]) 131 indices.sort(indexComparator);for(var i=0;i<this.length;++i){if(indices[i]<0||i= ==indices[i])
114 continue;var cyclical=i;var saved=this[i];while(true){var next=indices[cyclical] ;indices[cyclical]=-1;if(next===i){this[cyclical]=saved;break;}else{this[cyclica l]=this[next];cyclical=next;}}} 132 continue;var cyclical=i;var saved=this[i];while(true){var next=indices[cyclical] ;indices[cyclical]=-1;if(next===i){this[cyclical]=saved;break;}else{this[cyclica l]=this[next];cyclical=next;}}}
115 return this;}});Object.defineProperty(Array.prototype,"qselect",{value:function( k,comparator) 133 return this;}});Object.defineProperty(Array.prototype,"qselect",{value:function( k,comparator)
116 {if(k<0||k>=this.length) 134 {if(k<0||k>=this.length)
117 return;if(!comparator) 135 return;if(!comparator)
118 comparator=function(a,b){return a-b;} 136 comparator=function(a,b){return a-b;}
119 var low=0;var high=this.length-1;for(;;){var pivotPosition=this.partition(compar ator,low,high,Math.floor((high+low)/2));if(pivotPosition===k) 137 var low=0;var high=this.length-1;for(;;){var pivotPosition=this.partition(compar ator,low,high,Math.floor((high+low)/2));if(pivotPosition===k)
120 return this[k];else if(pivotPosition>k) 138 return this[k];else if(pivotPosition>k)
121 high=pivotPosition-1;else 139 high=pivotPosition-1;else
122 low=pivotPosition+1;}}});Object.defineProperty(Array.prototype,"lowerBound",{val ue:function(object,comparator) 140 low=pivotPosition+1;}}});Object.defineProperty(Array.prototype,"lowerBound",{val ue:function(object,comparator,left,right)
123 {function defaultComparator(a,b) 141 {function defaultComparator(a,b)
124 {return a<b?-1:(a>b?1:0);} 142 {return a<b?-1:(a>b?1:0);}
125 comparator=comparator||defaultComparator;var l=0;var r=this.length;while(l<r){va r m=(l+r)>>1;if(comparator(object,this[m])>0) 143 comparator=comparator||defaultComparator;var l=left||0;var r=right!==undefined?r ight:this.length;while(l<r){var m=(l+r)>>1;if(comparator(object,this[m])>0)
126 l=m+1;else 144 l=m+1;else
127 r=m;} 145 r=m;}
128 return r;}});Object.defineProperty(Array.prototype,"upperBound",{value:function( object,comparator) 146 return r;}});Object.defineProperty(Array.prototype,"upperBound",{value:function( object,comparator,left,right)
129 {function defaultComparator(a,b) 147 {function defaultComparator(a,b)
130 {return a<b?-1:(a>b?1:0);} 148 {return a<b?-1:(a>b?1:0);}
131 comparator=comparator||defaultComparator;var l=0;var r=this.length;while(l<r){va r m=(l+r)>>1;if(comparator(object,this[m])>=0) 149 comparator=comparator||defaultComparator;var l=left||0;var r=right!==undefined?r ight:this.length;while(l<r){var m=(l+r)>>1;if(comparator(object,this[m])>=0)
132 l=m+1;else 150 l=m+1;else
133 r=m;} 151 r=m;}
134 return r;}});Object.defineProperty(Array.prototype,"binaryIndexOf",{value:functi on(value,comparator) 152 return r;}});Object.defineProperty(Array.prototype,"binaryIndexOf",{value:functi on(value,comparator)
135 {var index=this.lowerBound(value,comparator);return index<this.length&&comparato r(value,this[index])===0?index:-1;}});Object.defineProperty(Array.prototype,"sel ect",{value:function(field) 153 {var index=this.lowerBound(value,comparator);return index<this.length&&comparato r(value,this[index])===0?index:-1;}});Object.defineProperty(Array.prototype,"sel ect",{value:function(field)
136 {var result=new Array(this.length);for(var i=0;i<this.length;++i) 154 {var result=new Array(this.length);for(var i=0;i<this.length;++i)
137 result[i]=this[i][field];return result;}});Object.defineProperty(Array.prototype ,"peekLast",{value:function() 155 result[i]=this[i][field];return result;}});Object.defineProperty(Array.prototype ,"peekLast",{value:function()
138 {return this[this.length-1];}});(function(){function mergeOrIntersect(array1,arr ay2,comparator,mergeNotIntersect) 156 {return this[this.length-1];}});(function(){function mergeOrIntersect(array1,arr ay2,comparator,mergeNotIntersect)
139 {var result=[];var i=0;var j=0;while(i<array1.length||j<array2.length){if(i===ar ray1.length){result=result.concat(array2.slice(j));j=array2.length;}else if(j=== array2.length){result=result.concat(array1.slice(i));i=array1.length;}else{var c ompareValue=comparator(array1[i],array2[j]) 157 {var result=[];var i=0;var j=0;while(i<array1.length&&j<array2.length){var compa reValue=comparator(array1[i],array2[j]);if(mergeNotIntersect||!compareValue)
140 if(compareValue<0){if(mergeNotIntersect) 158 result.push(compareValue<=0?array1[i]:array2[j]);if(compareValue<=0)
141 result.push(array1[i]);++i;}else if(compareValue>0){if(mergeNotIntersect) 159 i++;if(compareValue>=0)
142 result.push(array2[j]);++j;}else{result.push(array1[i]);++i;++j;}}} 160 j++;}
161 if(mergeNotIntersect){while(i<array1.length)
162 result.push(array1[i++]);while(j<array2.length)
163 result.push(array2[j++]);}
143 return result;} 164 return result;}
144 Object.defineProperty(Array.prototype,"intersectOrdered",{value:function(array,c omparator) 165 Object.defineProperty(Array.prototype,"intersectOrdered",{value:function(array,c omparator)
145 {return mergeOrIntersect(this,array,comparator,false);}});Object.defineProperty( Array.prototype,"mergeOrdered",{value:function(array,comparator) 166 {return mergeOrIntersect(this,array,comparator,false);}});Object.defineProperty( Array.prototype,"mergeOrdered",{value:function(array,comparator)
146 {return mergeOrIntersect(this,array,comparator,true);}});}());function insertion IndexForObjectInListSortedByFunction(object,list,comparator,insertionIndexAfter) 167 {return mergeOrIntersect(this,array,comparator,true);}});}());function insertion IndexForObjectInListSortedByFunction(object,list,comparator,insertionIndexAfter)
147 {if(insertionIndexAfter) 168 {if(insertionIndexAfter)
148 return list.upperBound(object,comparator);else 169 return list.upperBound(object,comparator);else
149 return list.lowerBound(object,comparator);} 170 return list.lowerBound(object,comparator);}
150 String.sprintf=function(format,var_arg) 171 String.sprintf=function(format,var_arg)
151 {return String.vsprintf(format,Array.prototype.slice.call(arguments,1));} 172 {return String.vsprintf(format,Array.prototype.slice.call(arguments,1));}
152 String.tokenizeFormatString=function(format,formatters) 173 String.tokenizeFormatString=function(format,formatters)
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 result.push("__proto__");return result;},values:function() 268 result.push("__proto__");return result;},values:function()
248 {var result=Object.values(this._map);if(this._hasProtoKey) 269 {var result=Object.values(this._map);if(this._hasProtoKey)
249 result.push(this._protoValue);return result;},get:function(key) 270 result.push(this._protoValue);return result;},get:function(key)
250 {if(key==="__proto__") 271 {if(key==="__proto__")
251 return this._protoValue;if(!Object.prototype.hasOwnProperty.call(this._map,key)) 272 return this._protoValue;if(!Object.prototype.hasOwnProperty.call(this._map,key))
252 return undefined;return this._map[key];},contains:function(key) 273 return undefined;return this._map[key];},contains:function(key)
253 {var result;if(key==="__proto__") 274 {var result;if(key==="__proto__")
254 return this._hasProtoKey;return Object.prototype.hasOwnProperty.call(this._map,k ey);},size:function() 275 return this._hasProtoKey;return Object.prototype.hasOwnProperty.call(this._map,k ey);},size:function()
255 {return this._size;},clear:function() 276 {return this._size;},clear:function()
256 {this._map={};this._size=0;delete this._hasProtoKey;delete this._protoValue;}} 277 {this._map={};this._size=0;delete this._hasProtoKey;delete this._protoValue;}}
278 var StringSet=function()
279 {this._map=new StringMap();}
280 StringSet.prototype={put:function(value)
281 {this._map.put(value,true);},remove:function(value)
282 {return!!this._map.remove(value);},values:function()
283 {return this._map.keys();},contains:function(value)
284 {return this._map.contains(value);},size:function()
285 {return this._map.size();},clear:function()
286 {this._map.clear();}}
257 function loadXHR(url,async,callback) 287 function loadXHR(url,async,callback)
258 {function onReadyStateChanged() 288 {function onReadyStateChanged()
259 {if(xhr.readyState!==XMLHttpRequest.DONE) 289 {if(xhr.readyState!==XMLHttpRequest.DONE)
260 return;if(xhr.status===200){callback(xhr.responseText);return;} 290 return;if(xhr.status===200){callback(xhr.responseText);return;}
261 callback(null);} 291 callback(null);}
262 var xhr=new XMLHttpRequest();xhr.open("GET",url,async);if(async) 292 var xhr=new XMLHttpRequest();xhr.open("GET",url,async);if(async)
263 xhr.onreadystatechange=onReadyStateChanged;xhr.send(null);if(!async){if(xhr.stat us===200) 293 xhr.onreadystatechange=onReadyStateChanged;xhr.send(null);if(!async){if(xhr.stat us===200)
264 return xhr.responseText;return null;} 294 return xhr.responseText;return null;}
265 return null;} 295 return null;}
266 function StringPool()
267 {this.reset();}
268 StringPool.prototype={intern:function(string)
269 {if(string==="__proto__")
270 return"__proto__";var result=this._strings[string];if(result===undefined){this._ strings[string]=string;result=string;}
271 return result;},reset:function()
272 {this._strings=Object.create(null);},internObjectStrings:function(obj,depthLimit )
273 {if(typeof depthLimit!=="number")
274 depthLimit=100;else if(--depthLimit<0)
275 throw"recursion depth limit reached in StringPool.deepIntern(), perhaps attempti ng to traverse cyclical references?";for(var field in obj){switch(typeof obj[fie ld]){case"string":obj[field]=this.intern(obj[field]);break;case"object":this.int ernObjectStrings(obj[field],depthLimit);break;}}}}
276 var _importedScripts={};function importScript(scriptName) 296 var _importedScripts={};function importScript(scriptName)
277 {if(_importedScripts[scriptName]) 297 {if(_importedScripts[scriptName])
278 return;var xhr=new XMLHttpRequest();_importedScripts[scriptName]=true;xhr.open(" GET",scriptName,false);xhr.send(null);if(!xhr.responseText) 298 return;var xhr=new XMLHttpRequest();_importedScripts[scriptName]=true;xhr.open(" GET",scriptName,false);xhr.send(null);if(!xhr.responseText)
279 throw"empty response arrived for script '"+scriptName+"'";var baseUrl=location.h ref;baseUrl=baseUrl.substring(0,baseUrl.lastIndexOf("/"));var sourceURL=baseUrl+ "/"+scriptName;eval(xhr.responseText+"\n//# sourceURL="+sourceURL);} 299 throw"empty response arrived for script '"+scriptName+"'";var baseUrl=location.o rigin+location.pathname;baseUrl=baseUrl.substring(0,baseUrl.lastIndexOf("/"));va r sourceURL=baseUrl+"/"+scriptName;self.eval(xhr.responseText+"\n//# sourceURL=" +sourceURL);}
280 var loadScript=importScript;function CallbackBarrier() 300 var loadScript=importScript;function CallbackBarrier()
281 {this._pendingIncomingCallbacksCount=0;} 301 {this._pendingIncomingCallbacksCount=0;}
282 CallbackBarrier.prototype={createCallback:function(userCallback) 302 CallbackBarrier.prototype={createCallback:function(userCallback)
283 {console.assert(!this._outgoingCallback,"CallbackBarrier.createCallback() is cal led after CallbackBarrier.callWhenDone()");++this._pendingIncomingCallbacksCount ;return this._incomingCallback.bind(this,userCallback);},callWhenDone:function(c allback) 303 {console.assert(!this._outgoingCallback,"CallbackBarrier.createCallback() is cal led after CallbackBarrier.callWhenDone()");++this._pendingIncomingCallbacksCount ;return this._incomingCallback.bind(this,userCallback);},callWhenDone:function(c allback)
284 {console.assert(!this._outgoingCallback,"CallbackBarrier.callWhenDone() is calle d multiple times");this._outgoingCallback=callback;if(!this._pendingIncomingCall backsCount) 304 {console.assert(!this._outgoingCallback,"CallbackBarrier.callWhenDone() is calle d multiple times");this._outgoingCallback=callback;if(!this._pendingIncomingCall backsCount)
285 this._outgoingCallback();},_incomingCallback:function(userCallback) 305 this._outgoingCallback();},_incomingCallback:function(userCallback)
286 {console.assert(this._pendingIncomingCallbacksCount>0);if(userCallback){var args =Array.prototype.slice.call(arguments,1);userCallback.apply(null,args);} 306 {console.assert(this._pendingIncomingCallbacksCount>0);if(userCallback){var args =Array.prototype.slice.call(arguments,1);userCallback.apply(null,args);}
287 if(!--this._pendingIncomingCallbacksCount&&this._outgoingCallback) 307 if(!--this._pendingIncomingCallbacksCount&&this._outgoingCallback)
288 this._outgoingCallback();}};(function(window){window.CodeMirror={};(function(){" use strict";function splitLines(string){return string.split(/\r?\n|\r/);};functi on StringStream(string){this.pos=this.start=0;this.string=string;this.lineStart= 0;} 308 this._outgoingCallback();}}
309 function suppressUnused(value)
310 {};(function(window){window.CodeMirror={};(function(){"use strict";function spli tLines(string){return string.split(/\r?\n|\r/);};function StringStream(string){t his.pos=this.start=0;this.string=string;this.lineStart=0;}
289 StringStream.prototype={eol:function(){return this.pos>=this.string.length;},sol :function(){return this.pos==0;},peek:function(){return this.string.charAt(this. pos)||null;},next:function(){if(this.pos<this.string.length) 311 StringStream.prototype={eol:function(){return this.pos>=this.string.length;},sol :function(){return this.pos==0;},peek:function(){return this.string.charAt(this. pos)||null;},next:function(){if(this.pos<this.string.length)
290 return this.string.charAt(this.pos++);},eat:function(match){var ch=this.string.c harAt(this.pos);if(typeof match=="string")var ok=ch==match;else var ok=ch&&(matc h.test?match.test(ch):match(ch));if(ok){++this.pos;return ch;}},eatWhile:functio n(match){var start=this.pos;while(this.eat(match)){} 312 return this.string.charAt(this.pos++);},eat:function(match){var ch=this.string.c harAt(this.pos);if(typeof match=="string")var ok=ch==match;else var ok=ch&&(matc h.test?match.test(ch):match(ch));if(ok){++this.pos;return ch;}},eatWhile:functio n(match){var start=this.pos;while(this.eat(match)){}
291 return this.pos>start;},eatSpace:function(){var start=this.pos;while(/[\s\u00a0] /.test(this.string.charAt(this.pos)))++this.pos;return this.pos>start;},skipToEn d:function(){this.pos=this.string.length;},skipTo:function(ch){var found=this.st ring.indexOf(ch,this.pos);if(found>-1){this.pos=found;return true;}},backUp:func tion(n){this.pos-=n;},column:function(){return this.start-this.lineStart;},inden tation:function(){return 0;},match:function(pattern,consume,caseInsensitive){if( typeof pattern=="string"){var cased=function(str){return caseInsensitive?str.toL owerCase():str;};var substr=this.string.substr(this.pos,pattern.length);if(cased (substr)==cased(pattern)){if(consume!==false)this.pos+=pattern.length;return tru e;}}else{var match=this.string.slice(this.pos).match(pattern);if(match&&match.in dex>0)return null;if(match&&consume!==false)this.pos+=match[0].length;return mat ch;}},current:function(){return this.string.slice(this.start,this.pos);},hideFir stChars:function(n,inner){this.lineStart+=n;try{return inner();} 313 return this.pos>start;},eatSpace:function(){var start=this.pos;while(/[\s\u00a0] /.test(this.string.charAt(this.pos)))++this.pos;return this.pos>start;},skipToEn d:function(){this.pos=this.string.length;},skipTo:function(ch){var found=this.st ring.indexOf(ch,this.pos);if(found>-1){this.pos=found;return true;}},backUp:func tion(n){this.pos-=n;},column:function(){return this.start-this.lineStart;},inden tation:function(){return 0;},match:function(pattern,consume,caseInsensitive){if( typeof pattern=="string"){var cased=function(str){return caseInsensitive?str.toL owerCase():str;};var substr=this.string.substr(this.pos,pattern.length);if(cased (substr)==cased(pattern)){if(consume!==false)this.pos+=pattern.length;return tru e;}}else{var match=this.string.slice(this.pos).match(pattern);if(match&&match.in dex>0)return null;if(match&&consume!==false)this.pos+=match[0].length;return mat ch;}},current:function(){return this.string.slice(this.start,this.pos);},hideFir stChars:function(n,inner){this.lineStart+=n;try{return inner();}
292 finally{this.lineStart-=n;}}};CodeMirror.StringStream=StringStream;CodeMirror.st artState=function(mode,a1,a2){return mode.startState?mode.startState(a1,a2):true ;};var modes=CodeMirror.modes={},mimeModes=CodeMirror.mimeModes={};CodeMirror.de fineMode=function(name,mode){modes[name]=mode;};CodeMirror.defineMIME=function(m ime,spec){mimeModes[mime]=spec;};CodeMirror.resolveMode=function(spec){if(typeof spec=="string"&&mimeModes.hasOwnProperty(spec)){spec=mimeModes[spec];}else if(s pec&&typeof spec.name=="string"&&mimeModes.hasOwnProperty(spec.name)){spec=mimeM odes[spec.name];} 314 finally{this.lineStart-=n;}}};CodeMirror.StringStream=StringStream;CodeMirror.st artState=function(mode,a1,a2){return mode.startState?mode.startState(a1,a2):true ;};var modes=CodeMirror.modes={},mimeModes=CodeMirror.mimeModes={};CodeMirror.de fineMode=function(name,mode){modes[name]=mode;};CodeMirror.defineMIME=function(m ime,spec){mimeModes[mime]=spec;};CodeMirror.resolveMode=function(spec){if(typeof spec=="string"&&mimeModes.hasOwnProperty(spec)){spec=mimeModes[spec];}else if(s pec&&typeof spec.name=="string"&&mimeModes.hasOwnProperty(spec.name)){spec=mimeM odes[spec.name];}
293 if(typeof spec=="string")return{name:spec};else return spec||{name:"null"};};Cod eMirror.getMode=function(options,spec){spec=CodeMirror.resolveMode(spec);var mfa ctory=modes[spec.name];if(!mfactory)throw new Error("Unknown mode: "+spec);retur n mfactory(options,spec);};CodeMirror.registerHelper=CodeMirror.registerGlobalHe lper=Math.min;CodeMirror.defineMode("null",function(){return{token:function(stre am){stream.skipToEnd();}};});CodeMirror.defineMIME("text/plain","null");CodeMirr or.runMode=function(string,modespec,callback,options){var mode=CodeMirror.getMod e({indentUnit:2},modespec);if(callback.nodeType==1){var tabSize=(options&&option s.tabSize)||4;var node=callback,col=0;node.innerHTML="";callback=function(text,s tyle){if(text=="\n"){node.appendChild(document.createElement("br"));col=0;return ;} 315 if(typeof spec=="string")return{name:spec};else return spec||{name:"null"};};Cod eMirror.getMode=function(options,spec){spec=CodeMirror.resolveMode(spec);var mfa ctory=modes[spec.name];if(!mfactory)throw new Error("Unknown mode: "+spec);retur n mfactory(options,spec);};CodeMirror.registerHelper=CodeMirror.registerGlobalHe lper=Math.min;CodeMirror.defineMode("null",function(){return{token:function(stre am){stream.skipToEnd();}};});CodeMirror.defineMIME("text/plain","null");CodeMirr or.runMode=function(string,modespec,callback,options){var mode=CodeMirror.getMod e({indentUnit:2},modespec);if(callback.nodeType==1){var tabSize=(options&&option s.tabSize)||4;var node=callback,col=0;node.innerHTML="";callback=function(text,s tyle){if(text=="\n"){node.appendChild(document.createElement("br"));col=0;return ;}
294 var content="";for(var pos=0;;){var idx=text.indexOf("\t",pos);if(idx==-1){conte nt+=text.slice(pos);col+=text.length-pos;break;}else{col+=idx-pos;content+=text. slice(pos,idx);var size=tabSize-col%tabSize;col+=size;for(var i=0;i<size;++i)con tent+=" ";pos=idx+1;}} 316 var content="";for(var pos=0;;){var idx=text.indexOf("\t",pos);if(idx==-1){conte nt+=text.slice(pos);col+=text.length-pos;break;}else{col+=idx-pos;content+=text. slice(pos,idx);var size=tabSize-col%tabSize;col+=size;for(var i=0;i<size;++i)con tent+=" ";pos=idx+1;}}
295 if(style){var sp=node.appendChild(document.createElement("span"));sp.className=" cm-"+style.replace(/ +/g," cm-");sp.appendChild(document.createTextNode(content) );}else{node.appendChild(document.createTextNode(content));}};} 317 if(style){var sp=node.appendChild(document.createElement("span"));sp.className=" cm-"+style.replace(/ +/g," cm-");sp.appendChild(document.createTextNode(content) );}else{node.appendChild(document.createTextNode(content));}};}
296 var lines=splitLines(string),state=(options&&options.state)||CodeMirror.startSta te(mode);for(var i=0,e=lines.length;i<e;++i){if(i)callback("\n");var stream=new CodeMirror.StringStream(lines[i]);while(!stream.eol()){var style=mode.token(stre am,state);callback(stream.current(),style,i,stream.start,state);stream.start=str eam.pos;}}};})();}(this));CodeMirror.defineMode("css",function(config,parserConf ig){"use strict";if(!parserConfig.propertyKeywords)parserConfig=CodeMirror.resol veMode("text/css");var indentUnit=config.indentUnit||config.tabSize||2,hooks=par serConfig.hooks||{},atMediaTypes=parserConfig.atMediaTypes||{},atMediaFeatures=p arserConfig.atMediaFeatures||{},propertyKeywords=parserConfig.propertyKeywords|| {},colorKeywords=parserConfig.colorKeywords||{},valueKeywords=parserConfig.value Keywords||{},allowNested=!!parserConfig.allowNested,type=null;function ret(style ,tp){type=tp;return style;} 318 var lines=splitLines(string),state=(options&&options.state)||CodeMirror.startSta te(mode);for(var i=0,e=lines.length;i<e;++i){if(i)callback("\n");var stream=new CodeMirror.StringStream(lines[i]);while(!stream.eol()){var style=mode.token(stre am,state);callback(stream.current(),style,i,stream.start,state);stream.start=str eam.pos;}}};})();}(this));CodeMirror.defineMode("css",function(config,parserConf ig){"use strict";if(!parserConfig.propertyKeywords)parserConfig=CodeMirror.resol veMode("text/css");var indentUnit=config.indentUnit||config.tabSize||2,hooks=par serConfig.hooks||{},atMediaTypes=parserConfig.atMediaTypes||{},atMediaFeatures=p arserConfig.atMediaFeatures||{},propertyKeywords=parserConfig.propertyKeywords|| {},colorKeywords=parserConfig.colorKeywords||{},valueKeywords=parserConfig.value Keywords||{},allowNested=!!parserConfig.allowNested,type=null;function ret(style ,tp){type=tp;return style;}
297 function tokenBase(stream,state){var ch=stream.next();if(hooks[ch]){var result=h ooks[ch](stream,state);if(result!==false)return result;} 319 function tokenBase(stream,state){var ch=stream.next();if(hooks[ch]){var result=h ooks[ch](stream,state);if(result!==false)return result;}
298 if(ch=="@"){stream.eatWhile(/[\w\\\-]/);return ret("def",stream.current());} 320 if(ch=="@"){stream.eatWhile(/[\w\\\-]/);return ret("def",stream.current());}
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 function maybeBackup(stream,pat,style){var cur=stream.current();var close=cur.se arch(pat),m;if(close>-1)stream.backUp(cur.length-close);else if(m=cur.match(/<\/ ?$/)){stream.backUp(cur.length);if(!stream.match(pat,false))stream.match(cur);} 510 function maybeBackup(stream,pat,style){var cur=stream.current();var close=cur.se arch(pat),m;if(close>-1)stream.backUp(cur.length-close);else if(m=cur.match(/<\/ ?$/)){stream.backUp(cur.length);if(!stream.match(pat,false))stream.match(cur);}
489 return style;} 511 return style;}
490 function script(stream,state){if(stream.match(/^<\/\s*script\s*>/i,false)){state .token=html;state.localState=state.localMode=null;return html(stream,state);} 512 function script(stream,state){if(stream.match(/^<\/\s*script\s*>/i,false)){state .token=html;state.localState=state.localMode=null;return html(stream,state);}
491 return maybeBackup(stream,/<\/\s*script\s*>/,state.localMode.token(stream,state. localState));} 513 return maybeBackup(stream,/<\/\s*script\s*>/,state.localMode.token(stream,state. localState));}
492 function css(stream,state){if(stream.match(/^<\/\s*style\s*>/i,false)){state.tok en=html;state.localState=state.localMode=null;return html(stream,state);} 514 function css(stream,state){if(stream.match(/^<\/\s*style\s*>/i,false)){state.tok en=html;state.localState=state.localMode=null;return html(stream,state);}
493 return maybeBackup(stream,/<\/\s*style\s*>/,cssMode.token(stream,state.localStat e));} 515 return maybeBackup(stream,/<\/\s*style\s*>/,cssMode.token(stream,state.localStat e));}
494 return{startState:function(){var state=htmlMode.startState();return{token:html,l ocalMode:null,localState:null,htmlState:state};},copyState:function(state){if(st ate.localState) 516 return{startState:function(){var state=htmlMode.startState();return{token:html,l ocalMode:null,localState:null,htmlState:state};},copyState:function(state){if(st ate.localState)
495 var local=CodeMirror.copyState(state.localMode,state.localState);return{token:st ate.token,localMode:state.localMode,localState:local,htmlState:CodeMirror.copySt ate(htmlMode,state.htmlState)};},token:function(stream,state){return state.token (stream,state);},indent:function(state,textAfter){if(!state.localMode||/^\s*<\// .test(textAfter)) 517 var local=CodeMirror.copyState(state.localMode,state.localState);return{token:st ate.token,localMode:state.localMode,localState:local,htmlState:CodeMirror.copySt ate(htmlMode,state.htmlState)};},token:function(stream,state){return state.token (stream,state);},indent:function(state,textAfter){if(!state.localMode||/^\s*<\// .test(textAfter))
496 return htmlMode.indent(state.htmlState,textAfter);else if(state.localMode.indent ) 518 return htmlMode.indent(state.htmlState,textAfter);else if(state.localMode.indent )
497 return state.localMode.indent(state.localState,textAfter);else 519 return state.localMode.indent(state.localState,textAfter);else
498 return CodeMirror.Pass;},electricChars:"/{}:",innerMode:function(state){return{s tate:state.localState||state.htmlState,mode:state.localMode||htmlMode};}};},"xml ","javascript","css");CodeMirror.defineMIME("text/html","htmlmixed");;WebInspect or={};FormatterWorker={};WebInspector.CodeMirrorUtils={createTokenizer:function( mimeType) 520 return CodeMirror.Pass;},electricChars:"/{}:",innerMode:function(state){return{s tate:state.localState||state.htmlState,mode:state.localMode||htmlMode};}};},"xml ","javascript","css");CodeMirror.defineMIME("text/html","htmlmixed");;WebInspect or={};FormatterWorker={createTokenizer:function(mimeType)
499 {var mode=CodeMirror.getMode({indentUnit:2},mimeType);var state=CodeMirror.start State(mode);function tokenize(line,callback) 521 {var mode=CodeMirror.getMode({indentUnit:2},mimeType);var state=CodeMirror.start State(mode);function tokenize(line,callback)
500 {var stream=new CodeMirror.StringStream(line);while(!stream.eol()){var style=mod e.token(stream,state);var value=stream.current();callback(value,style,stream.sta rt,stream.start+value.length);stream.start=stream.pos;}} 522 {var stream=new CodeMirror.StringStream(line);while(!stream.eol()){var style=mod e.token(stream,state);var value=stream.current();callback(value,style,stream.sta rt,stream.start+value.length);stream.start=stream.pos;}}
501 return tokenize;},convertTokenType:function(tokenType) 523 return tokenize;}};var FormatterParameters;var onmessage=function(event){var dat a=(event.data);if(!data.method)
502 {if(tokenType.startsWith("js-variable")||tokenType.startsWith("js-property")||to kenType==="js-def")
503 return"javascript-ident";if(tokenType==="js-string-2")
504 return"javascript-regexp";if(tokenType==="js-number"||tokenType==="js-comment"|| tokenType==="js-string"||tokenType==="js-keyword")
505 return"javascript-"+tokenType.substring("js-".length);if(tokenType==="css-number ")
506 return"css-number";return null;},overrideModeWithPrefixedTokens:function(modeNam e,tokenPrefix)
507 {var oldModeName=modeName+"-old";if(CodeMirror.modes[oldModeName])
508 return;CodeMirror.defineMode(oldModeName,CodeMirror.modes[modeName]);CodeMirror. defineMode(modeName,modeConstructor);function modeConstructor(config,parserConfi g)
509 {var innerConfig={};for(var i in parserConfig)
510 innerConfig[i]=parserConfig[i];innerConfig.name=oldModeName;var codeMirrorMode=C odeMirror.getMode(config,innerConfig);codeMirrorMode.name=modeName;codeMirrorMod e.token=tokenOverride.bind(null,codeMirrorMode.token);return codeMirrorMode;}
511 function tokenOverride(superToken,stream,state)
512 {var token=superToken(stream,state);return token?tokenPrefix+token:token;}}}
513 WebInspector.CodeMirrorUtils.overrideModeWithPrefixedTokens("css","css-");WebIns pector.CodeMirrorUtils.overrideModeWithPrefixedTokens("javascript","js-");WebIns pector.CodeMirrorUtils.overrideModeWithPrefixedTokens("xml","xml-");;var Formatt erParameters;var onmessage=function(event){var data=(event.data);if(!data.method )
514 return;FormatterWorker[data.method](data.params);};FormatterWorker.format=functi on(params) 524 return;FormatterWorker[data.method](data.params);};FormatterWorker.format=functi on(params)
515 {var indentString=params.indentString||" ";var result={};if(params.mimeType== ="text/html"){var formatter=new FormatterWorker.HTMLFormatter(indentString);resu lt=formatter.format(params.content);}else if(params.mimeType==="text/css"){resul t.mapping={original:[0],formatted:[0]};result.content=FormatterWorker._formatCSS (params.content,result.mapping,0,0,indentString);}else{result.mapping={original: [0],formatted:[0]};result.content=FormatterWorker._formatScript(params.content,r esult.mapping,0,0,indentString);} 525 {var indentString=params.indentString||" ";var result={};if(params.mimeType== ="text/html"){var formatter=new FormatterWorker.HTMLFormatter(indentString);resu lt=formatter.format(params.content);}else if(params.mimeType==="text/css"){resul t.mapping={original:[0],formatted:[0]};result.content=FormatterWorker._formatCSS (params.content,result.mapping,0,0,indentString);}else{result.mapping={original: [0],formatted:[0]};result.content=FormatterWorker._formatScript(params.content,r esult.mapping,0,0,indentString);}
516 postMessage(result);} 526 postMessage(result);}
517 FormatterWorker._chunkCount=function(totalLength,chunkSize) 527 FormatterWorker._chunkCount=function(totalLength,chunkSize)
518 {if(totalLength<=chunkSize) 528 {if(totalLength<=chunkSize)
519 return 1;var remainder=totalLength%chunkSize;var partialLength=totalLength-remai nder;return(partialLength/chunkSize)+(remainder?1:0);} 529 return 1;var remainder=totalLength%chunkSize;var partialLength=totalLength-remai nder;return(partialLength/chunkSize)+(remainder?1:0);}
520 FormatterWorker.outline=function(params) 530 FormatterWorker.javaScriptOutline=function(params)
521 {const chunkSize=100000;const totalLength=params.content.length;const lines=para ms.content.split("\n");const chunkCount=FormatterWorker._chunkCount(totalLength, chunkSize);var outlineChunk=[];var previousIdentifier=null;var previousToken=nul l;var previousTokenType=null;var currentChunk=1;var processedChunkCharacters=0;v ar addedFunction=false;var isReadingArguments=false;var argumentsText="";var cur rentFunction=null;var tokenizer=WebInspector.CodeMirrorUtils.createTokenizer("te xt/javascript");for(var i=0;i<lines.length;++i){var line=lines[i];tokenizer(line ,processToken);} 531 {var chunkSize=100000;var totalLength=params.content.length;var lines=params.con tent.split("\n");var chunkCount=FormatterWorker._chunkCount(totalLength,chunkSiz e);var outlineChunk=[];var previousIdentifier=null;var previousToken=null;var pr eviousTokenType=null;var currentChunk=1;var processedChunkCharacters=0;var added Function=false;var isReadingArguments=false;var argumentsText="";var currentFunc tion=null;var tokenizer=FormatterWorker.createTokenizer("text/javascript");for(v ar i=0;i<lines.length;++i){var line=lines[i];tokenizer(line,processToken);}
532 function isJavaScriptIdentifier(tokenType)
533 {if(!tokenType)
534 return false;return tokenType.startsWith("variable")||tokenType.startsWith("prop erty")||tokenType==="def";}
522 function processToken(tokenValue,tokenType,column,newColumn) 535 function processToken(tokenValue,tokenType,column,newColumn)
523 {var convertedType=tokenType?WebInspector.CodeMirrorUtils.convertTokenType(token Type):null;if(convertedType==="javascript-ident"){previousIdentifier=tokenValue; if(tokenValue&&previousToken==="function"){currentFunction={line:i,column:column ,name:tokenValue};addedFunction=true;previousIdentifier=null;}}else if(converted Type==="javascript-keyword"){if(tokenValue==="function"){if(previousIdentifier&& (previousToken==="="||previousToken===":")){currentFunction={line:i,column:colum n,name:previousIdentifier};addedFunction=true;previousIdentifier=null;}}}else if (tokenValue==="."&&previousTokenType==="javascript-ident") 536 {if(isJavaScriptIdentifier(tokenType)){previousIdentifier=tokenValue;if(tokenVal ue&&previousToken==="function"){currentFunction={line:i,column:column,name:token Value};addedFunction=true;previousIdentifier=null;}}else if(tokenType==="keyword "){if(tokenValue==="function"){if(previousIdentifier&&(previousToken==="="||prev iousToken===":")){currentFunction={line:i,column:column,name:previousIdentifier} ;addedFunction=true;previousIdentifier=null;}}}else if(tokenValue==="."&&isJavaS criptIdentifier(previousTokenType))
524 previousIdentifier+=".";else if(tokenValue==="("&&addedFunction) 537 previousIdentifier+=".";else if(tokenValue==="("&&addedFunction)
525 isReadingArguments=true;if(isReadingArguments&&tokenValue) 538 isReadingArguments=true;if(isReadingArguments&&tokenValue)
526 argumentsText+=tokenValue;if(tokenValue===")"&&isReadingArguments){addedFunction =false;isReadingArguments=false;currentFunction.arguments=argumentsText.replace( /,[\r\n\s]*/g,", ").replace(/([^,])[\r\n\s]+/g,"$1");argumentsText="";outlineChu nk.push(currentFunction);} 539 argumentsText+=tokenValue;if(tokenValue===")"&&isReadingArguments){addedFunction =false;isReadingArguments=false;currentFunction.arguments=argumentsText.replace( /,[\r\n\s]*/g,", ").replace(/([^,])[\r\n\s]+/g,"$1");argumentsText="";outlineChu nk.push(currentFunction);}
527 if(tokenValue.trim().length){previousToken=tokenValue;previousTokenType=converte dType;} 540 if(tokenValue.trim().length){previousToken=tokenValue;previousTokenType=tokenTyp e;}
528 processedChunkCharacters+=newColumn-column;if(processedChunkCharacters>=chunkSiz e){postMessage({chunk:outlineChunk,total:chunkCount,index:currentChunk++});outli neChunk=[];processedChunkCharacters=0;}} 541 processedChunkCharacters+=newColumn-column;if(processedChunkCharacters>=chunkSiz e){postMessage({chunk:outlineChunk,total:chunkCount,index:currentChunk++});outli neChunk=[];processedChunkCharacters=0;}}
529 postMessage({chunk:outlineChunk,total:chunkCount,index:chunkCount});} 542 postMessage({chunk:outlineChunk,total:chunkCount,index:chunkCount});}
543 FormatterWorker.CSSParserStates={Initial:"Initial",Selector:"Selector",Style:"St yle",PropertyName:"PropertyName",PropertyValue:"PropertyValue",AtRule:"AtRule",} ;FormatterWorker.parseCSS=function(params)
544 {var chunkSize=100000;var lines=params.content.split("\n");var rules=[];var proc essedChunkCharacters=0;var state=FormatterWorker.CSSParserStates.Initial;var rul e;var property;var UndefTokenType={};function processToken(tokenValue,tokenTypes ,column,newColumn)
545 {var tokenType=tokenTypes?tokenTypes.split(" ").keySet():UndefTokenType;switch(s tate){case FormatterWorker.CSSParserStates.Initial:if(tokenType["qualifier"]||to kenType["builtin"]||tokenType["tag"]){rule={selectorText:tokenValue,lineNumber:l ineNumber,columNumber:column,properties:[],};state=FormatterWorker.CSSParserStat es.Selector;}else if(tokenType["def"]){rule={atRule:tokenValue,lineNumber:lineNu mber,columNumber:column,};state=FormatterWorker.CSSParserStates.AtRule;}
546 break;case FormatterWorker.CSSParserStates.Selector:if(tokenValue==="{"&&tokenTy pe===UndefTokenType){rule.selectorText=rule.selectorText.trim();state=FormatterW orker.CSSParserStates.Style;}else{rule.selectorText+=tokenValue;}
547 break;case FormatterWorker.CSSParserStates.AtRule:if((tokenValue===";"||tokenVal ue==="{")&&tokenType===UndefTokenType){rule.atRule=rule.atRule.trim();rules.push (rule);state=FormatterWorker.CSSParserStates.Initial;}else{rule.atRule+=tokenVal ue;}
548 break;case FormatterWorker.CSSParserStates.Style:if(tokenType["meta"]||tokenType ["property"]){property={name:tokenValue,value:"",};state=FormatterWorker.CSSPars erStates.PropertyName;}else if(tokenValue==="}"&&tokenType===UndefTokenType){rul es.push(rule);state=FormatterWorker.CSSParserStates.Initial;}
549 break;case FormatterWorker.CSSParserStates.PropertyName:if(tokenValue===":"&&tok enType["operator"]){property.name=property.name.trim();state=FormatterWorker.CSS ParserStates.PropertyValue;}else if(tokenType["property"]){property.name+=tokenV alue;}
550 break;case FormatterWorker.CSSParserStates.PropertyValue:if(tokenValue===";"&&to kenType===UndefTokenType){property.value=property.value.trim();rule.properties.p ush(property);state=FormatterWorker.CSSParserStates.Style;}else if(tokenValue=== "}"&&tokenType===UndefTokenType){property.value=property.value.trim();rule.prope rties.push(property);rules.push(rule);state=FormatterWorker.CSSParserStates.Init ial;}else if(!tokenType["comment"]){property.value+=tokenValue;}
551 break;default:console.assert(false,"Unknown CSS parser state.");}
552 processedChunkCharacters+=newColumn-column;if(processedChunkCharacters>chunkSize ){postMessage({chunk:rules,isLastChunk:false});rules=[];processedChunkCharacters =0;}}
553 var tokenizer=FormatterWorker.createTokenizer("text/css");var lineNumber;for(lin eNumber=0;lineNumber<lines.length;++lineNumber){var line=lines[lineNumber];token izer(line,processToken);}
554 postMessage({chunk:rules,isLastChunk:true});}
530 FormatterWorker._formatScript=function(content,mapping,offset,formattedOffset,in dentString) 555 FormatterWorker._formatScript=function(content,mapping,offset,formattedOffset,in dentString)
531 {var formattedContent;try{var tokenizer=new FormatterWorker.JavaScriptTokenizer( content);var builder=new FormatterWorker.JavaScriptFormattedContentBuilder(token izer.content(),mapping,offset,formattedOffset,indentString);var formatter=new Fo rmatterWorker.JavaScriptFormatter(tokenizer,builder);formatter.format();formatte dContent=builder.content();}catch(e){formattedContent=content;} 556 {var formattedContent;try{var tokenizer=new FormatterWorker.JavaScriptTokenizer( content);var builder=new FormatterWorker.JavaScriptFormattedContentBuilder(token izer.content(),mapping,offset,formattedOffset,indentString);var formatter=new Fo rmatterWorker.JavaScriptFormatter(tokenizer,builder);formatter.format();formatte dContent=builder.content();}catch(e){formattedContent=content;}
532 return formattedContent;} 557 return formattedContent;}
533 FormatterWorker._formatCSS=function(content,mapping,offset,formattedOffset,inden tString) 558 FormatterWorker._formatCSS=function(content,mapping,offset,formattedOffset,inden tString)
534 {var formattedContent;try{var builder=new FormatterWorker.CSSFormattedContentBui lder(content,mapping,offset,formattedOffset,indentString);var formatter=new Form atterWorker.CSSFormatter(content,builder);formatter.format();formattedContent=bu ilder.content();}catch(e){formattedContent=content;} 559 {var formattedContent;try{var builder=new FormatterWorker.CSSFormattedContentBui lder(content,mapping,offset,formattedOffset,indentString);var formatter=new Form atterWorker.CSSFormatter(content,builder);formatter.format();formattedContent=bu ilder.content();}catch(e){formattedContent=content;}
535 return formattedContent;} 560 return formattedContent;}
536 FormatterWorker.HTMLFormatter=function(indentString) 561 FormatterWorker.HTMLFormatter=function(indentString)
537 {this._indentString=indentString;} 562 {this._indentString=indentString;}
538 FormatterWorker.HTMLFormatter.prototype={format:function(content) 563 FormatterWorker.HTMLFormatter.prototype={format:function(content)
539 {this.line=content;this._content=content;this._formattedContent="";this._mapping ={original:[0],formatted:[0]};this._position=0;var scriptOpened=false;var styleO pened=false;var tokenizer=WebInspector.CodeMirrorUtils.createTokenizer("text/htm l");function processToken(tokenValue,tokenType,tokenStart,tokenEnd){if(tokenType !=="xml-tag") 564 {this.line=content;this._content=content;this._formattedContent="";this._mapping ={original:[0],formatted:[0]};this._position=0;var scriptOpened=false;var styleO pened=false;var tokenizer=FormatterWorker.createTokenizer("text/html");function processToken(tokenValue,tokenType,tokenStart,tokenEnd){if(tokenType!=="tag")
540 return;if(tokenValue.toLowerCase()==="<script"){scriptOpened=true;}else if(scrip tOpened&&tokenValue===">"){scriptOpened=false;this._scriptStarted(tokenEnd);}els e if(tokenValue.toLowerCase()==="</script"){this._scriptEnded(tokenStart);}else if(tokenValue.toLowerCase()==="<style"){styleOpened=true;}else if(styleOpened&&t okenValue===">"){styleOpened=false;this._styleStarted(tokenEnd);}else if(tokenVa lue.toLowerCase()==="</style"){this._styleEnded(tokenStart);}} 565 return;if(tokenValue.toLowerCase()==="<script"){scriptOpened=true;}else if(scrip tOpened&&tokenValue===">"){scriptOpened=false;this._scriptStarted(tokenEnd);}els e if(tokenValue.toLowerCase()==="</script"){this._scriptEnded(tokenStart);}else if(tokenValue.toLowerCase()==="<style"){styleOpened=true;}else if(styleOpened&&t okenValue===">"){styleOpened=false;this._styleStarted(tokenEnd);}else if(tokenVa lue.toLowerCase()==="</style"){this._styleEnded(tokenStart);}}
541 tokenizer(content,processToken.bind(this));this._formattedContent+=this._content .substring(this._position);return{content:this._formattedContent,mapping:this._m apping};},_scriptStarted:function(cursor) 566 tokenizer(content,processToken.bind(this));this._formattedContent+=this._content .substring(this._position);return{content:this._formattedContent,mapping:this._m apping};},_scriptStarted:function(cursor)
542 {this._handleSubFormatterStart(cursor);},_scriptEnded:function(cursor) 567 {this._handleSubFormatterStart(cursor);},_scriptEnded:function(cursor)
543 {this._handleSubFormatterEnd(FormatterWorker._formatScript,cursor);},_styleStart ed:function(cursor) 568 {this._handleSubFormatterEnd(FormatterWorker._formatScript,cursor);},_styleStart ed:function(cursor)
544 {this._handleSubFormatterStart(cursor);},_styleEnded:function(cursor) 569 {this._handleSubFormatterStart(cursor);},_styleEnded:function(cursor)
545 {this._handleSubFormatterEnd(FormatterWorker._formatCSS,cursor);},_handleSubForm atterStart:function(cursor) 570 {this._handleSubFormatterEnd(FormatterWorker._formatCSS,cursor);},_handleSubForm atterStart:function(cursor)
546 {this._formattedContent+=this._content.substring(this._position,cursor);this._fo rmattedContent+="\n";this._position=cursor;},_handleSubFormatterEnd:function(for matFunction,cursor) 571 {this._formattedContent+=this._content.substring(this._position,cursor);this._fo rmattedContent+="\n";this._position=cursor;},_handleSubFormatterEnd:function(for matFunction,cursor)
547 {if(cursor===this._position) 572 {if(cursor===this._position)
548 return;var scriptContent=this._content.substring(this._position,cursor);this._ma pping.original.push(this._position);this._mapping.formatted.push(this._formatted Content.length);var formattedScriptContent=formatFunction(scriptContent,this._ma pping,this._position,this._formattedContent.length,this._indentString);this._for mattedContent+=formattedScriptContent;this._position=cursor;}} 573 return;var scriptContent=this._content.substring(this._position,cursor);this._ma pping.original.push(this._position);this._mapping.formatted.push(this._formatted Content.length);var formattedScriptContent=formatFunction(scriptContent,this._ma pping,this._position,this._formattedContent.length,this._indentString);this._for mattedContent+=formattedScriptContent;this._position=cursor;}}
549 Array.prototype.keySet=function() 574 Array.prototype.keySet=function()
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 FormatterWorker.JavaScriptTokens={};FormatterWorker.JavaScriptTokensByValue={};F ormatterWorker.JavaScriptTokens.EOS=0;FormatterWorker.JavaScriptTokens.LPAREN=Fo rmatterWorker.JavaScriptTokensByValue["("]=1;FormatterWorker.JavaScriptTokens.RP AREN=FormatterWorker.JavaScriptTokensByValue[")"]=2;FormatterWorker.JavaScriptTo kens.LBRACK=FormatterWorker.JavaScriptTokensByValue["["]=3;FormatterWorker.JavaS criptTokens.RBRACK=FormatterWorker.JavaScriptTokensByValue["]"]=4;FormatterWorke r.JavaScriptTokens.LBRACE=FormatterWorker.JavaScriptTokensByValue["{"]=5;Formatt erWorker.JavaScriptTokens.RBRACE=FormatterWorker.JavaScriptTokensByValue["}"]=6; FormatterWorker.JavaScriptTokens.COLON=FormatterWorker.JavaScriptTokensByValue[" :"]=7;FormatterWorker.JavaScriptTokens.SEMICOLON=FormatterWorker.JavaScriptToken sByValue[";"]=8;FormatterWorker.JavaScriptTokens.PERIOD=FormatterWorker.JavaScri ptTokensByValue["."]=9;FormatterWorker.JavaScriptTokens.CONDITIONAL=FormatterWor ker.JavaScriptTokensByValue["?"]=10;FormatterWorker.JavaScriptTokens.INC=Formatt erWorker.JavaScriptTokensByValue["++"]=11;FormatterWorker.JavaScriptTokens.DEC=F ormatterWorker.JavaScriptTokensByValue["--"]=12;FormatterWorker.JavaScriptTokens .ASSIGN=FormatterWorker.JavaScriptTokensByValue["="]=13;FormatterWorker.JavaScri ptTokens.ASSIGN_BIT_OR=FormatterWorker.JavaScriptTokensByValue["|="]=14;Formatte rWorker.JavaScriptTokens.ASSIGN_BIT_XOR=FormatterWorker.JavaScriptTokensByValue[ "^="]=15;FormatterWorker.JavaScriptTokens.ASSIGN_BIT_AND=FormatterWorker.JavaScr iptTokensByValue["&="]=16;FormatterWorker.JavaScriptTokens.ASSIGN_SHL=FormatterW orker.JavaScriptTokensByValue["<<="]=17;FormatterWorker.JavaScriptTokens.ASSIGN_ SAR=FormatterWorker.JavaScriptTokensByValue[">>="]=18;FormatterWorker.JavaScript Tokens.ASSIGN_SHR=FormatterWorker.JavaScriptTokensByValue[">>>="]=19;FormatterWo rker.JavaScriptTokens.ASSIGN_ADD=FormatterWorker.JavaScriptTokensByValue["+="]=2 0;FormatterWorker.JavaScriptTokens.ASSIGN_SUB=FormatterWorker.JavaScriptTokensBy Value["-="]=21;FormatterWorker.JavaScriptTokens.ASSIGN_MUL=FormatterWorker.JavaS criptTokensByValue["*="]=22;FormatterWorker.JavaScriptTokens.ASSIGN_DIV=Formatte rWorker.JavaScriptTokensByValue["/="]=23;FormatterWorker.JavaScriptTokens.ASSIGN _MOD=FormatterWorker.JavaScriptTokensByValue["%="]=24;FormatterWorker.JavaScript Tokens.COMMA=FormatterWorker.JavaScriptTokensByValue[","]=25;FormatterWorker.Jav aScriptTokens.OR=FormatterWorker.JavaScriptTokensByValue["||"]=26;FormatterWorke r.JavaScriptTokens.AND=FormatterWorker.JavaScriptTokensByValue["&&"]=27;Formatte rWorker.JavaScriptTokens.BIT_OR=FormatterWorker.JavaScriptTokensByValue["|"]=28; FormatterWorker.JavaScriptTokens.BIT_XOR=FormatterWorker.JavaScriptTokensByValue ["^"]=29;FormatterWorker.JavaScriptTokens.BIT_AND=FormatterWorker.JavaScriptToke nsByValue["&"]=30;FormatterWorker.JavaScriptTokens.SHL=FormatterWorker.JavaScrip tTokensByValue["<<"]=31;FormatterWorker.JavaScriptTokens.SAR=FormatterWorker.Jav aScriptTokensByValue[">>"]=32;FormatterWorker.JavaScriptTokens.SHR=FormatterWork er.JavaScriptTokensByValue[">>>"]=33;FormatterWorker.JavaScriptTokens.ADD=Format terWorker.JavaScriptTokensByValue["+"]=34;FormatterWorker.JavaScriptTokens.SUB=F ormatterWorker.JavaScriptTokensByValue["-"]=35;FormatterWorker.JavaScriptTokens. MUL=FormatterWorker.JavaScriptTokensByValue["*"]=36;FormatterWorker.JavaScriptTo kens.DIV=FormatterWorker.JavaScriptTokensByValue["/"]=37;FormatterWorker.JavaScr iptTokens.MOD=FormatterWorker.JavaScriptTokensByValue["%"]=38;FormatterWorker.Ja vaScriptTokens.EQ=FormatterWorker.JavaScriptTokensByValue["=="]=39;FormatterWork er.JavaScriptTokens.NE=FormatterWorker.JavaScriptTokensByValue["!="]=40;Formatte rWorker.JavaScriptTokens.EQ_STRICT=FormatterWorker.JavaScriptTokensByValue["===" ]=41;FormatterWorker.JavaScriptTokens.NE_STRICT=FormatterWorker.JavaScriptTokens ByValue["!=="]=42;FormatterWorker.JavaScriptTokens.LT=FormatterWorker.JavaScript TokensByValue["<"]=43;FormatterWorker.JavaScriptTokens.GT=FormatterWorker.JavaSc riptTokensByValue[">"]=44;FormatterWorker.JavaScriptTokens.LTE=FormatterWorker.J avaScriptTokensByValue["<="]=45;FormatterWorker.JavaScriptTokens.GTE=FormatterWo rker.JavaScriptTokensByValue[">="]=46;FormatterWorker.JavaScriptTokens.INSTANCEO F=FormatterWorker.JavaScriptTokensByValue["instanceof"]=47;FormatterWorker.JavaS criptTokens.IN=FormatterWorker.JavaScriptTokensByValue["in"]=48;FormatterWorker. JavaScriptTokens.NOT=FormatterWorker.JavaScriptTokensByValue["!"]=49;FormatterWo rker.JavaScriptTokens.BIT_NOT=FormatterWorker.JavaScriptTokensByValue["~"]=50;Fo rmatterWorker.JavaScriptTokens.DELETE=FormatterWorker.JavaScriptTokensByValue["d elete"]=51;FormatterWorker.JavaScriptTokens.TYPEOF=FormatterWorker.JavaScriptTok ensByValue["typeof"]=52;FormatterWorker.JavaScriptTokens.VOID=FormatterWorker.Ja vaScriptTokensByValue["void"]=53;FormatterWorker.JavaScriptTokens.BREAK=Formatte rWorker.JavaScriptTokensByValue["break"]=54;FormatterWorker.JavaScriptTokens.CAS E=FormatterWorker.JavaScriptTokensByValue["case"]=55;FormatterWorker.JavaScriptT okens.CATCH=FormatterWorker.JavaScriptTokensByValue["catch"]=56;FormatterWorker. JavaScriptTokens.CONTINUE=FormatterWorker.JavaScriptTokensByValue["continue"]=57 ;FormatterWorker.JavaScriptTokens.DEBUGGER=FormatterWorker.JavaScriptTokensByVal ue["debugger"]=58;FormatterWorker.JavaScriptTokens.DEFAULT=FormatterWorker.JavaS criptTokensByValue["default"]=59;FormatterWorker.JavaScriptTokens.DO=FormatterWo rker.JavaScriptTokensByValue["do"]=60;FormatterWorker.JavaScriptTokens.ELSE=Form atterWorker.JavaScriptTokensByValue["else"]=61;FormatterWorker.JavaScriptTokens. FINALLY=FormatterWorker.JavaScriptTokensByValue["finally"]=62;FormatterWorker.Ja vaScriptTokens.FOR=FormatterWorker.JavaScriptTokensByValue["for"]=63;FormatterWo rker.JavaScriptTokens.FUNCTION=FormatterWorker.JavaScriptTokensByValue["function "]=64;FormatterWorker.JavaScriptTokens.IF=FormatterWorker.JavaScriptTokensByValu e["if"]=65;FormatterWorker.JavaScriptTokens.NEW=FormatterWorker.JavaScriptTokens ByValue["new"]=66;FormatterWorker.JavaScriptTokens.RETURN=FormatterWorker.JavaSc riptTokensByValue["return"]=67;FormatterWorker.JavaScriptTokens.SWITCH=Formatter Worker.JavaScriptTokensByValue["switch"]=68;FormatterWorker.JavaScriptTokens.THI S=FormatterWorker.JavaScriptTokensByValue["this"]=69;FormatterWorker.JavaScriptT okens.THROW=FormatterWorker.JavaScriptTokensByValue["throw"]=70;FormatterWorker. JavaScriptTokens.TRY=FormatterWorker.JavaScriptTokensByValue["try"]=71;Formatter Worker.JavaScriptTokens.VAR=FormatterWorker.JavaScriptTokensByValue["var"]=72;Fo rmatterWorker.JavaScriptTokens.WHILE=FormatterWorker.JavaScriptTokensByValue["wh ile"]=73;FormatterWorker.JavaScriptTokens.WITH=FormatterWorker.JavaScriptTokensB yValue["with"]=74;FormatterWorker.JavaScriptTokens.NULL_LITERAL=FormatterWorker. JavaScriptTokensByValue["null"]=75;FormatterWorker.JavaScriptTokens.TRUE_LITERAL =FormatterWorker.JavaScriptTokensByValue["true"]=76;FormatterWorker.JavaScriptTo kens.FALSE_LITERAL=FormatterWorker.JavaScriptTokensByValue["false"]=77;Formatter Worker.JavaScriptTokens.NUMBER=78;FormatterWorker.JavaScriptTokens.STRING=79;For matterWorker.JavaScriptTokens.IDENTIFIER=80;FormatterWorker.JavaScriptTokens.CON ST=FormatterWorker.JavaScriptTokensByValue["const"]=81;FormatterWorker.JavaScrip tTokensByType={"eof":FormatterWorker.JavaScriptTokens.EOS,"name":FormatterWorker .JavaScriptTokens.IDENTIFIER,"num":FormatterWorker.JavaScriptTokens.NUMBER,"rege xp":FormatterWorker.JavaScriptTokens.DIV,"string":FormatterWorker.JavaScriptToke ns.STRING};FormatterWorker.JavaScriptTokenizer=function(content) 770 FormatterWorker.JavaScriptTokens={};FormatterWorker.JavaScriptTokensByValue={};F ormatterWorker.JavaScriptTokens.EOS=0;FormatterWorker.JavaScriptTokens.LPAREN=Fo rmatterWorker.JavaScriptTokensByValue["("]=1;FormatterWorker.JavaScriptTokens.RP AREN=FormatterWorker.JavaScriptTokensByValue[")"]=2;FormatterWorker.JavaScriptTo kens.LBRACK=FormatterWorker.JavaScriptTokensByValue["["]=3;FormatterWorker.JavaS criptTokens.RBRACK=FormatterWorker.JavaScriptTokensByValue["]"]=4;FormatterWorke r.JavaScriptTokens.LBRACE=FormatterWorker.JavaScriptTokensByValue["{"]=5;Formatt erWorker.JavaScriptTokens.RBRACE=FormatterWorker.JavaScriptTokensByValue["}"]=6; FormatterWorker.JavaScriptTokens.COLON=FormatterWorker.JavaScriptTokensByValue[" :"]=7;FormatterWorker.JavaScriptTokens.SEMICOLON=FormatterWorker.JavaScriptToken sByValue[";"]=8;FormatterWorker.JavaScriptTokens.PERIOD=FormatterWorker.JavaScri ptTokensByValue["."]=9;FormatterWorker.JavaScriptTokens.CONDITIONAL=FormatterWor ker.JavaScriptTokensByValue["?"]=10;FormatterWorker.JavaScriptTokens.INC=Formatt erWorker.JavaScriptTokensByValue["++"]=11;FormatterWorker.JavaScriptTokens.DEC=F ormatterWorker.JavaScriptTokensByValue["--"]=12;FormatterWorker.JavaScriptTokens .ASSIGN=FormatterWorker.JavaScriptTokensByValue["="]=13;FormatterWorker.JavaScri ptTokens.ASSIGN_BIT_OR=FormatterWorker.JavaScriptTokensByValue["|="]=14;Formatte rWorker.JavaScriptTokens.ASSIGN_BIT_XOR=FormatterWorker.JavaScriptTokensByValue[ "^="]=15;FormatterWorker.JavaScriptTokens.ASSIGN_BIT_AND=FormatterWorker.JavaScr iptTokensByValue["&="]=16;FormatterWorker.JavaScriptTokens.ASSIGN_SHL=FormatterW orker.JavaScriptTokensByValue["<<="]=17;FormatterWorker.JavaScriptTokens.ASSIGN_ SAR=FormatterWorker.JavaScriptTokensByValue[">>="]=18;FormatterWorker.JavaScript Tokens.ASSIGN_SHR=FormatterWorker.JavaScriptTokensByValue[">>>="]=19;FormatterWo rker.JavaScriptTokens.ASSIGN_ADD=FormatterWorker.JavaScriptTokensByValue["+="]=2 0;FormatterWorker.JavaScriptTokens.ASSIGN_SUB=FormatterWorker.JavaScriptTokensBy Value["-="]=21;FormatterWorker.JavaScriptTokens.ASSIGN_MUL=FormatterWorker.JavaS criptTokensByValue["*="]=22;FormatterWorker.JavaScriptTokens.ASSIGN_DIV=Formatte rWorker.JavaScriptTokensByValue["/="]=23;FormatterWorker.JavaScriptTokens.ASSIGN _MOD=FormatterWorker.JavaScriptTokensByValue["%="]=24;FormatterWorker.JavaScript Tokens.COMMA=FormatterWorker.JavaScriptTokensByValue[","]=25;FormatterWorker.Jav aScriptTokens.OR=FormatterWorker.JavaScriptTokensByValue["||"]=26;FormatterWorke r.JavaScriptTokens.AND=FormatterWorker.JavaScriptTokensByValue["&&"]=27;Formatte rWorker.JavaScriptTokens.BIT_OR=FormatterWorker.JavaScriptTokensByValue["|"]=28; FormatterWorker.JavaScriptTokens.BIT_XOR=FormatterWorker.JavaScriptTokensByValue ["^"]=29;FormatterWorker.JavaScriptTokens.BIT_AND=FormatterWorker.JavaScriptToke nsByValue["&"]=30;FormatterWorker.JavaScriptTokens.SHL=FormatterWorker.JavaScrip tTokensByValue["<<"]=31;FormatterWorker.JavaScriptTokens.SAR=FormatterWorker.Jav aScriptTokensByValue[">>"]=32;FormatterWorker.JavaScriptTokens.SHR=FormatterWork er.JavaScriptTokensByValue[">>>"]=33;FormatterWorker.JavaScriptTokens.ADD=Format terWorker.JavaScriptTokensByValue["+"]=34;FormatterWorker.JavaScriptTokens.SUB=F ormatterWorker.JavaScriptTokensByValue["-"]=35;FormatterWorker.JavaScriptTokens. MUL=FormatterWorker.JavaScriptTokensByValue["*"]=36;FormatterWorker.JavaScriptTo kens.DIV=FormatterWorker.JavaScriptTokensByValue["/"]=37;FormatterWorker.JavaScr iptTokens.MOD=FormatterWorker.JavaScriptTokensByValue["%"]=38;FormatterWorker.Ja vaScriptTokens.EQ=FormatterWorker.JavaScriptTokensByValue["=="]=39;FormatterWork er.JavaScriptTokens.NE=FormatterWorker.JavaScriptTokensByValue["!="]=40;Formatte rWorker.JavaScriptTokens.EQ_STRICT=FormatterWorker.JavaScriptTokensByValue["===" ]=41;FormatterWorker.JavaScriptTokens.NE_STRICT=FormatterWorker.JavaScriptTokens ByValue["!=="]=42;FormatterWorker.JavaScriptTokens.LT=FormatterWorker.JavaScript TokensByValue["<"]=43;FormatterWorker.JavaScriptTokens.GT=FormatterWorker.JavaSc riptTokensByValue[">"]=44;FormatterWorker.JavaScriptTokens.LTE=FormatterWorker.J avaScriptTokensByValue["<="]=45;FormatterWorker.JavaScriptTokens.GTE=FormatterWo rker.JavaScriptTokensByValue[">="]=46;FormatterWorker.JavaScriptTokens.INSTANCEO F=FormatterWorker.JavaScriptTokensByValue["instanceof"]=47;FormatterWorker.JavaS criptTokens.IN=FormatterWorker.JavaScriptTokensByValue["in"]=48;FormatterWorker. JavaScriptTokens.NOT=FormatterWorker.JavaScriptTokensByValue["!"]=49;FormatterWo rker.JavaScriptTokens.BIT_NOT=FormatterWorker.JavaScriptTokensByValue["~"]=50;Fo rmatterWorker.JavaScriptTokens.DELETE=FormatterWorker.JavaScriptTokensByValue["d elete"]=51;FormatterWorker.JavaScriptTokens.TYPEOF=FormatterWorker.JavaScriptTok ensByValue["typeof"]=52;FormatterWorker.JavaScriptTokens.VOID=FormatterWorker.Ja vaScriptTokensByValue["void"]=53;FormatterWorker.JavaScriptTokens.BREAK=Formatte rWorker.JavaScriptTokensByValue["break"]=54;FormatterWorker.JavaScriptTokens.CAS E=FormatterWorker.JavaScriptTokensByValue["case"]=55;FormatterWorker.JavaScriptT okens.CATCH=FormatterWorker.JavaScriptTokensByValue["catch"]=56;FormatterWorker. JavaScriptTokens.CONTINUE=FormatterWorker.JavaScriptTokensByValue["continue"]=57 ;FormatterWorker.JavaScriptTokens.DEBUGGER=FormatterWorker.JavaScriptTokensByVal ue["debugger"]=58;FormatterWorker.JavaScriptTokens.DEFAULT=FormatterWorker.JavaS criptTokensByValue["default"]=59;FormatterWorker.JavaScriptTokens.DO=FormatterWo rker.JavaScriptTokensByValue["do"]=60;FormatterWorker.JavaScriptTokens.ELSE=Form atterWorker.JavaScriptTokensByValue["else"]=61;FormatterWorker.JavaScriptTokens. FINALLY=FormatterWorker.JavaScriptTokensByValue["finally"]=62;FormatterWorker.Ja vaScriptTokens.FOR=FormatterWorker.JavaScriptTokensByValue["for"]=63;FormatterWo rker.JavaScriptTokens.FUNCTION=FormatterWorker.JavaScriptTokensByValue["function "]=64;FormatterWorker.JavaScriptTokens.IF=FormatterWorker.JavaScriptTokensByValu e["if"]=65;FormatterWorker.JavaScriptTokens.NEW=FormatterWorker.JavaScriptTokens ByValue["new"]=66;FormatterWorker.JavaScriptTokens.RETURN=FormatterWorker.JavaSc riptTokensByValue["return"]=67;FormatterWorker.JavaScriptTokens.SWITCH=Formatter Worker.JavaScriptTokensByValue["switch"]=68;FormatterWorker.JavaScriptTokens.THI S=FormatterWorker.JavaScriptTokensByValue["this"]=69;FormatterWorker.JavaScriptT okens.THROW=FormatterWorker.JavaScriptTokensByValue["throw"]=70;FormatterWorker. JavaScriptTokens.TRY=FormatterWorker.JavaScriptTokensByValue["try"]=71;Formatter Worker.JavaScriptTokens.VAR=FormatterWorker.JavaScriptTokensByValue["var"]=72;Fo rmatterWorker.JavaScriptTokens.WHILE=FormatterWorker.JavaScriptTokensByValue["wh ile"]=73;FormatterWorker.JavaScriptTokens.WITH=FormatterWorker.JavaScriptTokensB yValue["with"]=74;FormatterWorker.JavaScriptTokens.NULL_LITERAL=FormatterWorker. JavaScriptTokensByValue["null"]=75;FormatterWorker.JavaScriptTokens.TRUE_LITERAL =FormatterWorker.JavaScriptTokensByValue["true"]=76;FormatterWorker.JavaScriptTo kens.FALSE_LITERAL=FormatterWorker.JavaScriptTokensByValue["false"]=77;Formatter Worker.JavaScriptTokens.NUMBER=78;FormatterWorker.JavaScriptTokens.STRING=79;For matterWorker.JavaScriptTokens.IDENTIFIER=80;FormatterWorker.JavaScriptTokens.CON ST=FormatterWorker.JavaScriptTokensByValue["const"]=81;FormatterWorker.JavaScrip tTokensByType={"eof":FormatterWorker.JavaScriptTokens.EOS,"name":FormatterWorker .JavaScriptTokens.IDENTIFIER,"num":FormatterWorker.JavaScriptTokens.NUMBER,"rege xp":FormatterWorker.JavaScriptTokens.DIV,"string":FormatterWorker.JavaScriptToke ns.STRING};FormatterWorker.JavaScriptTokenizer=function(content)
746 {this._readNextToken=parse.tokenizer(content);this._state=this._readNextToken.co ntext();} 771 {this._readNextToken=parse.tokenizer(content);this._state=this._readNextToken.co ntext();}
747 FormatterWorker.JavaScriptTokenizer.prototype={content:function() 772 FormatterWorker.JavaScriptTokenizer.prototype={content:function()
748 {return this._state.text;},next:function(forceRegexp) 773 {return this._state.text;},next:function(forceRegexp)
749 {var uglifyToken=this._readNextToken(forceRegexp);uglifyToken.endPos=this._state .pos;uglifyToken.endLine=this._state.line;uglifyToken.token=this._convertUglifyT oken(uglifyToken);return uglifyToken;},_convertUglifyToken:function(uglifyToken) 774 {var uglifyToken=this._readNextToken(forceRegexp);uglifyToken.endPos=this._state .pos;uglifyToken.endLine=this._state.line;uglifyToken.token=this._convertUglifyT oken(uglifyToken);return uglifyToken;},_convertUglifyToken:function(uglifyToken)
750 {var token=FormatterWorker.JavaScriptTokensByType[uglifyToken.type];if(typeof to ken==="number") 775 {var token=FormatterWorker.JavaScriptTokensByType[uglifyToken.type];if(typeof to ken==="number")
751 return token;token=FormatterWorker.JavaScriptTokensByValue[uglifyToken.value];if (typeof token==="number") 776 return token;token=FormatterWorker.JavaScriptTokensByValue[uglifyToken.value];if (typeof token==="number")
752 return token;throw"Unknown token type "+uglifyToken.type;}};FormatterWorker.CSSF ormatter=function(content,builder) 777 return token;throw"Unknown token type "+uglifyToken.type;}};FormatterWorker.CSSF ormatter=function(content,builder)
753 {this._content=content;this._builder=builder;this._lastLine=-1;this._state={};} 778 {this._content=content;this._builder=builder;this._lastLine=-1;this._state={};}
754 FormatterWorker.CSSFormatter.prototype={format:function() 779 FormatterWorker.CSSFormatter.prototype={format:function()
755 {this._lineEndings=this._lineEndings(this._content);var tokenize=WebInspector.Co deMirrorUtils.createTokenizer("text/css");var lines=this._content.split("\n");fo r(var i=0;i<lines.length;++i){var line=lines[i];tokenize(line,this._tokenCallbac k.bind(this,i));} 780 {this._lineEndings=this._lineEndings(this._content);var tokenize=FormatterWorker .createTokenizer("text/css");var lines=this._content.split("\n");for(var i=0;i<l ines.length;++i){var line=lines[i];tokenize(line,this._tokenCallback.bind(this,i ));}
756 this._builder.flushNewLines(true);},_lineEndings:function(text) 781 this._builder.flushNewLines(true);},_lineEndings:function(text)
757 {var lineEndings=[];var i=text.indexOf("\n");while(i!==-1){lineEndings.push(i);i =text.indexOf("\n",i+1);} 782 {var lineEndings=[];var i=text.indexOf("\n");while(i!==-1){lineEndings.push(i);i =text.indexOf("\n",i+1);}
758 lineEndings.push(text.length);return lineEndings;},_tokenCallback:function(start Line,token,type,startColumn) 783 lineEndings.push(text.length);return lineEndings;},_tokenCallback:function(start Line,token,type,startColumn)
759 {if(startLine!==this._lastLine) 784 {if(startLine!==this._lastLine)
760 this._state.eatWhitespace=true;if(/^css-property/.test(type)&&!this._state.inPro pertyValue) 785 this._state.eatWhitespace=true;if(/^property/.test(type)&&!this._state.inPropert yValue)
761 this._state.seenProperty=true;this._lastLine=startLine;var isWhitespace=/^\s+$/. test(token);if(isWhitespace){if(!this._state.eatWhitespace) 786 this._state.seenProperty=true;this._lastLine=startLine;var isWhitespace=/^\s+$/. test(token);if(isWhitespace){if(!this._state.eatWhitespace)
762 this._builder.addSpace();return;} 787 this._builder.addSpace();return;}
763 this._state.eatWhitespace=false;if(token==="\n") 788 this._state.eatWhitespace=false;if(token==="\n")
764 return;if(token!=="}"){if(this._state.afterClosingBrace) 789 return;if(token!=="}"){if(this._state.afterClosingBrace)
765 this._builder.addNewLine();this._state.afterClosingBrace=false;} 790 this._builder.addNewLine();this._state.afterClosingBrace=false;}
766 var startPosition=(startLine?this._lineEndings[startLine-1]:0)+startColumn;if(to ken==="}"){if(this._state.inPropertyValue) 791 var startPosition=(startLine?this._lineEndings[startLine-1]:0)+startColumn;if(to ken==="}"){if(this._state.inPropertyValue)
767 this._builder.addNewLine();this._builder.decreaseNestingLevel();this._state.afte rClosingBrace=true;this._state.inPropertyValue=false;}else if(token===":"&&!this ._state.inPropertyValue&&this._state.seenProperty){this._builder.addToken(token, startPosition,startLine,startColumn);this._builder.addSpace();this._state.eatWhi tespace=true;this._state.inPropertyValue=true;this._state.seenProperty=false;ret urn;}else if(token==="{"){this._builder.addSpace();this._builder.addToken(token, startPosition,startLine,startColumn);this._builder.addNewLine();this._builder.in creaseNestingLevel();return;} 792 this._builder.addNewLine();this._builder.decreaseNestingLevel();this._state.afte rClosingBrace=true;this._state.inPropertyValue=false;}else if(token===":"&&!this ._state.inPropertyValue&&this._state.seenProperty){this._builder.addToken(token, startPosition,startLine,startColumn);this._builder.addSpace();this._state.eatWhi tespace=true;this._state.inPropertyValue=true;this._state.seenProperty=false;ret urn;}else if(token==="{"){this._builder.addSpace();this._builder.addToken(token, startPosition,startLine,startColumn);this._builder.addNewLine();this._builder.in creaseNestingLevel();return;}
768 this._builder.addToken(token,startPosition,startLine,startColumn);if(type==="css -comment"&&!this._state.inPropertyValue&&!this._state.seenProperty) 793 this._builder.addToken(token,startPosition,startLine,startColumn);if(type==="com ment"&&!this._state.inPropertyValue&&!this._state.seenProperty)
769 this._builder.addNewLine();if(token===";"&&this._state.inPropertyValue){this._st ate.inPropertyValue=false;this._builder.addNewLine();}else if(token==="}"){this. _builder.addNewLine();}}} 794 this._builder.addNewLine();if(token===";"&&this._state.inPropertyValue){this._st ate.inPropertyValue=false;this._builder.addNewLine();}else if(token==="}"){this. _builder.addNewLine();}}}
770 FormatterWorker.CSSFormattedContentBuilder=function(content,mapping,originalOffs et,formattedOffset,indentString) 795 FormatterWorker.CSSFormattedContentBuilder=function(content,mapping,originalOffs et,formattedOffset,indentString)
771 {this._originalContent=content;this._originalOffset=originalOffset;this._lastOri ginalPosition=0;this._formattedContent=[];this._formattedContentLength=0;this._f ormattedOffset=formattedOffset;this._lastFormattedPosition=0;this._mapping=mappi ng;this._lineNumber=0;this._nestingLevel=0;this._needNewLines=0;this._atLineStar t=true;this._indentString=indentString;this._cachedIndents={};} 796 {this._originalContent=content;this._originalOffset=originalOffset;this._lastOri ginalPosition=0;this._formattedContent=[];this._formattedContentLength=0;this._f ormattedOffset=formattedOffset;this._lastFormattedPosition=0;this._mapping=mappi ng;this._lineNumber=0;this._nestingLevel=0;this._needNewLines=0;this._atLineStar t=true;this._indentString=indentString;this._cachedIndents={};}
772 FormatterWorker.CSSFormattedContentBuilder.prototype={addToken:function(token,st artPosition,startLine,startColumn) 797 FormatterWorker.CSSFormattedContentBuilder.prototype={addToken:function(token,st artPosition,startLine,startColumn)
773 {if((this._isWhitespaceRun||this._atLineStart)&&/^\s+$/.test(token)) 798 {if((this._isWhitespaceRun||this._atLineStart)&&/^\s+$/.test(token))
774 return;if(this._isWhitespaceRun&&this._lineNumber===startLine&&!this._needNewLin es) 799 return;if(this._isWhitespaceRun&&this._lineNumber===startLine&&!this._needNewLin es)
775 this._addText(" ");this._isWhitespaceRun=false;this._atLineStart=false;while(thi s._lineNumber<startLine){this._addText("\n");this._addIndent();this._needNewLine s=0;this._lineNumber+=1;this._atLineStart=true;} 800 this._addText(" ");this._isWhitespaceRun=false;this._atLineStart=false;while(thi s._lineNumber<startLine){this._addText("\n");this._addIndent();this._needNewLine s=0;this._lineNumber+=1;this._atLineStart=true;}
776 if(this._needNewLines){this.flushNewLines();this._addIndent();this._atLineStart= true;} 801 if(this._needNewLines){this.flushNewLines();this._addIndent();this._atLineStart= true;}
777 this._addMappingIfNeeded(startPosition);this._addText(token);this._lineNumber=st artLine;},addSpace:function() 802 this._addMappingIfNeeded(startPosition);this._addText(token);this._lineNumber=st artLine;},addSpace:function()
778 {if(this._isWhitespaceRun) 803 {if(this._isWhitespaceRun)
779 return;this._isWhitespaceRun=true;},addNewLine:function() 804 return;this._isWhitespaceRun=true;},addNewLine:function()
780 {++this._needNewLines;},flushNewLines:function(atLeastOne) 805 {++this._needNewLines;},flushNewLines:function(atLeastOne)
781 {var newLineCount=atLeastOne&&!this._needNewLines?1:this._needNewLines;if(newLin eCount) 806 {var newLineCount=atLeastOne&&!this._needNewLines?1:this._needNewLines;if(newLin eCount)
782 this._isWhitespaceRun=false;for(var i=0;i<newLineCount;++i) 807 this._isWhitespaceRun=false;for(var i=0;i<newLineCount;++i)
783 this._addText("\n");this._needNewLines=0;},increaseNestingLevel:function() 808 this._addText("\n");this._needNewLines=0;},increaseNestingLevel:function()
784 {this._nestingLevel+=1;},decreaseNestingLevel:function(addNewline) 809 {this._nestingLevel+=1;},decreaseNestingLevel:function(addNewline)
785 {if(this._nestingLevel) 810 {if(this._nestingLevel)
786 this._nestingLevel-=1;if(addNewline) 811 this._nestingLevel-=1;if(addNewline)
787 this.addNewLine();},content:function() 812 this.addNewLine();},content:function()
788 {return this._formattedContent.join("");},_addIndent:function() 813 {return this._formattedContent.join("");},_addIndent:function()
789 {if(this._cachedIndents[this._nestingLevel]){this._addText(this._cachedIndents[t his._nestingLevel]);return;} 814 {if(this._cachedIndents[this._nestingLevel]){this._addText(this._cachedIndents[t his._nestingLevel]);return;}
790 var fullIndent="";for(var i=0;i<this._nestingLevel;++i) 815 var fullIndent="";for(var i=0;i<this._nestingLevel;++i)
791 fullIndent+=this._indentString;this._addText(fullIndent);if(this._nestingLevel<= 20) 816 fullIndent+=this._indentString;this._addText(fullIndent);if(this._nestingLevel<= 20)
792 this._cachedIndents[this._nestingLevel]=fullIndent;},_addText:function(text) 817 this._cachedIndents[this._nestingLevel]=fullIndent;},_addText:function(text)
793 {if(!text) 818 {if(!text)
794 return;this._formattedContent.push(text);this._formattedContentLength+=text.leng th;},_addMappingIfNeeded:function(originalPosition) 819 return;this._formattedContent.push(text);this._formattedContentLength+=text.leng th;},_addMappingIfNeeded:function(originalPosition)
795 {if(originalPosition-this._lastOriginalPosition===this._formattedContentLength-t his._lastFormattedPosition) 820 {if(originalPosition-this._lastOriginalPosition===this._formattedContentLength-t his._lastFormattedPosition)
796 return;this._mapping.original.push(this._originalOffset+originalPosition);this._ lastOriginalPosition=originalPosition;this._mapping.formatted.push(this._formatt edOffset+this._formattedContentLength);this._lastFormattedPosition=this._formatt edContentLength;}}; 821 return;this._mapping.original.push(this._originalOffset+originalPosition);this._ lastOriginalPosition=originalPosition;this._mapping.formatted.push(this._formatt edOffset+this._formattedContentLength);this._lastFormattedPosition=this._formatt edContentLength;}};
OLDNEW
« no previous file with comments | « chrome_linux64/resources/inspector/ResourcesPanel.js ('k') | chrome_linux64/resources/inspector/SourcesPanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698