Move ScreenDprMonitor to be owned by RenderCoordinator

(and a11y manager)
This commit is contained in:
Daniel Imms
2019-05-18 19:12:37 -07:00
parent f698cafccb
commit 3e4c1b5a21
4 changed files with 17 additions and 20 deletions
+7 -5
View File
@@ -9,6 +9,7 @@ import { isMac } from './common/Platform';
import { RenderDebouncer } from './ui/RenderDebouncer';
import { addDisposableDomListener } from './ui/Lifecycle';
import { Disposable } from './common/Lifecycle';
import { ScreenDprMonitor } from './ui/ScreenDprMonitor';
const MAX_ROWS_TO_READ = 20;
@@ -25,6 +26,7 @@ export class AccessibilityManager extends Disposable {
private _liveRegionLineCount: number = 0;
private _renderRowsDebouncer: RenderDebouncer;
private _screenDprMonitor: ScreenDprMonitor;
private _topBoundaryFocusListener: (e: FocusEvent) => void;
private _bottomBoundaryFocusListener: (e: FocusEvent) => void;
@@ -81,12 +83,12 @@ export class AccessibilityManager extends Disposable {
this.register(this._terminal.addDisposableListener('a11y.tab', spaceCount => this._onTab(spaceCount)));
this.register(this._terminal.onKey(e => this._onKey(e.key)));
this.register(this._terminal.addDisposableListener('blur', () => this._clearLiveRegion()));
// TODO: Maybe renderer should fire an event on terminal when the characters change and that
// should be listened to instead? That would mean that the order of events are always
// guarenteed
this.register(this._terminal.addDisposableListener('dprchange', () => this.refreshRowsDimensions()));
this._screenDprMonitor = new ScreenDprMonitor();
this.register(this._screenDprMonitor);
this._screenDprMonitor.setListener(() => this.refreshRowsDimensions());
// This shouldn't be needed on modern browsers but is present in case the
// media query that drives the dprchange event isn't supported
// media query that drives the ScreenDprMonitor isn't supported
this.register(addDisposableDomListener(window, 'resize', () => this.refreshRowsDimensions()));
}