Repository: electron/electron
File: shell/browser/native_window_mac.mm (Objective-C++)

Code before:
      if (title_bar_style_ == TitleBarStyle::kCustomButtonsOnHover) {
        [buttons_proxy_ setShowOnHover:YES];
      } else {
        // customButtonsOnHover does not show buttons initially.
        InternalSetWindowButtonVisibility(true);
      }
    }
  }

  // Create a tab only if tabbing identifier is specified and window has
  // a native title bar.
  if (tabbingIdentifier.empty() || transparent() || !has_frame()) {
    [window_ setTabbingMode:NSWindowTabbingModeDisallowed];
  } else {
    [window_ setTabbingIdentifier:base::SysUTF8ToNSString(tabbingIdentifier)];
  }

  // Resize to content bounds.
  bool use_content_size = false;
  int inner_width = 0;
  int inner_height = 0;
  options.Get(options::kUseContentSize, &use_content_size);
  options.Get(options::kinnerWidth, &inner_width);
  options.Get(options::kinnerHeight, &inner_height);
  if (inner_width || inner_height) {
    use_content_size = true;
    if (inner_width)
      width = inner_width;
    if (inner_height)
      height = inner_height;
  }

  if (!has_frame() || use_content_size)
    SetContentSize(gfx::Size(width, height));

  // Enable the NSView to accept first mouse event.
  bool acceptsFirstMouse = false;
  options.Get(options::kAcceptFirstMouse, &acceptsFirstMouse);
  [window_ setAcceptsFirstMouse:acceptsFirstMouse];

  // Disable auto-hiding cursor.
  bool disableAutoHideCursor = false;
  options.Get(options::kDisableAutoHideCursor, &disableAutoHideCursor);
  [window_ setDisableAutoHideCursor:disableAutoHideCursor];

  SetHiddenInMissionControl(hiddenInMissionControl);

  // Set maximizable state last to ensure zoom button does not get reset
  // by calls to other APIs.
  SetMaximizable(maximizable);


Review comment (suggestion):
By spec these should have an enforced minimum of 100

> Specifies the width of the content area, including scrollbars. The minimum required value is 100.

Code after:
      if (title_bar_style_ == TitleBarStyle::kCustomButtonsOnHover) {
        [buttons_proxy_ setShowOnHover:YES];
      } else {
        // customButtonsOnHover does not show buttons initially.
        InternalSetWindowButtonVisibility(true);
      }
    }
  }

  // Create a tab only if tabbing identifier is specified and window has
  // a native title bar.
  if (tabbingIdentifier.empty() || transparent() || !has_frame()) {
    [window_ setTabbingMode:NSWindowTabbingModeDisallowed];
  } else {
    [window_ setTabbingIdentifier:base::SysUTF8ToNSString(tabbingIdentifier)];
  }

  // Resize to content bounds.
  // NOTE(@mlaurencin) Spec requirements can be found here:
  // https://developer.mozilla.org/en-US/docs/Web/API/Window/open#width
  constexpr int kMinSizeReqdBySpec = 100;
  int inner_width = 0;
  int inner_height = 0;
  bool use_content_size =
      options.ValueOrDefault(options::kUseContentSize, false);
  options.Get(options::kinnerWidth, &inner_width);
  options.Get(options::kinnerHeight, &inner_height);
  if (inner_width || inner_height) {
    use_content_size = true;
    if (inner_width)
      width = std::max(kMinSizeReqdBySpec, inner_width);
    if (inner_height)
      height = std::max(kMinSizeReqdBySpec, inner_height);
  }

  if (!has_frame() || use_content_size)
    SetContentSize(gfx::Size(width, height));

  // Enable the NSView to accept first mouse event.
  const bool acceptsFirstMouse =
      options.ValueOrDefault(options::kAcceptFirstMouse, false);
  [window_ setAcceptsFirstMouse:acceptsFirstMouse];

  // Disable auto-hiding cursor.
  const bool disableAutoHideCursor =
      options.ValueOrDefault(options::kDisableAutoHideCursor, false);
  [window_ setDisableAutoHideCursor:disableAutoHideCursor];

  SetHiddenInMissionControl(hiddenInMissionControl);

  // Set maximizable state last to ensure zoom button does not get reset