提交 50751af4 编写于 作者: R rebornix

Remove initial dimension update

上级 c78a8696
......@@ -1579,13 +1579,8 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
this._modelData = null;
this._domElement.removeAttribute('data-mode-id');
if (removeDomNode) {
try {
// @todo Peng
this._domElement.removeChild(removeDomNode);
} catch {
}
if (removeDomNode && this._domElement.contains(removeDomNode)) {
this._domElement.removeChild(removeDomNode);
}
return model;
......
......@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { addClass, Dimension } from 'vs/base/browser/dom';
import { addClass } from 'vs/base/browser/dom';
import { Emitter } from 'vs/base/common/event';
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
......@@ -28,7 +28,6 @@ export const enum WebviewMessageChannels {
loadResource = 'load-resource',
loadLocalhost = 'load-localhost',
webviewReady = 'webview-ready',
didSetInitialDimension = 'did-set-initial-dimension',
containsScripts = 'content-contains-scripts',
wheel = 'did-scroll-wheel',
ack = 'speed-test-ack'
......@@ -126,10 +125,6 @@ export abstract class BaseWebview<T extends HTMLElement> extends Disposable {
this.handleFocusChange(true);
}));
this._register(this.on(WebviewMessageChannels.didSetInitialDimension, (dimension: Dimension) => {
this.handleInitialDimension(dimension);
}));
this._register(this.on(WebviewMessageChannels.containsScripts, (containsScript: boolean) => {
this.containsScript = containsScript;
}));
......@@ -202,9 +197,6 @@ export abstract class BaseWebview<T extends HTMLElement> extends Disposable {
private readonly _onDidFocus = this._register(new Emitter<void>());
public readonly onDidFocus = this._onDidFocus.event;
private readonly _onDidSetInitialDimension = this._register(new Emitter<Dimension>());
public readonly onDidSetInitialDimension = this._onDidSetInitialDimension.event;
public containsScript: boolean = false;
public sendMessage(data: any): void {
......@@ -321,10 +313,6 @@ export abstract class BaseWebview<T extends HTMLElement> extends Disposable {
}
}
protected handleInitialDimension(dimension: Dimension) {
this._onDidSetInitialDimension.fire(dimension);
}
private handleKeyDown(event: IKeydownEvent) {
// Create a fake KeyboardEvent from the data provided
const emulatedKeyboardEvent = new KeyboardEvent('keydown', event);
......
......@@ -16,12 +16,9 @@ import { IMouseWheelEvent } from 'vs/base/browser/mouseEvent';
* Webview editor overlay that creates and destroys the underlying webview as needed.
*/
export class DynamicWebviewEditorOverlay extends Disposable implements WebviewEditorOverlay {
private readonly _onDidWheel= this._register(new Emitter<IMouseWheelEvent>());
private readonly _onDidWheel = this._register(new Emitter<IMouseWheelEvent>());
public readonly onDidWheel = this._onDidWheel.event;
private readonly _onDidSetInitialDimension = this._register(new Emitter<Dimension>());
public readonly onDidSetInitialDimension = this._onDidSetInitialDimension.event;
private readonly _pendingMessages = new Set<any>();
private readonly _webview = this._register(new MutableDisposable<WebviewElement>());
private readonly _webviewEvents = this._register(new DisposableStore());
......
......@@ -506,7 +506,6 @@
newFrame.contentWindow.focus();
}
host.postMessage('did-set-initial-dimension', { width: newFrame.contentWindow.document.body.scrollWidth, height: newFrame.contentWindow.document.body.scrollHeight });
host.postMessage('content-contains-scripts', checkScripts(newFrame.contentWindow.document));
contentWindow.addEventListener('scroll', handleInnerScroll);
......
......@@ -80,7 +80,6 @@ export interface Webview extends IDisposable {
containsScript: boolean;
readonly onDidFocus: Event<void>;
readonly onDidSetInitialDimension: Event<Dimension>;
readonly onDidClickLink: Event<string>;
readonly onDidScroll: Event<{ scrollYPercentage: number }>;
readonly onDidWheel: Event<IMouseWheelEvent>;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册