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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/SidebarTreeElement.js

Issue 2341343002: [DevTools] Remove outline-disclosure and sidebar-tree. (Closed)
Patch Set: Created 4 years, 3 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
(Empty)
1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 /**
27 * @constructor
28 * @extends {TreeElement}
29 * @param {string} title
30 */
31 WebInspector.SidebarSectionTreeElement = function(title)
32 {
33 TreeElement.call(this, title.escapeHTML(), true);
34 this.expand();
35 }
36
37 WebInspector.SidebarSectionTreeElement.prototype = {
38 selectable: false,
39
40 collapse: function()
41 {
42 // Should not collapse as it is not selectable.
43 },
44
45 get smallChildren()
46 {
47 return this._smallChildren;
48 },
49
50 set smallChildren(x)
51 {
52 if (this._smallChildren === x)
53 return;
54
55 this._smallChildren = x;
56
57 this._childrenListNode.classList.toggle("small", this._smallChildren);
58 },
59
60 onattach: function()
61 {
62 this.listItemElement.classList.add("sidebar-tree-section");
63 },
64
65 __proto__: TreeElement.prototype
66 }
67
68 /**
69 * @constructor
70 * @extends {TreeElement}
71 * @param {string} className
72 * @param {string} title
73 * @param {string=} subtitle
74 * @param {boolean=} expandable
75 */
76 WebInspector.SidebarTreeElement = function(className, title, subtitle, expandabl e)
77 {
78 TreeElement.call(this, "", expandable);
79
80 if (expandable)
81 this.disclosureButton = createElementWithClass("button", "disclosure-but ton");
82
83 this.iconElement = createElementWithClass("div", "icon");
84 this.statusElement = createElementWithClass("div", "status");
85 this._titlesElement = createElementWithClass("div", "titles");
86
87 this.titleContainer = this._titlesElement.createChild("span", "title-contain er");
88 this.titleElement = this.titleContainer.createChild("span", "title");
89
90 this.subtitleElement = this._titlesElement.createChild("span", "subtitle");
91
92 this.className = className;
93 this.mainTitle = title;
94 this.subtitle = subtitle;
95 }
96
97 WebInspector.SidebarTreeElement.prototype = {
98 get small()
99 {
100 return this._small;
101 },
102
103 set small(x)
104 {
105 this._small = x;
106 if (this.listItemElement)
107 this.listItemElement.classList.toggle("small", this._small);
108 },
109
110 get mainTitle()
111 {
112 return this._mainTitle;
113 },
114
115 set mainTitle(x)
116 {
117 this._mainTitle = x;
118 this.refreshTitles();
119 },
120
121 get subtitle()
122 {
123 return this._subtitle;
124 },
125
126 set subtitle(x)
127 {
128 this._subtitle = x;
129 this.refreshTitles();
130 },
131
132 set wait(x)
133 {
134 this.listItemElement.classList.toggle("wait", x);
135 },
136
137 refreshTitles: function()
138 {
139 var mainTitle = this.mainTitle;
140 if (this.titleElement.textContent !== mainTitle)
141 this.titleElement.textContent = mainTitle;
142
143 var subtitle = this.subtitle;
144 if (subtitle) {
145 if (this.subtitleElement.textContent !== subtitle)
146 this.subtitleElement.textContent = subtitle;
147 this._titlesElement.classList.remove("no-subtitle");
148 } else {
149 this.subtitleElement.textContent = "";
150 this._titlesElement.classList.add("no-subtitle");
151 }
152 },
153
154 /**
155 * @override
156 * @return {boolean}
157 */
158 isEventWithinDisclosureTriangle: function(event)
159 {
160 return event.target === this.disclosureButton;
161 },
162
163 onattach: function()
164 {
165 this.listItemElement.classList.add("sidebar-tree-item");
166
167 if (this.className)
168 this.listItemElement.classList.add(this.className);
169
170 if (this.small)
171 this.listItemElement.classList.add("small");
172
173 if (this.isExpandable() && this.disclosureButton)
174 this.listItemElement.appendChild(this.disclosureButton);
175
176 this.listItemElement.appendChildren(this.iconElement, this.statusElement , this._titlesElement);
177 },
178
179 __proto__: TreeElement.prototype
180 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/BUILD.gn ('k') | third_party/WebKit/Source/devtools/front_end/ui/inspectorStyle.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698