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 2070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2081 | 2081 |
2082 /** | 2082 /** |
2083 * @override | 2083 * @override |
2084 */ | 2084 */ |
2085 onattach() { | 2085 onattach() { |
2086 this.updateTitle(); | 2086 this.updateTitle(); |
2087 | 2087 |
2088 this.listItemElement.addEventListener('mousedown', this._mouseDown.bind(this )); | 2088 this.listItemElement.addEventListener('mousedown', this._mouseDown.bind(this )); |
2089 this.listItemElement.addEventListener('mouseup', this._resetMouseDownElement .bind(this)); | 2089 this.listItemElement.addEventListener('mouseup', this._resetMouseDownElement .bind(this)); |
2090 this.listItemElement.addEventListener('click', this._mouseClick.bind(this)); | 2090 this.listItemElement.addEventListener('click', this._mouseClick.bind(this)); |
2091 this.listItemElement.addEventListener('copy', this._clipboardCopy.bind(this) ); | |
pfeldman
2017/02/08 19:04:48
You just created a lot of listeners for no good re
chenwilliam
2017/02/10 22:53:38
Done.
| |
2091 } | 2092 } |
2092 | 2093 |
2093 /** | 2094 /** |
2094 * @param {!Event} event | 2095 * @param {!Event} event |
2095 */ | 2096 */ |
2096 _mouseDown(event) { | 2097 _mouseDown(event) { |
2097 if (this._parentPane) { | 2098 if (this._parentPane) { |
2098 this._parentPane._mouseDownTreeElement = this; | 2099 this._parentPane._mouseDownTreeElement = this; |
2099 this._parentPane._mouseDownTreeElementIsName = | 2100 this._parentPane._mouseDownTreeElementIsName = |
2100 this.nameElement && this.nameElement.isSelfOrAncestor(event.target); | 2101 this.nameElement && this.nameElement.isSelfOrAncestor(event.target); |
2101 this._parentPane._mouseDownTreeElementIsValue = | 2102 this._parentPane._mouseDownTreeElementIsValue = |
2102 this.valueElement && this.valueElement.isSelfOrAncestor(event.target); | 2103 this.valueElement && this.valueElement.isSelfOrAncestor(event.target); |
2103 } | 2104 } |
2104 } | 2105 } |
2105 | 2106 |
2106 _resetMouseDownElement() { | 2107 _resetMouseDownElement() { |
2107 if (this._parentPane) { | 2108 if (this._parentPane) { |
2108 delete this._parentPane._mouseDownTreeElement; | 2109 delete this._parentPane._mouseDownTreeElement; |
2109 delete this._parentPane._mouseDownTreeElementIsName; | 2110 delete this._parentPane._mouseDownTreeElementIsName; |
2110 delete this._parentPane._mouseDownTreeElementIsValue; | 2111 delete this._parentPane._mouseDownTreeElementIsValue; |
2111 } | 2112 } |
2112 } | 2113 } |
2113 | 2114 |
2115 _clipboardCopy() { | |
2116 Host.userMetrics.actionTaken(Host.UserMetrics.Action.StyleRuleCopied); | |
2117 } | |
2118 | |
2114 /** | 2119 /** |
2115 * @override | 2120 * @override |
2116 */ | 2121 */ |
2117 onexpand() { | 2122 onexpand() { |
2118 this._updateExpandElement(); | 2123 this._updateExpandElement(); |
2119 } | 2124 } |
2120 | 2125 |
2121 /** | 2126 /** |
2122 * @override | 2127 * @override |
2123 */ | 2128 */ |
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3080 } | 3085 } |
3081 | 3086 |
3082 /** | 3087 /** |
3083 * @override | 3088 * @override |
3084 * @return {!UI.ToolbarItem} | 3089 * @return {!UI.ToolbarItem} |
3085 */ | 3090 */ |
3086 item() { | 3091 item() { |
3087 return this._button; | 3092 return this._button; |
3088 } | 3093 } |
3089 }; | 3094 }; |
OLD | NEW |