GTK >= 3.90.0 removed support for menuitem icons. When Electron is
built with GTK >= 3.90.0, our code builds these icons and then throws
them away unused. Instead, let's just not build them.
Our gtk_util::GdkPixbufFromSkBitmap utility uses BGRAToRGBA and is
expensive to call.
The GlobalMenuBar used to hold a raw_ptr reference to its NativeWindow;
but since it doesn't use it & only wants the gfx::AcceleratedWidget info,
let's remove the NativeWindowViews reference.
AFAICT, GlobalMenuBarX11::window_ has never been used
* refactor: make TrackableObject::weak_map_id() constexpr
refactor: make BaseWindow::GetID() inline and constexpr
* refactor: make NativeWindow::window_id() constexpr too
* refactor: use x11_util::IsX11() in BuildSubmenuFromModel()
* refactor: use x11_util::IsX11() in ElectronDesktopWindowTreeHostLinux::OnBoundsChanged()
* refactor: use skia_can_fall_back_to_x11 in x11_util::IsX11()
it is identical in practice to electron_can_call_x11 and does not require a Chromium patch
* chore: remove introduce_ozoneplatform_electron_can_call_x11_property.patch
* refactor: use ui::GetOzonePlatformId() to test for x11
* 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
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.
* 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: Deepak Mohan <hop2deep@gmail.com>
* refactor: do not use native_widget_private() in NativeWindowViews::SetContentProtection()
refactor: do not use native_widget_private() in NativeWindowViews::IsContentProtected()
* refactor: do not use native_widget_private() in NativeWindowViews::Show()
* chore: remove native_widget_private #include from native_window_views_win
Not needed since Feb 2025: 9199d5c6
* Remove microtasks_scope.h and microtasks_scope.cc
* Use v8::MicrotasksScope when ignoring browser checkpoint
These call always skip the browser checkpoint, so they are equivalent to using v8::MicrotasksScope directly (modulo the optional wrapper behavior).
* Remove MicrotasksScope from node_bindings.cc
This code seems contradictory: it explicitly specifies "do not run microtasks" yet runs a microtask checkpoint in the browser process.
Looking at its history, it [was introduced][1] with the intention to not run microtasks, but a [subtle C++ language behavior][2] caused it to do the opposite later in the same roll. Since the original intention was to not run microtasks, and since that is also the simplest explanation, we can assume `ignore_browser_checkpoint` should be true and migrate this to `v8::MicrotasksScope` as it is equivalent (modulo the optional wrapper behavior).
[1]: a4ea80dd47 (diff-efe58cf03c97028f37f801db044d396a5f428686da6595d2c692f1c052bbd09c)
[2]: https://github.com/electron/electron/pull/43185
* Migrate gin_helper/promise.h and gin_helper/promise.cc to v8::MicrotasksScope
Restores the [original][1] behavior of running the microtask checkpoint at destruction, but preserves the behavior of running microtasks in the browser process. This had last changed in the migration to gin_helper::MicroTasks.
[1]: https://github.com/electron/electron/pull/16401
* feat: add gin_helper::Dictionary::ValueOrDefault()
A convenience function for using a default value if the
specified key isn't present in the dictionary.
* refactor: use ValueOrDefault() in native_window.cc
* refactor: use ValueOrDefault() in native_window_mac.mm
* refactor: use ValueOrDefault() in native_window_views.cc
* refactor: use ValueOrDefault() in electron_api_native_image.cc
* 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
* chore: use dbus thread for portal version detection
* Update shell/browser/ui/file_dialog_linux_portal.cc
Co-authored-by: Robo <hop2deep@gmail.com>
---------
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* fix: prevent log files being written to current directory on Windows
* Update shell/common/logging.cc
Co-authored-by: Robo <hop2deep@gmail.com>
* chore: add test
* chore: update includes
Refs 6418805
* chore: address review feedback
---------
Co-authored-by: Robo <hop2deep@gmail.com>
* refactor: use ObserverList::Notify() in shell/browser/window_list.cc
* refactor: use ObserverList::Notify() in shell/browser/web_contents_zoom_controller.cc
* refactor: use ObserverList::Notify() in shell/browser/usb/usb_chooser_context.cc
* refactor: use ObserverList::Notify() in shell/browser/usb/electron_usb_delegate.cc
* refactor: use ObserverList::Notify() in shell/browser/ui/views/menu_delegate.cc
* refactor: use ObserverList::Notify() in shell/browser/ui/tray_icon.cc
* refactor: use ObserverList::Notify() in shell/browser/ui/electron_menu_model.cc
* refactor: use ObserverList::Notify() in shell/browser/serial/serial_chooser_context.cc
* refactor: use ObserverList::Notify() in shell/browser/native_window.cc
* refactor: use ObserverList::Notify() in shell/browser/serial/electron_serial_delegate.cc
* refactor: use ObserverList::Notify() in shell/browser/browser.cc
* refactor: use ObserverList::Notify() in shell/browser/api/electron_api_web_contents.cc
* refactor: use ObserverList::Notify() in shell/browser/hid/electron_hid_delegate.cc
* refactor: use ObserverList::Notify() in shell/browser/hid/hid_chooser_context.cc
* refactor: don't call RegisterDeleteDelegateCallback()
move NativeWindowViews' on-widget-delegate-destroyed callback logic to
the NativeWindowViews destructor.
Since NativeWindowViews subclasses from WidgetDelegate and |this| *is*
the delegate being destroyed, we can handle this more cleanly in
~NativeWindowViews() instead of in a separate callback.
* chore: remove NativeWindowViews from the grandfathered-classes-that-can-call-deprecated-views-behavior patch
* refactor: don't call RegisterDeleteDelegateCallback()
RegisterDeleteDelegateCallback() is private upstream API, so we
shouldn't be using it.
Move the on-widget-delegate-destroyed callback logic over to our methods
NativeWindowViews::OnWidgetDestroying() and
NativeWindowViews::OnWidgetDestroyed().
* refactor: add EmitDeprecationWarning helper
Also switches EmitWarning to using Node's ProcessEmitWarningGeneric
* chore: use node namespace for function call
* refactor: use WidgetDelegate::SetTitle()
* Make NativeWindow::SetTitle() and NativeWindow::GetTitle() non-virtual.
Use WidgetDelegate for their implementation.
* Add NativeWindow::OnTitleChanged(), a new protected virtual method to update
subclasses (e.g. NativeWindowMac needs to redraw the button proxy).
* In NativeWindowMac, replace SetTitle() and GetTitle() with OnTitleChanged().
* In NativeWindowViews, replace SetTitle() and GetTitle() with OnTitleChanged().
* test: enable BrowserWindow.title tests on Linux
* test: add a test to confirm win.title changes when document.title is set in the renderer