Skip to content

Commit 763d3c0

Browse files
committed
Some refactoring and cleanup.
1 parent 50bf232 commit 763d3c0

File tree

4 files changed

+148
-131
lines changed

4 files changed

+148
-131
lines changed

src/profiler/profiler_style.css

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
background-image: -o-linear-gradient(to bottom, rgba(0, 0, 0, 0.03) 50%, transparent 50%);
4040
background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.03) 50%, transparent 50%);
4141
background-position: 0 1px;
42-
background-size: 1px 36px;
43-
height: 145px;
42+
background-size: 1px 44px;
43+
height: 177px;
4444
}
4545

4646
.profiler-timeline
@@ -52,7 +52,7 @@
5252
border-top: 1px solid rgba(0, 0, 0, 0.055);
5353
border-bottom: 1px solid rgba(0, 0, 0, 0.055);
5454
overflow: hidden;
55-
height: 144px;
55+
height: 176px;
5656
}
5757

5858
.profiler-details-list
@@ -108,8 +108,8 @@
108108

109109
.profiler-timeline-row
110110
{
111-
height: 16px;
112-
line-height: 16px;
111+
height: 20px;
112+
line-height: 20px;
113113
padding: 1px 5px; /* Line up up with the table below */
114114
white-space: nowrap;
115115
position: relative;
@@ -124,8 +124,6 @@
124124
{
125125
box-sizing: border-box;
126126
padding-right: 10px;
127-
font-weight: bold;
128-
color: #333;
129127
overflow: hidden;
130128
text-overflow: ellipsis;
131129
}
@@ -136,9 +134,16 @@
136134
right: 2px;
137135
}
138136

139-
.profiler-timeline-row:hover .profiler-legend-label
137+
.profiler-timeline-row:hover
138+
{
139+
background: rgba(137, 173, 232, 0.2);
140+
color: #000;
141+
}
142+
143+
.profiler-timeline-row:active
140144
{
141-
color: #769fe1;
145+
background-color: rgba(55, 115, 211, 0.7);
146+
color: #fff;
142147
}
143148

144149
.profiler-timeline-marker
@@ -173,36 +178,35 @@
173178

174179
.profiler-event-small
175180
{
176-
min-width: 2px;
181+
min-width: 1px;
177182
height: 3px;
178183
position: absolute;
179184
}
180185

181186
.profiler-event
182187
{
183188
min-width: 3px;
184-
height: 10px;
185-
margin: 3px 0;
189+
height: 12px;
190+
margin: 4px 0;
186191
box-shadow: inset 0 2px 0 0 rgba(255, 255, 255, 0.09),
187192
inset 0 0 0 1px rgba(0, 0, 0, 0.07),
188193
inset 0 -1px 0 0 rgba(0, 0, 0, 0.05);
189-
/*border-radius: 2px;*/ /* Disable this, it's too expensive to paint */
190194
}
191195

192196
.profiler-event.expandable:hover
193197
{
194198
box-shadow: inset 0 2px 0 0 rgba(255, 255, 255, 0.09),
195199
inset 0 0 0 1px rgba(0, 0, 0, 0.07),
196200
inset 0 -1px 0 0 rgba(0, 0, 0, 0.05),
197-
0 0 0 2px #ceddf5;
201+
0 0 0 2px rgba(137, 173, 232, 0.5);
198202
}
199203

200204
.profiler-event.non-expandable:hover
201205
{
202206
box-shadow: inset 0 2px 0 0 rgba(255, 255, 255, 0.09),
203207
inset 0 0 0 1px rgba(0, 0, 0, 0.07),
204208
inset 0 -1px 0 0 rgba(0, 0, 0, 0.05),
205-
0 0 0 2px #ddd;
209+
0 0 0 2px rgba(204, 204, 204, 0.5);
206210
}
207211

208212
.profiler-timeline .profiler-event

src/profiler/profiler_templates.js

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,10 @@ var ProfilerTemplates = function()
8383

8484
var style_sheets = document.styleSheets;
8585
var profiler_event_decl = style_sheets.getDeclaration(".profiler-event");
86+
var profiler_event_small_decl = style_sheets.getDeclaration(".profiler-event-small");
8687
var profiler_timeline_row_decl = style_sheets.getDeclaration(".profiler-timeline-row");
87-
var BAR_MIN_WIDTH = profiler_event_decl ? parseInt(profiler_event_decl.minWidth) : 0;
88+
var EVENT_MIN_WIDTH = profiler_event_decl ? parseInt(profiler_event_decl.minWidth) : 0;
89+
var EVENT_SMALL_MIN_WIDTH = profiler_event_decl ? parseInt(profiler_event_small_decl.minWidth) : 0;
8890
var BAR_HEIGHT = profiler_timeline_row_decl
8991
? (parseInt(style_sheets.getDeclaration(".profiler-timeline-row").height) +
9092
parseInt(style_sheets.getDeclaration(".profiler-timeline-row").paddingTop) +
@@ -152,7 +154,7 @@ var ProfilerTemplates = function()
152154
var MIN_MARKER_GAP = 80;
153155
var MIN_MARKERS = 2;
154156
var duration = Math.max(interval_end - interval_start, MIN_DURATION);
155-
var ms_unit = (container_width - BAR_MIN_WIDTH) / duration;
157+
var ms_unit = (container_width - EVENT_MIN_WIDTH) / duration;
156158
var cell_amount = Math.max(MIN_MARKERS, Math.round(container_width / MIN_MARKER_GAP));
157159
var marker_time = duration / cell_amount;
158160
var fractions = marker_time < 10 ? 1 : 0;
@@ -186,32 +188,28 @@ var ProfilerTemplates = function()
186188
return template;
187189
};
188190

189-
this.event_list_full = function(event_list, interval, container_width)
191+
this.event_list_full = function(event_list, interval_end, container_width)
190192
{
191193
var template = [];
192194
if (event_list)
193195
{
194-
var interval_start = 0;
195-
var interval_end = interval.end;
196-
var duration = Math.max(interval_end - interval_start, MIN_DURATION);
197-
var ms_unit = (container_width - BAR_MIN_WIDTH) / duration;
196+
var duration = Math.max(interval_end, MIN_DURATION);
197+
var ms_unit = (container_width - EVENT_SMALL_MIN_WIDTH) / duration;
198198

199-
template.extend(event_list.map(this._full_timeline_event.bind(this, interval_start, ms_unit)));
199+
template.extend(event_list.map(this._full_timeline_event.bind(this, 0, ms_unit)));
200200
}
201201
return template;
202202
};
203203

204-
this.event_list_all = function(event_list, interval, selected_id, container_width, start, end)
204+
this.event_list_all = function(event_list, interval_start, interval_end, container_width)
205205
{
206206
var template = [];
207207
if (event_list)
208208
{
209-
var interval_start = start || 0;
210-
var interval_end = end || interval.end;
211209
var duration = Math.max(interval_end - interval_start, MIN_DURATION);
212-
var ms_unit = (container_width - BAR_MIN_WIDTH) / duration;
210+
var ms_unit = (container_width - EVENT_MIN_WIDTH) / duration;
213211

214-
template.extend(event_list.map(this._timeline_event.bind(this, interval_start, ms_unit, selected_id)));
212+
template.extend(event_list.map(this._timeline_event.bind(this, interval_start, ms_unit)));
215213
}
216214
return template;
217215
};
@@ -232,8 +230,7 @@ var ProfilerTemplates = function()
232230
);
233231
};
234232

235-
// NOTE: the container_width is only needed for a workaround of a CORE bug
236-
this._timeline_event = function(interval_start, ms_unit, selected_id, event)
233+
this._timeline_event = function(interval_start, ms_unit, event)
237234
{
238235
var duration = Math.max(event.interval.end - event.interval.start, MIN_DURATION);
239236
var self_time_amount = duration
@@ -264,7 +261,6 @@ var ProfilerTemplates = function()
264261
),
265262
"id", "profiler-event-" + event.eventID,
266263
"class", "profiler-event event-type-" + event.type +
267-
(event.eventID == selected_id && is_expandable ? " selected" : "") +
268264
(is_expandable ? " expandable" : " non-expandable"),
269265
"data-event-id", String(event.eventID),
270266
"data-event-type", String(event.type),
@@ -338,7 +334,7 @@ var ProfilerTemplates = function()
338334
"class", "profiler-event-tooltip-label"
339335
],
340336
this.format_time(event.interval.start) +
341-
" (relative: " + this.format_time(event.interval.start - range_start) + ")"
337+
" (rel: " + this.format_time(event.interval.start - range_start) + ")"
342338
],
343339
["li",
344340
["span",

0 commit comments

Comments
 (0)