New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix contents.setSize(options) documentation in web-contents.md #12922

Merged
merged 1 commit into from May 15, 2018

Conversation

Projects
None yet
4 participants
@miniak
Contributor

miniak commented May 14, 2018

Diff for electron.d.ts after the fix:

   interface SizeOptions {
     /**
+     * true to make the webview container automatically resize within the bounds
+     * specified by the attributes normal, min and max.
+     */
+    enableAutoSize?: boolean;
+    /**
      * Normal size of the page. This can be used in combination with the attribute to
      * manually resize the webview guest contents.
      */
-    normal?: Normal;
+    normal?: Size;
+    /**
+     * Minimum size of the page. This can be used in combination with the attribute to
+     * manually resize the webview guest contents.
+     */
+    min?: Size;
+    /**
+     * Maximium size of the page. This can be used in combination with the attribute to
+     * manually resize the webview guest contents.
+     */
+    max?: Size;
   }

...

-  interface Normal {
-    width: number;
-    height: number;
-  }

This is how the options are parsed:

template<>
struct Converter<atom::SetSizeParams> {
  static bool FromV8(v8::Isolate* isolate,
                     v8::Local<v8::Value> val,
                     atom::SetSizeParams* out) {
    mate::Dictionary params;
    if (!ConvertFromV8(isolate, val, &params))
      return false;
    bool autosize;
    if (params.Get("enableAutoSize", &autosize))
      out->enable_auto_size.reset(new bool(true));
    gfx::Size size;
    if (params.Get("min", &size))
      out->min_size.reset(new gfx::Size(size));
    if (params.Get("max", &size))
      out->max_size.reset(new gfx::Size(size));
    if (params.Get("normal", &size))
      out->normal_size.reset(new gfx::Size(size));
    return true;
  }
};

@miniak miniak requested a review from electron/docs as a code owner May 14, 2018

@miniak miniak requested review from ckerr and codebytere May 14, 2018

@juturu

juturu approved these changes May 14, 2018

@MarshallOfSound MarshallOfSound merged commit 56cdf94 into master May 15, 2018

10 checks passed

WIP ready for review
Details
ci/circleci: electron-linux-arm Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-arm-test Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-arm64 Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-arm64-test Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-ia32 Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-x64 Your tests passed on CircleCI!
Details
ci/circleci: electron-mas-x64 Your tests passed on CircleCI!
Details
ci/circleci: electron-osx-x64 Your tests passed on CircleCI!
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details

@MarshallOfSound MarshallOfSound deleted the fix-web-contents-doc branch May 15, 2018

@trop

This comment has been minimized.

Contributor

trop bot commented May 15, 2018

An error occurred while attempting to backport this PR to "1-8-x", you will need to perform this backport manually

@trop

This comment has been minimized.

Contributor

trop bot commented May 15, 2018

We have automatically backported this PR to "2-0-x", please check out #12926

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment