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

Side by Side Diff: chrome/resources/inspector/PropertiesSection.js

Issue 339015: Update Windows reference build to r30072.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/reference_builds/
Patch Set: Created 11 years, 1 month 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 | Annotate | Revision Log
Property Changes:
Added: svn:executable
+ *
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2007 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 *
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
14 * its contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 WebInspector.PropertiesSection = function(title, subtitle)
30 {
31 this.element = document.createElement("div");
32 this.element.className = "section";
33
34 this.headerElement = document.createElement("div");
35 this.headerElement.className = "header";
36
37 this.titleElement = document.createElement("div");
38 this.titleElement.className = "title";
39
40 this.subtitleElement = document.createElement("div");
41 this.subtitleElement.className = "subtitle";
42
43 this.headerElement.appendChild(this.subtitleElement);
44 this.headerElement.appendChild(this.titleElement);
45
46 this.headerElement.addEventListener("click", this.toggleExpanded.bind(this), false);
47
48 this.propertiesElement = document.createElement("ol");
49 this.propertiesElement.className = "properties";
50 this.propertiesTreeOutline = new TreeOutline(this.propertiesElement);
51 this.propertiesTreeOutline.section = this;
52
53 this.element.appendChild(this.headerElement);
54 this.element.appendChild(this.propertiesElement);
55
56 this.title = title;
57 this.subtitle = subtitle;
58 this._expanded = false;
59 }
60
61 WebInspector.PropertiesSection.prototype = {
62 get title()
63 {
64 return this._title;
65 },
66
67 set title(x)
68 {
69 if (this._title === x)
70 return;
71 this._title = x;
72
73 if (x instanceof Node) {
74 this.titleElement.removeChildren();
75 this.titleElement.appendChild(x);
76 } else
77 this.titleElement.textContent = x;
78 },
79
80 get subtitle()
81 {
82 return this._subtitle;
83 },
84
85 set subtitle(x)
86 {
87 if (this._subtitle === x)
88 return;
89 this._subtitle = x;
90 this.subtitleElement.innerHTML = x;
91 },
92
93 get expanded()
94 {
95 return this._expanded;
96 },
97
98 set expanded(x)
99 {
100 if (x)
101 this.expand();
102 else
103 this.collapse();
104 },
105
106 get populated()
107 {
108 return this._populated;
109 },
110
111 set populated(x)
112 {
113 this._populated = x;
114 if (!x && this.onpopulate && this._expanded) {
115 this.onpopulate(this);
116 this._populated = true;
117 }
118 },
119
120 expand: function()
121 {
122 if (this._expanded)
123 return;
124 this._expanded = true;
125 this.element.addStyleClass("expanded");
126
127 if (!this._populated && this.onpopulate) {
128 this.onpopulate(this);
129 this._populated = true;
130 }
131 },
132
133 collapse: function()
134 {
135 if (!this._expanded)
136 return;
137 this._expanded = false;
138 this.element.removeStyleClass("expanded");
139 },
140
141 toggleExpanded: function()
142 {
143 this.expanded = !this.expanded;
144 }
145 }
OLDNEW
« no previous file with comments | « chrome/resources/inspector/ProfilesPanel.js ('k') | chrome/resources/inspector/PropertiesSidebarPane.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698