Skip to content

Commit

Permalink
Rollup merge of #107531 - GuillaumeGomez:inline-images-in-css, r=notr…
Browse files Browse the repository at this point in the history
…iddle

Inline CSS background images directly into the CSS

A nice advantage of this is that it removes a few entries in the list of static files.

r? ``@notriddle``
  • Loading branch information
matthiaskrgr authored Feb 2, 2023
2 parents 150b9d7 + 63f82db commit 75ea3a9
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
17 changes: 13 additions & 4 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -814,8 +814,11 @@ so that we can apply CSS-filters to change the arrow color in themes */
background-repeat: no-repeat;
background-size: 20px;
background-position: calc(100% - 2px) 56%;
/* image is black color */
background-image: url("down-arrow-927217e04c7463ac.svg");
/* down arrow (image is black color) */
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" \
width="128" height="128" viewBox="-30 -20 176 176"><path d="M111,40.5L64,87.499L17,40.5" \
fill="none" stroke="black" strike-linecap="square" stroke-miterlimit="10" stroke-width="12"/> \
</svg>');
/* changes the arrow image color */
filter: var(--crate-search-div-filter);
}
Expand Down Expand Up @@ -1444,7 +1447,10 @@ details.toggle > summary.hideme > span {
}

details.toggle > summary::before {
background: url("toggle-plus-1092eb4930d581b0.svg") no-repeat top left;
/* toggle plus */
background: url('data:image/svg+xml,<svg width="17" height="17" \
shape-rendering="crispEdges" stroke="black" fill="none" xmlns="http://www.w3.org/2000/svg"><path \
d="M5 2.5H2.5v12H5m7-12h2.5v12H12M5 8.5h7M8.5 12V8.625v0V5"/></svg>') no-repeat top left;
content: "";
cursor: pointer;
width: 16px;
Expand Down Expand Up @@ -1522,7 +1528,10 @@ details.toggle[open] > summary.hideme > span {
}

details.toggle[open] > summary::before {
background: url("toggle-minus-31bbd6e4c77f5c96.svg") no-repeat top left;
/* toggle minus */
background: url('data:image/svg+xml,<svg width="17" height="17" \
shape-rendering="crispEdges" stroke="black" fill="none" xmlns="http://www.w3.org/2000/svg"><path \
d="M5 2.5H2.5v12H5m7-12h2.5v12H12M5 8.5h7"/></svg>') no-repeat top left;
}

details.toggle[open] > summary::after {
Expand Down
1 change: 0 additions & 1 deletion src/librustdoc/html/static/images/down-arrow.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/librustdoc/html/static/images/toggle-minus.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/librustdoc/html/static/images/toggle-plus.svg

This file was deleted.

3 changes: 0 additions & 3 deletions src/librustdoc/html/static_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@ static_files! {
scrape_examples_js => "static/js/scrape-examples.js",
wheel_svg => "static/images/wheel.svg",
clipboard_svg => "static/images/clipboard.svg",
down_arrow_svg => "static/images/down-arrow.svg",
toggle_minus_png => "static/images/toggle-minus.svg",
toggle_plus_png => "static/images/toggle-plus.svg",
copyright => "static/COPYRIGHT.txt",
license_apache => "static/LICENSE-APACHE.txt",
license_mit => "static/LICENSE-MIT.txt",
Expand Down

0 comments on commit 75ea3a9

Please sign in to comment.