Skip to content

Commit 2883a7d

Browse files
committed
Some cleanup.
1 parent 704f18c commit 2883a7d

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

src/profiler/profiler_style.css

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
left: 160px;
1616
right: 0;
1717
top: 22px;
18-
height: 26px; /* 8 types * 3px height + 2 extra for padding */
19-
border-top: 1px solid rgba(0, 0, 0, 0.055);
20-
border-bottom: 1px solid rgba(0, 0, 0, 0.055);
18+
height: 28px;
19+
box-shadow: 0 1px inset rgba(0, 0, 0, 0.055),
20+
0 -1px inset rgba(0, 0, 0, 0.055);
2121
overflow-x: hidden;
2222
}
2323

@@ -26,8 +26,8 @@
2626
position: absolute;
2727
left: 160px;
2828
right: 0;
29-
top: 22px;
30-
height: 27px;
29+
top: 23px;
30+
height: 26px;
3131
}
3232

3333
.profiler-timeline-background
@@ -179,14 +179,15 @@
179179
{
180180
min-width: 1px;
181181
height: 3px;
182+
margin-top: 2px;
182183
position: absolute;
183184
}
184185

185186
.profiler-event
186187
{
187188
min-width: 3px;
188189
height: 12px;
189-
margin: 4px 0;
190+
margin: 5px 0;
190191
box-shadow: inset 0 2px rgba(255, 255, 255, 0.09),
191192
inset 0 0 0 1px rgba(0, 0, 0, 0.07),
192193
inset 0 -1px rgba(0, 0, 0, 0.05);

src/profiler/profiler_templates.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,14 @@ var ProfilerTemplates = function()
8585
var profiler_event_decl = style_sheets.getDeclaration(".profiler-event");
8686
var profiler_event_small_decl = style_sheets.getDeclaration(".profiler-event-small");
8787
var profiler_timeline_row_decl = style_sheets.getDeclaration(".profiler-timeline-row");
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;
90-
var BAR_HEIGHT = profiler_timeline_row_decl
91-
? (parseInt(style_sheets.getDeclaration(".profiler-timeline-row").height) +
92-
parseInt(style_sheets.getDeclaration(".profiler-timeline-row").paddingTop) +
93-
parseInt(style_sheets.getDeclaration(".profiler-timeline-row").paddingBottom))
94-
: 0;
88+
var EVENT_MIN_WIDTH = profiler_event_decl ? parseInt(profiler_event_decl.minWidth) : 1;
89+
var EVENT_SMALL_MIN_WIDTH = profiler_event_decl ? parseInt(profiler_event_small_decl.minWidth) : 1;
90+
var EVENT_HEIGHT = profiler_timeline_row_decl
91+
? (parseInt(style_sheets.getDeclaration(".profiler-timeline-row").height) +
92+
parseInt(style_sheets.getDeclaration(".profiler-timeline-row").paddingTop) +
93+
parseInt(style_sheets.getDeclaration(".profiler-timeline-row").paddingBottom))
94+
: 1;
95+
var EVENT_SMALL_HEIGHT = profiler_event_decl ? parseInt(profiler_event_small_decl.height) : 1;
9596

9697
var MIN_DURATION = ProfilerView.MIN_DURATION;
9798

@@ -227,8 +228,8 @@ var ProfilerTemplates = function()
227228
"style",
228229
"width: " + width + "px; " +
229230
"left: " + left + "px; " +
230-
"top: " + (column * 3 + 1) + "px;", // TODO: 3 -> constant
231-
"class", "profiler-event-small event-type-" + event.type + "-selftime" // FIXME: not actually selftime
231+
"top: " + (column * EVENT_SMALL_HEIGHT) + "px;",
232+
"class", "profiler-event-small event-type-" + event.type + "-selftime" // not actually selftime, just using that color
232233
]
233234
);
234235
};
@@ -249,7 +250,7 @@ var ProfilerTemplates = function()
249250
"style",
250251
"width: " + width + "px; " +
251252
"left: " + left + "px; " +
252-
"top: " + (column * BAR_HEIGHT + 1) + "px; " +
253+
"top: " + (column * EVENT_HEIGHT) + "px; " +
253254
(width > 46340 ? ("background-size: " + Math.floor(46340 / width * 100) + "%; ") : "") + // workaround for CORE-48579
254255
(HAS_UNPREFIXED_GRADIENTS
255256
? "background-image: linear-gradient(0deg, transparent 0, rgba(255, 255, 255, .25) 100%), " +

src/profiler/profiler_view.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ var ProfilerView = function(id, name, container_class, html, default_handler)
3434
var profiler_timeline_decl = document.styleSheets.getDeclaration(".profiler-timeline");
3535
var profiler_event_decl = document.styleSheets.getDeclaration(".profiler-event");
3636
var AGGREGATED_EVENTS_WIDTH = profiler_timeline_decl ? parseInt(profiler_timeline_decl.left) : 0;
37-
var BAR_MIN_WIDTH = profiler_event_decl ? parseInt(profiler_event_decl.minWidth) : 0;
37+
var EVENT_MIN_WIDTH = profiler_event_decl ? parseInt(profiler_event_decl.minWidth) : 1;
3838

3939
// Parent-children relationships
4040
this._children = {};
@@ -466,7 +466,7 @@ var ProfilerView = function(id, name, container_class, html, default_handler)
466466
var width = this._timeline_width;
467467

468468
var duration = Math.max(x1 - x0, ProfilerView.MIN_DURATION);
469-
var ms_unit = (width - BAR_MIN_WIDTH) / duration;
469+
var ms_unit = (width - EVENT_MIN_WIDTH) / duration;
470470
var new_event_list = [];
471471
for (var i = 0, event; event = timeline_list.eventList[i]; i++)
472472
{

0 commit comments

Comments
 (0)