Merge VS Code 1.21 source code (#1067)

* Initial VS Code 1.21 file copy with patches

* A few more merges

* Post npm install

* Fix batch of build breaks

* Fix more build breaks

* Fix more build errors

* Fix more build breaks

* Runtime fixes 1

* Get connection dialog working with some todos

* Fix a few packaging issues

* Copy several node_modules to package build to fix loader issues

* Fix breaks from master

* A few more fixes

* Make tests pass

* First pass of license header updates

* Second pass of license header updates

* Fix restore dialog issues

* Remove add additional themes menu items

* fix select box issues where the list doesn't show up

* formatting

* Fix editor dispose issue

* Copy over node modules to correct location on all platforms
This commit is contained in:
Karl Burtram
2018-04-04 15:27:51 -07:00
committed by GitHub
parent 5fba3e31b4
commit dafb780987
9412 changed files with 141255 additions and 98813 deletions

View File

@@ -251,41 +251,26 @@ export function addDisposableNonBubblingMouseOutListener(node: Element, handler:
});
}
const _animationFrame = (function () {
let emulatedRequestAnimationFrame = (callback: (time: number) => void): number => {
return setTimeout(() => callback(new Date().getTime()), 0);
};
let nativeRequestAnimationFrame: (callback: (time: number) => void) => number =
self.requestAnimationFrame
|| (<any>self).msRequestAnimationFrame
|| (<any>self).webkitRequestAnimationFrame
|| (<any>self).mozRequestAnimationFrame
|| (<any>self).oRequestAnimationFrame;
let emulatedCancelAnimationFrame = (id: number) => { };
let nativeCancelAnimationFrame: (id: number) => void =
self.cancelAnimationFrame || (<any>self).cancelRequestAnimationFrame
|| (<any>self).msCancelAnimationFrame || (<any>self).msCancelRequestAnimationFrame
|| (<any>self).webkitCancelAnimationFrame || (<any>self).webkitCancelRequestAnimationFrame
|| (<any>self).mozCancelAnimationFrame || (<any>self).mozCancelRequestAnimationFrame
|| (<any>self).oCancelAnimationFrame || (<any>self).oCancelRequestAnimationFrame;
let isNative = !!nativeRequestAnimationFrame;
let request = nativeRequestAnimationFrame || emulatedRequestAnimationFrame;
let cancel = nativeCancelAnimationFrame || emulatedCancelAnimationFrame;
return {
isNative: isNative,
request: (callback: (time: number) => void): number => {
return request(callback);
},
cancel: (id: number) => {
return cancel(id);
}
};
})();
interface IRequestAnimationFrame {
(callback: (time: number) => void): number;
}
let _animationFrame: IRequestAnimationFrame = null;
function doRequestAnimationFrame(callback: (time: number) => void): number {
if (!_animationFrame) {
const emulatedRequestAnimationFrame = (callback: (time: number) => void): number => {
return setTimeout(() => callback(new Date().getTime()), 0);
};
_animationFrame = (
self.requestAnimationFrame
|| (<any>self).msRequestAnimationFrame
|| (<any>self).webkitRequestAnimationFrame
|| (<any>self).mozRequestAnimationFrame
|| (<any>self).oRequestAnimationFrame
|| emulatedRequestAnimationFrame
);
}
return _animationFrame(callback);
}
/**
* Schedule a callback to be run at the next animation frame.
@@ -375,7 +360,7 @@ class AnimationFrameQueueItem implements IDisposable {
if (!animFrameRequested) {
animFrameRequested = true;
_animationFrame.request(animationFrameRunner);
doRequestAnimationFrame(animationFrameRunner);
}
return item;
@@ -515,8 +500,6 @@ const sizeUtils = {
__commaSentinel: false
};
// ----------------------------------------------------------------------------------------
@@ -688,7 +671,13 @@ export function createStyleSheet(container: HTMLElement = document.getElementsBy
return style;
}
const sharedStyle = <any>createStyleSheet();
let _sharedStyleSheet: HTMLStyleElement = null;
function getSharedStyleSheet(): HTMLStyleElement {
if (!_sharedStyleSheet) {
_sharedStyleSheet = createStyleSheet();
}
return _sharedStyleSheet;
}
function getDynamicStyleSheetRules(style: any) {
if (style && style.sheet && style.sheet.rules) {
@@ -702,7 +691,7 @@ function getDynamicStyleSheetRules(style: any) {
return [];
}
export function createCSSRule(selector: string, cssText: string, style: HTMLStyleElement = sharedStyle): void {
export function createCSSRule(selector: string, cssText: string, style: HTMLStyleElement = getSharedStyleSheet()): void {
if (!style || !cssText) {
return;
}
@@ -710,7 +699,7 @@ export function createCSSRule(selector: string, cssText: string, style: HTMLStyl
(<CSSStyleSheet>style.sheet).insertRule(selector + '{' + cssText + '}', 0);
}
export function removeCSSRulesContainingSelector(ruleName: string, style = sharedStyle): void {
export function removeCSSRulesContainingSelector(ruleName: string, style: HTMLStyleElement = getSharedStyleSheet()): void {
if (!style) {
return;
}
@@ -725,7 +714,7 @@ export function removeCSSRulesContainingSelector(ruleName: string, style = share
}
for (let i = toDelete.length - 1; i >= 0; i--) {
style.sheet.deleteRule(toDelete[i]);
(<any>style.sheet).deleteRule(toDelete[i]);
}
}