Merge from vscode 1eb87b0e9ce9886afeaecec22b31abd0d9b7939f (#7282)

* Merge from vscode 1eb87b0e9ce9886afeaecec22b31abd0d9b7939f

* fix various icon issues

* fix preview features
This commit is contained in:
Anthony Dresser
2019-09-19 21:50:52 -07:00
committed by GitHub
parent 9d3d64eef3
commit db498db0a8
459 changed files with 10195 additions and 7528 deletions

View File

@@ -203,16 +203,16 @@ export const toggleClass: (node: HTMLElement | SVGElement, className: string, sh
class DomListener implements IDisposable {
private _handler: (e: any) => void;
private _node: Element | Window | Document;
private _node: EventTarget;
private readonly _type: string;
private readonly _useCapture: boolean;
private readonly _options: boolean | AddEventListenerOptions;
constructor(node: Element | Window | Document, type: string, handler: (e: any) => void, useCapture?: boolean) {
constructor(node: EventTarget, type: string, handler: (e: any) => void, options?: boolean | AddEventListenerOptions) {
this._node = node;
this._type = type;
this._handler = handler;
this._useCapture = (useCapture || false);
this._node.addEventListener(this._type, this._handler, this._useCapture);
this._options = (options || false);
this._node.addEventListener(this._type, this._handler, this._options);
}
public dispose(): void {
@@ -221,7 +221,7 @@ class DomListener implements IDisposable {
return;
}
this._node.removeEventListener(this._type, this._handler, this._useCapture);
this._node.removeEventListener(this._type, this._handler, this._options);
// Prevent leakers from holding on to the dom or handler func
this._node = null!;
@@ -229,9 +229,10 @@ class DomListener implements IDisposable {
}
}
export function addDisposableListener<K extends keyof GlobalEventHandlersEventMap>(node: Element | Window | Document, type: K, handler: (event: GlobalEventHandlersEventMap[K]) => void, useCapture?: boolean): IDisposable;
export function addDisposableListener(node: Element | Window | Document, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable;
export function addDisposableListener(node: Element | Window | Document, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable {
export function addDisposableListener<K extends keyof GlobalEventHandlersEventMap>(node: EventTarget, type: K, handler: (event: GlobalEventHandlersEventMap[K]) => void, useCapture?: boolean): IDisposable;
export function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable;
export function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, useCapture: AddEventListenerOptions): IDisposable;
export function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, useCapture?: boolean | AddEventListenerOptions): IDisposable {
return new DomListener(node, type, handler, useCapture);
}
@@ -559,13 +560,11 @@ class SizeUtils {
// Position & Dimension
export class Dimension {
public width: number;
public height: number;
constructor(width: number, height: number) {
this.width = width;
this.height = height;
}
constructor(
public readonly width: number,
public readonly height: number,
) { }
static equals(a: Dimension | undefined, b: Dimension | undefined): boolean {
if (a === b) {