fix signature of zoom getter apis
This commit is contained in:
parent
5e30ccd891
commit
203a920c64
3 changed files with 32 additions and 10 deletions
|
@ -1672,9 +1672,9 @@ void WebContents::BuildPrototype(v8::Isolate* isolate,
|
||||||
.SetMethod("getFrameRate", &WebContents::GetFrameRate)
|
.SetMethod("getFrameRate", &WebContents::GetFrameRate)
|
||||||
.SetMethod("invalidate", &WebContents::Invalidate)
|
.SetMethod("invalidate", &WebContents::Invalidate)
|
||||||
.SetMethod("setZoomLevel", &WebContents::SetZoomLevel)
|
.SetMethod("setZoomLevel", &WebContents::SetZoomLevel)
|
||||||
.SetMethod("getZoomLevel", &WebContents::GetZoomLevel)
|
.SetMethod("_getZoomLevel", &WebContents::GetZoomLevel)
|
||||||
.SetMethod("setZoomFactor", &WebContents::SetZoomFactor)
|
.SetMethod("setZoomFactor", &WebContents::SetZoomFactor)
|
||||||
.SetMethod("getZoomFactor", &WebContents::GetZoomFactor)
|
.SetMethod("_getZoomFactor", &WebContents::GetZoomFactor)
|
||||||
.SetMethod("getType", &WebContents::GetType)
|
.SetMethod("getType", &WebContents::GetType)
|
||||||
.SetMethod("getWebPreferences", &WebContents::GetWebPreferences)
|
.SetMethod("getWebPreferences", &WebContents::GetWebPreferences)
|
||||||
.SetMethod("getOwnerBrowserWindow", &WebContents::GetOwnerBrowserWindow)
|
.SetMethod("getOwnerBrowserWindow", &WebContents::GetOwnerBrowserWindow)
|
||||||
|
|
|
@ -206,6 +206,26 @@ WebContents.prototype.printToPDF = function (options, callback) {
|
||||||
this._printToPDF(printingSetting, callback)
|
this._printToPDF(printingSetting, callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WebContents.prototype.getZoomLevel = function (callback) {
|
||||||
|
if (typeof callback !== 'function') {
|
||||||
|
throw new Error('Must pass function as an argument')
|
||||||
|
}
|
||||||
|
process.nextTick(() => {
|
||||||
|
const zoomLevel = this._getZoomLevel()
|
||||||
|
callback(zoomLevel)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
WebContents.prototype.getZoomFactor = function (callback) {
|
||||||
|
if (typeof callback !== 'function') {
|
||||||
|
throw new Error('Must pass function as an argument')
|
||||||
|
}
|
||||||
|
process.nextTick(() => {
|
||||||
|
const zoomFactor = this._getZoomFactor()
|
||||||
|
callback(zoomFactor)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// Add JavaScript wrappers for WebContents class.
|
// Add JavaScript wrappers for WebContents class.
|
||||||
WebContents.prototype._init = function () {
|
WebContents.prototype._init = function () {
|
||||||
// The navigation controller.
|
// The navigation controller.
|
||||||
|
|
|
@ -184,7 +184,6 @@ const attachGuest = function (event, elementInstanceId, guestInstanceId, params)
|
||||||
guestInstanceId: guestInstanceId,
|
guestInstanceId: guestInstanceId,
|
||||||
nodeIntegration: params.nodeintegration != null ? params.nodeintegration : false,
|
nodeIntegration: params.nodeintegration != null ? params.nodeintegration : false,
|
||||||
plugins: params.plugins,
|
plugins: params.plugins,
|
||||||
zoomFactor: embedder.getZoomFactor(),
|
|
||||||
webSecurity: !params.disablewebsecurity,
|
webSecurity: !params.disablewebsecurity,
|
||||||
blinkFeatures: params.blinkfeatures,
|
blinkFeatures: params.blinkfeatures,
|
||||||
disableBlinkFeatures: params.disableblinkfeatures
|
disableBlinkFeatures: params.disableblinkfeatures
|
||||||
|
@ -213,6 +212,8 @@ const attachGuest = function (event, elementInstanceId, guestInstanceId, params)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
embedder.getZoomFactor(function (zoomFactor) {
|
||||||
|
webPreferences.zoomFactor = zoomFactor
|
||||||
webViewManager.addGuest(guestInstanceId, elementInstanceId, embedder, guest, webPreferences)
|
webViewManager.addGuest(guestInstanceId, elementInstanceId, embedder, guest, webPreferences)
|
||||||
guest.attachParams = params
|
guest.attachParams = params
|
||||||
embedderElementsMap[key] = guestInstanceId
|
embedderElementsMap[key] = guestInstanceId
|
||||||
|
@ -222,6 +223,7 @@ const attachGuest = function (event, elementInstanceId, guestInstanceId, params)
|
||||||
guestInstance.elementInstanceId = elementInstanceId
|
guestInstance.elementInstanceId = elementInstanceId
|
||||||
|
|
||||||
watchEmbedder(embedder)
|
watchEmbedder(embedder)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destroy an existing guest instance.
|
// Destroy an existing guest instance.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue