| OLD | NEW |
| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 SourceFrame.SourcesTextEditor.Events.EditorBlurred, | 67 SourceFrame.SourcesTextEditor.Events.EditorBlurred, |
| 68 () => UI.context.setFlavor(SourceFrame.UISourceCodeFrame, null)); | 68 () => UI.context.setFlavor(SourceFrame.UISourceCodeFrame, null)); |
| 69 this.textEditor.addEventListener( | 69 this.textEditor.addEventListener( |
| 70 SourceFrame.SourcesTextEditor.Events.EditorFocused, | 70 SourceFrame.SourcesTextEditor.Events.EditorFocused, |
| 71 () => UI.context.setFlavor(SourceFrame.UISourceCodeFrame, this)); | 71 () => UI.context.setFlavor(SourceFrame.UISourceCodeFrame, this)); |
| 72 | 72 |
| 73 this._updateStyle(); | 73 this._updateStyle(); |
| 74 | 74 |
| 75 this._errorPopoverHelper = new UI.PopoverHelper(this.element); | 75 this._errorPopoverHelper = new UI.PopoverHelper(this.element); |
| 76 this._errorPopoverHelper.initializeCallbacks(this._getErrorAnchor.bind(this)
, this._showErrorPopover.bind(this)); | 76 this._errorPopoverHelper.initializeCallbacks(this._getErrorAnchor.bind(this)
, this._showErrorPopover.bind(this)); |
| 77 this._errorPopoverHelper.setHasPadding(true); |
| 77 | 78 |
| 78 this._errorPopoverHelper.setTimeout(100, 100); | 79 this._errorPopoverHelper.setTimeout(100, 100); |
| 79 | 80 |
| 80 /** | 81 /** |
| 81 * @return {!Promise<?string>} | 82 * @return {!Promise<?string>} |
| 82 */ | 83 */ |
| 83 function workingCopy() { | 84 function workingCopy() { |
| 84 if (uiSourceCode.isDirty()) | 85 if (uiSourceCode.isDirty()) |
| 85 return /** @type {!Promise<?string>} */ (Promise.resolve(uiSourceCode.wo
rkingCopy())); | 86 return /** @type {!Promise<?string>} */ (Promise.resolve(uiSourceCode.wo
rkingCopy())); |
| 86 return uiSourceCode.requestContent(); | 87 return uiSourceCode.requestContent(); |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 var element = target.enclosingNodeOrSelfWithClass('text-editor-line-decorati
on-icon') || | 394 var element = target.enclosingNodeOrSelfWithClass('text-editor-line-decorati
on-icon') || |
| 394 target.enclosingNodeOrSelfWithClass('text-editor-line-decoration-wave'); | 395 target.enclosingNodeOrSelfWithClass('text-editor-line-decoration-wave'); |
| 395 if (!element) | 396 if (!element) |
| 396 return; | 397 return; |
| 397 this._errorWavePopoverAnchor = new AnchorBox(event.clientX, event.clientY, 1
, 1); | 398 this._errorWavePopoverAnchor = new AnchorBox(event.clientX, event.clientY, 1
, 1); |
| 398 return element; | 399 return element; |
| 399 } | 400 } |
| 400 | 401 |
| 401 /** | 402 /** |
| 402 * @param {!Element} anchor | 403 * @param {!Element} anchor |
| 403 * @param {!UI.Popover} popover | 404 * @param {!UI.GlassPane} popover |
| 405 * @return {!Promise<boolean>} |
| 404 */ | 406 */ |
| 405 _showErrorPopover(anchor, popover) { | 407 _showErrorPopover(anchor, popover) { |
| 406 var messageBucket = anchor.enclosingNodeOrSelfWithClass('text-editor-line-de
coration')._messageBucket; | 408 var messageBucket = anchor.enclosingNodeOrSelfWithClass('text-editor-line-de
coration')._messageBucket; |
| 407 var messagesOutline = messageBucket.messagesDescription(); | 409 var messagesOutline = messageBucket.messagesDescription(); |
| 408 var popoverAnchor = | 410 popover.setContentAnchorBox( |
| 409 anchor.enclosingNodeOrSelfWithClass('text-editor-line-decoration-icon')
? anchor : this._errorWavePopoverAnchor; | 411 anchor.enclosingNodeOrSelfWithClass('text-editor-line-decoration-icon')
? anchor.boxInWindow() : |
| 410 popover.showForAnchor(messagesOutline, popoverAnchor); | 412
this._errorWavePopoverAnchor); |
| 413 popover.contentElement.appendChild(messagesOutline); |
| 414 return Promise.resolve(true); |
| 411 } | 415 } |
| 412 | 416 |
| 413 _updateBucketDecorations() { | 417 _updateBucketDecorations() { |
| 414 for (var bucket of this._rowMessageBuckets.values()) | 418 for (var bucket of this._rowMessageBuckets.values()) |
| 415 bucket._updateDecoration(); | 419 bucket._updateDecoration(); |
| 416 } | 420 } |
| 417 | 421 |
| 418 /** | 422 /** |
| 419 * @param {!Common.Event} event | 423 * @param {!Common.Event} event |
| 420 */ | 424 */ |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 | 682 |
| 679 /** | 683 /** |
| 680 * @param {!Workspace.UISourceCode.Message} a | 684 * @param {!Workspace.UISourceCode.Message} a |
| 681 * @param {!Workspace.UISourceCode.Message} b | 685 * @param {!Workspace.UISourceCode.Message} b |
| 682 * @return {number} | 686 * @return {number} |
| 683 */ | 687 */ |
| 684 Workspace.UISourceCode.Message.messageLevelComparator = function(a, b) { | 688 Workspace.UISourceCode.Message.messageLevelComparator = function(a, b) { |
| 685 return Workspace.UISourceCode.Message._messageLevelPriority[a.level()] - | 689 return Workspace.UISourceCode.Message._messageLevelPriority[a.level()] - |
| 686 Workspace.UISourceCode.Message._messageLevelPriority[b.level()]; | 690 Workspace.UISourceCode.Message._messageLevelPriority[b.level()]; |
| 687 }; | 691 }; |
| OLD | NEW |