From 31484c0e19e1a2445b9d6d5f073f8a08a11b696e Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 17 Jul 2021 23:39:18 +0200 Subject: [PATCH 1/3] Fix overflow in doc blocks --- src/librustdoc/html/static/css/rustdoc.css | 3 ++- src/librustdoc/html/static/css/themes/ayu.css | 2 +- src/librustdoc/html/static/css/themes/dark.css | 2 +- src/librustdoc/html/static/css/themes/light.css | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index b86f012c0e168..08bcc46689822 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -556,7 +556,8 @@ nav.sub { .docblock table { margin: .5em 0; width: calc(100% - 2px); - border: 1px dashed; + overflow-x: auto; + display: block; } .docblock table td { diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css index 8296c3f91ca3b..354cdd2fb035b 100644 --- a/src/librustdoc/html/static/css/themes/ayu.css +++ b/src/librustdoc/html/static/css/themes/ayu.css @@ -140,7 +140,7 @@ pre, .rustdoc.source .example-wrap { border-bottom-color: #5c6773; } -.docblock table, .docblock table td, .docblock table th { +.docblock table td, .docblock table th { border-color: #5c6773; } diff --git a/src/librustdoc/html/static/css/themes/dark.css b/src/librustdoc/html/static/css/themes/dark.css index 599fb942dbe2a..b4f5a13c81509 100644 --- a/src/librustdoc/html/static/css/themes/dark.css +++ b/src/librustdoc/html/static/css/themes/dark.css @@ -97,7 +97,7 @@ pre, .rustdoc.source .example-wrap { border-bottom-color: #DDD; } -.docblock table, .docblock table td, .docblock table th { +.docblock table td, .docblock table th { border-color: #ddd; } diff --git a/src/librustdoc/html/static/css/themes/light.css b/src/librustdoc/html/static/css/themes/light.css index 0c2799727f3e3..29cbcd65ce81d 100644 --- a/src/librustdoc/html/static/css/themes/light.css +++ b/src/librustdoc/html/static/css/themes/light.css @@ -97,7 +97,7 @@ pre, .rustdoc.source .example-wrap { border-bottom-color: #ddd; } -.docblock table, .docblock table td, .docblock table th { +.docblock table td, .docblock table th { border-color: #ddd; } From b0f8776d11b746ab7dd7098fb225eff34a992d87 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 17 Jul 2021 23:56:24 +0200 Subject: [PATCH 2/3] Remove unused file --- src/test/rustdoc-gui/src/lib2/src/lib.rs | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 src/test/rustdoc-gui/src/lib2/src/lib.rs diff --git a/src/test/rustdoc-gui/src/lib2/src/lib.rs b/src/test/rustdoc-gui/src/lib2/src/lib.rs deleted file mode 100644 index 31e1bb209f98e..0000000000000 --- a/src/test/rustdoc-gui/src/lib2/src/lib.rs +++ /dev/null @@ -1,7 +0,0 @@ -#[cfg(test)] -mod tests { - #[test] - fn it_works() { - assert_eq!(2 + 2, 4); - } -} From 3f1a120ba9c5077029ffb2d39d654dd3732314a7 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 18 Jul 2021 00:03:08 +0200 Subject: [PATCH 3/3] Add GUI test for
overflow --- src/test/rustdoc-gui/docblock-table-overflow.goml | 9 +++++++++ src/test/rustdoc-gui/src/lib2/lib.rs | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 src/test/rustdoc-gui/docblock-table-overflow.goml diff --git a/src/test/rustdoc-gui/docblock-table-overflow.goml b/src/test/rustdoc-gui/docblock-table-overflow.goml new file mode 100644 index 0000000000000..9ab7cd0fa07b0 --- /dev/null +++ b/src/test/rustdoc-gui/docblock-table-overflow.goml @@ -0,0 +1,9 @@ +// This test ensures that the type declaration content overflow is handled inside the
 directly.
+goto: file://|DOC_PATH|/lib2/long_table/struct.Foo.html
+// We set a fixed size so there is no chance of "random" resize.
+size: (1100, 800)
+// Logically, the ".docblock" and the "

" should have the same scroll width. +compare-elements-property: (".top-doc .docblock", ".top-doc .docblock > p", ["scrollWidth"]) +assert-property: (".top-doc .docblock", {"scrollWidth": "816"}) +// However, since there is overflow in the

, its scroll width is bigger. +assert-property: (".top-doc .docblock table", {"scrollWidth": "1573"}) diff --git a/src/test/rustdoc-gui/src/lib2/lib.rs b/src/test/rustdoc-gui/src/lib2/lib.rs index 0466909479b67..f724a64e30760 100644 --- a/src/test/rustdoc-gui/src/lib2/lib.rs +++ b/src/test/rustdoc-gui/src/lib2/lib.rs @@ -54,3 +54,12 @@ pub mod long_trait { pub trait ALongNameBecauseItHelpsTestingTheCurrentProblem: DerefMut + From + Send + Sync + AsRef + 'static {} } + +pub mod long_table { + /// | 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 | + /// | ----------- | ----------- | ----------- | ----------- | + /// | 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 | + /// + /// 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 + pub struct Foo; +}