Skip to content

Commit

Permalink
flamegraph: Clean up flameGraph.css patch (1)
Browse files Browse the repository at this point in the history
Follows-up 71f521e.

* Undo the overrides and place them in xhgui.css instead.
* Add a class "xhgui-flamegraph" to the main chart element
  so that we can uniquely address flamegraphs within xhgui
  with a higher CSS specificity selector (using the same selector
  as in d3.flameGraph.css won't work given that they have the
  same weight, and load order would break the tie, which currently
  means the upstream one applies last, use a stronger selector
  instead of relying on load order).

This is in preparation of upgrading d3.flameGraph to a newer
version from upstream.

Ref perftools#211.
  • Loading branch information
Krinkle committed Nov 13, 2017
1 parent 365fc2b commit 104f818
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
12 changes: 7 additions & 5 deletions webroot/css/d3.flameGraph.css
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
.d3-flame-graph rect {
stroke: #fff;
stroke: #EEEEEE;
fill-opacity: .8;
}

.d3-flame-graph .frame {
.d3-flame-graph rect:hover {
stroke: #474747;
stroke-width: 0.5;
cursor: pointer;
}
.d3-flame-graph .frame:hover .label {
color: #fff;
}

.d3-flame-graph .label {
pointer-events: none;
Expand All @@ -32,6 +31,7 @@

.d3-flame-graph .title {
font-size: 20px;
font-family: Verdana;
}

.d3-flame-graph .label {
Expand All @@ -40,6 +40,8 @@

.d3-flame-graph-tip {
line-height: 1;
font-family: Verdana;
font-size: 12px;
padding: 12px;
background: #fff;
border-radius: 6px;
Expand Down
24 changes: 24 additions & 0 deletions webroot/css/xhgui.css
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,30 @@ tr .no-results {
color: black;
}

/**
* FlameGraph
*
* Note: Uses "body" selector to make sure specificity is higher
* than the original styles in d3.flameGraph.css.
*/

/* Use white stroke instead of grey, to make them invisible on our background */
body .d3-flame-graph rect,
body .d3-flame-graph rect:hover {
stroke: #fff;
stroke-width: 1px;
}
/* Instead of stroke, change text color on hover */
body .d3-flame-graph .frame:hover .label {
color: #fff;
}

/* Inherit our font style instead of hardcoded Verdana 12px */
body .d3-flame-graph-tip {
font-family: inherit;
font-size: inherit;
}

/**
* Run details
*/
Expand Down

0 comments on commit 104f818

Please sign in to comment.