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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/CSSSourceFrame.js

Issue 2567573002: DevTools: fix private field usage violation discovered after the compiler roll. (Closed)
Patch Set: Created 4 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 var bezierString = /** @type {string} */ (event.data); 263 var bezierString = /** @type {string} */ (event.data);
264 this._currentSwatch.setBezierText(bezierString); 264 this._currentSwatch.setBezierText(bezierString);
265 this._changeSwatchText(bezierString); 265 this._changeSwatchText(bezierString);
266 } 266 }
267 267
268 /** 268 /**
269 * @param {string} text 269 * @param {string} text
270 */ 270 */
271 _changeSwatchText(text) { 271 _changeSwatchText(text) {
272 this._hadSwatchChange = true; 272 this._hadSwatchChange = true;
273 this._textEditor.editRange(this._editedSwatchTextRange, text, '*swatch-text- changed'); 273 this.textEditor.editRange(this._editedSwatchTextRange, text, '*swatch-text-c hanged');
274 this._editedSwatchTextRange.endColumn = this._editedSwatchTextRange.startCol umn + text.length; 274 this._editedSwatchTextRange.endColumn = this._editedSwatchTextRange.startCol umn + text.length;
275 } 275 }
276 276
277 /** 277 /**
278 * @param {boolean} commitEdit 278 * @param {boolean} commitEdit
279 */ 279 */
280 _swatchPopoverHidden(commitEdit) { 280 _swatchPopoverHidden(commitEdit) {
281 this._muteSwatchProcessing = false; 281 this._muteSwatchProcessing = false;
282 if (!commitEdit && this._hadSwatchChange) 282 if (!commitEdit && this._hadSwatchChange)
283 this.textEditor.undo(); 283 this.textEditor.undo();
(...skipping 26 matching lines...) Expand all
310 _isWordChar(char) { 310 _isWordChar(char) {
311 return Common.TextUtils.isWordChar(char) || char === '.' || char === '-' || char === '$'; 311 return Common.TextUtils.isWordChar(char) || char === '.' || char === '-' || char === '$';
312 } 312 }
313 313
314 /** 314 /**
315 * @param {!Common.TextRange} prefixRange 315 * @param {!Common.TextRange} prefixRange
316 * @param {!Common.TextRange} substituteRange 316 * @param {!Common.TextRange} substituteRange
317 * @return {?Promise.<!UI.SuggestBox.Suggestions>} 317 * @return {?Promise.<!UI.SuggestBox.Suggestions>}
318 */ 318 */
319 _cssSuggestions(prefixRange, substituteRange) { 319 _cssSuggestions(prefixRange, substituteRange) {
320 var prefix = this._textEditor.text(prefixRange); 320 var prefix = this.textEditor.text(prefixRange);
321 if (prefix.startsWith('$')) 321 if (prefix.startsWith('$'))
322 return null; 322 return null;
323 323
324 var propertyToken = this._backtrackPropertyToken(prefixRange.startLine, pref ixRange.startColumn - 1); 324 var propertyToken = this._backtrackPropertyToken(prefixRange.startLine, pref ixRange.startColumn - 1);
325 if (!propertyToken) 325 if (!propertyToken)
326 return null; 326 return null;
327 327
328 var line = this._textEditor.line(prefixRange.startLine); 328 var line = this.textEditor.line(prefixRange.startLine);
329 var tokenContent = line.substring(propertyToken.startColumn, propertyToken.e ndColumn); 329 var tokenContent = line.substring(propertyToken.startColumn, propertyToken.e ndColumn);
330 var propertyValues = SDK.cssMetadata().propertyValues(tokenContent); 330 var propertyValues = SDK.cssMetadata().propertyValues(tokenContent);
331 return Promise.resolve(propertyValues.filter(value => value.startsWith(prefi x)).map(value => ({title: value}))); 331 return Promise.resolve(propertyValues.filter(value => value.startsWith(prefi x)).map(value => ({title: value})));
332 } 332 }
333 333
334 /** 334 /**
335 * @param {number} lineNumber 335 * @param {number} lineNumber
336 * @param {number} columnNumber 336 * @param {number} columnNumber
337 * @return {?{startColumn: number, endColumn: number, type: string}} 337 * @return {?{startColumn: number, endColumn: number, type: string}}
338 */ 338 */
339 _backtrackPropertyToken(lineNumber, columnNumber) { 339 _backtrackPropertyToken(lineNumber, columnNumber) {
340 var backtrackDepth = 10; 340 var backtrackDepth = 10;
341 var tokenPosition = columnNumber; 341 var tokenPosition = columnNumber;
342 var line = this._textEditor.line(lineNumber); 342 var line = this.textEditor.line(lineNumber);
343 var seenColon = false; 343 var seenColon = false;
344 344
345 for (var i = 0; i < backtrackDepth && tokenPosition >= 0; ++i) { 345 for (var i = 0; i < backtrackDepth && tokenPosition >= 0; ++i) {
346 var token = this._textEditor.tokenAtTextPosition(lineNumber, tokenPosition ); 346 var token = this.textEditor.tokenAtTextPosition(lineNumber, tokenPosition) ;
347 if (!token) 347 if (!token)
348 return null; 348 return null;
349 if (token.type === 'css-property') 349 if (token.type === 'css-property')
350 return seenColon ? token : null; 350 return seenColon ? token : null;
351 if (token.type && !(token.type.indexOf('whitespace') !== -1 || token.type. startsWith('css-comment'))) 351 if (token.type && !(token.type.indexOf('whitespace') !== -1 || token.type. startsWith('css-comment')))
352 return null; 352 return null;
353 353
354 if (!token.type && line.substring(token.startColumn, token.endColumn) === ':') { 354 if (!token.type && line.substring(token.startColumn, token.endColumn) === ':') {
355 if (!seenColon) 355 if (!seenColon)
356 seenColon = true; 356 seenColon = true;
357 else 357 else
358 return null; 358 return null;
359 } 359 }
360 tokenPosition = token.startColumn - 1; 360 tokenPosition = token.startColumn - 1;
361 } 361 }
362 return null; 362 return null;
363 } 363 }
364 }; 364 };
365 365
366 /** @type {number} */ 366 /** @type {number} */
367 Sources.CSSSourceFrame.maxSwatchProcessingLength = 300; 367 Sources.CSSSourceFrame.maxSwatchProcessingLength = 300;
368 /** @type {symbol} */ 368 /** @type {symbol} */
369 Sources.CSSSourceFrame.SwatchBookmark = Symbol('swatch'); 369 Sources.CSSSourceFrame.SwatchBookmark = Symbol('swatch');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698