diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index c6d6843db5fb3..2fb3143b0bf6e 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -663,31 +663,27 @@ impl fmt::Show for ModuleSummary { context.push(m.name.as_slice()); let path = context.connect("::"); - // the total width of each row's stability summary, in pixels - let width = 500; - try!(write!(f, "")); - try!(write!(f, "\ - {}", + try!(write!(f, "{}", Vec::from_slice(context.slice_from(1)) .append_one("index.html").connect("/"), path)); - try!(write!(f, "")); + try!(write!(f, "")); try!(write!(f, " ", - (width * cnt.stable)/tot)); + style='width: {:.4}%; display: inline-block'> ", + (100 * cnt.stable) as f64/tot as f64)); try!(write!(f, " ", - (width * cnt.unstable)/tot)); + style='width: {:.4}%; display: inline-block'> ", + (100 * cnt.unstable) as f64/tot as f64)); try!(write!(f, " ", - (width * cnt.experimental)/tot)); + style='width: {:.4}%; display: inline-block'> ", + (100 * cnt.experimental) as f64/tot as f64)); try!(write!(f, " ", - (width * cnt.deprecated)/tot)); + style='width: {:.4}%; display: inline-block'> ", + (100 * cnt.deprecated) as f64/tot as f64)); try!(write!(f, " ", - (width * cnt.unmarked)/tot)); + style='width: {:.4}%; display: inline-block'> ", + (100 * cnt.unmarked) as f64/tot as f64)); try!(write!(f, "")); for submodule in m.submodules.iter() { @@ -699,20 +695,33 @@ impl fmt::Show for ModuleSummary { let mut context = Vec::new(); + let tot = self.counts.total(); + let (stable, unstable, experimental, deprecated, unmarked) = if tot == 0 { + (0, 0, 0, 0, 0) + } else { + ((100 * self.counts.stable)/tot, + (100 * self.counts.unstable)/tot, + (100 * self.counts.experimental)/tot, + (100 * self.counts.deprecated)/tot, + (100 * self.counts.unmarked)/tot) + }; + try!(write!(f, -r"

Stability dashboard: crate {}

+r"

Stability dashboard: crate {name}

This dashboard summarizes the stability levels for all of the public modules of -the crate, according to the total number of items at each level in the module and its children: +the crate, according to the total number of items at each level in the module and +its children (percentages total for {name}):
- stable,
- unstable,
- experimental,
- deprecated,
- unmarked + stable ({}%),
+ unstable ({}%),
+ experimental ({}%),
+ deprecated ({}%),
+ unmarked ({}%)
The counts do not include methods or trait implementations that are visible only through a re-exported type.", -self.name)); +stable, unstable, experimental, deprecated, unmarked, +name=self.name)); try!(write!(f, "")) try!(fmt_inner(f, &mut context, self)); write!(f, "
") diff --git a/src/librustdoc/html/static/main.css b/src/librustdoc/html/static/main.css index 4f790f9675028..c22dd64d2b4c8 100644 --- a/src/librustdoc/html/static/main.css +++ b/src/librustdoc/html/static/main.css @@ -407,7 +407,7 @@ h1 .stability { .stability.Stable { border-color: #54A759; color: #2D8632; } .stability.Frozen { border-color: #009431; color: #007726; } .stability.Locked { border-color: #0084B6; color: #00668c; } -.stability.Unmarked { border-color: #FFFFFF; } +.stability.Unmarked { border-color: #BBBBBB; } .summary { padding-right: 0px; @@ -416,7 +416,7 @@ h1 .stability { .summary.Experimental { background-color: #D46D6A; } .summary.Unstable { background-color: #D4B16A; } .summary.Stable { background-color: #54A759; } -.summary.Unmarked { background-color: #FFFFFF; } +.summary.Unmarked { background-color: #BBBBBB; } :target { background: #FDFFD3; } diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 1869031dab3c2..3a51348784fc9 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -42,6 +42,9 @@ $('.docblock.short').width(function() { return contentWidth - 40 - $(this).prev().width(); }).addClass('nowrap'); + $('.summary-column').width(function() { + return contentWidth - 40 - $(this).prev().width(); + }) }, 150); } resizeShortBlocks();