Changeset 238589 in webkit
- Timestamp:
- Nov 27, 2018 4:28:06 PM (5 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 3 added
- 12 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r238570 r238589 1 2018-11-27 Nikita Vasilyev <nvasilyev@apple.com> 2 3 Web Inspector: Computed panel: allow to expand properties to show list of overridden values 4 https://bugs.webkit.org/show_bug.cgi?id=191984 5 6 Reviewed by Devin Rousso. 7 8 Introduce the new experimental Computed Style Cascades. 9 10 Each property now can expand to show a list of overridden values, their corresponding 11 selectors, and source locations. 12 13 * Localizations/en.lproj/localizedStrings.js: 14 * UserInterface/Base/Setting.js: 15 * UserInterface/Main.html: 16 * UserInterface/Models/DOMNodeStyles.js: 17 (WI.DOMNodeStyles.prototype.get uniqueOrderedStyles): 18 Move `uniqueOrderedStyles` function unmodified from SpreadsheetRulesStyleDetailsPanel so it can be used by ComputedStyleDetailsPanel, too. 19 20 * UserInterface/Views/ComputedStyleDetailsPanel.css: 21 (.computed-with-traces .computed-style-properties): 22 (.computed-with-traces .details-section.computed-style-properties:not(.collapsed) > :matches(.header, .content)): 23 (.computed-with-traces .details-section.computed-style-properties > .content): 24 (.computed-with-traces .computed-style-properties .property .go-to-arrow): 25 26 * UserInterface/Views/ComputedStyleDetailsPanel.js: 27 (WI.ComputedStyleDetailsPanel.prototype.refresh): 28 (WI.ComputedStyleDetailsPanel.prototype.applyFilter): 29 (WI.ComputedStyleDetailsPanel.prototype.focusFirstSection): 30 (WI.ComputedStyleDetailsPanel.prototype.initialLayout): 31 (WI.ComputedStyleDetailsPanel.prototype._computePropertyTraces): 32 (WI.ComputedStyleDetailsPanel.prototype._computedStyleShowAllCheckboxValueChanged): 33 (WI.ComputedStyleDetailsPanel.prototype._handlePropertiesSectionCollapsedStateChanged): 34 (WI.ComputedStyleDetailsPanel.prototype._handleEditorFilterApplied): 35 (WI.ComputedStyleDetailsPanel): 36 Use the new Computed section (WI.ComputedStyleSection) only when it's enabled in the experimental settings. 37 Otherwise, use the current Computed section. 38 39 * UserInterface/Views/ComputedStyleDetailsSidebarPanel.js: 40 (WI.ComputedStyleDetailsSidebarPanel): 41 42 * UserInterface/Views/ComputedStyleSection.css: Added. 43 (.computed-style-section): 44 (.computed-style-section .computed-property-item): 45 (.computed-style-section .computed-property-item.expanded): 46 (.computed-style-section .computed-property-item.expanded + .computed-property-item): 47 (.computed-style-section .computed-property-item .disclosure-button): 48 (.computed-style-section .computed-property-item .property-traces): 49 (.computed-style-section .computed-property-item.expanded .property-traces): 50 (.computed-style-section .computed-property-item.expanded .disclosure-button): 51 (.computed-style-section .computed-property-item .property-trace-item): 52 (.computed-style-section .computed-property-item .property-trace-item .property.overridden .value): 53 (.computed-style-section .property-trace-item-left,): 54 (.computed-style-section .property-trace-item-right): 55 (.computed-style-section .computed-property-item .property-trace-item .value): 56 (.computed-style-section .property .value): 57 (.computed-style-section .computed-property-item .property): 58 (.computed-style-section .computed-property-item .property .name): 59 (.computed-style-section .computed-property-item .property-trace-item .selector): 60 (.computed-style-section .computed-property-item .origin): 61 (.computed-style-section .computed-property-item .go-to-link): 62 (.computed-style-section .property-trace-item .property .name,): 63 (.computed-style-section .property-trace-item .property .value + span): 64 (.computed-style-properties.details-section > .content,): 65 66 * UserInterface/Views/ComputedStyleSection.js: Added. 67 (WI.ComputedStyleSection): 68 (WI.ComputedStyleSection.prototype.get style): 69 (WI.ComputedStyleSection.prototype.set style): 70 (WI.ComputedStyleSection.prototype.get styleTraces): 71 (WI.ComputedStyleSection.prototype.set styleTraces): 72 (WI.ComputedStyleSection.prototype.set showsImplicitProperties): 73 (WI.ComputedStyleSection.prototype.set alwaysShowPropertyNames): 74 (WI.ComputedStyleSection.prototype.set propertyVisibilityMode): 75 (WI.ComputedStyleSection.prototype.set hideFilterNonMatchingProperties): 76 (WI.ComputedStyleSection.prototype.get propertiesToRender): 77 (WI.ComputedStyleSection.prototype.layout): 78 (WI.ComputedStyleSection.prototype.detached): 79 (WI.ComputedStyleSection.prototype.hidden): 80 (WI.ComputedStyleSection.prototype.applyFilter): 81 (WI.ComputedStyleSection.prototype.spreadsheetStylePropertyShowProperty): 82 (WI.ComputedStyleSection.prototype._createTrace): 83 (WI.ComputedStyleSection.prototype._handlePropertiesChanged): 84 85 * UserInterface/Views/ExpandableView.js: Added. 86 (WI.ExpandableView): 87 (WI.ExpandableView.prototype.get element): 88 (WI.ExpandableView.prototype._onDisclosureButtonClick): 89 (WI.ExpandableView.prototype._update): 90 91 * UserInterface/Views/SettingsTabContentView.js: 92 (WI.SettingsTabContentView.prototype._createExperimentalSettingsView): 93 94 * UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js: 95 (WI.SpreadsheetCSSStyleDeclarationSection.prototype.initialLayout): 96 (WI.SpreadsheetCSSStyleDeclarationSection.prototype.layout): 97 Replace `_renderOrigin` with WI.StyleOriginView so it could be used by WI.ComputedStyleSection. 98 99 * UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js: 100 (WI.SpreadsheetRulesStyleDetailsPanel.prototype.layout): 101 102 * UserInterface/Views/SpreadsheetStyleProperty.js: 103 (WI.SpreadsheetStyleProperty.prototype.update): 104 (WI.SpreadsheetStyleProperty.prototype._isEditable): 105 (WI.SpreadsheetStyleProperty.prototype._createInlineSwatch): 106 Introduce `readOnly` option so WI.SpreadsheetStyleProperty could be used by WI.ComputedStyleSection. 107 108 * UserInterface/Views/StyleOriginView.js: Added. 109 (WI.StyleOriginView): 110 1 111 2018-11-27 Timothy Hatcher <timothy@apple.com> 2 112 -
trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
r238570 r238589 352 352 localizedStrings["Enable Breakpoint"] = "Enable Breakpoint"; 353 353 localizedStrings["Enable Breakpoints"] = "Enable Breakpoints"; 354 localizedStrings["Enable Computed Style Cascades"] = "Enable Computed Style Cascades"; 354 355 localizedStrings["Enable Event Listener"] = "Enable Event Listener"; 355 356 localizedStrings["Enable Layers Tab"] = "Enable Layers Tab"; -
trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js
r238192 r238589 131 131 // Experimental 132 132 experimentalEnableMultiplePropertiesSelection: new WI.Setting("experimental-enable-multiple-properties-selection", false), 133 experimentalEnableComputedStyleCascades: new WI.Setting("experimental-enable-computed-style-cascades", false), 133 134 experimentalEnableLayersTab: new WI.Setting("experimental-enable-layers-tab", false), 134 135 experimentalEnableNewTabBar: new WI.Setting("experimental-enable-new-tab-bar", false), -
trunk/Source/WebInspectorUI/UserInterface/Main.html
r238563 r238589 63 63 <link rel="stylesheet" href="Views/CompletionSuggestionsView.css"> 64 64 <link rel="stylesheet" href="Views/ComputedStyleDetailsPanel.css"> 65 <link rel="stylesheet" href="Views/ComputedStyleSection.css"> 65 66 <link rel="stylesheet" href="Views/ConsoleDrawer.css"> 66 67 <link rel="stylesheet" href="Views/ConsoleMessageView.css"> … … 600 601 <script src="Views/CompletionSuggestionsView.js"></script> 601 602 <script src="Views/ComputedStyleDetailsPanel.js"></script> 603 <script src="Views/ComputedStyleSection.js"></script> 602 604 <script src="Views/ConsoleDrawer.js"></script> 603 605 <script src="Views/ConsoleGroup.js"></script> … … 640 642 <script src="Views/EventBreakpointTreeElement.js"></script> 641 643 <script src="Views/EventListenerSectionGroup.js"></script> 644 <script src="Views/ExpandableView.js"></script> 642 645 <script src="Views/FilterBar.js"></script> 643 646 <script src="Views/FilterBarButton.js"></script> … … 781 784 <script src="Views/SpreadsheetStyleProperty.js"></script> 782 785 <script src="Views/SpreadsheetTextField.js"></script> 786 <script src="Views/StyleOriginView.js"></script> 783 787 784 788 <script src="Views/SpringEditor.js"></script> -
trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js
r236766 r238589 369 369 } 370 370 371 get uniqueOrderedStyles() 372 { 373 let uniqueStyles = []; 374 375 for (let style of this._orderedStyles) { 376 let rule = style.ownerRule; 377 if (!rule) { 378 uniqueStyles.push(style); 379 continue; 380 } 381 382 let found = false; 383 for (let existingStyle of uniqueStyles) { 384 if (rule.isEqualTo(existingStyle.ownerRule)) { 385 found = true; 386 break; 387 } 388 } 389 if (!found) 390 uniqueStyles.push(style); 391 } 392 393 return uniqueStyles; 394 } 395 371 396 effectivePropertyForName(name) 372 397 { -
trunk/Source/WebInspectorUI/UserInterface/Views/ComputedStyleDetailsPanel.css
r236705 r238589 39 39 display: initial; 40 40 } 41 42 .computed-with-traces .computed-style-properties { 43 --disclosure-button-size: 15px; 44 } 45 46 .computed-with-traces .details-section.computed-style-properties:not(.collapsed) > :matches(.header, .content) { 47 background-color: hsl(0, 0%, 97%); 48 } 49 50 .computed-with-traces .details-section.computed-style-properties > .content { 51 font: 12px -webkit-system-font, sans-serif; 52 } 53 54 .computed-with-traces .computed-style-properties .property .go-to-arrow { 55 width: var(--disclosure-button-size); 56 height: var(--disclosure-button-size); 57 } -
trunk/Source/WebInspectorUI/UserInterface/Views/ComputedStyleDetailsPanel.js
r236336 r238589 46 46 } 47 47 48 this._propertiesTextEditor.style = this.nodeStyles.computedStyle; 49 this._propertiesSection.element.classList.toggle("hidden", !this._propertiesTextEditor.propertiesToRender.length); 48 if (WI.settings.experimentalEnableComputedStyleCascades.value) 49 this._computedStyleSection.styleTraces = this._computePropertyTraces(this.nodeStyles.uniqueOrderedStyles); 50 51 this._computedStyleSection.style = this.nodeStyles.computedStyle; 50 52 51 53 this._variablesTextEditor.style = this.nodeStyles.computedStyle; … … 67 69 return; 68 70 69 this._ propertiesTextEditor.applyFilter(filterText);71 this._computedStyleSection.applyFilter(filterText); 70 72 this._variablesTextEditor.applyFilter(filterText); 71 73 } … … 81 83 focusFirstSection() 82 84 { 83 this._ propertiesTextEditor.focus();85 this._computedStyleSection.focus(); 84 86 } 85 87 … … 102 104 computedStyleShowAllLabel.appendChild(this._computedStyleShowAllCheckbox); 103 105 104 this._propertiesTextEditor = new WI.SpreadsheetCSSStyleDeclarationEditor(this); 105 this._propertiesTextEditor.propertyVisibilityMode = WI.SpreadsheetCSSStyleDeclarationEditor.PropertyVisibilityMode.HideVariables; 106 this._propertiesTextEditor.showsImplicitProperties = this._computedStyleShowAllSetting.value; 107 this._propertiesTextEditor.alwaysShowPropertyNames = ["display", "width", "height"]; 108 this._propertiesTextEditor.hideFilterNonMatchingProperties = true; 109 this._propertiesTextEditor.sortPropertiesByName = true; 110 this._propertiesTextEditor.addEventListener(WI.SpreadsheetCSSStyleDeclarationEditor.Event.FilterApplied, this._handleEditorFilterApplied, this); 106 if (WI.settings.experimentalEnableComputedStyleCascades.value) { 107 this._computedStyleSection = new WI.ComputedStyleSection(this); 108 this._computedStyleSection.propertyVisibilityMode = WI.ComputedStyleSection.PropertyVisibilityMode.HideVariables; 109 this._computedStyleSection.addEventListener(WI.ComputedStyleSection.Event.FilterApplied, this._handleEditorFilterApplied, this); 110 } else { 111 this._computedStyleSection = new WI.SpreadsheetCSSStyleDeclarationEditor(this); 112 this._computedStyleSection.propertyVisibilityMode = WI.SpreadsheetCSSStyleDeclarationEditor.PropertyVisibilityMode.HideVariables; 113 this._computedStyleSection.sortPropertiesByName = true; 114 this._computedStyleSection.addEventListener(WI.SpreadsheetCSSStyleDeclarationEditor.Event.FilterApplied, this._handleEditorFilterApplied, this); 115 } 116 117 this._computedStyleSection.showsImplicitProperties = this._computedStyleShowAllSetting.value; 118 this._computedStyleSection.alwaysShowPropertyNames = ["display", "width", "height"]; 119 this._computedStyleSection.hideFilterNonMatchingProperties = true; 111 120 112 121 let propertiesRow = new WI.DetailsSectionRow; … … 115 124 this._propertiesSection.addEventListener(WI.DetailsSection.Event.CollapsedStateChanged, this._handlePropertiesSectionCollapsedStateChanged, this); 116 125 117 this.addSubview(this._ propertiesTextEditor);118 119 propertiesRow.element.appendChild(this._ propertiesTextEditor.element);126 this.addSubview(this._computedStyleSection); 127 128 propertiesRow.element.appendChild(this._computedStyleSection.element); 120 129 121 130 this._variablesTextEditor = new WI.SpreadsheetCSSStyleDeclarationEditor(this); … … 154 163 // Private 155 164 165 _computePropertyTraces(orderedDeclarations) 166 { 167 let result = new Map(); 168 for (let rule of orderedDeclarations) { 169 for (let property of rule.allProperties) { 170 let properties = result.get(property.name); 171 if (!properties) { 172 properties = []; 173 result.set(property.name, properties); 174 } 175 properties.push(property); 176 } 177 } 178 179 return result; 180 } 181 156 182 _computedStyleShowAllCheckboxValueChanged(event) 157 183 { 158 184 let checked = this._computedStyleShowAllCheckbox.checked; 159 185 this._computedStyleShowAllSetting.value = checked; 160 this._ propertiesTextEditor.showsImplicitProperties = checked;186 this._computedStyleSection.showsImplicitProperties = checked; 161 187 } 162 188 … … 164 190 { 165 191 if (event && event.data && !event.data.collapsed) 166 this._ propertiesTextEditor.needsLayout();192 this._computedStyleSection.needsLayout(); 167 193 } 168 194 … … 176 202 { 177 203 let section = null; 178 if (event.target === this._ propertiesTextEditor)204 if (event.target === this._computedStyleSection) 179 205 section = this._propertiesSection; 180 206 else if (event.target === this._variablesTextEditor) -
trunk/Source/WebInspectorUI/UserInterface/Views/ComputedStyleDetailsSidebarPanel.js
r227078 r238589 29 29 { 30 30 super("style-computed", WI.UIString("Computed"), WI.ComputedStyleDetailsPanel); 31 32 if (WI.settings.experimentalEnableComputedStyleCascades.value) 33 this.element.classList.add("computed-with-traces"); 31 34 } 32 35 }; -
trunk/Source/WebInspectorUI/UserInterface/Views/ExpandableView.js
r238588 r238589 1 1 /* 2 * Copyright (C) 201 7Apple Inc. All rights reserved.2 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 WI. ComputedStyleDetailsSidebarPanel = class ComputedStyleDetailsSidebarPanel extends WI.GeneralStyleDetailsSidebarPanel26 WI.ExpandableView = class ExpandableView 27 27 { 28 constructor( )28 constructor(key, titleElement, childElement) 29 29 { 30 super("style-computed", WI.UIString("Computed"), WI.ComputedStyleDetailsPanel); 30 this._element = document.createElement("div"); 31 32 if (childElement) { 33 let disclosureButton = document.createElement("button"); 34 disclosureButton.classList.add("disclosure-button"); 35 disclosureButton.addEventListener("click", this._onDisclosureButtonClick.bind(this)); 36 this._element.append(disclosureButton); 37 } 38 39 this._element.append(titleElement); 40 this._expandedSetting = new WI.Setting("expanded-" + key, false); 41 42 if (childElement) { 43 this._element.append(childElement); 44 this._element.classList.toggle("expanded", this._expandedSetting.value); 45 } 46 } 47 48 // Public 49 50 get element() 51 { 52 return this._element; 53 } 54 55 // Private 56 57 _onDisclosureButtonClick(event) 58 { 59 let shouldExpand = !this._expandedSetting.value; 60 this._update(shouldExpand); 61 } 62 63 _update(shouldExpand) 64 { 65 this._element.classList.toggle("expanded", shouldExpand); 66 this._expandedSetting.value = shouldExpand; 31 67 } 32 68 }; -
trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js
r238500 r238589 244 244 245 245 if (window.CSSAgent) { 246 experimentalSettingsView.addSetting(WI.UIString("Styles Sidebar:"), WI.settings.experimentalEnableMultiplePropertiesSelection, WI.UIString("Enable Selection of Multiple Properties")); 246 let group = experimentalSettingsView.addGroup(WI.UIString("Styles Sidebar:")); 247 group.addSetting(WI.settings.experimentalEnableMultiplePropertiesSelection, WI.UIString("Enable Selection of Multiple Properties")); 248 group.addSetting(WI.settings.experimentalEnableComputedStyleCascades, WI.UIString("Enable Computed Style Cascades")); 247 249 experimentalSettingsView.addSeparator(); 248 250 } … … 286 288 287 289 listenForChange(WI.settings.experimentalEnableMultiplePropertiesSelection); 290 listenForChange(WI.settings.experimentalEnableComputedStyleCascades); 288 291 listenForChange(WI.settings.experimentalEnableLayersTab); 289 292 listenForChange(WI.settings.experimentalEnableAuditTab); -
trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js
r238201 r238589 70 70 this._headerElement.classList.add("header"); 71 71 72 this._originElement = document.createElement("span"); 73 this._originElement.classList.add("origin"); 74 this._headerElement.append(this._originElement); 72 this._styleOriginView = new WI.StyleOriginView(); 73 this._headerElement.append(this._styleOriginView.element); 75 74 76 75 this._selectorElement = document.createElement("span"); … … 123 122 super.layout(); 124 123 125 this._ renderOrigin();124 this._styleOriginView.update(this._style); 126 125 this._renderSelector(); 127 126 … … 327 326 } 328 327 329 _renderOrigin()330 {331 this._originElement.removeChildren();332 333 switch (this._style.type) {334 case WI.CSSStyleDeclaration.Type.Rule:335 console.assert(this._style.ownerRule);336 337 if (this._style.ownerRule.sourceCodeLocation) {338 let options = {339 dontFloat: true,340 ignoreNetworkTab: true,341 ignoreSearchTab: true,342 };343 344 if (this._style.ownerStyleSheet.isInspectorStyleSheet()) {345 options.nameStyle = WI.SourceCodeLocation.NameStyle.None;346 options.prefix = WI.UIString("Inspector Style Sheet") + ":";347 }348 349 let sourceCodeLink = WI.createSourceCodeLocationLink(this._style.ownerRule.sourceCodeLocation, options);350 this._originElement.appendChild(sourceCodeLink);351 } else {352 let originString = "";353 354 switch (this._style.ownerRule.type) {355 case WI.CSSStyleSheet.Type.Author:356 originString = WI.UIString("Author Stylesheet");357 break;358 359 case WI.CSSStyleSheet.Type.User:360 originString = WI.UIString("User Stylesheet");361 break;362 363 case WI.CSSStyleSheet.Type.UserAgent:364 originString = WI.UIString("User Agent Stylesheet");365 break;366 367 case WI.CSSStyleSheet.Type.Inspector:368 originString = WI.UIString("Web Inspector");369 break;370 }371 372 console.assert(originString);373 if (originString)374 this._originElement.append(originString);375 376 if (!this._style.editable) {377 let styleTitle = "";378 if (this._style.ownerRule && this._style.ownerRule.type === WI.CSSStyleSheet.Type.UserAgent)379 styleTitle = WI.UIString("User Agent Stylesheet");380 else381 styleTitle = WI.UIString("Style rule");382 383 this._originElement.title = WI.UIString("%s cannot be modified").format(styleTitle);384 }385 }386 break;387 388 case WI.CSSStyleDeclaration.Type.Attribute:389 this._originElement.append(WI.UIString("HTML Attributes"));390 break;391 }392 }393 394 328 _createMediaHeader() 395 329 { -
trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js
r236766 r238589 216 216 this._sections = []; 217 217 218 let uniqueOrderedStyles = (orderedStyles) => {219 let uniqueStyles = [];220 221 for (let style of orderedStyles) {222 let rule = style.ownerRule;223 if (!rule) {224 uniqueStyles.push(style);225 continue;226 }227 228 let found = false;229 for (let existingStyle of uniqueStyles) {230 if (rule.isEqualTo(existingStyle.ownerRule)) {231 found = true;232 break;233 }234 }235 if (!found)236 uniqueStyles.push(style);237 }238 239 return uniqueStyles;240 };241 242 218 let createHeader = (text, node) => { 243 219 let header = this.element.appendChild(document.createElement("h2")); … … 271 247 }; 272 248 273 for (let style of uniqueOrderedStyles(this.nodeStyles.orderedStyles)) {249 for (let style of this.nodeStyles.uniqueOrderedStyles) { 274 250 if (style.inherited && (!previousStyle || previousStyle.node !== style.node)) 275 251 createHeader(WI.UIString("Inherited From"), style.node); … … 284 260 createHeader(WI.UIString("Pseudo Element"), pseudoNodeStyle.node); 285 261 286 for (let style of uniqueOrderedStyles(pseudoNodeStyle.orderedStyles))262 for (let style of pseudoNodeStyle.uniqueOrderedStyles) 287 263 createSection(style); 288 264 } -
trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js
r238201 r238589 26 26 WI.SpreadsheetStyleProperty = class SpreadsheetStyleProperty extends WI.Object 27 27 { 28 constructor(delegate, property )28 constructor(delegate, property, options = {}) 29 29 { 30 30 super(); … … 34 34 this._delegate = delegate || null; 35 35 this._property = property; 36 this._readOnly = options.readOnly || false; 36 37 this._element = document.createElement("div"); 37 38 … … 43 44 this._valueTextField = null; 44 45 45 this._property.__propertyView = this; 46 if (!this._readOnly) { 47 // This is only needed to navigate from Computed to the corresponding property in the Styles panel. 48 this._property.__propertyView = this; 49 } 46 50 47 51 this._selected = false; … … 52 56 property.addEventListener(WI.CSSProperty.Event.Changed, this.updateStatus, this); 53 57 54 if (WI.settings.experimentalEnableMultiplePropertiesSelection.value && this._ property.editable) {58 if (WI.settings.experimentalEnableMultiplePropertiesSelection.value && this._isEditable()) { 55 59 this._element.tabIndex = -1; 56 60 … … 137 141 this.element.removeChildren(); 138 142 139 if (this._ property.editable) {143 if (this._isEditable()) { 140 144 this._checkboxElement = this.element.appendChild(document.createElement("input")); 141 145 this._checkboxElement.classList.add("property-toggle"); … … 168 172 this._renderValue(this._property.rawValue); 169 173 170 if (this._ property.editable&& this._property.enabled) {174 if (this._isEditable() && this._property.enabled) { 171 175 this._nameElement.tabIndex = 0; 172 176 this._nameElement.addEventListener("beforeinput", this._handleNameBeforeInput.bind(this)); … … 181 185 } 182 186 183 if (this._ property.editable) {187 if (this._isEditable()) { 184 188 this._setupJumpToSymbol(this._nameElement); 185 189 this._setupJumpToSymbol(this._valueElement); … … 380 384 // Private 381 385 386 _isEditable() 387 { 388 return !this._readOnly && this._property.editable; 389 } 390 382 391 _renderValue(value) 383 392 { … … 435 444 innerElement.textContent = text; 436 445 437 let readOnly = !this._ property.editable;446 let readOnly = !this._isEditable(); 438 447 let swatch = new WI.InlineSwatch(type, valueObject, readOnly); 439 448
Note: See TracChangeset
for help on using the changeset viewer.