From: DongHyun Song Date: Wed, 6 Oct 2021 04:39:33 +0000 (+0900) Subject: [VD] Set focus of last web contents X-Git-Tag: submit/tizen/20211007.160021~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=775504e6cb956d7304f7c38df42f6254f61c80b0;p=platform%2Fframework%2Fweb%2Fwrtjs.git [VD] Set focus of last web contents After closed another WRTWindow, the last web contents has no focus until any registered key is handled. This patch will give focus on the last web contents when WRTWindow closed. Related patch: https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/264955/ Change-Id: I43475272f757a05be05aa51ca7ff5dbac659bf6b Signed-off-by: DongHyun Song --- diff --git a/wrt_app/common/web_application_delegate.ts b/wrt_app/common/web_application_delegate.ts index 8d80b786..648ccb4a 100644 --- a/wrt_app/common/web_application_delegate.ts +++ b/wrt_app/common/web_application_delegate.ts @@ -29,6 +29,7 @@ export class WebApplicationDelegate { canIgnoreSuspend() { return false; } clearCache() { } clearSuface(webContents: any) { } + focus(webContents: any) { } handleAppControlEvent(appControl: any) { return true; } handleProxyInfo(authInfo: any, callback: any) { return false; } initialize(options: RuntimeOption) { } diff --git a/wrt_app/src/tv/web_application_tv.ts b/wrt_app/src/tv/web_application_tv.ts index 683515fd..8a297330 100644 --- a/wrt_app/src/tv/web_application_tv.ts +++ b/wrt_app/src/tv/web_application_tv.ts @@ -264,4 +264,8 @@ Then you can get profile log from the initial loading.`; profileName() { return 'TV'; } + + focus(webContents: any) { + this.tv.focus(webContents); + } } diff --git a/wrt_app/src/web_application.ts b/wrt_app/src/web_application.ts index b68bf17d..1ba13d71 100755 --- a/wrt_app/src/web_application.ts +++ b/wrt_app/src/web_application.ts @@ -69,8 +69,11 @@ export class WebApplication { console.log(`window closed : #${this.windowList.length}`); let index = this.windowList.indexOf(window); this.windowList.splice(index, 1); - if (!this.inQuit && index === this.windowList.length && this.windowList.length > 0) - this.windowList[this.windowList.length - 1].show(); + if (!this.inQuit && index === this.windowList.length && this.windowList.length > 0) { + let lastWindow = this.windowList[this.windowList.length - 1]; + lastWindow.show(); + this.profileDelegate.focus(lastWindow.webContents); + } }); });