Skip to content

Commit f2be7d9

Browse files
committed
feat: add css containment to minimap elements
1 parent 4a41540 commit f2be7d9

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

styles/minimap.less

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,15 @@ atom-text-editor[with-minimap] {
1414
}
1515
}
1616

17+
// css containment to improve performance
18+
// this means the css properties of the minimap does not affect other parts of Atom
19+
// https://drafts.csswg.org/css-contain/#propdef-contain
20+
@contain_all: size layout paint style;
21+
@contain_except_size: layout paint style;
22+
1723
atom-text-editor, html {
1824
atom-text-editor-minimap {
25+
contain: @contain_all;
1926
display: block;
2027
overflow: hidden;
2128
position: relative;
@@ -42,6 +49,7 @@ atom-text-editor, html {
4249
pointer-events: none;
4350

4451
canvas, .minimap-visible-area {
52+
contain: @contain_except_size;
4553
pointer-events: auto;
4654
}
4755
}
@@ -58,13 +66,15 @@ atom-text-editor, html {
5866
}
5967

6068
canvas {
69+
contain: @contain_except_size;
6170
position: absolute;
6271
top: 0;
6372
left: 0;
6473
transform-origin: 0 0;
6574
}
6675

6776
.minimap-visible-area {
77+
contain: @contain_all;
6878
position: absolute;
6979
display: block;
7080
cursor: -webkit-grab;
@@ -87,12 +97,14 @@ atom-text-editor, html {
8797
}
8898

8999
.minimap-controls {
100+
contain: @contain_all;
90101
position: relative;
91102
height: 100%;
92103
pointer-events: none;
93104
}
94105

95106
.minimap-scroll-indicator {
107+
contain: @contain_all;
96108
position: absolute;
97109
display: block;
98110
right: 0;
@@ -103,6 +115,7 @@ atom-text-editor, html {
103115
}
104116

105117
.open-minimap-quick-settings {
118+
contain: @contain_all;
106119
opacity: 0;
107120
position: absolute;
108121
z-index: 1;
@@ -131,10 +144,12 @@ atom-text-editor, html {
131144
}
132145

133146
minimap-quick-settings {
147+
contain: @contain_all;
134148
position: absolute !important;
135149
z-index: 5;
136150

137151
.hidden-input {
152+
contain: @contain_all;
138153
position: absolute;
139154
width: 0;
140155
height: 0;
@@ -143,6 +158,7 @@ minimap-quick-settings {
143158
}
144159

145160
ol {
161+
contain: @contain_all;
146162
margin-top: 0 !important;
147163

148164
.separator {
@@ -160,14 +176,17 @@ minimap-quick-settings {
160176
}
161177

162178
.select-list.popover-list ol.list-group {
179+
contain: @contain_all;
163180
overflow: visible;
164181
max-height: none;
165182
}
166183

167184
.btn-group {
185+
contain: @contain_all;
168186
width: 100%;
169187

170188
.btn {
189+
contain: @contain_all;
171190
width: 50%;
172191
}
173192
}

0 commit comments

Comments
 (0)