diff --git a/src/vs/base/browser/browser.ts b/src/vs/base/browser/browser.ts index 24ca5f427f1..9a1e56d073b 100644 --- a/src/vs/base/browser/browser.ts +++ b/src/vs/base/browser/browser.ts @@ -114,17 +114,9 @@ export function onDidChangeFullscreen(callback: () => void): IDisposable { const userAgent = navigator.userAgent; -// DOCUMENTED FOR FUTURE REFERENCE: -// When running IE11 in IE10 document mode, the code below will identify the browser as being IE10, -// which is correct because IE11 in IE10 document mode will reimplement all the bugs of IE10 -export const isIE11 = (userAgent.indexOf('Trident') >= 0 && userAgent.indexOf('MSIE') < 0); -export const isIE10 = (userAgent.indexOf('MSIE 10') >= 0); -export const isIE9 = (userAgent.indexOf('MSIE 9') >= 0); -export const isIE11orEarlier = isIE11 || isIE10 || isIE9; -export const isIE10orEarlier = isIE10 || isIE9; -export const isIE10orLater = isIE11 || isIE10; +export const isIE = (userAgent.indexOf('Trident') >= 0); export const isEdge = (userAgent.indexOf('Edge/') >= 0); -export const isEdgeOrIE = isEdge || isIE11 || isIE10 || isIE9; +export const isEdgeOrIE = isIE || isEdge; export const isOpera = (userAgent.indexOf('Opera') >= 0); export const isFirefox = (userAgent.indexOf('Firefox') >= 0); @@ -133,7 +125,7 @@ export const isChrome = (userAgent.indexOf('Chrome') >= 0); export const isSafari = (userAgent.indexOf('Chrome') === -1) && (userAgent.indexOf('Safari') >= 0); export const isIPad = (userAgent.indexOf('iPad') >= 0); -export const canUseTranslate3d = !isIE9 && !isFirefox; +export const canUseTranslate3d = !isFirefox; export const enableEmptySelectionClipboard = isWebKit; @@ -167,7 +159,7 @@ export function hasCSSAnimationSupport() { export function supportsExecCommand(command: string): boolean { return ( - (isIE11orEarlier || Platform.isNative) + (isIE || Platform.isNative) && document.queryCommandSupported(command) ); } \ No newline at end of file diff --git a/src/vs/base/browser/dom.ts b/src/vs/base/browser/dom.ts index ab8b9e2631c..567e9d85db4 100644 --- a/src/vs/base/browser/dom.ts +++ b/src/vs/base/browser/dom.ts @@ -176,58 +176,36 @@ export function toggleClass(node: HTMLElement, className: string, shouldHaveIt?: } } -class DomListener extends Disposable { +class DomListener implements IDisposable { - private _usedAddEventListener: boolean; - private _wrapHandler: (e: any) => void; - private _node: any; - private _type: string; - private _useCapture: boolean; - - constructor(node: Element | Window | Document, type: string, handler: (e: any) => void, useCapture?: boolean) { - super(); + private _handler: (e: any) => void; + private _node: Element | Window | Document; + private readonly _type: string; + private readonly _useCapture: boolean; + constructor(node: Element | Window | Document, type: string, handler: (e: any) => void, useCapture: boolean) { this._node = node; this._type = type; + this._handler = handler; this._useCapture = (useCapture || false); - - this._wrapHandler = (e) => { - e = e || window.event; - handler(e); - }; - - if (typeof this._node.addEventListener === 'function') { - this._usedAddEventListener = true; - this._node.addEventListener(this._type, this._wrapHandler, this._useCapture); - } else { - this._usedAddEventListener = false; - this._node.attachEvent('on' + this._type, this._wrapHandler); - } + this._node.addEventListener(this._type, this._handler, this._useCapture); } public dispose(): void { - if (!this._wrapHandler) { + if (!this._handler) { // Already disposed return; } - if (this._usedAddEventListener) { - this._node.removeEventListener(this._type, this._wrapHandler, this._useCapture); - } else { - this._node.detachEvent('on' + this._type, this._wrapHandler); - } + this._node.removeEventListener(this._type, this._handler, this._useCapture); // Prevent leakers from holding on to the dom or handler func this._node = null; - this._wrapHandler = null; + this._handler = null; } } -export function addDisposableListener(node: Element, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable; -export function addDisposableListener(node: Element | Window, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable; -export function addDisposableListener(node: Window, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable; -export function addDisposableListener(node: Document, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable; -export function addDisposableListener(node: any, 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 { return new DomListener(node, type, handler, useCapture); } @@ -444,9 +422,9 @@ class AnimationFrameQueueItem implements IDisposable { }; })(); -/// -/// Add a throttled listener. `handler` is fired at most every 16ms or with the next animation frame (if browser supports it). -/// +/** + * Add a throttled listener. `handler` is fired at most every 16ms or with the next animation frame (if browser supports it). + */ export interface IEventMerger { (lastEvent: R, currentEvent: Event): R; } diff --git a/src/vs/base/browser/keyboardEvent.ts b/src/vs/base/browser/keyboardEvent.ts index f9dadd7b77d..ee6ff691158 100644 --- a/src/vs/base/browser/keyboardEvent.ts +++ b/src/vs/base/browser/keyboardEvent.ts @@ -128,7 +128,7 @@ let KEY_CODE_MAP: { [keyCode: number]: KeyCode } = {}; KEY_CODE_MAP[226] = KeyCode.OEM_102; - if (browser.isIE11orEarlier) { + if (browser.isIE) { KEY_CODE_MAP[91] = KeyCode.Meta; } else if (browser.isFirefox) { KEY_CODE_MAP[59] = KeyCode.US_SEMICOLON; diff --git a/src/vs/base/browser/ui/inputbox/inputBox.ts b/src/vs/base/browser/ui/inputbox/inputBox.ts index 53fa3398693..0ee84d99af8 100644 --- a/src/vs/base/browser/ui/inputbox/inputBox.ts +++ b/src/vs/base/browser/ui/inputbox/inputBox.ts @@ -125,15 +125,11 @@ export class InputBox extends Widget { this.onfocus(this.input, () => this.onFocus()); // Add placeholder shim for IE because IE decides to hide the placeholder on focus (we dont want that!) - if (this.placeholder && Bal.isIE11orEarlier) { + if (this.placeholder && Bal.isIE) { this.onclick(this.input, (e) => { dom.EventHelper.stop(e, true); this.input.focus(); }); - - if (Bal.isIE9) { - this.onkeyup(this.input, () => this.onValueChange()); - } } setTimeout(() => this.updateMirror(), 0); diff --git a/src/vs/base/browser/ui/menu/menu.css b/src/vs/base/browser/ui/menu/menu.css index a29d9177e47..291f08b6ade 100644 --- a/src/vs/base/browser/ui/menu/menu.css +++ b/src/vs/base/browser/ui/menu/menu.css @@ -104,10 +104,6 @@ animation: fadeIn 0.083s linear; } -.ie.ie9 .context-view.monaco-menu-container { - box-shadow: 0 2px 8px 2px #A8A8A8; -} - .context-view.monaco-menu-container :focus { outline: 0; } diff --git a/src/vs/base/common/diff/diff.ts b/src/vs/base/common/diff/diff.ts index a72323015b5..3b402e44a1d 100644 --- a/src/vs/base/common/diff/diff.ts +++ b/src/vs/base/common/diff/diff.ts @@ -196,10 +196,10 @@ class DiffChangeHelper { return this.m_changes; } + /** + * Retrieves all of the changes marked by the class in the reverse order + */ public getReverseChanges(): DiffChange[] { - /// - /// Retrieves all of the changes marked by the class in the reverse order - /// if (this.m_originalCount > 0 || this.m_modifiedCount > 0) { // Finish up on whatever is left this.MarkNextChange(); diff --git a/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts b/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts index bb65b26102d..daa2a33c22f 100644 --- a/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts +++ b/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts @@ -8,7 +8,6 @@ import 'vs/css!./quickopen'; import nls = require('vs/nls'); import { TPromise } from 'vs/base/common/winjs.base'; import platform = require('vs/base/common/platform'); -import browser = require('vs/base/browser/browser'); import { EventType } from 'vs/base/common/events'; import types = require('vs/base/common/types'); import errors = require('vs/base/common/errors'); @@ -182,11 +181,6 @@ export class QuickOpenWidget implements IModelProvider { this.elementSelected(focus, e, shouldOpenInBackground ? Mode.OPEN_IN_BACKGROUND : Mode.OPEN); } } - - // Bug in IE 9: onInput is not fired for Backspace or Delete keys - else if (browser.isIE9 && (keyboardEvent.keyCode === KeyCode.Backspace || keyboardEvent.keyCode === KeyCode.Delete)) { - this.onType(); - } }); DOM.addDisposableListener(this.inputBox.inputElement, DOM.EventType.INPUT, (e: Event) => { @@ -301,7 +295,6 @@ export class QuickOpenWidget implements IModelProvider { // Widget Attributes .addClass('quick-open-widget') - .addClass((browser.isIE10orEarlier) ? ' no-shadow' : '') .build(this.container); // Support layout diff --git a/src/vs/base/parts/quickopen/browser/quickopen.css b/src/vs/base/parts/quickopen/browser/quickopen.css index ef1ca7ff74a..bcd356bd298 100644 --- a/src/vs/base/parts/quickopen/browser/quickopen.css +++ b/src/vs/base/parts/quickopen/browser/quickopen.css @@ -107,21 +107,11 @@ box-shadow: 0 5px 8px #A8A8A8; } -.quick-open-widget.no-shadow { - box-shadow: none; - border: 1px solid #E6E6E6; -} - .vs-dark .quick-open-widget { background-color: #252526; box-shadow: 0 5px 8px #000; } -.vs-dark .quick-open-widget.no-shadow { - box-shadow: none; - border: 1px solid #000; -} - .vs-dark .quick-open-widget input { background-color: #3C3C3C; color: inherit; diff --git a/src/vs/base/parts/tree/browser/treeView.ts b/src/vs/base/parts/tree/browser/treeView.ts index 1adb1f544be..2d9a815f57c 100644 --- a/src/vs/base/parts/tree/browser/treeView.ts +++ b/src/vs/base/parts/tree/browser/treeView.ts @@ -495,7 +495,7 @@ export class TreeView extends HeightMap { this.emit('scroll', e); // TODO@Joao: is anyone interested in this event? }); - if (Browser.isIE11orEarlier) { + if (Browser.isIE) { this.wrapper.style.msTouchAction = 'none'; this.wrapper.style.msContentZooming = 'none'; } else { @@ -519,7 +519,7 @@ export class TreeView extends HeightMap { this.viewListeners.push(DOM.addDisposableListener(this.wrapper, Touch.EventType.Tap, (e) => this.onTap(e))); this.viewListeners.push(DOM.addDisposableListener(this.wrapper, Touch.EventType.Change, (e) => this.onTouchChange(e))); - if (Browser.isIE11orEarlier) { + if (Browser.isIE) { this.viewListeners.push(DOM.addDisposableListener(this.wrapper, 'MSPointerDown', (e) => this.onMsPointerDown(e))); this.viewListeners.push(DOM.addDisposableListener(this.wrapper, 'MSGestureTap', (e) => this.onMsGestureTap(e))); @@ -1116,7 +1116,7 @@ export class TreeView extends HeightMap { return; } - if (Browser.isIE10orLater && Date.now() - this.lastClickTimeStamp < 300) { + if (Browser.isIE && Date.now() - this.lastClickTimeStamp < 300) { // IE10+ doesn't set the detail property correctly. While IE10 simply // counts the number of clicks, IE11 reports always 1. To align with // other browser, we set the value to 2 if clicks events come in a 300ms diff --git a/src/vs/base/test/browser/browser.test.ts b/src/vs/base/test/browser/browser.test.ts index 321d5868b09..6992e882bf4 100644 --- a/src/vs/base/test/browser/browser.test.ts +++ b/src/vs/base/test/browser/browser.test.ts @@ -13,7 +13,7 @@ suite('Browsers', () => { assert(!(isWindows && isMacintosh)); let isOpera = browser.isOpera || navigator.userAgent.indexOf('OPR') >= 0; - let isIE11orEarlier = browser.isIE11orEarlier; + let isIE = browser.isIE; let isFirefox = browser.isFirefox; let isWebKit = browser.isWebKit; let isChrome = browser.isChrome; @@ -25,7 +25,7 @@ suite('Browsers', () => { if (isOpera) { browserCount++; } - if (isIE11orEarlier) { + if (isIE) { browserCount++; } if (isFirefox) { diff --git a/src/vs/css.js b/src/vs/css.js index 28047d44cb3..21f8ba39a88 100644 --- a/src/vs/css.js +++ b/src/vs/css.js @@ -14,11 +14,6 @@ *--------------------------------------------------------------------------------------------- *--------------------------------------------------------------------------------------------*/ 'use strict'; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; var _cssPluginGlobal = this; var CSSLoaderPlugin; (function (CSSLoaderPlugin) { @@ -99,120 +94,6 @@ var CSSLoaderPlugin; }; return BrowserCSSLoader; }()); - /** - * Prior to IE10, IE could not go above 31 stylesheets in a page - * http://blogs.msdn.com/b/ieinternals/archive/2011/05/14/internet-explorer-stylesheet-rule-selector-import-sheet-limit-maximum.aspx - * - * The general strategy here is to not write more than 31 link nodes to the page at the same time - * When stylesheets get loaded, they will get merged one into another to free up - * some positions for new link nodes. - */ - var IE9CSSLoader = (function (_super) { - __extends(IE9CSSLoader, _super); - function IE9CSSLoader() { - _super.call(this); - this._blockedLoads = []; - this._mergeStyleSheetsTimeout = -1; - } - IE9CSSLoader.prototype.load = function (name, cssUrl, externalCallback, externalErrorback) { - if (this._linkTagExists(name, cssUrl)) { - externalCallback(); - return; - } - var linkNode = this.createLinkTag(name, cssUrl, externalCallback, externalErrorback); - if (this._styleSheetCount() < 31) { - this._insertLinkNode(linkNode); - } - else { - this._blockedLoads.push(linkNode); - this._handleBlocked(); - } - }; - IE9CSSLoader.prototype._styleSheetCount = function () { - var linkCount = document.getElementsByTagName('link').length; - var styleCount = document.getElementsByTagName('style').length; - return linkCount + styleCount; - }; - IE9CSSLoader.prototype._onLoad = function (name, callback) { - _super.prototype._onLoad.call(this, name, callback); - this._handleBlocked(); - }; - IE9CSSLoader.prototype._onLoadError = function (name, errorback, err) { - _super.prototype._onLoadError.call(this, name, errorback, err); - this._handleBlocked(); - }; - IE9CSSLoader.prototype._handleBlocked = function () { - var _this = this; - var blockedLoadsCount = this._blockedLoads.length; - if (blockedLoadsCount > 0 && this._mergeStyleSheetsTimeout === -1) { - this._mergeStyleSheetsTimeout = window.setTimeout(function () { return _this._mergeStyleSheets(); }, 0); - } - }; - IE9CSSLoader.prototype._mergeStyleSheet = function (dstPath, dst, srcPath, src) { - for (var i = src.rules.length - 1; i >= 0; i--) { - dst.insertRule(Utilities.rewriteUrls(srcPath, dstPath, src.rules[i].cssText), 0); - } - }; - IE9CSSLoader.prototype._asIE9HTMLLinkElement = function (linkElement) { - return linkElement; - }; - IE9CSSLoader.prototype._mergeStyleSheets = function () { - this._mergeStyleSheetsTimeout = -1; - var blockedLoadsCount = this._blockedLoads.length; - var i, linkDomNodes = document.getElementsByTagName('link'); - var linkDomNodesCount = linkDomNodes.length; - var mergeCandidates = []; - for (i = 0; i < linkDomNodesCount; i++) { - if (linkDomNodes[i].readyState === 'loaded' || linkDomNodes[i].readyState === 'complete') { - mergeCandidates.push({ - linkNode: linkDomNodes[i], - rulesLength: this._asIE9HTMLLinkElement(linkDomNodes[i]).styleSheet.rules.length - }); - } - } - var mergeCandidatesCount = mergeCandidates.length; - // Just a little legend here :) - // - linkDomNodesCount: total number of link nodes in the DOM (this should be kept <= 31) - // - mergeCandidatesCount: loaded (finished) link nodes in the DOM (only these can be merged) - // - blockedLoadsCount: remaining number of load requests that did not fit in before (because of the <= 31 constraint) - // Now comes the heuristic part, we don't want to do too much work with the merging of styles, - // but we do need to merge stylesheets to free up loading slots. - var mergeCount = Math.min(Math.floor(mergeCandidatesCount / 2), blockedLoadsCount); - // Sort the merge candidates descending (least rules last) - mergeCandidates.sort(function (a, b) { - return b.rulesLength - a.rulesLength; - }); - var srcIndex, dstIndex; - for (i = 0; i < mergeCount; i++) { - srcIndex = mergeCandidates.length - 1 - i; - dstIndex = i % (mergeCandidates.length - mergeCount); - // Merge rules of src into dst - this._mergeStyleSheet(mergeCandidates[dstIndex].linkNode.href, this._asIE9HTMLLinkElement(mergeCandidates[dstIndex].linkNode).styleSheet, mergeCandidates[srcIndex].linkNode.href, this._asIE9HTMLLinkElement(mergeCandidates[srcIndex].linkNode).styleSheet); - // Remove dom node of src - mergeCandidates[srcIndex].linkNode.parentNode.removeChild(mergeCandidates[srcIndex].linkNode); - linkDomNodesCount--; - } - var styleSheetCount = this._styleSheetCount(); - while (styleSheetCount < 31 && this._blockedLoads.length > 0) { - this._insertLinkNode(this._blockedLoads.shift()); - styleSheetCount++; - } - }; - return IE9CSSLoader; - }(BrowserCSSLoader)); - var IE8CSSLoader = (function (_super) { - __extends(IE8CSSLoader, _super); - function IE8CSSLoader() { - _super.call(this); - } - IE8CSSLoader.prototype.attachListeners = function (name, linkNode, callback, errorback) { - linkNode.onload = function () { - linkNode.onload = null; - callback(); - }; - }; - return IE8CSSLoader; - }(IE9CSSLoader)); var NodeCSSLoader = (function () { function NodeCSSLoader() { this.fs = require.nodeRequire('fs'); @@ -225,9 +106,9 @@ var CSSLoaderPlugin; } externalCallback(contents); }; - NodeCSSLoader.BOM_CHAR_CODE = 65279; return NodeCSSLoader; }()); + NodeCSSLoader.BOM_CHAR_CODE = 65279; // ------------------------------ Finally, the plugin var CSSPlugin = (function () { function CSSPlugin(cssLoader) { @@ -287,10 +168,10 @@ var CSSLoaderPlugin; CSSPlugin.prototype.getInlinedResources = function () { return global.cssInlinedResources || []; }; - CSSPlugin.BUILD_MAP = {}; - CSSPlugin.BUILD_PATH_MAP = {}; return CSSPlugin; }()); + CSSPlugin.BUILD_MAP = {}; + CSSPlugin.BUILD_PATH_MAP = {}; CSSLoaderPlugin.CSSPlugin = CSSPlugin; var Utilities = (function () { function Utilities() { @@ -472,12 +353,6 @@ var CSSLoaderPlugin; if (typeof process !== 'undefined' && process.versions && !!process.versions.node && !isElectron) { cssLoader = new NodeCSSLoader(); } - else if (typeof navigator !== 'undefined' && navigator.userAgent.indexOf('MSIE 9') >= 0) { - cssLoader = new IE9CSSLoader(); - } - else if (typeof navigator !== 'undefined' && navigator.userAgent.indexOf('MSIE 8') >= 0) { - cssLoader = new IE8CSSLoader(); - } else { cssLoader = new BrowserCSSLoader(); } diff --git a/src/vs/editor/browser/config/configuration.ts b/src/vs/editor/browser/config/configuration.ts index f53b2df12f4..26cdc0c5193 100644 --- a/src/vs/editor/browser/config/configuration.ts +++ b/src/vs/editor/browser/config/configuration.ts @@ -273,16 +273,13 @@ export class Configuration extends CommonEditorConfiguration { protected _getEditorClassName(theme: string, fontLigatures: boolean): string { let extra = ''; - if (browser.isIE11orEarlier) { + if (browser.isIE) { extra += 'ie '; } else if (browser.isFirefox) { extra += 'ff '; } else if (browser.isEdge) { extra += 'edge '; } - if (browser.isIE9) { - extra += 'ie9 '; - } if (platform.isMacintosh) { extra += 'mac '; } diff --git a/src/vs/editor/browser/controller/input/textAreaWrapper.ts b/src/vs/editor/browser/controller/input/textAreaWrapper.ts index 86c22c5d88a..c9c2efa502f 100644 --- a/src/vs/editor/browser/controller/input/textAreaWrapper.ts +++ b/src/vs/editor/browser/controller/input/textAreaWrapper.ts @@ -179,7 +179,7 @@ export class TextAreaWrapper extends Disposable implements ITextAreaWrapper { public isInOverwriteMode(): boolean { // In IE, pressing Insert will bring the typing into overwrite mode - if (browser.isIE11orEarlier && document.queryCommandValue('OverWrite')) { + if (browser.isIE && document.queryCommandValue('OverWrite')) { return true; } return false; diff --git a/src/vs/editor/browser/controller/mouseHandler.ts b/src/vs/editor/browser/controller/mouseHandler.ts index 1ae754302c5..da1bc15c307 100644 --- a/src/vs/editor/browser/controller/mouseHandler.ts +++ b/src/vs/editor/browser/controller/mouseHandler.ts @@ -291,7 +291,7 @@ export class MouseHandler extends ViewEventHandler implements IDisposable { // In IE11, if the focus is in the browser's address bar and // then you click in the editor, calling preventDefault() // will not move focus properly (focus remains the address bar) - if (browser.isIE11orEarlier && !this._isFocused) { + if (browser.isIE && !this._isFocused) { this._asyncFocus.schedule(); } else { e.preventDefault(); diff --git a/src/vs/editor/browser/viewParts/lines/rangeUtil.ts b/src/vs/editor/browser/viewParts/lines/rangeUtil.ts index 248109fc108..d728502f9b0 100644 --- a/src/vs/editor/browser/viewParts/lines/rangeUtil.ts +++ b/src/vs/editor/browser/viewParts/lines/rangeUtil.ts @@ -43,18 +43,18 @@ export class RangeUtil { } } - private static _createHorizontalRangesFromClientRects(clientRects: ClientRectList, clientRectDeltaLeft: number, scaleRatio: number): HorizontalRange[] { + private static _createHorizontalRangesFromClientRects(clientRects: ClientRectList, clientRectDeltaLeft: number): HorizontalRange[] { if (!clientRects || clientRects.length === 0) { return null; } let result: HorizontalRange[] = []; - let prevLeft = Math.max(0, clientRects[0].left * scaleRatio - clientRectDeltaLeft); - let prevWidth = clientRects[0].width * scaleRatio; + let prevLeft = Math.max(0, clientRects[0].left - clientRectDeltaLeft); + let prevWidth = clientRects[0].width; for (let i = 1, len = clientRects.length; i < len; i++) { - let myLeft = Math.max(0, clientRects[i].left * scaleRatio - clientRectDeltaLeft); - let myWidth = clientRects[i].width * scaleRatio; + let myLeft = Math.max(0, clientRects[i].left - clientRectDeltaLeft); + let myWidth = clientRects[i].width; if (myLeft < prevLeft) { console.error('Unexpected: RangeUtil._createHorizontalRangesFromClientRects: client rects are not sorted'); @@ -74,7 +74,7 @@ export class RangeUtil { return result; } - public static readHorizontalRanges(domNode: HTMLElement, startChildIndex: number, startOffset: number, endChildIndex: number, endOffset: number, clientRectDeltaLeft: number, scaleRatio: number, endNode: HTMLElement): HorizontalRange[] { + public static readHorizontalRanges(domNode: HTMLElement, startChildIndex: number, startOffset: number, endChildIndex: number, endOffset: number, clientRectDeltaLeft: number, endNode: HTMLElement): HorizontalRange[] { // Panic check let min = 0; let max = domNode.children.length - 1; @@ -104,6 +104,6 @@ export class RangeUtil { endOffset = Math.min(endElement.textContent.length, Math.max(0, endOffset)); let clientRects = this._readClientRects(startElement, startOffset, endElement, endOffset, endNode); - return this._createHorizontalRangesFromClientRects(clientRects, clientRectDeltaLeft, scaleRatio); + return this._createHorizontalRangesFromClientRects(clientRects, clientRectDeltaLeft); } } diff --git a/src/vs/editor/browser/viewParts/lines/viewLine.ts b/src/vs/editor/browser/viewParts/lines/viewLine.ts index 3350b3587aa..ed57d054f4a 100644 --- a/src/vs/editor/browser/viewParts/lines/viewLine.ts +++ b/src/vs/editor/browser/viewParts/lines/viewLine.ts @@ -312,7 +312,7 @@ class RenderedViewLine { let partIndex = findIndexInArrayWithMax(this.input.lineParts, column - 1, this._lastRenderedPartIndex); let charOffsetInPart = this._charOffsetInPart[column - 1]; - let r = RangeUtil.readHorizontalRanges(this._getReadingTarget(), partIndex, charOffsetInPart, partIndex, charOffsetInPart, clientRectDeltaLeft, this._getScaleRatio(), endNode); + let r = RangeUtil.readHorizontalRanges(this._getReadingTarget(), partIndex, charOffsetInPart, partIndex, charOffsetInPart, clientRectDeltaLeft, endNode); if (!r || r.length === 0) { return -1; } @@ -332,11 +332,7 @@ class RenderedViewLine { let endPartIndex = findIndexInArrayWithMax(this.input.lineParts, endColumn - 1, this._lastRenderedPartIndex); let endCharOffsetInPart = this._charOffsetInPart[endColumn - 1]; - return RangeUtil.readHorizontalRanges(this._getReadingTarget(), startPartIndex, startCharOffsetInPart, endPartIndex, endCharOffsetInPart, clientRectDeltaLeft, this._getScaleRatio(), endNode); - } - - protected _getScaleRatio(): number { - return 1; + return RangeUtil.readHorizontalRanges(this._getReadingTarget(), startPartIndex, startCharOffsetInPart, endPartIndex, endCharOffsetInPart, clientRectDeltaLeft, endNode); } /** @@ -364,12 +360,6 @@ class RenderedViewLine { } } -class IERenderedViewLine extends RenderedViewLine { - protected _getScaleRatio(): number { - return screen.logicalXDPI / screen.deviceXDPI; - } -} - class WebKitRenderedViewLine extends RenderedViewLine { protected _readVisibleRangesForRange(startColumn: number, endColumn: number, clientRectDeltaLeft: number, endNode: HTMLElement): HorizontalRange[] { let output = super._readVisibleRangesForRange(startColumn, endColumn, clientRectDeltaLeft, endNode); @@ -407,20 +397,12 @@ function findIndexInArrayWithMax(lineParts: LineParts, desiredIndex: number, max } const createRenderedLine: (domNode: FastDomNode, renderLineInput: RenderLineInput, modelContainsRTL: boolean, renderLineOutput: RenderLineOutput) => RenderedViewLine = (function () { - if (window.screen && window.screen.deviceXDPI && (navigator.userAgent.indexOf('Trident/6.0') >= 0 || navigator.userAgent.indexOf('Trident/5.0') >= 0)) { - // IE11 doesn't need the screen.logicalXDPI / screen.deviceXDPI ratio multiplication - // for TextRange.getClientRects() anymore - return createIERenderedLine; - } else if (browser.isWebKit) { + if (browser.isWebKit) { return createWebKitRenderedLine; } return createNormalRenderedLine; })(); -function createIERenderedLine(domNode: FastDomNode, renderLineInput: RenderLineInput, modelContainsRTL: boolean, renderLineOutput: RenderLineOutput): RenderedViewLine { - return new IERenderedViewLine(domNode, renderLineInput, modelContainsRTL, renderLineOutput); -} - function createWebKitRenderedLine(domNode: FastDomNode, renderLineInput: RenderLineInput, modelContainsRTL: boolean, renderLineOutput: RenderLineOutput): RenderedViewLine { return new WebKitRenderedViewLine(domNode, renderLineInput, modelContainsRTL, renderLineOutput); } diff --git a/src/vs/editor/browser/viewParts/overviewRuler/decorationsOverviewRuler.ts b/src/vs/editor/browser/viewParts/overviewRuler/decorationsOverviewRuler.ts index e901afea346..fe1377560d3 100644 --- a/src/vs/editor/browser/viewParts/overviewRuler/decorationsOverviewRuler.ts +++ b/src/vs/editor/browser/viewParts/overviewRuler/decorationsOverviewRuler.ts @@ -210,7 +210,7 @@ export class DecorationsOverviewRuler extends ViewPart { let hasRendered = this._overviewRuler.render(false); - if (hasRendered && OverviewRulerImpl.hasCanvas && this._overviewRuler.getLanesCount() > 0 && (this._zonesFromDecorations.length > 0 || this._zonesFromCursors.length > 0)) { + if (hasRendered && this._overviewRuler.getLanesCount() > 0 && (this._zonesFromDecorations.length > 0 || this._zonesFromCursors.length > 0)) { let ctx2 = this._overviewRuler.getDomNode().getContext('2d'); ctx2.beginPath(); ctx2.lineWidth = 1; diff --git a/src/vs/editor/browser/viewParts/overviewRuler/overviewRulerImpl.ts b/src/vs/editor/browser/viewParts/overviewRuler/overviewRulerImpl.ts index 9c1fb370e6c..1020e203a99 100644 --- a/src/vs/editor/browser/viewParts/overviewRuler/overviewRulerImpl.ts +++ b/src/vs/editor/browser/viewParts/overviewRuler/overviewRulerImpl.ts @@ -12,8 +12,6 @@ import { OverviewZoneManager } from 'vs/editor/common/view/overviewZoneManager'; export class OverviewRulerImpl { - public static hasCanvas = (window.navigator.userAgent.indexOf('MSIE 8') === -1); - private _canvasLeftOffset: number; private _domNode: HTMLCanvasElement; private _lanesCount: number; @@ -139,9 +137,6 @@ export class OverviewRulerImpl { } public render(forceRender: boolean): boolean { - if (!OverviewRulerImpl.hasCanvas) { - return false; - } if (this._zoneManager.getOuterHeight() === 0) { return false; } diff --git a/src/vs/editor/browser/viewParts/selections/selections.ts b/src/vs/editor/browser/viewParts/selections/selections.ts index f5504d64e75..b26654e88a2 100644 --- a/src/vs/editor/browser/viewParts/selections/selections.ts +++ b/src/vs/editor/browser/viewParts/selections/selections.ts @@ -11,6 +11,7 @@ import { DynamicViewOverlay } from 'vs/editor/browser/view/dynamicViewOverlay'; import { ViewContext } from 'vs/editor/common/view/viewContext'; import { HorizontalRange, LineVisibleRanges, IRenderingContext } from 'vs/editor/common/view/renderingContext'; import { Range } from 'vs/editor/common/core/range'; +import * as browser from 'vs/base/browser/browser'; const enum CornerStyle { EXTERN, @@ -58,10 +59,7 @@ function toStyled(item: LineVisibleRanges): LineVisibleRangesWithStyle { // TODO@Alex: Remove this once IE11 fixes Bug #524217 // The problem in IE11 is that it does some sort of auto-zooming to accomodate for displays with different pixel density. // Unfortunately, this auto-zooming is buggy around dealing with rounded borders -const isIEWithZoomingIssuesNearRoundedBorders = ( - (navigator.userAgent.indexOf('Trident/7.0') >= 0) - || (navigator.userAgent.indexOf('Edge/') >= 0) -); +const isIEWithZoomingIssuesNearRoundedBorders = browser.isEdgeOrIE; export class SelectionsOverlay extends DynamicViewOverlay { diff --git a/src/vs/editor/browser/viewParts/viewCursors/viewCursors.ts b/src/vs/editor/browser/viewParts/viewCursors/viewCursors.ts index ca503c7b620..f1c7688436b 100644 --- a/src/vs/editor/browser/viewParts/viewCursors/viewCursors.ts +++ b/src/vs/editor/browser/viewParts/viewCursors/viewCursors.ts @@ -14,10 +14,7 @@ import { IViewCursorRenderData, ViewCursor } from 'vs/editor/browser/viewParts/v import { ViewContext } from 'vs/editor/common/view/viewContext'; import { IRenderingContext, IRestrictedRenderingContext } from 'vs/editor/common/view/renderingContext'; import { FastDomNode, createFastDomNode } from 'vs/base/browser/styleMutator'; -import { TimeoutTimer, IntervalTimer } from 'vs/base/common/async'; -import * as browsers from 'vs/base/browser/browser'; - -const ANIMATIONS_SUPPORTED = !browsers.isIE9; +import { TimeoutTimer } from 'vs/base/common/async'; export class ViewCursors extends ViewPart { @@ -32,7 +29,6 @@ export class ViewCursors extends ViewPart { private _domNode: FastDomNode; private _startCursorBlinkAnimation: TimeoutTimer; - private _compatBlink: IntervalTimer; private _blinkingEnabled: boolean; private _editorHasFocus: boolean; @@ -58,7 +54,6 @@ export class ViewCursors extends ViewPart { this._domNode.domNode.appendChild(this._primaryCursor.getDomNode()); this._startCursorBlinkAnimation = new TimeoutTimer(); - this._compatBlink = new IntervalTimer(); this._blinkingEnabled = false; this._editorHasFocus = false; @@ -68,7 +63,6 @@ export class ViewCursors extends ViewPart { public dispose(): void { super.dispose(); this._startCursorBlinkAnimation.dispose(); - this._compatBlink.dispose(); } public getDomNode(): HTMLElement { @@ -204,7 +198,6 @@ export class ViewCursors extends ViewPart { private _updateBlinking(): void { this._startCursorBlinkAnimation.cancel(); - this._compatBlink.cancel(); let blinkingStyle = this._getCursorBlinking(); @@ -222,14 +215,10 @@ export class ViewCursors extends ViewPart { this._updateDomClassName(); if (!isHidden && !isSolid) { - if (ANIMATIONS_SUPPORTED) { - this._startCursorBlinkAnimation.setIfNotSet(() => { - this._blinkingEnabled = true; - this._updateDomClassName(); - }, ViewCursors.BLINK_INTERVAL); - } else { - this._compatBlink.cancelAndSet(() => this._compatBlinkUpdate(), ViewCursors.BLINK_INTERVAL); - } + this._startCursorBlinkAnimation.setIfNotSet(() => { + this._blinkingEnabled = true; + this._updateDomClassName(); + }, ViewCursors.BLINK_INTERVAL); } } // --- end blinking logic @@ -279,14 +268,6 @@ export class ViewCursors extends ViewPart { return result; } - private _compatBlinkUpdate(): void { - if (this._isVisible) { - this._hide(); - } else { - this._show(); - } - } - private _show(): void { this._primaryCursor.show(); for (let i = 0, len = this._secondaryCursors.length; i < len; i++) { diff --git a/src/vs/editor/contrib/goToDeclaration/browser/goToDeclaration.ts b/src/vs/editor/contrib/goToDeclaration/browser/goToDeclaration.ts index 7fbd1dbe432..979421d8f9d 100644 --- a/src/vs/editor/contrib/goToDeclaration/browser/goToDeclaration.ts +++ b/src/vs/editor/contrib/goToDeclaration/browser/goToDeclaration.ts @@ -454,7 +454,7 @@ class GotoDefinitionWithMouseEditorContribution implements editorCommon.IEditorC private isEnabled(mouseEvent: IEditorMouseEvent, withKey?: IKeyboardEvent): boolean { return this.editor.getModel() && - (browser.isIE11orEarlier || mouseEvent.event.detail <= 1) && // IE does not support event.detail properly + (browser.isIE || mouseEvent.event.detail <= 1) && // IE does not support event.detail properly mouseEvent.target.type === editorCommon.MouseTargetType.CONTENT_TEXT && (mouseEvent.event[GotoDefinitionWithMouseEditorContribution.TRIGGER_MODIFIER] || (withKey && withKey.keyCode === GotoDefinitionWithMouseEditorContribution.TRIGGER_KEY_VALUE)) && DefinitionProviderRegistry.has(this.editor.getModel()); diff --git a/src/vs/editor/contrib/quickOpen/browser/quickCommand.ts b/src/vs/editor/contrib/quickOpen/browser/quickCommand.ts index 5b3c32dd8cd..d93c23fa24f 100644 --- a/src/vs/editor/contrib/quickOpen/browser/quickCommand.ts +++ b/src/vs/editor/contrib/quickOpen/browser/quickCommand.ts @@ -78,7 +78,7 @@ export class QuickCommandAction extends BaseEditorQuickOpenAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.Focus, - primary: (browser.isIE11orEarlier ? KeyMod.Alt | KeyCode.F1 : KeyCode.F1) + primary: (browser.isIE ? KeyMod.Alt | KeyCode.F1 : KeyCode.F1) }, menuOpts: { } diff --git a/src/vs/loader.js b/src/vs/loader.js index 1ce1f631a34..542c1314ede 100644 --- a/src/vs/loader.js +++ b/src/vs/loader.js @@ -120,9 +120,9 @@ var AMDLoader; Utilities.isAnonymousModule = function (id) { return id.indexOf('===anonymous') === 0; }; - Utilities.NEXT_ANONYMOUS_ID = 1; return Utilities; - } ()); + }()); + Utilities.NEXT_ANONYMOUS_ID = 1; AMDLoader.Utilities = Utilities; var ConfigurationOptionsUtil = (function () { function ConfigurationOptionsUtil() { @@ -248,7 +248,7 @@ var AMDLoader; return ConfigurationOptionsUtil.validateConfigurationOptions(result); }; return ConfigurationOptionsUtil; - } ()); + }()); AMDLoader.ConfigurationOptionsUtil = ConfigurationOptionsUtil; var Configuration = (function () { function Configuration(options) { @@ -336,7 +336,7 @@ var AMDLoader; callback: function () { var depsValues = []; for (var _i = 0; _i < arguments.length; _i++) { - depsValues[_i - 0] = arguments[_i]; + depsValues[_i] = arguments[_i]; } if (typeof shimMD.init === 'function') { var initReturnValue = shimMD.init.apply(global, depsValues); @@ -542,7 +542,7 @@ var AMDLoader; this.options.onError(err); }; return Configuration; - } ()); + }()); AMDLoader.Configuration = Configuration; // ------------------------------------------------------------------------ // ModuleIdResolver @@ -622,7 +622,7 @@ var AMDLoader; this._config.onError(err); }; return ModuleIdResolver; - } ()); + }()); AMDLoader.ModuleIdResolver = ModuleIdResolver; // ------------------------------------------------------------------------ // Module @@ -852,10 +852,11 @@ var AMDLoader; return this._unresolvedDependenciesCount === 0; }; return Module; - } ()); + }()); AMDLoader.Module = Module; // ------------------------------------------------------------------------ // LoaderEvent + var LoaderEventType; (function (LoaderEventType) { LoaderEventType[LoaderEventType["LoaderAvailable"] = 1] = "LoaderAvailable"; LoaderEventType[LoaderEventType["BeginLoadingScript"] = 10] = "BeginLoadingScript"; @@ -867,8 +868,7 @@ var AMDLoader; LoaderEventType[LoaderEventType["NodeEndEvaluatingScript"] = 32] = "NodeEndEvaluatingScript"; LoaderEventType[LoaderEventType["NodeBeginNativeRequire"] = 33] = "NodeBeginNativeRequire"; LoaderEventType[LoaderEventType["NodeEndNativeRequire"] = 34] = "NodeEndNativeRequire"; - })(AMDLoader.LoaderEventType || (AMDLoader.LoaderEventType = {})); - var LoaderEventType = AMDLoader.LoaderEventType; + })(LoaderEventType = AMDLoader.LoaderEventType || (AMDLoader.LoaderEventType = {})); function getHighPerformanceTimestamp() { return (hasPerformanceNow ? global.performance.now() : Date.now()); } @@ -879,7 +879,7 @@ var AMDLoader; this.timestamp = timestamp; } return LoaderEvent; - } ()); + }()); AMDLoader.LoaderEvent = LoaderEvent; var LoaderEventRecorder = (function () { function LoaderEventRecorder(loaderAvailableTimestamp) { @@ -892,7 +892,7 @@ var AMDLoader; return this._events; }; return LoaderEventRecorder; - } ()); + }()); AMDLoader.LoaderEventRecorder = LoaderEventRecorder; var NullLoaderEventRecorder = (function () { function NullLoaderEventRecorder() { @@ -903,9 +903,9 @@ var AMDLoader; NullLoaderEventRecorder.prototype.getEvents = function () { return []; }; - NullLoaderEventRecorder.INSTANCE = new NullLoaderEventRecorder(); return NullLoaderEventRecorder; - } ()); + }()); + NullLoaderEventRecorder.INSTANCE = new NullLoaderEventRecorder(); AMDLoader.NullLoaderEventRecorder = NullLoaderEventRecorder; var ModuleManager = (function () { function ModuleManager(scriptLoader) { @@ -1009,7 +1009,7 @@ var AMDLoader; ModuleManager.prototype.enqueueDefineAnonymousModule = function (dependencies, callback) { var stack = null; if (this._config.isBuild()) { - stack = (new Error('StackLocation')).stack; + stack = new Error('StackLocation').stack; } this._queuedDefineCalls.push({ id: null, @@ -1540,7 +1540,7 @@ var AMDLoader; } }; return ModuleManager; - } ()); + }()); AMDLoader.ModuleManager = ModuleManager; /** * Load `scriptSrc` only once (avoid multiple