Add new method to set layout-based zoom level limit

This commit is contained in:
Paul Betts 2016-11-21 14:59:27 -05:00
parent 71f94c7a3a
commit e2649ce7d8
4 changed files with 8 additions and 0 deletions

View file

@ -92,6 +92,10 @@ void WebFrame::SetZoomLevelLimits(double min_level, double max_level) {
web_frame_->view()->setDefaultPageScaleLimits(min_level, max_level); web_frame_->view()->setDefaultPageScaleLimits(min_level, max_level);
} }
void WebFrame::SetLayoutZoomLevelLimits(double min_level, double max_level) {
web_frame_->view()->zoomLimitsChanged(min_level, max_level);
}
v8::Local<v8::Value> WebFrame::RegisterEmbedderCustomElement( v8::Local<v8::Value> WebFrame::RegisterEmbedderCustomElement(
const base::string16& name, v8::Local<v8::Object> options) { const base::string16& name, v8::Local<v8::Object> options) {
blink::WebExceptionCode c = 0; blink::WebExceptionCode c = 0;
@ -228,6 +232,7 @@ void WebFrame::BuildPrototype(
.SetMethod("setZoomFactor", &WebFrame::SetZoomFactor) .SetMethod("setZoomFactor", &WebFrame::SetZoomFactor)
.SetMethod("getZoomFactor", &WebFrame::GetZoomFactor) .SetMethod("getZoomFactor", &WebFrame::GetZoomFactor)
.SetMethod("setZoomLevelLimits", &WebFrame::SetZoomLevelLimits) .SetMethod("setZoomLevelLimits", &WebFrame::SetZoomLevelLimits)
.SetMethod("setLayoutZoomLevelLimits", &WebFrame::SetLayoutZoomLevelLimits)
.SetMethod("registerEmbedderCustomElement", .SetMethod("registerEmbedderCustomElement",
&WebFrame::RegisterEmbedderCustomElement) &WebFrame::RegisterEmbedderCustomElement)
.SetMethod("registerElementResizeCallback", .SetMethod("registerElementResizeCallback",

View file

@ -46,6 +46,7 @@ class WebFrame : public mate::Wrappable<WebFrame> {
double GetZoomFactor() const; double GetZoomFactor() const;
void SetZoomLevelLimits(double min_level, double max_level); void SetZoomLevelLimits(double min_level, double max_level);
void SetLayoutZoomLevelLimits(double min_level, double max_level);
v8::Local<v8::Value> RegisterEmbedderCustomElement( v8::Local<v8::Value> RegisterEmbedderCustomElement(
const base::string16& name, v8::Local<v8::Object> options); const base::string16& name, v8::Local<v8::Object> options);

View file

@ -100,6 +100,7 @@ WebContents.prototype.sendToAll = function (channel, ...args) {
// Following methods are mapped to webFrame. // Following methods are mapped to webFrame.
const webFrameMethods = [ const webFrameMethods = [
'insertText', 'insertText',
'setLayoutZoomLevelLimits',
'setZoomFactor', 'setZoomFactor',
'setZoomLevel', 'setZoomLevel',
'setZoomLevelLimits' 'setZoomLevelLimits'

View file

@ -390,6 +390,7 @@ var registerWebViewElement = function () {
'insertText', 'insertText',
'send', 'send',
'sendInputEvent', 'sendInputEvent',
'setLayoutZoomLevelLimits',
'setZoomFactor', 'setZoomFactor',
'setZoomLevel', 'setZoomLevel',
'setZoomLevelLimits' 'setZoomLevelLimits'