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

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

Issue 2440953003: DevTools: use semicolons after each statement. (Closed)
Patch Set: rebaseline Created 4 years, 1 month 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 * 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 * 10 *
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 /** 69 /**
70 * @return {!Promise<?string>} 70 * @return {!Promise<?string>}
71 */ 71 */
72 function workingCopy() 72 function workingCopy()
73 { 73 {
74 if (uiSourceCode.isDirty()) 74 if (uiSourceCode.isDirty())
75 return /** @type {!Promise<?string>} */(Promise.resolve(uiSourceCode .workingCopy())); 75 return /** @type {!Promise<?string>} */(Promise.resolve(uiSourceCode .workingCopy()));
76 return uiSourceCode.requestContent(); 76 return uiSourceCode.requestContent();
77 } 77 }
78 } 78 };
79 79
80 WebInspector.UISourceCodeFrame.prototype = { 80 WebInspector.UISourceCodeFrame.prototype = {
81 /** 81 /**
82 * @return {!WebInspector.UISourceCode} 82 * @return {!WebInspector.UISourceCode}
83 */ 83 */
84 uiSourceCode: function() 84 uiSourceCode: function()
85 { 85 {
86 return this._uiSourceCode; 86 return this._uiSourceCode;
87 }, 87 },
88 88
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 }); 432 });
433 }, 433 },
434 434
435 _decorateAllTypes: function() 435 _decorateAllTypes: function()
436 { 436 {
437 var extensions = self.runtime.extensions(WebInspector.UISourceCodeFrame. LineDecorator); 437 var extensions = self.runtime.extensions(WebInspector.UISourceCodeFrame. LineDecorator);
438 extensions.forEach(extension => this._decorateTypeThrottled(extension.de scriptor()["decoratorType"])); 438 extensions.forEach(extension => this._decorateTypeThrottled(extension.de scriptor()["decoratorType"]));
439 }, 439 },
440 440
441 __proto__: WebInspector.SourceFrame.prototype 441 __proto__: WebInspector.SourceFrame.prototype
442 } 442 };
443 443
444 WebInspector.UISourceCodeFrame._iconClassPerLevel = {}; 444 WebInspector.UISourceCodeFrame._iconClassPerLevel = {};
445 WebInspector.UISourceCodeFrame._iconClassPerLevel[WebInspector.UISourceCode.Mess age.Level.Error] = "error-icon"; 445 WebInspector.UISourceCodeFrame._iconClassPerLevel[WebInspector.UISourceCode.Mess age.Level.Error] = "error-icon";
446 WebInspector.UISourceCodeFrame._iconClassPerLevel[WebInspector.UISourceCode.Mess age.Level.Warning] = "warning-icon"; 446 WebInspector.UISourceCodeFrame._iconClassPerLevel[WebInspector.UISourceCode.Mess age.Level.Warning] = "warning-icon";
447 447
448 WebInspector.UISourceCodeFrame._bubbleTypePerLevel = {}; 448 WebInspector.UISourceCodeFrame._bubbleTypePerLevel = {};
449 WebInspector.UISourceCodeFrame._bubbleTypePerLevel[WebInspector.UISourceCode.Mes sage.Level.Error] = "error"; 449 WebInspector.UISourceCodeFrame._bubbleTypePerLevel[WebInspector.UISourceCode.Mes sage.Level.Error] = "error";
450 WebInspector.UISourceCodeFrame._bubbleTypePerLevel[WebInspector.UISourceCode.Mes sage.Level.Warning] = "warning"; 450 WebInspector.UISourceCodeFrame._bubbleTypePerLevel[WebInspector.UISourceCode.Mes sage.Level.Warning] = "warning";
451 451
452 WebInspector.UISourceCodeFrame._lineClassPerLevel = {}; 452 WebInspector.UISourceCodeFrame._lineClassPerLevel = {};
453 WebInspector.UISourceCodeFrame._lineClassPerLevel[WebInspector.UISourceCode.Mess age.Level.Error] = "text-editor-line-with-error"; 453 WebInspector.UISourceCodeFrame._lineClassPerLevel[WebInspector.UISourceCode.Mess age.Level.Error] = "text-editor-line-with-error";
454 WebInspector.UISourceCodeFrame._lineClassPerLevel[WebInspector.UISourceCode.Mess age.Level.Warning] = "text-editor-line-with-warning"; 454 WebInspector.UISourceCodeFrame._lineClassPerLevel[WebInspector.UISourceCode.Mess age.Level.Warning] = "text-editor-line-with-warning";
455 455
456 /** 456 /**
457 * @interface 457 * @interface
458 */ 458 */
459 WebInspector.UISourceCodeFrame.LineDecorator = function() { } 459 WebInspector.UISourceCodeFrame.LineDecorator = function() { };
460 460
461 WebInspector.UISourceCodeFrame.LineDecorator.prototype = { 461 WebInspector.UISourceCodeFrame.LineDecorator.prototype = {
462 /** 462 /**
463 * @param {!WebInspector.UISourceCode} uiSourceCode 463 * @param {!WebInspector.UISourceCode} uiSourceCode
464 * @param {!WebInspector.CodeMirrorTextEditor} textEditor 464 * @param {!WebInspector.CodeMirrorTextEditor} textEditor
465 */ 465 */
466 decorate: function(uiSourceCode, textEditor) { } 466 decorate: function(uiSourceCode, textEditor) { }
467 } 467 };
468 468
469 /** 469 /**
470 * @constructor 470 * @constructor
471 * @param {!WebInspector.UISourceCode.Message} message 471 * @param {!WebInspector.UISourceCode.Message} message
472 */ 472 */
473 WebInspector.UISourceCodeFrame.RowMessage = function(message) 473 WebInspector.UISourceCodeFrame.RowMessage = function(message)
474 { 474 {
475 this._message = message; 475 this._message = message;
476 this._repeatCount = 1; 476 this._repeatCount = 1;
477 this.element = createElementWithClass("div", "text-editor-row-message"); 477 this.element = createElementWithClass("div", "text-editor-row-message");
478 this._icon = this.element.createChild("label", "", "dt-icon-label"); 478 this._icon = this.element.createChild("label", "", "dt-icon-label");
479 this._icon.type = WebInspector.UISourceCodeFrame._iconClassPerLevel[message. level()]; 479 this._icon.type = WebInspector.UISourceCodeFrame._iconClassPerLevel[message. level()];
480 this._repeatCountElement = this.element.createChild("label", "message-repeat -count hidden", "dt-small-bubble"); 480 this._repeatCountElement = this.element.createChild("label", "message-repeat -count hidden", "dt-small-bubble");
481 this._repeatCountElement.type = WebInspector.UISourceCodeFrame._bubbleTypePe rLevel[message.level()]; 481 this._repeatCountElement.type = WebInspector.UISourceCodeFrame._bubbleTypePe rLevel[message.level()];
482 var linesContainer = this.element.createChild("div", "text-editor-row-messag e-lines"); 482 var linesContainer = this.element.createChild("div", "text-editor-row-messag e-lines");
483 var lines = this._message.text().split("\n"); 483 var lines = this._message.text().split("\n");
484 for (var i = 0; i < lines.length; ++i) { 484 for (var i = 0; i < lines.length; ++i) {
485 var messageLine = linesContainer.createChild("div"); 485 var messageLine = linesContainer.createChild("div");
486 messageLine.textContent = lines[i]; 486 messageLine.textContent = lines[i];
487 } 487 }
488 } 488 };
489 489
490 WebInspector.UISourceCodeFrame.RowMessage.prototype = { 490 WebInspector.UISourceCodeFrame.RowMessage.prototype = {
491 /** 491 /**
492 * @return {!WebInspector.UISourceCode.Message} 492 * @return {!WebInspector.UISourceCode.Message}
493 */ 493 */
494 message: function() 494 message: function()
495 { 495 {
496 return this._message; 496 return this._message;
497 }, 497 },
498 498
(...skipping 13 matching lines...) Expand all
512 this._updateMessageRepeatCount(); 512 this._updateMessageRepeatCount();
513 }, 513 },
514 514
515 _updateMessageRepeatCount: function() 515 _updateMessageRepeatCount: function()
516 { 516 {
517 this._repeatCountElement.textContent = this._repeatCount; 517 this._repeatCountElement.textContent = this._repeatCount;
518 var showRepeatCount = this._repeatCount > 1; 518 var showRepeatCount = this._repeatCount > 1;
519 this._repeatCountElement.classList.toggle("hidden", !showRepeatCount); 519 this._repeatCountElement.classList.toggle("hidden", !showRepeatCount);
520 this._icon.classList.toggle("hidden", showRepeatCount); 520 this._icon.classList.toggle("hidden", showRepeatCount);
521 } 521 }
522 } 522 };
523 523
524 /** 524 /**
525 * @constructor 525 * @constructor
526 * @param {!WebInspector.UISourceCodeFrame} sourceFrame 526 * @param {!WebInspector.UISourceCodeFrame} sourceFrame
527 * @param {!WebInspector.CodeMirrorTextEditor} textEditor 527 * @param {!WebInspector.CodeMirrorTextEditor} textEditor
528 * @param {number} lineNumber 528 * @param {number} lineNumber
529 */ 529 */
530 WebInspector.UISourceCodeFrame.RowMessageBucket = function(sourceFrame, textEdit or, lineNumber) 530 WebInspector.UISourceCodeFrame.RowMessageBucket = function(sourceFrame, textEdit or, lineNumber)
531 { 531 {
532 this._sourceFrame = sourceFrame; 532 this._sourceFrame = sourceFrame;
533 this._textEditor = textEditor; 533 this._textEditor = textEditor;
534 this._lineHandle = textEditor.textEditorPositionHandle(lineNumber, 0); 534 this._lineHandle = textEditor.textEditorPositionHandle(lineNumber, 0);
535 this._decoration = createElementWithClass("div", "text-editor-line-decoratio n"); 535 this._decoration = createElementWithClass("div", "text-editor-line-decoratio n");
536 this._decoration._messageBucket = this; 536 this._decoration._messageBucket = this;
537 this._wave = this._decoration.createChild("div", "text-editor-line-decoratio n-wave"); 537 this._wave = this._decoration.createChild("div", "text-editor-line-decoratio n-wave");
538 this._icon = this._wave.createChild("label", "text-editor-line-decoration-ic on", "dt-icon-label"); 538 this._icon = this._wave.createChild("label", "text-editor-line-decoration-ic on", "dt-icon-label");
539 this._hasDecoration = false; 539 this._hasDecoration = false;
540 540
541 this._messagesDescriptionElement = createElementWithClass("div", "text-edito r-messages-description-container"); 541 this._messagesDescriptionElement = createElementWithClass("div", "text-edito r-messages-description-container");
542 /** @type {!Array.<!WebInspector.UISourceCodeFrame.RowMessage>} */ 542 /** @type {!Array.<!WebInspector.UISourceCodeFrame.RowMessage>} */
543 this._messages = []; 543 this._messages = [];
544 544
545 this._level = null; 545 this._level = null;
546 } 546 };
547 547
548 WebInspector.UISourceCodeFrame.RowMessageBucket.prototype = { 548 WebInspector.UISourceCodeFrame.RowMessageBucket.prototype = {
549 /** 549 /**
550 * @param {number} lineNumber 550 * @param {number} lineNumber
551 * @param {number} columnNumber 551 * @param {number} columnNumber
552 */ 552 */
553 _updateWavePosition: function(lineNumber, columnNumber) 553 _updateWavePosition: function(lineNumber, columnNumber)
554 { 554 {
555 lineNumber = Math.min(lineNumber, this._textEditor.linesCount - 1); 555 lineNumber = Math.min(lineNumber, this._textEditor.linesCount - 1);
556 var lineText = this._textEditor.line(lineNumber); 556 var lineText = this._textEditor.line(lineNumber);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 if (this._level) { 654 if (this._level) {
655 this._textEditor.toggleLineClass(lineNumber, WebInspector.UISourceCo deFrame._lineClassPerLevel[this._level], false); 655 this._textEditor.toggleLineClass(lineNumber, WebInspector.UISourceCo deFrame._lineClassPerLevel[this._level], false);
656 this._icon.type = ""; 656 this._icon.type = "";
657 } 657 }
658 this._level = maxMessage.level(); 658 this._level = maxMessage.level();
659 if (!this._level) 659 if (!this._level)
660 return; 660 return;
661 this._textEditor.toggleLineClass(lineNumber, WebInspector.UISourceCodeFr ame._lineClassPerLevel[this._level], true); 661 this._textEditor.toggleLineClass(lineNumber, WebInspector.UISourceCodeFr ame._lineClassPerLevel[this._level], true);
662 this._icon.type = WebInspector.UISourceCodeFrame._iconClassPerLevel[this ._level]; 662 this._icon.type = WebInspector.UISourceCodeFrame._iconClassPerLevel[this ._level];
663 } 663 }
664 } 664 };
665 665
666 WebInspector.UISourceCode.Message._messageLevelPriority = { 666 WebInspector.UISourceCode.Message._messageLevelPriority = {
667 "Warning": 3, 667 "Warning": 3,
668 "Error": 4 668 "Error": 4
669 }; 669 };
670 670
671 /** 671 /**
672 * @param {!WebInspector.UISourceCode.Message} a 672 * @param {!WebInspector.UISourceCode.Message} a
673 * @param {!WebInspector.UISourceCode.Message} b 673 * @param {!WebInspector.UISourceCode.Message} b
674 * @return {number} 674 * @return {number}
675 */ 675 */
676 WebInspector.UISourceCode.Message.messageLevelComparator = function(a, b) 676 WebInspector.UISourceCode.Message.messageLevelComparator = function(a, b)
677 { 677 {
678 return WebInspector.UISourceCode.Message._messageLevelPriority[a.level()] - WebInspector.UISourceCode.Message._messageLevelPriority[b.level()]; 678 return WebInspector.UISourceCode.Message._messageLevelPriority[a.level()] - WebInspector.UISourceCode.Message._messageLevelPriority[b.level()];
679 } 679 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698