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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/DOMSyntaxHighlighter.js

Issue 2300633005: DevTools: Remove leading newline on scripts immediately (Closed)
Patch Set: fix test Created 4 years, 3 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 | « third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 return self.runtime.extension(WebInspector.TokenizerFactory).instance(). then(processTokens.bind(this)); 68 return self.runtime.extension(WebInspector.TokenizerFactory).instance(). then(processTokens.bind(this));
69 69
70 /** 70 /**
71 * @param {!WebInspector.TokenizerFactory} tokenizerFactory 71 * @param {!WebInspector.TokenizerFactory} tokenizerFactory
72 * @this {WebInspector.DOMSyntaxHighlighter} 72 * @this {WebInspector.DOMSyntaxHighlighter}
73 */ 73 */
74 function processTokens(tokenizerFactory) 74 function processTokens(tokenizerFactory)
75 { 75 {
76 node.removeChildren(); 76 node.removeChildren();
77 var tokenize = tokenizerFactory.createTokenizer(this._mimeType); 77 var tokenize = tokenizerFactory.createTokenizer(this._mimeType);
78 for (var i = lines[0].length ? 0 : 1; i < lines.length; ++i) { 78 for (var i = 0; i < lines.length; ++i) {
79 line = lines[i]; 79 line = lines[i];
80 plainTextStart = 0; 80 plainTextStart = 0;
81 tokenize(line, processToken.bind(this)); 81 tokenize(line, processToken.bind(this));
82 if (plainTextStart < line.length) { 82 if (plainTextStart < line.length) {
83 var plainText = line.substring(plainTextStart, line.length); 83 var plainText = line.substring(plainTextStart, line.length);
84 node.createTextChild(plainText); 84 node.createTextChild(plainText);
85 } 85 }
86 if (i < lines.length - 1) 86 if (i < lines.length - 1)
87 node.createTextChild("\n"); 87 node.createTextChild("\n");
88 } 88 }
(...skipping 13 matching lines...) Expand all
102 102
103 if (column > plainTextStart) { 103 if (column > plainTextStart) {
104 var plainText = line.substring(plainTextStart, column); 104 var plainText = line.substring(plainTextStart, column);
105 node.createTextChild(plainText); 105 node.createTextChild(plainText);
106 } 106 }
107 node.appendChild(this.createSpan(token, tokenType)); 107 node.appendChild(this.createSpan(token, tokenType));
108 plainTextStart = newColumn; 108 plainTextStart = newColumn;
109 } 109 }
110 } 110 }
111 } 111 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698