This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
src/librustdoc/html/static/css Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -2282,8 +2282,13 @@ in src-script.js and main.js
22822282 .example-wrap .scraped-example .button-holder {
22832283 top : calc (var (--pre-line-height ) + 4px );
22842284 }
2285+ .scraped-example : not (.expanded )::before {
2286+ /* The gradient effect needs to be moved under the title */
2287+ top : var (--pre-line-height );
2288+ }
22852289}
22862290
2291+
22872292/* Should have min-width: (N + 1)px where N is the mobile breakpoint above. */
22882293@media (min-width : 701px ) {
22892294 /* Places file-link for a scraped example on top of the example to save space.
@@ -2305,6 +2310,12 @@ in src-script.js and main.js
23052310 .item-table > li > div {
23062311 overflow-wrap : anywhere;
23072312 }
2313+
2314+ /* Starting this width, the "title" of scraped example will be in the code block so we can
2315+ put the background gradient at the top. */
2316+ .scraped-example : not (.expanded )::before {
2317+ top : 0 ;
2318+ }
23082319}
23092320
23102321@media print {
@@ -2395,7 +2406,6 @@ in src-script.js and main.js
23952406 z-index : 1 ;
23962407}
23972408.scraped-example : not (.expanded )::before {
2398- top : 0 ;
23992409 background : linear-gradient (to bottom,
24002410 var (--scrape-example-code-wrapper-background-start ),
24012411 var (--scrape-example-code-wrapper-background-end ));
Original file line number Diff line number Diff line change @@ -56,10 +56,19 @@ store-value: (offset_y, 4)
5656assert-position: (".scraped-example", {"y": 226})
5757assert-position: (".scraped-example .prev", {"y": 226 + |offset_y|})
5858
59+ // Gradient background should be at the top of the code block.
60+ assert-css: (".scraped-example::before", {"top": "0px"})
61+ assert-css: (".scraped-example::after", {"bottom": "0px"})
62+
5963// Then with mobile
6064set-window-size: (600, 600)
65+ store-size: (".example-wrap.scraped-example .scraped-example-title", {"height": title_height})
6166assert-position: (".scraped-example", {"y": 284})
62- assert-position: (".scraped-example .prev", {"y": 284 + |offset_y|})
67+ assert-position: (".scraped-example .prev", {"y": 284 + |offset_y| + |title_height|})
68+
69+ // Gradient background should be at the top of the code block, which is now below the "title".
70+ assert-css: (".scraped-example::before", {"top": |title_height| + "px"})
71+ assert-css: (".scraped-example::after", {"bottom": "0px"})
6372
6473define-function: (
6574 "check_title_and_code_position",
You can’t perform that action at this time.
0 commit comments