Skip to content

Commit b250011

Browse files
authored
Merge pull request #236 from atom-ide-community/css-containment
2 parents 264b3d9 + 65eae9a commit b250011

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

static/core-ui/text-editor.less

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,28 @@
77
--editor-font-family: Menlo, Consolas, 'DejaVu Sans Mono', monospace;
88
}
99

10+
@contain_all: layout size paint style;
11+
@contain_but_size: layout paint style;
12+
@contain_but_layout: size paint style;
13+
@contain_but_paint: layout size style;
14+
1015
atom-text-editor {
16+
contain: @contain_but_size;
1117
display: flex;
1218
cursor: text;
1319
font-family: var(--editor-font-family);
1420
font-size: var(--editor-font-size);
1521
line-height: var(--editor-line-height);
1622

1723
.gutter-container {
24+
contain: @contain_but_size;
1825
width: min-content;
1926
background-color: inherit;
2027
cursor: default;
2128
}
2229

2330
.gutter {
31+
contain: @contain_but_size;
2432
overflow: hidden;
2533
z-index: 0;
2634
text-align: right;
@@ -32,6 +40,7 @@ atom-text-editor {
3240

3341
.gutter:hover {
3442
.line-number.foldable .icon-right {
43+
contain: paint style;
3544
visibility: visible;
3645

3746
&:hover {
@@ -42,6 +51,7 @@ atom-text-editor {
4251

4352
.gutter, .gutter:hover {
4453
.line-number.folded .icon-right {
54+
contain: paint style;
4555
.octicon(chevron-right, 0.8em);
4656

4757
visibility: visible;
@@ -54,17 +64,20 @@ atom-text-editor {
5464
}
5565

5666
.line-numbers {
67+
contain: @contain_but_size;
5768
width: max-content;
5869
background-color: inherit;
5970
}
6071

6172
.line-number {
73+
contain: @contain_but_size;
6274
padding-left: .5em;
6375
white-space: nowrap;
6476
opacity: 0.6;
6577
position: relative;
6678

6779
.icon-right {
80+
contain: paint style;
6881
.octicon(chevron-down, 0.8em);
6982
display: inline-block;
7083
visibility: hidden;
@@ -78,25 +91,28 @@ atom-text-editor {
7891
}
7992

8093
.highlight {
94+
contain: @contain_but_paint;
8195
background: none;
8296
padding: 0;
8397
}
8498

8599
.highlight .region {
100+
contain: @contain_but_paint;
86101
pointer-events: none;
87102
z-index: -1;
88103
}
89104

90105
.line {
91106
white-space: pre;
92-
contain: layout;
107+
contain: @contain_but_size;
93108

94109
&.cursor-line .fold-marker::after {
95110
opacity: 1;
96111
}
97112
}
98113

99114
.fold-marker {
115+
contain: @contain_all;
100116
cursor: default;
101117

102118
&::after {
@@ -108,21 +124,25 @@ atom-text-editor {
108124
}
109125

110126
.placeholder-text {
127+
contain: @contain_all;
111128
position: absolute;
112129
color: @text-color-subtle;
113130
}
114131

115132
.invisible-character {
133+
contain: @contain_all;
116134
font-weight: normal !important;
117135
font-style: normal !important;
118136
}
119137

120138
.indent-guide {
139+
contain: paint style;
121140
display: inline-block;
122141
box-shadow: inset 1px 0;
123142
}
124143

125144
.cursor {
145+
contain: @contain_all;
126146
z-index: 4;
127147
pointer-events: none;
128148
box-sizing: border-box;
@@ -145,13 +165,15 @@ atom-text-editor {
145165
}
146166

147167
atom-text-editor[mini] {
168+
contain: @contain_but_size;
148169
font-size: @input-font-size;
149170
line-height: @component-line-height;
150171
max-height: @component-line-height + 2; // +2 for borders
151172
overflow: auto;
152173
}
153174

154175
atom-overlay {
176+
contain: layout style;
155177
position: fixed;
156178
display: block;
157179
z-index: 4;

0 commit comments

Comments
 (0)