feat: enable innerWidth and innerHeight for window open (#46749)
* feat: enable innerWidth and innerHeight for window open
* update comment for added special innerWidth and innerHeight
* update 100 min spec requirement handling
* update testing to include getContentSize
* update macOS min requirement handling
* adjust refactored consts
* update const values from nativewindowviews
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Michaela Laurencin <35157522+mlaurencin@users.noreply.github.com>
We probably didn't use this before because IsAltModifier() was written
two years before the KeyModifiers mask was added upstream in 98ec378a.
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Fixes https://github.com/electron/electron/issues/45990
We previously made a change in https://github.com/electron/electron/pull/45868
to fix content protection being lost on hide and re-show. However, this
cause a breaking change where protected windows were made opaque black
instead of being hidden as before. This overrides relevant methods in
ElectronDesktopWindowTreeHostWin to restore the previous behavior.
without regressing the original issue.
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
refactor: use `gin_helper::Dictionary::ValueOrDefault()` (#46982)
* refactor: use ValueOrDefault() in electron_api_web_contents.cc
* refactor: use ValueOrDefault() in electron_api_url_loader.cc
* refactor: use ValueOrDefault() in electron_download_manager_delegate.cc
* refactor: use ValueOrDefault() in electron_touch_bar.mm
* refactor: use ValueOrDefault() in electron_url_loader_factory.cc
* refactor: use ValueOrDefault() in electron_browser_context.cc
* refactor: use ValueOrDefault() in electron_touch_bar.mm
* refactor: use ValueOrDefault() in blink_converter.cc
* feat: add ValueOrDefault() to PersistentDictionary
* empty commit
* refactor: use ValueOrDefault() in blink_converter.cc
* refactor: inline the rectangle base::Value::Dict
* refactor: remove has_scroll temporary
---------
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: do not use native_widget_private() in NativeWindowViews::SetContentProtection()
refactor: do not use native_widget_private() in NativeWindowViews::IsContentProtected()
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: do not use native_widget_private() in NativeWindowViews::Show()
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* chore: remove native_widget_private #include from native_window_views_win
Not needed since Feb 2025: 9199d5c6
Co-authored-by: Charles Kerr <charles@charleskerr.com>
---------
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
build: move to new hasher function
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
refactor: enable hasShadow tests on Linux
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* feat: add gin_helper::Dictionary::ValueOrDefault()
A convenience function for using a default value if the
specified key isn't present in the dictionary.
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ValueOrDefault() in native_window.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ValueOrDefault() in native_window_mac.mm
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ValueOrDefault() in native_window_views.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ValueOrDefault() in electron_api_native_image.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
---------
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
refactor: pass gfx::ResizeEdge by value
It is an enum class, so no reason to pass by reference
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
refactor: remove some `NativeWindow` public API (#46919)
* refactor: make NativeWindow::titlebar_overlay_height_ private
* refactor: make NativeWindow::set_has_frame() protected
* refactor: remove NativeWindow::background_material()
It's only used once, in NativeWindow, so use |background_material_| directly.
* refactor: remove NativeWindow::vibrancy()
It's only used once, in a NativeWindow method, so use |vibrancy_| directly.
* refactor: unfriend api::BrowserView
It was added in Oct 2022 by 23d4a25 for access to protected NativeWindow
methods add_inspectable_view() and remove_inspectable_view().
That dependency was removed in Nov 2022 by 184ac2b, so BrowserView
doesn't need access to NativeWindow's private fields & methods anymore.
* refactor: make NativeWindow::ContentBoundsToWindowBounds() protected
refactor: make NativeWindow::WindowBoundsToContentBounds() protected
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
refactor: add `NativeWindow::FromWidget()` helper (#46917)
refactor: add NativeWindow::FromWidet() helper
refactor: make kElectronNativeWindowKey a protected field
* refactor: use ObserverList::Notify() in shell/browser/window_list.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ObserverList::Notify() in shell/browser/web_contents_zoom_controller.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ObserverList::Notify() in shell/browser/usb/usb_chooser_context.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ObserverList::Notify() in shell/browser/usb/electron_usb_delegate.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ObserverList::Notify() in shell/browser/ui/views/menu_delegate.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ObserverList::Notify() in shell/browser/ui/tray_icon.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ObserverList::Notify() in shell/browser/ui/electron_menu_model.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ObserverList::Notify() in shell/browser/serial/serial_chooser_context.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ObserverList::Notify() in shell/browser/native_window.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ObserverList::Notify() in shell/browser/serial/electron_serial_delegate.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ObserverList::Notify() in shell/browser/browser.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ObserverList::Notify() in shell/browser/api/electron_api_web_contents.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ObserverList::Notify() in shell/browser/hid/electron_hid_delegate.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ObserverList::Notify() in shell/browser/hid/hid_chooser_context.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
---------
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* feat: add support for `--js-flags=--perf-prof` on macOS
allows for profiling of macOS electron apps using samply[1],
which can capture cpu usage for an entire process tree, including
both c/c++ frames and interpreted + jit-compiled JS stack frames
[1] https://github.com/mstange/samply
* chore: update patches
---------
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
* refactor: add EmitDeprecationWarning helper
Also switches EmitWarning to using Node's ProcessEmitWarningGeneric
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
* chore: use node namespace for function call
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
---------
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
* fix: tests that were not run in api-app-spec due to nested it()
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* fix: tests that were not run in api-browser-window-spec due to nested it()
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* chore: annotate disabled test
Co-authored-by: Charles Kerr <charles@charleskerr.com>
---------
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* test: do not skip visibleOnAllWorkspaces tests on Windows
That feature is supported on Linux, so move the test from the
"window states (excluding Linux)" section into the
"window states" section.
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* chore: disable visibleOnAllWorkspaces test on Linux
* fix: NativeWindowViews::IsVisibleOnAllWorkspaces
* test: enable visibleOnAllWorkspaces tests on Linux
---------
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
* test: add platform test on visibleOnAllWorkspaces tests
visibleOnAllWorkspaces is not supported on Windows
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* test: do not skip visibleOnAllWorkspaces tests on Windows
That feature is supported on Linux, so move the test from the
"window states (excluding Linux)" section into the
"window states" section.
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* fix: nested it() calls in visibleOnAllWorkspaces specs
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* chore: make the process.platform test simpler
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* chore: disable visibleOnAllWorkspaces test on Linux
---------
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* fix: enable autoHideMenuBar tests
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* docs: mark autoHideMenuBar as supported on Linux, Windows
Co-authored-by: Charles Kerr <charles@charleskerr.com>
---------
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
perf: use a stack-allocated string_view array in ToV8(USBProtectedClasses)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>