diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index aabbd21d702..821e6379e2a 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -25,14 +25,8 @@ xmlns="http://www.w3.org/2000/svg" aria-label="Copy to clipboard">\ 2s-1.75.755-1.75 1.667c0 .911-.793 1.666-1.75 1.666H4.75C3.793 5.333 3 6.09 3 7z"/>\ \ '); - --clipboard-image-big: url('data:image/svg+xml,\ -\ -\ -'); + --copy-path-height: 34px; + --copy-path-width: 33px; /* Checkmark */ --checkmark-image: url('data:image/svg+xml,\ @@ -1453,9 +1447,9 @@ documentation. */ z-index: 1; } a.test-arrow { - padding: 5px 10px 5px 10px; + padding: 5px 7px; border-radius: 5px; - font-size: 1.375rem; + font-size: 1rem; color: var(--test-arrow-color); background-color: var(--test-arrow-background-color); } @@ -1467,7 +1461,7 @@ a.test-arrow:hover { display: flex; } .example-wrap:hover > .test-arrow { - padding: 3px 10px; + padding: 2px 7px; } .example-wrap:hover > .test-arrow, .example-wrap:hover > .button-holder { visibility: visible; @@ -1475,28 +1469,24 @@ a.test-arrow:hover { .example-wrap .button-holder .copy-button { color: var(--copy-path-button-color); background: var(--main-background-color); - height: 43px; - width: 40px; + height: var(--copy-path-height); + width: var(--copy-path-width); margin-left: 5px; padding: 2px 0 0 4px; border: 0; cursor: pointer; border-radius: 5px; } -.example-wrap .button-holder .copy-button.clicked { - padding-top: 4px; -} .example-wrap .button-holder .copy-button::before { filter: var(--copy-path-img-filter); - content: var(--clipboard-image-big); - width: 23px; - height: 22px; + content: var(--clipboard-image); } .example-wrap .button-holder .copy-button:hover::before { filter: var(--copy-path-img-hover-filter); } .example-wrap .button-holder .copy-button.clicked::before { content: var(--checkmark-image); + padding-right: 5px; } .code-attribute { @@ -1745,8 +1735,8 @@ a.tooltip:hover::after { #copy-path { color: var(--copy-path-button-color); background: var(--main-background-color); - height: 34px; - width: 33px; + height: var(--copy-path-height); + width: var(--copy-path-width); margin-left: 10px; padding: 0; padding-left: 2px; @@ -1756,8 +1746,6 @@ a.tooltip:hover::after { #copy-path::before { filter: var(--copy-path-img-filter); content: var(--clipboard-image); - width: 19px; - height: 18px; } #copy-path:hover::before { filter: var(--copy-path-img-hover-filter); diff --git a/tests/rustdoc-gui/copy-code.goml b/tests/rustdoc-gui/copy-code.goml index 726f9bba9b6..72a5bece175 100644 --- a/tests/rustdoc-gui/copy-code.goml +++ b/tests/rustdoc-gui/copy-code.goml @@ -14,6 +14,12 @@ define-function: ( assert-css: (".example-wrap .copy-button", { "visibility": "visible" }) move-cursor-to: ".search-input" assert-css: (".example-wrap .copy-button", { "visibility": "hidden" }) + // Checking that the copy button has the same size as the "copy path" button. + compare-elements-size: ( + "#copy-path", + ".example-wrap:nth-of-type(1) .copy-button", + ["height", "width"], + ) }, ) diff --git a/tests/rustdoc-gui/run-on-hover.goml b/tests/rustdoc-gui/run-on-hover.goml index 087dd3374f8..1698a61b147 100644 --- a/tests/rustdoc-gui/run-on-hover.goml +++ b/tests/rustdoc-gui/run-on-hover.goml @@ -17,7 +17,7 @@ define-function: ( "visibility": "visible", "color": |color|, "background-color": |background|, - "font-size": "22px", + "font-size": "16px", "border-radius": "5px", }) move-cursor-to: ".test-arrow" @@ -25,7 +25,7 @@ define-function: ( "visibility": "visible", "color": |hover_color|, "background-color": |hover_background|, - "font-size": "22px", + "font-size": "16px", "border-radius": "5px", }) },