mirror of
https://github.com/electron/electron.git
synced 2026-01-08 23:18:06 -05:00
* chore: bump chromium in DEPS to 145.0.7588.0 * fix(patch-conflict): update scroll_bounce_flag for split overscroll methods Chromium split IsElasticOverscrollEnabled() into two methods: IsElasticOverscrollEnabledOnRoot() and IsElasticOverscrollSupported(). Updated patch to apply the scroll-bounce command-line switch to both methods. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7233733 * fix(patch-conflict): update exclusive_access patch context Upstream refactored the profile variable declaration. Updated patch to match new surrounding context with brace-style if statement. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7239252 * fix(patch-conflict): update screen capture kit non-shareable filter Upstream refactored PiP window exclusion to use GetWindowsToExclude() helper function. Updated patch to combine non-shareable window filtering with the new helper's output. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7274596 * fix(patch-conflict): update corner smoothing CSS property id position Upstream added new internal overscroll CSS properties. Updated patch to add kElectronCornerSmoothing after the new entries. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7234051 * fix(patch-conflict): update permission patches for new permission types Upstream added new permission types: LOCAL_NETWORK, LOOPBACK_NETWORK, and GEOLOCATION_APPROXIMATE. Updated Electron permission patches to include these new types and renumber Electron-specific permissions. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7231952 * fix(patch-conflict): update memory query fallback for new function signature Upstream added AmountOfTotalPhysicalMemory() with PCHECK. Updated patch to maintain fallback logic with correct ByteSize return type. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7254886 * chore: update patch hunk headers * fix(patch): update reclient-configs patch to use new file mode The fix_add_python_remote_wrapper patch was using 'copy from' mode which caused inconsistent behavior between local and CI git versions. Changed to 'new file' mode for consistent patch application. * fix(patch-conflict): remove duplicate GEOLOCATION_APPROXIMATE case Upstream moved GEOLOCATION_APPROXIMATE earlier in the switch statement in GetPermissionString(). The 3-way merge kept both the old and new positions, causing a duplicate case error. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/6397637 * chore: update libcxx filenames for new headers * chore: bump chromium in DEPS to 145.0.7590.0 * chore: update patch hunk headers * fix(patch): update memory fallback return type to ByteSize Upstream changed the return type from ByteCount to ByteSize. * fix: suppress nodiscard warning in node_file.cc libc++ added [[nodiscard]] to std::filesystem::copy_options operator|= which causes build failures with -Werror. * 7229082: update CopyFromSurface to use CopyFromSurfaceResult Upstream changed CopyFromSurface callback to return base::expected<viz::CopyOutputBitmapWithMetadata, std::string> instead of SkBitmap, enabling better error handling. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7229082 * 7254070: add ip_address_space param to OnLocalNetworkAccessPermissionRequired Upstream added IPAddressSpace parameter to check address space for proper permission handling in Local Network Access. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7254070 * 7136679: add spelling_markers param to RequestCheckingOfText Upstream added spelling_markers parameter to report misspelling ranges from Blink to Spellcheck to IME. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7136679 * 7240487: remove second param from RegisterWebSafeIsolatedScheme Upstream removed the schemes_okay_to_appear_as_origin_headers_ parameter. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7240487 * 7254577: use explicit WebElement constructor WebElement default constructor now requires explicit construction rather than brace initialization. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7254577 * 7256335: remove override from CreateGlobalFeaturesForTesting Upstream removed BrowserProcess::CreateGlobalFeaturesForTesting virtual method so the override specifier is no longer valid. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7256335 * chore: add missing SingleThreadTaskRunner include A transitive include of SingleThreadTaskRunner was removed upstream, requiring an explicit include. Ref: Unable to locate specific CL (transitive include change) * 7260483: add LOCAL_NETWORK, LOOPBACK_NETWORK permission type cases Upstream added new permission types for Local Network Access split permissions. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7260483 * chore: update patch hunk headers * 7264893: update postMessage tests for file: origin serialization change Chromium now serializes file: origins as 'null' in MessageEvent per spec. This is a security improvement aligning with the HTML spec behavior. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7264893 * fix: add paths to custom scheme URLs in protocol tests Custom scheme URLs without paths (e.g. test-scheme://foo) cause a DCHECK crash in ASAN builds when CorsURLLoader tries to log the request via GenerateRequestLine -> PathForRequest, which asserts that the path is non-empty. Adding trailing slashes ensures URLs have valid paths. * chore: bump chromium in DEPS to 145.0.7592.0 * chore: update patches (trivial only) * chore: bump chromium in DEPS to 145.0.7594.0 * chore: bump chromium in DEPS to 145.0.7596.0 * chore: update accelerator.patch no manual changes; patch applied with fuzz 2 (offset 1 line) * chore: update patches (trivial only) * chore: node ./script/gen-libc++-filenames.js --------- Co-authored-by: Alice Zhao <alicelovescake@anthropic.com> Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com>
289 lines
11 KiB
Diff
289 lines
11 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: David Sanders <dsanders11@ucsbalum.com>
|
|
Date: Wed, 8 Jan 2025 23:53:27 -0800
|
|
Subject: Revert "Code Health: Clean up stale MacWebContentsOcclusion"
|
|
|
|
Chrome has removed this WebContentsOcclusion feature flag upstream,
|
|
which is now causing our visibility tests to break. This patch
|
|
restores the legacy occlusion behavior to ensure the roll can continue
|
|
while we debug the issue.
|
|
|
|
This patch can be removed when the root cause because the visibility
|
|
specs failing on MacOS only is debugged and fixed. It should be removed
|
|
before Electron 35's stable date.
|
|
|
|
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/6078344
|
|
|
|
This partially (leaves the removal of the feature flag) reverts
|
|
ef865130abd5539e7bce12308659b19980368f12.
|
|
|
|
diff --git a/content/app_shim_remote_cocoa/web_contents_occlusion_checker_mac.h b/content/app_shim_remote_cocoa/web_contents_occlusion_checker_mac.h
|
|
index 13e928e3790735fdad68fbca0a8a8e9d0836fdee..2719f8853e840d6f890d01220345644db163fd07 100644
|
|
--- a/content/app_shim_remote_cocoa/web_contents_occlusion_checker_mac.h
|
|
+++ b/content/app_shim_remote_cocoa/web_contents_occlusion_checker_mac.h
|
|
@@ -11,6 +11,8 @@
|
|
#include "base/metrics/field_trial_params.h"
|
|
#import "content/app_shim_remote_cocoa/web_contents_view_cocoa.h"
|
|
|
|
+extern CONTENT_EXPORT const base::FeatureParam<bool>
|
|
+ kEnhancedWindowOcclusionDetection;
|
|
extern CONTENT_EXPORT const base::FeatureParam<bool>
|
|
kDisplaySleepAndAppHideDetection;
|
|
|
|
diff --git a/content/app_shim_remote_cocoa/web_contents_occlusion_checker_mac.mm b/content/app_shim_remote_cocoa/web_contents_occlusion_checker_mac.mm
|
|
index a5570988c3721d9f6bd05c402a7658d3af6f2c2c..0a2dba6aa2d48bc39d2a55c8b4d6606744c10ca7 100644
|
|
--- a/content/app_shim_remote_cocoa/web_contents_occlusion_checker_mac.mm
|
|
+++ b/content/app_shim_remote_cocoa/web_contents_occlusion_checker_mac.mm
|
|
@@ -14,9 +14,16 @@
|
|
#include "base/mac/mac_util.h"
|
|
#include "base/metrics/field_trial_params.h"
|
|
#include "base/no_destructor.h"
|
|
+#include "content/common/features.h"
|
|
#include "content/public/browser/content_browser_client.h"
|
|
#include "content/public/common/content_client.h"
|
|
|
|
+using features::kMacWebContentsOcclusion;
|
|
+
|
|
+// Experiment features.
|
|
+const base::FeatureParam<bool> kEnhancedWindowOcclusionDetection{
|
|
+ &kMacWebContentsOcclusion, "EnhancedWindowOcclusionDetection", false};
|
|
+
|
|
namespace {
|
|
|
|
NSString* const kWindowDidChangePositionInWindowList =
|
|
@@ -125,7 +132,8 @@ - (void)dealloc {
|
|
|
|
- (BOOL)isManualOcclusionDetectionEnabled {
|
|
return [WebContentsOcclusionCheckerMac
|
|
- manualOcclusionDetectionSupportedForCurrentMacOSVersion];
|
|
+ manualOcclusionDetectionSupportedForCurrentMacOSVersion] &&
|
|
+ kEnhancedWindowOcclusionDetection.Get();
|
|
}
|
|
|
|
// Alternative implementation of orderWindow:relativeTo:. Replaces
|
|
diff --git a/content/app_shim_remote_cocoa/web_contents_view_cocoa.mm b/content/app_shim_remote_cocoa/web_contents_view_cocoa.mm
|
|
index 17d6d7d935f93afefa9123f56ef9c138c3070f93..8dfa7501a6a2998e107bf9b51f5e5c3d52e880bf 100644
|
|
--- a/content/app_shim_remote_cocoa/web_contents_view_cocoa.mm
|
|
+++ b/content/app_shim_remote_cocoa/web_contents_view_cocoa.mm
|
|
@@ -16,6 +16,7 @@
|
|
#import "content/app_shim_remote_cocoa/web_drag_source_mac.h"
|
|
#import "content/browser/web_contents/web_contents_view_mac.h"
|
|
#import "content/browser/web_contents/web_drag_dest_mac.h"
|
|
+#include "content/common/features.h"
|
|
#include "content/public/browser/content_browser_client.h"
|
|
#include "content/public/common/content_client.h"
|
|
#include "ui/base/clipboard/clipboard_constants.h"
|
|
@@ -28,6 +29,7 @@
|
|
#include "ui/resources/grit/ui_resources.h"
|
|
|
|
using content::DropData;
|
|
+using features::kMacWebContentsOcclusion;
|
|
using remote_cocoa::mojom::DraggingInfo;
|
|
using remote_cocoa::mojom::SelectionDirection;
|
|
|
|
@@ -123,17 +125,20 @@ @implementation WebContentsViewCocoa {
|
|
WebDragSource* __strong _dragSource;
|
|
NSDragOperation _dragOperation;
|
|
|
|
+ BOOL _inFullScreenTransition;
|
|
BOOL _willSetWebContentsOccludedAfterDelay;
|
|
}
|
|
|
|
+ (void)initialize {
|
|
- if (![WebContentsOcclusionCheckerMac
|
|
- manualOcclusionDetectionSupportedForCurrentMacOSVersion]) {
|
|
- return;
|
|
- }
|
|
+ if (base::FeatureList::IsEnabled(kMacWebContentsOcclusion)) {
|
|
+ if (![WebContentsOcclusionCheckerMac
|
|
+ manualOcclusionDetectionSupportedForCurrentMacOSVersion]) {
|
|
+ return;
|
|
+ }
|
|
|
|
- // Create the WebContentsOcclusionCheckerMac shared instance.
|
|
- [WebContentsOcclusionCheckerMac sharedInstance];
|
|
+ // Create the WebContentsOcclusionCheckerMac shared instance.
|
|
+ [WebContentsOcclusionCheckerMac sharedInstance];
|
|
+ }
|
|
}
|
|
|
|
- (instancetype)initWithViewsHostableView:(ui::ViewsHostableView*)v {
|
|
@@ -444,6 +449,7 @@ - (void)updateWebContentsVisibility:
|
|
(remote_cocoa::mojom::Visibility)visibility {
|
|
using remote_cocoa::mojom::Visibility;
|
|
|
|
+ DCHECK(base::FeatureList::IsEnabled(kMacWebContentsOcclusion));
|
|
if (!_host)
|
|
return;
|
|
|
|
@@ -489,6 +495,20 @@ - (void)updateWebContentsVisibility {
|
|
[self updateWebContentsVisibility:visibility];
|
|
}
|
|
|
|
+- (void)legacyUpdateWebContentsVisibility {
|
|
+ using remote_cocoa::mojom::Visibility;
|
|
+ if (!_host || _inFullScreenTransition)
|
|
+ return;
|
|
+ Visibility visibility = Visibility::kVisible;
|
|
+ if ([self isHiddenOrHasHiddenAncestor] || ![self window])
|
|
+ visibility = Visibility::kHidden;
|
|
+ else if ([[self window] occlusionState] & NSWindowOcclusionStateVisible)
|
|
+ visibility = Visibility::kVisible;
|
|
+ else
|
|
+ visibility = Visibility::kOccluded;
|
|
+ _host->OnWindowVisibilityChanged(visibility);
|
|
+}
|
|
+
|
|
- (void)resizeSubviewsWithOldSize:(NSSize)oldBoundsSize {
|
|
// Subviews do not participate in auto layout unless the the size this view
|
|
// changes. This allows RenderWidgetHostViewMac::SetBounds(..) to select a
|
|
@@ -511,11 +531,39 @@ - (void)viewWillMoveToWindow:(NSWindow*)newWindow {
|
|
|
|
NSWindow* oldWindow = [self window];
|
|
|
|
+ if (base::FeatureList::IsEnabled(kMacWebContentsOcclusion)) {
|
|
+ if (oldWindow) {
|
|
+ [notificationCenter
|
|
+ removeObserver:self
|
|
+ name:NSWindowDidChangeOcclusionStateNotification
|
|
+ object:oldWindow];
|
|
+ }
|
|
+
|
|
+ if (newWindow) {
|
|
+ [notificationCenter
|
|
+ addObserver:self
|
|
+ selector:@selector(windowChangedOcclusionState:)
|
|
+ name:NSWindowDidChangeOcclusionStateNotification
|
|
+ object:newWindow];
|
|
+ }
|
|
+
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ _inFullScreenTransition = NO;
|
|
if (oldWindow) {
|
|
- [notificationCenter
|
|
- removeObserver:self
|
|
- name:NSWindowDidChangeOcclusionStateNotification
|
|
- object:oldWindow];
|
|
+ NSArray* notificationsToRemove = @[
|
|
+ NSWindowDidChangeOcclusionStateNotification,
|
|
+ NSWindowWillEnterFullScreenNotification,
|
|
+ NSWindowDidEnterFullScreenNotification,
|
|
+ NSWindowWillExitFullScreenNotification,
|
|
+ NSWindowDidExitFullScreenNotification
|
|
+ ];
|
|
+ for (NSString* notificationName in notificationsToRemove) {
|
|
+ [notificationCenter removeObserver:self
|
|
+ name:notificationName
|
|
+ object:oldWindow];
|
|
+ }
|
|
}
|
|
|
|
if (newWindow) {
|
|
@@ -523,26 +571,66 @@ - (void)viewWillMoveToWindow:(NSWindow*)newWindow {
|
|
selector:@selector(windowChangedOcclusionState:)
|
|
name:NSWindowDidChangeOcclusionStateNotification
|
|
object:newWindow];
|
|
+ // The fullscreen transition causes spurious occlusion notifications.
|
|
+ // See https://crbug.com/1081229
|
|
+ [notificationCenter addObserver:self
|
|
+ selector:@selector(fullscreenTransitionStarted:)
|
|
+ name:NSWindowWillEnterFullScreenNotification
|
|
+ object:newWindow];
|
|
+ [notificationCenter addObserver:self
|
|
+ selector:@selector(fullscreenTransitionComplete:)
|
|
+ name:NSWindowDidEnterFullScreenNotification
|
|
+ object:newWindow];
|
|
+ [notificationCenter addObserver:self
|
|
+ selector:@selector(fullscreenTransitionStarted:)
|
|
+ name:NSWindowWillExitFullScreenNotification
|
|
+ object:newWindow];
|
|
+ [notificationCenter addObserver:self
|
|
+ selector:@selector(fullscreenTransitionComplete:)
|
|
+ name:NSWindowDidExitFullScreenNotification
|
|
+ object:newWindow];
|
|
}
|
|
}
|
|
|
|
- (void)windowChangedOcclusionState:(NSNotification*)aNotification {
|
|
- // Only respond to occlusion notifications sent by the occlusion checker.
|
|
- NSDictionary* userInfo = [aNotification userInfo];
|
|
- NSString* occlusionCheckerKey = [WebContentsOcclusionCheckerMac className];
|
|
- if (userInfo[occlusionCheckerKey] != nil)
|
|
- [self updateWebContentsVisibility];
|
|
+ if (!base::FeatureList::IsEnabled(kMacWebContentsOcclusion)) {
|
|
+ [self legacyUpdateWebContentsVisibility];
|
|
+ return;
|
|
+ }
|
|
+}
|
|
+
|
|
+- (void)fullscreenTransitionStarted:(NSNotification*)notification {
|
|
+ _inFullScreenTransition = YES;
|
|
+}
|
|
+
|
|
+- (void)fullscreenTransitionComplete:(NSNotification*)notification {
|
|
+ _inFullScreenTransition = NO;
|
|
}
|
|
|
|
- (void)viewDidMoveToWindow {
|
|
+ if (!base::FeatureList::IsEnabled(kMacWebContentsOcclusion)) {
|
|
+ [self legacyUpdateWebContentsVisibility];
|
|
+ return;
|
|
+ }
|
|
+
|
|
[self updateWebContentsVisibility];
|
|
}
|
|
|
|
- (void)viewDidHide {
|
|
+ if (!base::FeatureList::IsEnabled(kMacWebContentsOcclusion)) {
|
|
+ [self legacyUpdateWebContentsVisibility];
|
|
+ return;
|
|
+ }
|
|
+
|
|
[self updateWebContentsVisibility];
|
|
}
|
|
|
|
- (void)viewDidUnhide {
|
|
+ if (!base::FeatureList::IsEnabled(kMacWebContentsOcclusion)) {
|
|
+ [self legacyUpdateWebContentsVisibility];
|
|
+ return;
|
|
+ }
|
|
+
|
|
[self updateWebContentsVisibility];
|
|
}
|
|
|
|
diff --git a/content/common/features.cc b/content/common/features.cc
|
|
index 7e980732c46ffcba5da4434ea33986c5fd6671e1..a25cfddf395bb7c7022f1fbefc444470426c316a 100644
|
|
--- a/content/common/features.cc
|
|
+++ b/content/common/features.cc
|
|
@@ -343,6 +343,14 @@ BASE_FEATURE(kInterestGroupUpdateIfOlderThan, base::FEATURE_ENABLED_BY_DEFAULT);
|
|
BASE_FEATURE(kIOSurfaceCapturer, base::FEATURE_ENABLED_BY_DEFAULT);
|
|
#endif
|
|
|
|
+// Feature that controls whether WebContentsOcclusionChecker should handle
|
|
+// occlusion notifications.
|
|
+#if BUILDFLAG(IS_MAC)
|
|
+BASE_FEATURE(kMacWebContentsOcclusion,
|
|
+ "MacWebContentsOcclusion",
|
|
+ base::FEATURE_ENABLED_BY_DEFAULT);
|
|
+#endif
|
|
+
|
|
// When enabled, child process will not terminate itself when IPC is reset.
|
|
BASE_FEATURE(kKeepChildProcessAfterIPCReset, base::FEATURE_DISABLED_BY_DEFAULT);
|
|
|
|
diff --git a/content/common/features.h b/content/common/features.h
|
|
index 1bc3d8351ef88687248e22fb726d7e612805e8b6..db6000afe30850aa33e85a1e26513e596e1177f5 100644
|
|
--- a/content/common/features.h
|
|
+++ b/content/common/features.h
|
|
@@ -133,6 +133,9 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kInterestGroupUpdateIfOlderThan);
|
|
#if BUILDFLAG(IS_MAC)
|
|
CONTENT_EXPORT BASE_DECLARE_FEATURE(kIOSurfaceCapturer);
|
|
#endif
|
|
+#if BUILDFLAG(IS_MAC)
|
|
+CONTENT_EXPORT BASE_DECLARE_FEATURE(kMacWebContentsOcclusion);
|
|
+#endif
|
|
CONTENT_EXPORT BASE_DECLARE_FEATURE(kKeepChildProcessAfterIPCReset);
|
|
|
|
CONTENT_EXPORT BASE_DECLARE_FEATURE(kLocalNetworkAccessForWorkers);
|