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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/elements/PropertiesWidget.js

Issue 2978713002: DevTools: migrate PropertiesWidget to shadow (Closed)
Patch Set: rebase Created 3 years, 5 months 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/elements/elementsPanel.css » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2014 Google Inc. All rights reserved. 3 * Copyright (C) 2014 Google Inc. All rights reserved.
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 14 matching lines...) Expand all
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */ 28 */
29 29
30 /** 30 /**
31 * @unrestricted 31 * @unrestricted
32 */ 32 */
33 Elements.PropertiesWidget = class extends UI.ThrottledWidget { 33 Elements.PropertiesWidget = class extends UI.ThrottledWidget {
34 constructor() { 34 constructor() {
35 super(); 35 super(true /* isWebComponent */);
36 this.registerRequiredCSS('elements/propertiesWidget.css');
36 37
37 SDK.targetManager.addModelListener(SDK.DOMModel, SDK.DOMModel.Events.AttrMod ified, this._onNodeChange, this); 38 SDK.targetManager.addModelListener(SDK.DOMModel, SDK.DOMModel.Events.AttrMod ified, this._onNodeChange, this);
38 SDK.targetManager.addModelListener(SDK.DOMModel, SDK.DOMModel.Events.AttrRem oved, this._onNodeChange, this); 39 SDK.targetManager.addModelListener(SDK.DOMModel, SDK.DOMModel.Events.AttrRem oved, this._onNodeChange, this);
39 SDK.targetManager.addModelListener( 40 SDK.targetManager.addModelListener(
40 SDK.DOMModel, SDK.DOMModel.Events.CharacterDataModified, this._onNodeCha nge, this); 41 SDK.DOMModel, SDK.DOMModel.Events.CharacterDataModified, this._onNodeCha nge, this);
41 SDK.targetManager.addModelListener( 42 SDK.targetManager.addModelListener(
42 SDK.DOMModel, SDK.DOMModel.Events.ChildNodeCountUpdated, this._onNodeCha nge, this); 43 SDK.DOMModel, SDK.DOMModel.Events.ChildNodeCountUpdated, this._onNodeCha nge, this);
43 UI.context.addFlavorChangeListener(SDK.DOMNode, this._setNode, this); 44 UI.context.addFlavorChangeListener(SDK.DOMNode, this._setNode, this);
44 this._node = UI.context.flavor(SDK.DOMNode); 45 this._node = UI.context.flavor(SDK.DOMNode);
45 this.update(); 46 this.update();
(...skipping 12 matching lines...) Expand all
58 * @protected 59 * @protected
59 * @return {!Promise.<?>} 60 * @return {!Promise.<?>}
60 */ 61 */
61 doUpdate() { 62 doUpdate() {
62 if (this._lastRequestedNode) { 63 if (this._lastRequestedNode) {
63 this._lastRequestedNode.domModel().runtimeModel().releaseObjectGroup(Eleme nts.PropertiesWidget._objectGroupName); 64 this._lastRequestedNode.domModel().runtimeModel().releaseObjectGroup(Eleme nts.PropertiesWidget._objectGroupName);
64 delete this._lastRequestedNode; 65 delete this._lastRequestedNode;
65 } 66 }
66 67
67 if (!this._node) { 68 if (!this._node) {
68 this.element.removeChildren(); 69 this.contentElement.removeChildren();
69 this.sections = []; 70 this.sections = [];
70 return Promise.resolve(); 71 return Promise.resolve();
71 } 72 }
72 73
73 this._lastRequestedNode = this._node; 74 this._lastRequestedNode = this._node;
74 return this._node.resolveToObject(Elements.PropertiesWidget._objectGroupName ).then(nodeResolved.bind(this)); 75 return this._node.resolveToObject(Elements.PropertiesWidget._objectGroupName ).then(nodeResolved.bind(this));
75 76
76 /** 77 /**
77 * @param {?SDK.RemoteObject} object 78 * @param {?SDK.RemoteObject} object
78 * @this {Elements.PropertiesWidget} 79 * @this {Elements.PropertiesWidget}
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 function fillSection(result) { 121 function fillSection(result) {
121 if (!result || !result.properties) 122 if (!result || !result.properties)
122 return; 123 return;
123 124
124 var properties = result.properties; 125 var properties = result.properties;
125 var expanded = []; 126 var expanded = [];
126 var sections = this.sections || []; 127 var sections = this.sections || [];
127 for (var i = 0; i < sections.length; ++i) 128 for (var i = 0; i < sections.length; ++i)
128 expanded.push(sections[i].expanded); 129 expanded.push(sections[i].expanded);
129 130
130 this.element.removeChildren(); 131 this.contentElement.removeChildren();
131 this.sections = []; 132 this.sections = [];
132 133
133 // Get array of property user-friendly names. 134 // Get array of property user-friendly names.
134 for (var i = 0; i < properties.length; ++i) { 135 for (var i = 0; i < properties.length; ++i) {
135 if (!parseInt(properties[i].name, 10)) 136 if (!parseInt(properties[i].name, 10))
136 continue; 137 continue;
137 var property = properties[i].value; 138 var property = properties[i].value;
138 var title = property.description; 139 var title = property.description;
139 title = title.replace(/Prototype$/, ''); 140 title = title.replace(/Prototype$/, '');
140 var section = new ObjectUI.ObjectPropertiesSection(property, title); 141 var section = new ObjectUI.ObjectPropertiesSection(property, title);
141 section.element.classList.add('properties-widget-section'); 142 section.element.classList.add('properties-widget-section');
142 this.sections.push(section); 143 this.sections.push(section);
143 this.element.appendChild(section.element); 144 this.contentElement.appendChild(section.element);
144 if (expanded[this.sections.length - 1]) 145 if (expanded[this.sections.length - 1])
145 section.expand(); 146 section.expand();
146 section.addEventListener(UI.TreeOutline.Events.ElementExpanded, this._pr opertyExpanded, this); 147 section.addEventListener(UI.TreeOutline.Events.ElementExpanded, this._pr opertyExpanded, this);
147 } 148 }
148 } 149 }
149 } 150 }
150 151
151 /** 152 /**
152 * @param {!Common.Event} event 153 * @param {!Common.Event} event
153 */ 154 */
(...skipping 11 matching lines...) Expand all
165 return; 166 return;
166 var data = event.data; 167 var data = event.data;
167 var node = /** @type {!SDK.DOMNode} */ (data instanceof SDK.DOMNode ? data : data.node); 168 var node = /** @type {!SDK.DOMNode} */ (data instanceof SDK.DOMNode ? data : data.node);
168 if (this._node !== node) 169 if (this._node !== node)
169 return; 170 return;
170 this.update(); 171 this.update();
171 } 172 }
172 }; 173 };
173 174
174 Elements.PropertiesWidget._objectGroupName = 'properties-sidebar-pane'; 175 Elements.PropertiesWidget._objectGroupName = 'properties-sidebar-pane';
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/elements/elementsPanel.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698