d9ba26273a
* chore: bump chromium in DEPS to 118.0.5982.0 * chore: bump chromium in DEPS to 118.0.5983.0 * chore: bump chromium in DEPS to 118.0.5985.0 * chore: bump chromium in DEPS to 118.0.5987.0 * chore: update v8 patches * chore: update chromium patches * chore: update patches * [PEPC] Add new structs to contain permission request data Refs https://chromium-review.googlesource.com/c/chromium/src/+/4756727 * Add ThumbnailCapturer interface Refs https://chromium-review.googlesource.com/c/chromium/src/+/4812256 * Reland "[ChromeRefresh2023] Update document pip windows for Chrome Refresh" Refs https://chromium-review.googlesource.com/c/chromium/src/+/4814275 * chore: bump chromium in DEPS to 118.0.5989.0 * chore: bump chromium in DEPS to 118.0.5991.0 * chore: update patches --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
319 lines
13 KiB
Diff
319 lines
13 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Cheng Zhao <zcbenz@gmail.com>
|
|
Date: Thu, 20 Sep 2018 17:48:49 -0700
|
|
Subject: mas: avoid usage of NSAccessibilityRemoteUIElement
|
|
|
|
According to ccameron:
|
|
|
|
NSAccessibilityRemoteUIElement is unnecessary for Electron's use-case. We use it
|
|
for progressive web apps (where the AXTree is in the browser process, but macOS
|
|
needs to think it's coming from the PWA process). I think it can just be chopped
|
|
out -- if there are any side-effects, we should be able to work around them.
|
|
|
|
diff --git a/components/remote_cocoa/app_shim/application_bridge.mm b/components/remote_cocoa/app_shim/application_bridge.mm
|
|
index 5a096477c123a782341115f964c4975301ccaf9a..ecfbb3b405425af346a6ba6788fc1d8ff89760cd 100644
|
|
--- a/components/remote_cocoa/app_shim/application_bridge.mm
|
|
+++ b/components/remote_cocoa/app_shim/application_bridge.mm
|
|
@@ -51,6 +51,7 @@
|
|
|
|
// NativeWidgetNSWindowHostHelper:
|
|
id GetNativeViewAccessible() override {
|
|
+#if !IS_MAS_BUILD()
|
|
if (!remote_accessibility_element_) {
|
|
int64_t browser_pid = 0;
|
|
std::vector<uint8_t> element_token;
|
|
@@ -61,6 +62,9 @@ id GetNativeViewAccessible() override {
|
|
ui::RemoteAccessibility::GetRemoteElementFromToken(element_token);
|
|
}
|
|
return remote_accessibility_element_;
|
|
+#else
|
|
+ return nil;
|
|
+#endif
|
|
}
|
|
void DispatchKeyEvent(ui::KeyEvent* event) override {
|
|
bool event_handled = false;
|
|
@@ -99,7 +103,9 @@ void GetWordAt(const gfx::Point& location_in_content,
|
|
mojo::AssociatedRemote<mojom::TextInputHost> text_input_host_remote_;
|
|
|
|
std::unique_ptr<NativeWidgetNSWindowBridge> bridge_;
|
|
+#if !IS_MAS_BUILD()
|
|
NSAccessibilityRemoteUIElement* __strong remote_accessibility_element_;
|
|
+#endif
|
|
};
|
|
|
|
} // namespace
|
|
diff --git a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
|
|
index 5855f1272c65fb5b6c0e6a5493aded657d2eb2e9..4b175b312907cce2b6ef8b6eaf05f84c2aefba5b 100644
|
|
--- a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
|
|
+++ b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
|
|
@@ -609,10 +609,12 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) {
|
|
// this should be treated as an error and caught early.
|
|
CHECK(bridged_view_);
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
// Send the accessibility tokens for the NSView now that it exists.
|
|
host_->SetRemoteAccessibilityTokens(
|
|
ui::RemoteAccessibility::GetTokenForLocalElement(window_),
|
|
ui::RemoteAccessibility::GetTokenForLocalElement(bridged_view_));
|
|
+#endif
|
|
|
|
// Beware: This view was briefly removed (in favor of a bare CALayer) in
|
|
// https://crrev.com/c/1236675. The ordering of unassociated layers relative
|
|
diff --git a/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm b/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm
|
|
index 76be676717e62c429319338c6115be89f2dfa424..18a5fd3c87b08c95d668b70c9b8f7a76413a75bb 100644
|
|
--- a/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm
|
|
+++ b/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm
|
|
@@ -86,8 +86,10 @@ id GetFocusedBrowserAccessibilityElement() override {
|
|
return nil;
|
|
}
|
|
void SetAccessibilityWindow(NSWindow* window) override {
|
|
+#if !IS_MAS_BUILD()
|
|
host_->SetRemoteAccessibilityWindowToken(
|
|
ui::RemoteAccessibility::GetTokenForLocalElement(window));
|
|
+#endif
|
|
}
|
|
|
|
void ForwardKeyboardEvent(const content::NativeWebKeyboardEvent& key_event,
|
|
diff --git a/content/browser/accessibility/browser_accessibility_manager_mac.mm b/content/browser/accessibility/browser_accessibility_manager_mac.mm
|
|
index 5a6706495ed2a8f1cd781da9bde8572318bf6897..afd4d1f728a7f056e49b2ecb006c5a05388d3409 100644
|
|
--- a/content/browser/accessibility/browser_accessibility_manager_mac.mm
|
|
+++ b/content/browser/accessibility/browser_accessibility_manager_mac.mm
|
|
@@ -21,7 +21,9 @@
|
|
#include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
|
|
#include "ui/accessibility/ax_role_properties.h"
|
|
#include "ui/accessibility/platform/ax_private_webkit_constants_mac.h"
|
|
+#if !IS_MAS_BUILD()
|
|
#include "ui/base/cocoa/remote_accessibility_api.h"
|
|
+#endif
|
|
|
|
namespace {
|
|
|
|
@@ -224,6 +226,7 @@ void PostAnnouncementNotification(NSString* announcement,
|
|
return;
|
|
}
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
BrowserAccessibilityManager* root_manager = GetManagerForRootFrame();
|
|
if (root_manager) {
|
|
BrowserAccessibilityManagerMac* root_manager_mac =
|
|
@@ -246,6 +249,7 @@ void PostAnnouncementNotification(NSString* announcement,
|
|
return;
|
|
}
|
|
}
|
|
+#endif
|
|
|
|
// Use native VoiceOver support for live regions.
|
|
BrowserAccessibilityCocoa* retained_node = native_node;
|
|
@@ -632,6 +636,7 @@ void PostAnnouncementNotification(NSString* announcement,
|
|
return window == [NSApp accessibilityFocusedWindow];
|
|
}
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
// TODO(accessibility): We need a solution to the problem described below.
|
|
// If the window is NSAccessibilityRemoteUIElement, there are some challenges:
|
|
// 1. NSApp is the browser which spawned the PWA, and what it considers the
|
|
@@ -660,6 +665,7 @@ void PostAnnouncementNotification(NSString* announcement,
|
|
if ([window isKindOfClass:[NSAccessibilityRemoteUIElement class]]) {
|
|
return true;
|
|
}
|
|
+#endif
|
|
|
|
return false;
|
|
}
|
|
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.h b/content/browser/renderer_host/render_widget_host_view_mac.h
|
|
index 3edad19a3ecbd27f54f1d17aca2e806fbbff05d4..1b4ed839f0d00334fd32a102be07be91516592d5 100644
|
|
--- a/content/browser/renderer_host/render_widget_host_view_mac.h
|
|
+++ b/content/browser/renderer_host/render_widget_host_view_mac.h
|
|
@@ -50,7 +50,9 @@ class ScopedPasswordInputEnabler;
|
|
|
|
@protocol RenderWidgetHostViewMacDelegate;
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
@class NSAccessibilityRemoteUIElement;
|
|
+#endif
|
|
@class RenderWidgetHostViewCocoa;
|
|
@class CursorAccessibilityScaleFactorObserver;
|
|
|
|
@@ -675,9 +677,11 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
|
|
// EnsureSurfaceSynchronizedForWebTest().
|
|
uint32_t latest_capture_sequence_number_ = 0u;
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
// Remote accessibility objects corresponding to the NSWindow that this is
|
|
// displayed to the user in.
|
|
NSAccessibilityRemoteUIElement* __strong remote_window_accessible_;
|
|
+#endif
|
|
|
|
// Used to force the NSApplication's focused accessibility element to be the
|
|
// content::BrowserAccessibilityCocoa accessibility tree when the NSView for
|
|
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
|
|
index d7e190889ff678599410eef4c172f0a25e9837d0..3fb6ed640ee9d857f19b4d60b12047133e68f920 100644
|
|
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
|
|
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
|
|
@@ -278,8 +278,10 @@
|
|
void RenderWidgetHostViewMac::MigrateNSViewBridge(
|
|
remote_cocoa::mojom::Application* remote_cocoa_application,
|
|
uint64_t parent_ns_view_id) {
|
|
+#if !IS_MAS_BUILD()
|
|
// Destroy the previous remote accessibility element.
|
|
remote_window_accessible_ = nil;
|
|
+#endif
|
|
|
|
// Reset `ns_view_` before resetting `remote_ns_view_` to avoid dangling
|
|
// pointers. `ns_view_` gets reinitialized later in this method.
|
|
@@ -1636,8 +1638,10 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
|
|
|
|
gfx::NativeViewAccessible
|
|
RenderWidgetHostViewMac::AccessibilityGetNativeViewAccessibleForWindow() {
|
|
+#if !IS_MAS_BUILD()
|
|
if (remote_window_accessible_)
|
|
return remote_window_accessible_;
|
|
+#endif
|
|
return [GetInProcessNSView() window];
|
|
}
|
|
|
|
@@ -1682,9 +1686,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
|
|
}
|
|
|
|
void RenderWidgetHostViewMac::SetAccessibilityWindow(NSWindow* window) {
|
|
+#if !IS_MAS_BUILD()
|
|
// When running in-process, just use the NSView's NSWindow as its own
|
|
// accessibility element.
|
|
remote_window_accessible_ = nil;
|
|
+#endif
|
|
}
|
|
|
|
bool RenderWidgetHostViewMac::SyncIsWidgetForMainFrame(
|
|
@@ -2186,12 +2192,14 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
|
|
|
|
void RenderWidgetHostViewMac::SetRemoteAccessibilityWindowToken(
|
|
const std::vector<uint8_t>& window_token) {
|
|
+#if !IS_MAS_BUILD()
|
|
if (window_token.empty()) {
|
|
remote_window_accessible_ = nil;
|
|
} else {
|
|
remote_window_accessible_ =
|
|
ui::RemoteAccessibility::GetRemoteElementFromToken(window_token);
|
|
}
|
|
+#endif
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn
|
|
index 323bd6f74158114f308a0daba06eec0c4ba15c14..9bb69e114fc6eed4db1921f2fa7b409013f9a4cd 100644
|
|
--- a/ui/base/BUILD.gn
|
|
+++ b/ui/base/BUILD.gn
|
|
@@ -377,6 +377,13 @@ component("base") {
|
|
sources += [ "resource/resource_bundle_lacros.cc" ]
|
|
}
|
|
|
|
+ if (is_mas_build) {
|
|
+ sources -= [
|
|
+ "cocoa/remote_accessibility_api.h",
|
|
+ "cocoa/remote_accessibility_api.mm",
|
|
+ ]
|
|
+ }
|
|
+
|
|
if (is_ios) {
|
|
sources += [
|
|
"device_form_factor_ios.mm",
|
|
diff --git a/ui/base/cocoa/remote_accessibility_api.h b/ui/base/cocoa/remote_accessibility_api.h
|
|
index 835cce73b7ab8b38c37d3e2650e12303d9d918e3..4460a00497dfaee0ba90cd5d14888055ed8a2830 100644
|
|
--- a/ui/base/cocoa/remote_accessibility_api.h
|
|
+++ b/ui/base/cocoa/remote_accessibility_api.h
|
|
@@ -13,6 +13,8 @@
|
|
|
|
// NSAccessibilityRemoteUIElement is a private class in AppKit.
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
+
|
|
@interface NSAccessibilityRemoteUIElement : NSObject
|
|
+ (void)registerRemoteUIProcessIdentifier:(int)pid;
|
|
+ (NSData*)remoteTokenForLocalUIElement:(id)element;
|
|
@@ -34,4 +36,6 @@ class COMPONENT_EXPORT(UI_BASE) RemoteAccessibility {
|
|
|
|
} // namespace ui
|
|
|
|
+#endif // MAS_BUILD
|
|
+
|
|
#endif // UI_BASE_COCOA_REMOTE_ACCESSIBILITY_API_H_
|
|
diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.h b/ui/views/cocoa/native_widget_mac_ns_window_host.h
|
|
index 2daaf2b78b7a60d340c2ff1651f8b5450db4af0f..3080adea0402f9d57cbde5d4350605d463ee5c8e 100644
|
|
--- a/ui/views/cocoa/native_widget_mac_ns_window_host.h
|
|
+++ b/ui/views/cocoa/native_widget_mac_ns_window_host.h
|
|
@@ -30,7 +30,9 @@
|
|
#include "ui/views/window/dialog_observer.h"
|
|
|
|
@class NativeWidgetMacNSWindow;
|
|
+#if !IS_MAS_BUILD()
|
|
@class NSAccessibilityRemoteUIElement;
|
|
+#endif
|
|
@class NSView;
|
|
|
|
namespace remote_cocoa {
|
|
@@ -454,10 +456,12 @@ class VIEWS_EXPORT NativeWidgetMacNSWindowHost
|
|
mojo::AssociatedRemote<remote_cocoa::mojom::NativeWidgetNSWindow>
|
|
remote_ns_window_remote_;
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
// Remote accessibility objects corresponding to the NSWindow and its root
|
|
// NSView.
|
|
NSAccessibilityRemoteUIElement* __strong remote_window_accessible_;
|
|
NSAccessibilityRemoteUIElement* __strong remote_view_accessible_;
|
|
+#endif
|
|
|
|
// Used to force the NSApplication's focused accessibility element to be the
|
|
// views::Views accessibility tree when the NSView for this is focused.
|
|
diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
|
index 53bdb4d62294f128b8f4b7bdcddf1052e15f331f..d052f5bb619bf4092810c6d5dd489a38a60026b0 100644
|
|
--- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
|
+++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
|
@@ -339,7 +339,11 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
|
NativeWidgetMacNSWindowHost::GetNativeViewAccessibleForNSView() const {
|
|
if (in_process_ns_window_bridge_)
|
|
return in_process_ns_window_bridge_->ns_view();
|
|
+#if !IS_MAS_BUILD()
|
|
return remote_view_accessible_;
|
|
+#else
|
|
+ return nullptr;
|
|
+#endif
|
|
}
|
|
|
|
gfx::NativeViewAccessible
|
|
@@ -354,7 +358,11 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
|
return [in_process_ns_window_bridge_->ns_view() window];
|
|
}
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
return remote_window_accessible_;
|
|
+#else
|
|
+ return nullptr;
|
|
+#endif
|
|
}
|
|
|
|
remote_cocoa::mojom::NativeWidgetNSWindow*
|
|
@@ -1353,20 +1361,24 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
|
void NativeWidgetMacNSWindowHost::SetRemoteAccessibilityTokens(
|
|
const std::vector<uint8_t>& window_token,
|
|
const std::vector<uint8_t>& view_token) {
|
|
+#if !IS_MAS_BUILD()
|
|
remote_window_accessible_ =
|
|
ui::RemoteAccessibility::GetRemoteElementFromToken(window_token);
|
|
remote_view_accessible_ =
|
|
ui::RemoteAccessibility::GetRemoteElementFromToken(view_token);
|
|
[remote_view_accessible_ setWindowUIElement:remote_window_accessible_];
|
|
[remote_view_accessible_ setTopLevelUIElement:remote_window_accessible_];
|
|
+#endif
|
|
}
|
|
|
|
bool NativeWidgetMacNSWindowHost::GetRootViewAccessibilityToken(
|
|
int64_t* pid,
|
|
std::vector<uint8_t>* token) {
|
|
+#if !IS_MAS_BUILD()
|
|
*pid = getpid();
|
|
id element_id = GetNativeViewAccessible();
|
|
*token = ui::RemoteAccessibility::GetTokenForLocalElement(element_id);
|
|
+#endif
|
|
return true;
|
|
}
|
|
|