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

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

Issue 2778283002: [DevTools] Do not inherit SDK.DOMNode from SDK.SDKObject (Closed)
Patch Set: Created 3 years, 8 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
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 /** 4 /**
5 * @unrestricted 5 * @unrestricted
6 */ 6 */
7 Elements.ElementStatePaneWidget = class extends UI.Widget { 7 Elements.ElementStatePaneWidget = class extends UI.Widget {
8 constructor() { 8 constructor() {
9 super(); 9 super();
10 this.element.className = 'styles-element-state-pane'; 10 this.element.className = 'styles-element-state-pane';
11 this.element.createChild('div').createTextChild(Common.UIString('Force eleme nt state')); 11 this.element.createChild('div').createTextChild(Common.UIString('Force eleme nt state'));
12 var table = createElementWithClass('table', 'source-code'); 12 var table = createElementWithClass('table', 'source-code');
13 13
14 var inputs = []; 14 var inputs = [];
15 this._inputs = inputs; 15 this._inputs = inputs;
16 16
17 /** 17 /**
18 * @param {!Event} event 18 * @param {!Event} event
19 */ 19 */
20 function clickListener(event) { 20 function clickListener(event) {
21 var node = UI.context.flavor(SDK.DOMNode); 21 var node = UI.context.flavor(SDK.DOMNode);
22 if (!node) 22 if (!node)
23 return; 23 return;
24 SDK.CSSModel.fromNode(node).forcePseudoState(node, event.target.state, eve nt.target.checked); 24 node.domModel().cssModel().forcePseudoState(node, event.target.state, even t.target.checked);
25 } 25 }
26 26
27 /** 27 /**
28 * @param {string} state 28 * @param {string} state
29 * @return {!Element} 29 * @return {!Element}
30 */ 30 */
31 function createCheckbox(state) { 31 function createCheckbox(state) {
32 var td = createElement('td'); 32 var td = createElement('td');
33 var label = UI.createCheckboxLabel(':' + state); 33 var label = UI.createCheckboxLabel(':' + state);
34 var input = label.checkboxElement; 34 var input = label.checkboxElement;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 72 }
73 73
74 _update() { 74 _update() {
75 if (!this.isShowing()) 75 if (!this.isShowing())
76 return; 76 return;
77 77
78 var node = UI.context.flavor(SDK.DOMNode); 78 var node = UI.context.flavor(SDK.DOMNode);
79 if (node) 79 if (node)
80 node = node.enclosingElementOrSelf(); 80 node = node.enclosingElementOrSelf();
81 81
82 this._updateModel(node ? SDK.CSSModel.fromNode(node) : null); 82 this._updateModel(node ? node.domModel().cssModel() : null);
83 if (node) { 83 if (node) {
84 var nodePseudoState = SDK.CSSModel.fromNode(node).pseudoState(node); 84 var nodePseudoState = node.domModel().cssModel().pseudoState(node);
85 for (var input of this._inputs) { 85 for (var input of this._inputs) {
86 input.disabled = !!node.pseudoType(); 86 input.disabled = !!node.pseudoType();
87 input.checked = nodePseudoState.indexOf(input.state) >= 0; 87 input.checked = nodePseudoState.indexOf(input.state) >= 0;
88 } 88 }
89 } else { 89 } else {
90 for (var input of this._inputs) { 90 for (var input of this._inputs) {
91 input.disabled = true; 91 input.disabled = true;
92 input.checked = false; 92 input.checked = false;
93 } 93 }
94 } 94 }
(...skipping 18 matching lines...) Expand all
113 } 113 }
114 114
115 /** 115 /**
116 * @override 116 * @override
117 * @return {!UI.ToolbarItem} 117 * @return {!UI.ToolbarItem}
118 */ 118 */
119 item() { 119 item() {
120 return this._button; 120 return this._button;
121 } 121 }
122 }; 122 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698