Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 41 this._sectionsContainer = this.element.createChild('div'); | 41 this._sectionsContainer = this.element.createChild('div'); |
| 42 this._swatchPopoverHelper = new InlineEditor.SwatchPopoverHelper(); | 42 this._swatchPopoverHelper = new InlineEditor.SwatchPopoverHelper(); |
| 43 this._linkifier = new Components.Linkifier(Elements.StylesSidebarPane._maxLi nkLength, /* useLinkDecorator */ true); | 43 this._linkifier = new Components.Linkifier(Elements.StylesSidebarPane._maxLi nkLength, /* useLinkDecorator */ true); |
| 44 | 44 |
| 45 this.element.classList.add('styles-pane'); | 45 this.element.classList.add('styles-pane'); |
| 46 | 46 |
| 47 /** @type {!Array<!Elements.SectionBlock>} */ | 47 /** @type {!Array<!Elements.SectionBlock>} */ |
| 48 this._sectionBlocks = []; | 48 this._sectionBlocks = []; |
| 49 Elements.StylesSidebarPane._instance = this; | 49 Elements.StylesSidebarPane._instance = this; |
| 50 UI.context.addFlavorChangeListener(SDK.DOMNode, this.forceUpdate, this); | 50 UI.context.addFlavorChangeListener(SDK.DOMNode, this.forceUpdate, this); |
| 51 this.element.addEventListener('copy', this._clipboardCopy.bind(this)); | |
| 51 } | 52 } |
| 52 | 53 |
| 53 /** | 54 /** |
| 54 * @param {!SDK.CSSProperty} property | 55 * @param {!SDK.CSSProperty} property |
| 55 * @return {!Element} | 56 * @return {!Element} |
| 56 */ | 57 */ |
| 57 static createExclamationMark(property) { | 58 static createExclamationMark(property) { |
| 58 var exclamationElement = createElement('label', 'dt-icon-label'); | 59 var exclamationElement = createElement('label', 'dt-icon-label'); |
| 59 exclamationElement.className = 'exclamation-mark'; | 60 exclamationElement.className = 'exclamation-mark'; |
| 60 if (!Elements.StylesSidebarPane.ignoreErrorsForProperty(property)) | 61 if (!Elements.StylesSidebarPane.ignoreErrorsForProperty(property)) |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 478 | 479 |
| 479 /** | 480 /** |
| 480 * @return {!Array<!Elements.StylePropertiesSection>} | 481 * @return {!Array<!Elements.StylePropertiesSection>} |
| 481 */ | 482 */ |
| 482 allSections() { | 483 allSections() { |
| 483 var sections = []; | 484 var sections = []; |
| 484 for (var block of this._sectionBlocks) | 485 for (var block of this._sectionBlocks) |
| 485 sections = sections.concat(block.sections); | 486 sections = sections.concat(block.sections); |
| 486 return sections; | 487 return sections; |
| 487 } | 488 } |
| 489 | |
| 490 /** | |
| 491 * @param {!Event} event | |
| 492 * @suppressGlobalPropertiesCheck | |
| 493 */ | |
| 494 _clipboardCopy(event) { | |
| 495 // event.target is unreliable for copy event | |
|
chenwilliam
2017/02/10 22:53:38
w/o this hack, it was firing after I selected Styl
pfeldman
2017/02/10 23:00:46
Can't be!
chenwilliam
2017/02/25 00:49:14
Seems like the focus was fixed...
| |
| 496 if (this.element.contains(self.document.activeElement)) | |
| 497 Host.userMetrics.actionTaken(Host.UserMetrics.Action.StyleRuleCopied); | |
| 498 } | |
| 488 }; | 499 }; |
| 489 | 500 |
| 490 Elements.StylesSidebarPane._maxLinkLength = 30; | 501 Elements.StylesSidebarPane._maxLinkLength = 30; |
| 491 | 502 |
| 492 /** | 503 /** |
| 493 * @unrestricted | 504 * @unrestricted |
| 494 */ | 505 */ |
| 495 Elements.SectionBlock = class { | 506 Elements.SectionBlock = class { |
| 496 /** | 507 /** |
| 497 * @param {?Element} titleElement | 508 * @param {?Element} titleElement |
| (...skipping 2582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3080 } | 3091 } |
| 3081 | 3092 |
| 3082 /** | 3093 /** |
| 3083 * @override | 3094 * @override |
| 3084 * @return {!UI.ToolbarItem} | 3095 * @return {!UI.ToolbarItem} |
| 3085 */ | 3096 */ |
| 3086 item() { | 3097 item() { |
| 3087 return this._button; | 3098 return this._button; |
| 3088 } | 3099 } |
| 3089 }; | 3100 }; |
| OLD | NEW |