|
@@ -1,65 +0,0 @@
|
|
|
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
-From: Samuel Attard <[email protected]>
|
|
|
-Date: Wed, 5 Jun 2019 15:11:00 -0700
|
|
|
-Subject: chore: add debounce on the updateWebContentsVisibility method to
|
|
|
- ensure quick changes in occlusion do not result in flickering
|
|
|
-
|
|
|
-diff --git a/content/app_shim_remote_cocoa/web_contents_view_cocoa.h b/content/app_shim_remote_cocoa/web_contents_view_cocoa.h
|
|
|
-index 48529f4471d8400573d29571b97c365d134f2e28..6ca7456333364cc1ee1981dee00963f988819d9e 100644
|
|
|
---- a/content/app_shim_remote_cocoa/web_contents_view_cocoa.h
|
|
|
-+++ b/content/app_shim_remote_cocoa/web_contents_view_cocoa.h
|
|
|
-@@ -55,6 +55,8 @@ CONTENT_EXPORT
|
|
|
- offset:(NSPoint)offset;
|
|
|
- - (void)clearViewsHostableView;
|
|
|
- - (void)updateWebContentsVisibility;
|
|
|
-+- (content::mojom::Visibility)currentVisibility;
|
|
|
-+- (void)notifyWebContentsVisibilityChanged;
|
|
|
- - (void)viewDidBecomeFirstResponder:(NSNotification*)notification;
|
|
|
- @end
|
|
|
-
|
|
|
-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 1bd2729c47071f65e938a7bc61eed4520cc4f96f..b0b1d315faec1a8c893412b5d216f28349ea99e4 100644
|
|
|
---- a/content/app_shim_remote_cocoa/web_contents_view_cocoa.mm
|
|
|
-+++ b/content/app_shim_remote_cocoa/web_contents_view_cocoa.mm
|
|
|
-@@ -255,9 +255,14 @@ - (void)viewDidBecomeFirstResponder:(NSNotification*)notification {
|
|
|
- client_->OnBecameFirstResponder(direction);
|
|
|
- }
|
|
|
-
|
|
|
--- (void)updateWebContentsVisibility {
|
|
|
-+- (void)notifyWebContentsVisibilityChanged {
|
|
|
- if (!client_)
|
|
|
- return;
|
|
|
-+
|
|
|
-+ client_->OnWindowVisibilityChanged([self currentVisibility]);
|
|
|
-+}
|
|
|
-+
|
|
|
-+- (content::mojom::Visibility)currentVisibility {
|
|
|
- content::mojom::Visibility visibility = content::mojom::Visibility::kVisible;
|
|
|
- if ([self isHiddenOrHasHiddenAncestor] || ![self window])
|
|
|
- visibility = content::mojom::Visibility::kHidden;
|
|
|
-@@ -265,7 +270,24 @@ - (void)updateWebContentsVisibility {
|
|
|
- visibility = content::mojom::Visibility::kVisible;
|
|
|
- else
|
|
|
- visibility = content::mojom::Visibility::kOccluded;
|
|
|
-- client_->OnWindowVisibilityChanged(visibility);
|
|
|
-+ return visibility;
|
|
|
-+}
|
|
|
-+
|
|
|
-+- (void)updateWebContentsVisibility {
|
|
|
-+ if (!client_)
|
|
|
-+ return;
|
|
|
-+ // Cancel any pending notifications visibility changes, this ensures that the latest incoming change is the only
|
|
|
-+ // change that will take affect
|
|
|
-+ [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(notifyWebContentsVisibilityChanged) object:nil];
|
|
|
-+
|
|
|
-+ content::mojom::Visibility visibility = [self currentVisibility];
|
|
|
-+
|
|
|
-+ // If it's visible, notify immediately to render ASAP
|
|
|
-+ if (visibility == content::mojom::Visibility::kVisible)
|
|
|
-+ client_->OnWindowVisibilityChanged(visibility);
|
|
|
-+ else
|
|
|
-+ // If it's occluded queue it for 3 seconds to be sure that it isn't a double kOccluded -> kVisible
|
|
|
-+ [self performSelector:@selector(notifyWebContentsVisibilityChanged) withObject:nil afterDelay:3.0];
|
|
|
- }
|
|
|
-
|
|
|
- - (void)resizeSubviewsWithOldSize:(NSSize)oldBoundsSize {
|