about summary refs log tree commit diff
path: root/src/librustdoc/html/render
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2021-05-09 20:41:24 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2021-05-10 16:26:16 +0200
commit7450f70ae2fecdbf36152815addc7c3af3a6c022 (patch)
treeb1433b117b3a09384e680503800028704632d720 /src/librustdoc/html/render
parent00f2bf40d6374ec3541a72edb5b481fb1370dbca (diff)
downloadrust-7450f70ae2fecdbf36152815addc7c3af3a6c022.tar.gz
rust-7450f70ae2fecdbf36152815addc7c3af3a6c022.zip
Use an SVG image for clipboard instead of unicode character
Diffstat (limited to 'src/librustdoc/html/render')
-rw-r--r--src/librustdoc/html/render/context.rs2
-rw-r--r--src/librustdoc/html/render/print_item.rs14
-rw-r--r--src/librustdoc/html/render/write_shared.rs1
3 files changed, 14 insertions, 3 deletions
diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs
index e0c1fd06e7b..4e17dc8d3a7 100644
--- a/src/librustdoc/html/render/context.rs
+++ b/src/librustdoc/html/render/context.rs
@@ -215,7 +215,7 @@ impl<'tcx> Context<'tcx> {
                 &self.shared.layout,
                 &page,
                 |buf: &mut _| print_sidebar(self, it, buf),
-                |buf: &mut _| print_item(self, it, buf),
+                |buf: &mut _| print_item(self, it, buf, &page),
                 &self.shared.style_files,
             )
         } else {
diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs
index 4b7664f28a1..a08a340e3a9 100644
--- a/src/librustdoc/html/render/print_item.rs
+++ b/src/librustdoc/html/render/print_item.rs
@@ -22,9 +22,10 @@ use crate::formats::{AssocItemRender, Impl, RenderMode};
 use crate::html::escape::Escape;
 use crate::html::format::{print_abi_with_space, print_where_clause, Buffer, PrintWithSpace};
 use crate::html::highlight;
+use crate::html::layout::Page;
 use crate::html::markdown::MarkdownSummaryLine;
 
-pub(super) fn print_item(cx: &Context<'_>, item: &clean::Item, buf: &mut Buffer) {
+pub(super) fn print_item(cx: &Context<'_>, item: &clean::Item, buf: &mut Buffer, page: &Page<'_>) {
     debug_assert!(!item.is_stripped());
     // Write the breadcrumb trail header for the top
     buf.write_str("<h1 class=\"fqn\"><span class=\"in-band\">");
@@ -74,7 +75,16 @@ pub(super) fn print_item(cx: &Context<'_>, item: &clean::Item, buf: &mut Buffer)
         }
     }
     write!(buf, "<a class=\"{}\" href=\"\">{}</a>", item.type_(), item.name.as_ref().unwrap());
-    write!(buf, "<button id=\"copy-path\" onclick=\"copy_path(this)\">⎘</button>");
+    write!(
+        buf,
+        "<button id=\"copy-path\" onclick=\"copy_path(this)\">\
+            <img src=\"{static_root_path}clipboard{suffix}.svg\" \
+                width=\"19\" height=\"18\" \
+                alt=\"Copy item import\">\
+         </button>",
+        static_root_path = page.get_static_root_path(),
+        suffix = page.resource_suffix,
+    );
 
     buf.write_str("</span>"); // in-band
     buf.write_str("<span class=\"out-of-band\">");
diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs
index c493801d990..d0518cb6862 100644
--- a/src/librustdoc/html/render/write_shared.rs
+++ b/src/librustdoc/html/render/write_shared.rs
@@ -207,6 +207,7 @@ pub(super) fn write_shared(
     }
     write_toolchain("brush.svg", static_files::BRUSH_SVG)?;
     write_toolchain("wheel.svg", static_files::WHEEL_SVG)?;
+    write_toolchain("clipboard.svg", static_files::CLIPBOARD_SVG)?;
     write_toolchain("down-arrow.svg", static_files::DOWN_ARROW_SVG)?;
 
     let mut themes: Vec<&String> = themes.iter().collect();