Make autoresize follow Chrome's behavior
This commit is contained in:
parent
69bcc8e831
commit
04f1860bf5
3 changed files with 12 additions and 2 deletions
|
@ -56,6 +56,10 @@ createGuest = (embedder, params) ->
|
|||
guest.on event, (_, args...) ->
|
||||
embedder.send "ATOM_SHELL_GUEST_VIEW_INTERNAL_DISPATCH_EVENT-#{guest.viewInstanceId}", event, args...
|
||||
|
||||
# Autosize.
|
||||
guest.on 'size-changed', (_, args...) ->
|
||||
embedder.send "ATOM_SHELL_GUEST_VIEW_INTERNAL_SIZE_CHANGED", args...
|
||||
|
||||
id
|
||||
|
||||
# Destroy an existing guest instance.
|
||||
|
|
|
@ -20,13 +20,19 @@ dispatchEvent = (webView, event, args...) ->
|
|||
domEvent = new Event(event)
|
||||
for f, i in WEB_VIEW_EVENTS[event]
|
||||
domEvent[f] = args[i]
|
||||
webView.webviewNode.dispatchEvent domEvent
|
||||
webView.dispatchEvent domEvent
|
||||
|
||||
module.exports =
|
||||
registerEvents: (webView, viewInstanceId) ->
|
||||
ipc.on "ATOM_SHELL_GUEST_VIEW_INTERNAL_DISPATCH_EVENT-#{viewInstanceId}", (event, args...) ->
|
||||
dispatchEvent webView, event, args...
|
||||
|
||||
ipc.on 'ATOM_SHELL_GUEST_VIEW_INTERNAL_SIZE_CHANGED', (args...) ->
|
||||
domEvent = new Event('size-changed')
|
||||
for f, i in ['oldWidth', 'oldHeight', 'newWidth', 'newHeight']
|
||||
domEvent[f] = args[i]
|
||||
webView.onSizeChanged domEvent
|
||||
|
||||
createGuest: (type, params, callback) ->
|
||||
requestId++
|
||||
ipc.send 'ATOM_SHELL_GUEST_VIEW_MANAGER_CREATE_GUEST', type, params, requestId
|
||||
|
|
|
@ -382,7 +382,7 @@ class WebView
|
|||
@attachWindow guestInstanceId, false
|
||||
@pendingGuestCreation = true
|
||||
|
||||
@dispatchEvent = (webViewEvent) ->
|
||||
dispatchEvent: (webViewEvent) ->
|
||||
@webviewNode.dispatchEvent webViewEvent
|
||||
|
||||
# Adds an 'on<event>' property on the webview, which can be used to set/unset
|
||||
|
|
Loading…
Reference in a new issue