File tree 2 files changed +21
-2
lines changed
src/librustdoc/html/static/css
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
2282
2282
.example-wrap .scraped-example .button-holder {
2283
2283
top : calc (var (--pre-line-height ) + 4px );
2284
2284
}
2285
+ .scraped-example : not (.expanded )::before {
2286
+ /* The gradient effect needs to be moved under the title */
2287
+ top : var (--pre-line-height );
2288
+ }
2285
2289
}
2286
2290
2291
+
2287
2292
/* Should have min-width: (N + 1)px where N is the mobile breakpoint above. */
2288
2293
@media (min-width : 701px ) {
2289
2294
/* 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
2305
2310
.item-table > li > div {
2306
2311
overflow-wrap : anywhere;
2307
2312
}
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
+ }
2308
2319
}
2309
2320
2310
2321
@media print {
@@ -2395,7 +2406,6 @@ in src-script.js and main.js
2395
2406
z-index : 1 ;
2396
2407
}
2397
2408
.scraped-example : not (.expanded )::before {
2398
- top : 0 ;
2399
2409
background : linear-gradient (to bottom,
2400
2410
var (--scrape-example-code-wrapper-background-start ),
2401
2411
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)
56
56
assert-position: (".scraped-example", {"y": 226})
57
57
assert-position: (".scraped-example .prev", {"y": 226 + |offset_y|})
58
58
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
+
59
63
// Then with mobile
60
64
set-window-size: (600, 600)
65
+ store-size: (".example-wrap.scraped-example .scraped-example-title", {"height": title_height})
61
66
assert-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"})
63
72
64
73
define-function: (
65
74
"check_title_and_code_position",
You can’t perform that action at this time.
0 commit comments