Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
2f4ab281
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2f4ab281
编写于
6月 03, 2016
作者:
M
Martin Aeschlimann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Simplify deletion of rules
上级
2d0818e5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
20 addition
and
22 deletion
+20
-22
src/vs/base/browser/dom.ts
src/vs/base/browser/dom.ts
+2
-2
src/vs/editor/browser/services/codeEditorServiceImpl.ts
src/vs/editor/browser/services/codeEditorServiceImpl.ts
+18
-20
未找到文件。
src/vs/base/browser/dom.ts
浏览文件 @
2f4ab281
...
...
@@ -742,7 +742,7 @@ export function getCSSRule(selector: string, style: HTMLStyleElement = sharedSty
return
null
;
}
export
function
removeCSSRules
WithPrefix
(
ruleName
:
string
,
style
=
sharedStyle
):
void
{
export
function
removeCSSRules
ContainingSelector
(
ruleName
:
string
,
style
=
sharedStyle
):
void
{
if
(
!
style
)
{
return
;
}
...
...
@@ -752,7 +752,7 @@ export function removeCSSRulesWithPrefix(ruleName: string, style = sharedStyle):
for
(
let
i
=
0
;
i
<
rules
.
length
;
i
++
)
{
let
rule
=
rules
[
i
];
let
normalizedSelectorText
=
rule
.
selectorText
.
replace
(
/::/gi
,
'
:
'
);
if
(
normalizedSelectorText
.
indexOf
(
ruleName
)
===
0
)
{
if
(
normalizedSelectorText
.
indexOf
(
ruleName
)
!==
-
1
)
{
toDelete
.
push
(
i
);
}
}
...
...
src/vs/editor/browser/services/codeEditorServiceImpl.ts
浏览文件 @
2f4ab281
...
...
@@ -102,9 +102,7 @@ class DecorationSubTypeOptionsProvider implements IModelDecorationOptionsProvide
this
.
_inlineClassName
=
inlineClassName
;
this
.
_disposable
=
toDisposable
(()
=>
{
dom
.
removeCSSRulesWithPrefix
(
CSSNameHelper
.
getDeletionPrefixFor
(
ThemeType
.
Light
,
key
),
styleSheet
);
dom
.
removeCSSRulesWithPrefix
(
CSSNameHelper
.
getDeletionPrefixFor
(
ThemeType
.
Dark
,
key
),
styleSheet
);
dom
.
removeCSSRulesWithPrefix
(
CSSNameHelper
.
getDeletionPrefixFor
(
ThemeType
.
HighContrastBlack
,
key
),
styleSheet
);
dom
.
removeCSSRulesContainingSelector
(
CSSNameHelper
.
getDeletionPrefixFor
(
key
),
styleSheet
);
});
}
}
...
...
@@ -130,9 +128,7 @@ class DecorationSubTypeOptionsProvider implements IModelDecorationOptionsProvide
class
DecorationTypeOptionsProvider
implements
IModelDecorationOptionsProvider
{
private
_styleSheet
:
HTMLStyleElement
;
public
_key
:
string
;
private
_disposable
:
IDisposable
;
public
refCount
:
number
;
public
className
:
string
;
...
...
@@ -145,12 +141,9 @@ class DecorationTypeOptionsProvider implements IModelDecorationOptionsProvider {
constructor
(
styleSheet
:
HTMLStyleElement
,
key
:
string
,
options
:
IDecorationRenderOptions
)
{
var
themedOpts
=
getThemedRenderOptions
(
options
);
this
.
_styleSheet
=
styleSheet
;
this
.
_key
=
key
;
this
.
className
=
DecorationRenderHelper
.
handle
(
this
.
_
styleSheet
,
this
.
_
key
,
styleSheet
,
key
,
null
,
ModelDecorationCSSRuleType
.
ClassName
,
{
...
...
@@ -160,8 +153,8 @@ class DecorationTypeOptionsProvider implements IModelDecorationOptionsProvider {
);
this
.
inlineClassName
=
DecorationRenderHelper
.
handle
(
this
.
_
styleSheet
,
this
.
_
key
,
styleSheet
,
key
,
null
,
ModelDecorationCSSRuleType
.
InlineClassName
,
{
...
...
@@ -185,8 +178,8 @@ class DecorationTypeOptionsProvider implements IModelDecorationOptionsProvider {
}
this
.
glyphMarginClassName
=
DecorationRenderHelper
.
handle
(
this
.
_
styleSheet
,
this
.
_
key
,
styleSheet
,
key
,
null
,
ModelDecorationCSSRuleType
.
GlyphMarginClassName
,
{
...
...
@@ -207,6 +200,10 @@ class DecorationTypeOptionsProvider implements IModelDecorationOptionsProvider {
position
:
options
.
overviewRulerLane
||
OverviewRulerLane
.
Center
};
}
this
.
_disposable
=
toDisposable
(()
=>
{
dom
.
removeCSSRulesContainingSelector
(
CSSNameHelper
.
getDeletionPrefixFor
(
key
),
styleSheet
);
});
}
public
getOptions
(
codeEditorService
:
AbstractCodeEditorService
,
writable
:
boolean
):
IModelDecorationOptions
{
...
...
@@ -224,9 +221,10 @@ class DecorationTypeOptionsProvider implements IModelDecorationOptionsProvider {
}
public
dispose
():
void
{
dom
.
removeCSSRulesWithPrefix
(
CSSNameHelper
.
getDeletionPrefixFor
(
ThemeType
.
Light
,
this
.
_key
),
this
.
_styleSheet
);
dom
.
removeCSSRulesWithPrefix
(
CSSNameHelper
.
getDeletionPrefixFor
(
ThemeType
.
Dark
,
this
.
_key
),
this
.
_styleSheet
);
dom
.
removeCSSRulesWithPrefix
(
CSSNameHelper
.
getDeletionPrefixFor
(
ThemeType
.
HighContrastBlack
,
this
.
_key
),
this
.
_styleSheet
);
if
(
this
.
_disposable
)
{
this
.
_disposable
.
dispose
();
delete
this
.
_disposable
;
}
}
}
...
...
@@ -394,8 +392,8 @@ class CSSNameHelper {
return
selector
;
}
public
static
getDeletionPrefixFor
(
themeType
:
ThemeType
,
key
:
string
):
string
{
return
this
.
_getSelectorPrefixOf
(
themeType
)
+
'
.ced-
'
+
key
;
public
static
getDeletionPrefixFor
(
key
:
string
):
string
{
return
'
.ced-
'
+
key
+
'
-
'
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录