Skip to content

Commit

Permalink
Auto merge of #86271 - GuillaumeGomez:fix-font-weight, r=jsha
Browse files Browse the repository at this point in the history
Fix font weight

Fixes #86256.

I realized that the only cases where we actually needed to have bold text was inside `impl-items`.

cc `@camelid`
r? `@jsha`
  • Loading branch information
bors committed Jun 13, 2021
2 parents fb3ea63 + 466aec9 commit f586d79
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ ENV PATH="/node-v14.4.0-linux-x64/bin:${PATH}"
# https://github.com/puppeteer/puppeteer/issues/375
#
# We also specify the version in case we need to update it to go around cache limitations.
RUN npm install -g browser-ui-test@0.2.12 --unsafe-perm=true
RUN npm install -g browser-ui-test@0.2.14 --unsafe-perm=true

ENV RUST_CONFIGURE_ARGS \
--build=x86_64-unknown-linux-gnu \
Expand Down
6 changes: 3 additions & 3 deletions src/librustdoc/html/static/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ h1.fqn > .in-band > a:hover {
h2, h3, h4 {
border-bottom: 1px solid;
}
.impl, .method,
.type:not(.container-rustdoc), .associatedconstant,
.associatedtype {
.impl, .impl-items .method,
.impl-items .type, .impl-items .associatedconstant,
.impl-items .associatedtype {
flex-basis: 100%;
font-weight: 600;
margin-top: 16px;
Expand Down
7 changes: 7 additions & 0 deletions src/test/rustdoc-gui/font-weight.goml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
goto: file://|DOC_PATH|/lib2/struct.Foo.html
// This test checks that the font weight is correctly applied.
assert: ("//*[@class='docblock type-decl']//a[text()='Alias']", {"font-weight": "400"})
assert: ("//*[@class='structfield small-section-header']//a[text()='Alias']", {"font-weight": "400"})
assert: ("#method\.a_method > code", {"font-weight": "600"})
assert: ("#associatedtype\.X > code", {"font-weight": "600"})
assert: ("#associatedconstant\.Y > code", {"font-weight": "600"})
5 changes: 4 additions & 1 deletion src/test/rustdoc-gui/sidebar.goml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ assert: (".sidebar > .location", "Crate lib2")
assert: (".sidebar-elems > .crate > ul > li > a.current", "lib2")
// We now go to the "foobar" function page.
assert: (".sidebar-elems > .items > ul > li:nth-child(1)", "Modules")
assert: (".sidebar-elems > .items > ul > li:nth-child(2)", "Functions")
assert: (".sidebar-elems > .items > ul > li:nth-child(2)", "Structs")
assert: (".sidebar-elems > .items > ul > li:nth-child(3)", "Traits")
assert: (".sidebar-elems > .items > ul > li:nth-child(4)", "Functions")
assert: (".sidebar-elems > .items > ul > li:nth-child(5)", "Type Definitions")
assert: ("#functions + table td > a", "foobar")
click: "#functions + table td > a"

Expand Down
20 changes: 20 additions & 0 deletions src/test/rustdoc-gui/src/lib2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,23 @@ pub mod module {
}

pub fn foobar() {}

pub type Alias = u32;

pub struct Foo {
pub x: Alias,
}

impl Foo {
pub fn a_method(&self) {}
}

pub trait Trait {
type X;
const Y: u32;
}

impl Trait for Foo {
type X = u32;
const Y: u32 = 0;
}

0 comments on commit f586d79

Please sign in to comment.