Skip to content

Commit e6380a6

Browse files
Rollup merge of #87230 - GuillaumeGomez:docblock-table-overflow, r=notriddle
Fix docblock <table> overflow Before: ![Screenshot from 2021-07-18 00-05-23](https://user-images.githubusercontent.com/3050060/126050272-ce08bc5f-74ff-4135-bc12-d708d87470cc.png) After: ![Screenshot from 2021-07-18 00-03-55](https://user-images.githubusercontent.com/3050060/126050273-42f41b4d-ad57-4a87-91de-18e63f8504ec.png) cc `@SergioBenitez` r? `@notriddle`
2 parents 358b2cc + 3f1a120 commit e6380a6

File tree

7 files changed

+23
-11
lines changed

7 files changed

+23
-11
lines changed

src/librustdoc/html/static/css/rustdoc.css

+2-1
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,8 @@ nav.sub {
560560
.docblock table {
561561
margin: .5em 0;
562562
width: calc(100% - 2px);
563-
border: 1px dashed;
563+
overflow-x: auto;
564+
display: block;
564565
}
565566

566567
.docblock table td {

src/librustdoc/html/static/css/themes/ayu.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ pre, .rustdoc.source .example-wrap {
140140
border-bottom-color: #5c6773;
141141
}
142142

143-
.docblock table, .docblock table td, .docblock table th {
143+
.docblock table td, .docblock table th {
144144
border-color: #5c6773;
145145
}
146146

src/librustdoc/html/static/css/themes/dark.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ pre, .rustdoc.source .example-wrap {
9797
border-bottom-color: #DDD;
9898
}
9999

100-
.docblock table, .docblock table td, .docblock table th {
100+
.docblock table td, .docblock table th {
101101
border-color: #ddd;
102102
}
103103

src/librustdoc/html/static/css/themes/light.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ pre, .rustdoc.source .example-wrap {
9797
border-bottom-color: #ddd;
9898
}
9999

100-
.docblock table, .docblock table td, .docblock table th {
100+
.docblock table td, .docblock table th {
101101
border-color: #ddd;
102102
}
103103

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// This test ensures that the type declaration content overflow is handled inside the <pre> directly.
2+
goto: file://|DOC_PATH|/lib2/long_table/struct.Foo.html
3+
// We set a fixed size so there is no chance of "random" resize.
4+
size: (1100, 800)
5+
// Logically, the ".docblock" and the "<p>" should have the same scroll width.
6+
compare-elements-property: (".top-doc .docblock", ".top-doc .docblock > p", ["scrollWidth"])
7+
assert-property: (".top-doc .docblock", {"scrollWidth": "816"})
8+
// However, since there is overflow in the <table>, its scroll width is bigger.
9+
assert-property: (".top-doc .docblock table", {"scrollWidth": "1573"})

src/test/rustdoc-gui/src/lib2/lib.rs

+9
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,12 @@ pub mod long_trait {
5757
pub trait ALongNameBecauseItHelpsTestingTheCurrentProblem: DerefMut<Target = u32>
5858
+ From<u128> + Send + Sync + AsRef<str> + 'static {}
5959
}
60+
61+
pub mod long_table {
62+
/// | This::is::a::kinda::very::long::header::number::one | This::is::a::kinda::very::long::header::number::two | This::is::a::kinda::very::long::header::number::one | This::is::a::kinda::very::long::header::number::two |
63+
/// | ----------- | ----------- | ----------- | ----------- |
64+
/// | This::is::a::kinda::long::content::number::one | This::is::a::kinda::very::long::content::number::two | This::is::a::kinda::long::content::number::one | This::is::a::kinda::very::long::content::number::two |
65+
///
66+
/// I wanna sqdkfnqds f dsqf qds f dsqf dsq f dsq f qds f qds f qds f dsqq f dsf sqdf dsq fds f dsq f dq f ds fq sd fqds f dsq f sqd fsq df sd fdsqfqsd fdsq f dsq f dsqfd s dfq
67+
pub struct Foo;
68+
}

src/test/rustdoc-gui/src/lib2/src/lib.rs

-7
This file was deleted.

0 commit comments

Comments
 (0)