Skip to content

Commit c7312fb

Browse files
Fixes some style issues in rustdoc "implementations on Foreign types"
1 parent 3fd82a5 commit c7312fb

File tree

4 files changed

+33
-8
lines changed

4 files changed

+33
-8
lines changed

src/librustdoc/html/static/main.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -1979,7 +1979,7 @@
19791979
onEach(e.getElementsByClassName('associatedconstant'), func);
19801980
});
19811981

1982-
function createToggle(otherMessage) {
1982+
function createToggle(otherMessage, extraClass) {
19831983
var span = document.createElement('span');
19841984
span.className = 'toggle-label';
19851985
span.style.display = 'none';
@@ -1995,6 +1995,9 @@
19951995

19961996
var wrapper = document.createElement('div');
19971997
wrapper.className = 'toggle-wrapper';
1998+
if (extraClass) {
1999+
wrapper.className += ' ' + extraClass;
2000+
}
19982001
wrapper.appendChild(mainToggle);
19992002
return wrapper;
20002003
}
@@ -2023,10 +2026,13 @@
20232026
}
20242027
if (e.parentNode.id === "main") {
20252028
var otherMessage;
2029+
var extraClass;
20262030
if (hasClass(e, "type-decl")) {
20272031
otherMessage = ' Show declaration';
2032+
} else if (hasClass(e.childNodes[0], "impl-items")) {
2033+
extraClass = "marg-left";
20282034
}
2029-
e.parentNode.insertBefore(createToggle(otherMessage), e);
2035+
e.parentNode.insertBefore(createToggle(otherMessage, extraClass), e);
20302036
if (otherMessage && getCurrentValue('rustdoc-item-declarations') !== "false") {
20312037
collapseDocs(e.previousSibling.childNodes[0], "toggle");
20322038
}

src/librustdoc/html/static/rustdoc.css

+21-2
Original file line numberDiff line numberDiff line change
@@ -474,11 +474,30 @@ h4 > code, h3 > code, .invisible > code {
474474
margin-bottom: 15px;
475475
}
476476

477+
.content .impl-items .method, .content .impl-items > .type, .impl-items > .associatedconstant {
478+
margin-left: 20px;
479+
}
477480
.content .impl-items .docblock, .content .impl-items .stability {
478481
margin-bottom: .6em;
479482
}
480-
.content .impl-items .method, .content .impl-items > .type, .impl-items > .associatedconstant {
483+
.content .docblock > .impl-items {
481484
margin-left: 20px;
485+
margin-top: -34px;
486+
}
487+
.content .docblock > .impl-items > h4 {
488+
border-bottom: 0;
489+
}
490+
.content .docblock >.impl-items .table-display {
491+
margin: 0;
492+
}
493+
.content .docblock >.impl-items table td {
494+
padding: 0;
495+
}
496+
.toggle-wrapper.marg-left > .collapse-toggle {
497+
left: -24px;
498+
}
499+
.content .docblock > .impl-items .table-display, .impl-items table td {
500+
border: none;
482501
}
483502

484503
.content .stability code {
@@ -542,7 +561,7 @@ a {
542561
content: '\2002\00a7\2002';
543562
}
544563

545-
.docblock a:hover, .docblock-short a:hover, .stability a {
564+
.docblock a:not(.srclink):hover, .docblock-short a:not(.srclink):hover, .stability a {
546565
text-decoration: underline;
547566
}
548567

src/librustdoc/html/static/themes/dark.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.t
3333
background: rgba(0, 0, 0, 0);
3434
}
3535

36-
.docblock code, .docblock-short code {
36+
.docblock p > code, .docblock-short p > code {
3737
background-color: #2A2A2A;
3838
}
3939
pre {
@@ -163,7 +163,7 @@ a {
163163
color: #ddd;
164164
}
165165

166-
.docblock a, .docblock-short a, .stability a {
166+
.docblock a:not(.srclink), .docblock-short a:not(.srclink), .stability a {
167167
color: #D2991D;
168168
}
169169

src/librustdoc/html/static/themes/light.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.t
3535
background: rgba(0, 0, 0, 0);
3636
}
3737

38-
.docblock code, .docblock-short code {
38+
.docblock p > code, .docblock-short p > code {
3939
background-color: #F5F5F5;
4040
}
4141
pre {
@@ -163,7 +163,7 @@ a {
163163
color: #000;
164164
}
165165

166-
.docblock a, .docblock-short a, .stability a {
166+
.docblock a:not(.srclink), .docblock-short a:not(.srclink), .stability a {
167167
color: #3873AD;
168168
}
169169

0 commit comments

Comments
 (0)