Skip to content

Commit

Permalink
fixes #66972
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomoreno committed Jan 23, 2019
1 parent 07b3b9e commit 845d977
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/vs/base/browser/ui/list/listView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,6 @@ import { equals, distinct } from 'vs/base/common/arrays';
import { DataTransfers, StaticDND, IDragAndDropData } from 'vs/base/browser/dnd';
import { disposableTimeout } from 'vs/base/common/async';

function canUseTranslate3d(): boolean {
if (browser.isFirefox) {
return false;
}

if (browser.getZoomLevel() !== 0) {
return false;
}

return true;
}

interface IItem<T> {
readonly id: string;
readonly element: T;
Expand Down Expand Up @@ -172,6 +160,7 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
private dragOverMouseY: number;
private setRowLineHeight: boolean;
private supportDynamicHeights: boolean;
private canUseTranslate3d: boolean | undefined = undefined;

private dnd: IListViewDragAndDrop<T>;
private canDrop: boolean = false;
Expand Down Expand Up @@ -434,14 +423,26 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
}
}

if (canUseTranslate3d() && !isWindows /* Windows: translate3d breaks subpixel-antialias (ClearType) unless a background is defined */) {
const canUseTranslate3d = !isWindows && !browser.isFirefox && browser.getZoomLevel() === 0;

if (canUseTranslate3d) {
const transform = `translate3d(0px, -${renderTop}px, 0px)`;
this.rowsContainer.style.transform = transform;
this.rowsContainer.style.webkitTransform = transform;

if (canUseTranslate3d !== this.canUseTranslate3d) {
this.rowsContainer.style.top = '0';
}
} else {
this.rowsContainer.style.top = `-${renderTop}px`;

if (canUseTranslate3d !== this.canUseTranslate3d) {
this.rowsContainer.style.transform = '';
this.rowsContainer.style.webkitTransform = '';
}
}

this.canUseTranslate3d = canUseTranslate3d;
this.lastRenderTop = renderTop;
this.lastRenderHeight = renderHeight;
}
Expand Down

0 comments on commit 845d977

Please sign in to comment.