summaryrefslogtreecommitdiff
path: root/chromium/content/app_shim_remote_cocoa
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/content/app_shim_remote_cocoa')
-rw-r--r--chromium/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm14
-rw-r--r--chromium/content/app_shim_remote_cocoa/render_widget_host_ns_view_bridge.h6
-rw-r--r--chromium/content/app_shim_remote_cocoa/render_widget_host_ns_view_bridge.mm7
-rw-r--r--chromium/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm4
-rw-r--r--chromium/content/app_shim_remote_cocoa/web_contents_view_cocoa.mm48
-rw-r--r--chromium/content/app_shim_remote_cocoa/web_drag_source_mac.mm12
6 files changed, 68 insertions, 23 deletions
diff --git a/chromium/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm b/chromium/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm
index 2aecd9c9316..c3a9fbf0f9d 100644
--- a/chromium/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm
+++ b/chromium/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm
@@ -50,9 +50,12 @@ class RenderWidgetHostNSViewBridgeOwner
private:
void OnMojoDisconnect() { delete this; }
- std::unique_ptr<content::InputEvent> TranslateEvent(
+ std::unique_ptr<blink::WebCoalescedInputEvent> TranslateEvent(
const blink::WebInputEvent& web_event) {
- return std::make_unique<content::InputEvent>(web_event, ui::LatencyInfo());
+ return std::make_unique<blink::WebCoalescedInputEvent>(
+ web_event.Clone(), std::vector<std::unique_ptr<blink::WebInputEvent>>{},
+ std::vector<std::unique_ptr<blink::WebInputEvent>>{},
+ ui::LatencyInfo());
}
// RenderWidgetHostNSViewHostHelper implementation.
@@ -82,8 +85,11 @@ class RenderWidgetHostNSViewBridgeOwner
std::vector<blink::mojom::EditCommandPtr> edit_commands) override {
const blink::WebKeyboardEvent* web_event =
static_cast<const blink::WebKeyboardEvent*>(&key_event);
- std::unique_ptr<content::InputEvent> input_event =
- std::make_unique<content::InputEvent>(*web_event, latency_info);
+ std::unique_ptr<blink::WebCoalescedInputEvent> input_event =
+ std::make_unique<blink::WebCoalescedInputEvent>(
+ web_event->Clone(),
+ std::vector<std::unique_ptr<blink::WebInputEvent>>{},
+ std::vector<std::unique_ptr<blink::WebInputEvent>>{}, latency_info);
std::vector<uint8_t> native_event_data =
ui::EventToData(key_event.os_event);
host_->ForwardKeyboardEventWithCommands(
diff --git a/chromium/content/app_shim_remote_cocoa/render_widget_host_ns_view_bridge.h b/chromium/content/app_shim_remote_cocoa/render_widget_host_ns_view_bridge.h
index 9880927aef1..5514475b998 100644
--- a/chromium/content/app_shim_remote_cocoa/render_widget_host_ns_view_bridge.h
+++ b/chromium/content/app_shim_remote_cocoa/render_widget_host_ns_view_bridge.h
@@ -15,6 +15,7 @@
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "ui/accelerated_widget_mac/display_ca_layer_tree.h"
+#include "ui/base/mojom/attributed_string.mojom-forward.h"
#include "ui/display/display_observer.h"
namespace remote_cocoa {
@@ -61,9 +62,8 @@ class RenderWidgetHostNSViewBridge : public mojom::RenderWidgetHostNSView,
void DisplayCursor(const content::WebCursor& cursor) override;
void SetCursorLocked(bool locked) override;
void ShowDictionaryOverlayForSelection() override;
- void ShowDictionaryOverlay(
- const mac::AttributedStringCoder::EncodedString& encoded_string,
- const gfx::Point& baseline_point) override;
+ void ShowDictionaryOverlay(ui::mojom::AttributedStringPtr attributed_string,
+ const gfx::Point& baseline_point) override;
void LockKeyboard(
const base::Optional<std::vector<uint32_t>>& uint_dom_codes) override;
void UnlockKeyboard() override;
diff --git a/chromium/content/app_shim_remote_cocoa/render_widget_host_ns_view_bridge.mm b/chromium/content/app_shim_remote_cocoa/render_widget_host_ns_view_bridge.mm
index 24be6a2cad1..9183f8fe448 100644
--- a/chromium/content/app_shim_remote_cocoa/render_widget_host_ns_view_bridge.mm
+++ b/chromium/content/app_shim_remote_cocoa/render_widget_host_ns_view_bridge.mm
@@ -9,9 +9,11 @@
#include "components/remote_cocoa/app_shim/ns_view_ids.h"
#include "content/app_shim_remote_cocoa/render_widget_host_ns_view_host_helper.h"
#include "content/common/cursors/webcursor.h"
+#include "content/common/mac/attributed_string_type_converters.h"
#import "skia/ext/skia_utils_mac.h"
#include "ui/accelerated_widget_mac/window_resize_helper_mac.h"
#import "ui/base/cocoa/animation_utils.h"
+#include "ui/base/mojom/attributed_string.mojom.h"
#include "ui/display/screen.h"
#include "ui/events/keycodes/dom/dom_code.h"
#include "ui/gfx/mac/coordinate_conversion.h"
@@ -238,10 +240,9 @@ void RenderWidgetHostNSViewBridge::ShowDictionaryOverlayForSelection() {
}
void RenderWidgetHostNSViewBridge::ShowDictionaryOverlay(
- const mac::AttributedStringCoder::EncodedString& encoded_string,
+ ui::mojom::AttributedStringPtr attributed_string,
const gfx::Point& baseline_point) {
- NSAttributedString* string =
- mac::AttributedStringCoder::Decode(&encoded_string);
+ NSAttributedString* string = attributed_string.To<NSAttributedString*>();
if ([string length] == 0)
return;
NSPoint flipped_baseline_point = {
diff --git a/chromium/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/chromium/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
index 0d6c628b124..f872e4ec47c 100644
--- a/chromium/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
+++ b/chromium/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
@@ -36,9 +36,9 @@
#include "ui/events/event_utils.h"
#include "ui/events/keycodes/dom/dom_code.h"
#include "ui/events/keycodes/dom/keycode_converter.h"
+#include "ui/events/platform/platform_event_source.h"
#include "ui/gfx/mac/coordinate_conversion.h"
-using content::InputEvent;
using content::NativeWebKeyboardEvent;
using content::RenderWidgetHostViewMacEditCommandHelper;
using content::WebGestureEventBuilder;
@@ -678,6 +678,8 @@ void ExtractUnderlines(NSAttributedString* string,
if (handled)
return;
}
+ if (ui::PlatformEventSource::ShouldIgnoreNativePlatformEvents())
+ return;
// Set the pointer type when we are receiving a NSMouseEntered event and the
// following NSMouseExited event should have the same pointer type.
diff --git a/chromium/content/app_shim_remote_cocoa/web_contents_view_cocoa.mm b/chromium/content/app_shim_remote_cocoa/web_contents_view_cocoa.mm
index b3441157aca..386d48f0913 100644
--- a/chromium/content/app_shim_remote_cocoa/web_contents_view_cocoa.mm
+++ b/chromium/content/app_shim_remote_cocoa/web_contents_view_cocoa.mm
@@ -22,7 +22,9 @@ using content::DropData;
////////////////////////////////////////////////////////////////////////////////
// WebContentsViewCocoa
-@implementation WebContentsViewCocoa
+@implementation WebContentsViewCocoa {
+ BOOL _inFullScreenTransition;
+}
- (id)initWithViewsHostableView:(ui::ViewsHostableView*)v {
self = [super initWithFrame:NSZeroRect];
@@ -257,7 +259,7 @@ using content::DropData;
}
- (void)updateWebContentsVisibility {
- if (!_host)
+ if (!_host || _inFullScreenTransition)
return;
Visibility visibility = Visibility::kVisible;
if ([self isHiddenOrHasHiddenAncestor] || ![self window])
@@ -291,16 +293,42 @@ using content::DropData;
[NSNotificationCenter defaultCenter];
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) {
[notificationCenter addObserver:self
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];
}
}
@@ -308,6 +336,14 @@ using content::DropData;
[self updateWebContentsVisibility];
}
+- (void)fullscreenTransitionStarted:(NSNotification*)notification {
+ _inFullScreenTransition = YES;
+}
+
+- (void)fullscreenTransitionComplete:(NSNotification*)notification {
+ _inFullScreenTransition = NO;
+}
+
- (void)viewDidMoveToWindow {
[self updateWebContentsVisibility];
}
diff --git a/chromium/content/app_shim_remote_cocoa/web_drag_source_mac.mm b/chromium/content/app_shim_remote_cocoa/web_drag_source_mac.mm
index 85131002717..347aa7ef392 100644
--- a/chromium/content/app_shim_remote_cocoa/web_drag_source_mac.mm
+++ b/chromium/content/app_shim_remote_cocoa/web_drag_source_mac.mm
@@ -103,9 +103,9 @@ using content::DropData;
// HTML.
if ([type isEqualToString:NSHTMLPboardType] ||
[type isEqualToString:ui::kChromeDragImageHTMLPboardType]) {
- DCHECK(!_dropData->html.string().empty());
+ DCHECK(_dropData->html && !_dropData->html->empty());
// See comment on |kHtmlHeader| above.
- [pboard setString:SysUTF16ToNSString(kHtmlHeader + _dropData->html.string())
+ [pboard setString:SysUTF16ToNSString(kHtmlHeader + *_dropData->html)
forType:type];
// URL.
@@ -136,8 +136,8 @@ using content::DropData;
// Plain text.
} else if ([type isEqualToString:NSStringPboardType]) {
- DCHECK(!_dropData->text.string().empty());
- [pboard setString:SysUTF16ToNSString(_dropData->text.string())
+ DCHECK(_dropData->text && !_dropData->text->empty());
+ [pboard setString:SysUTF16ToNSString(*_dropData->text)
forType:NSStringPboardType];
// Custom MIME data.
@@ -348,7 +348,7 @@ using content::DropData;
}
// HTML.
- bool hasHTMLData = !_dropData->html.string().empty();
+ bool hasHTMLData = _dropData->html && !_dropData->html->empty();
// Mail.app and TextEdit accept drags that have both HTML and image flavors on
// them, but don't process them correctly <http://crbug.com/55879>. Therefore,
// if there is an image flavor, don't put the HTML data on as HTML, but rather
@@ -369,7 +369,7 @@ using content::DropData;
}
// Plain text.
- if (!_dropData->text.string().empty()) {
+ if (_dropData->text && !_dropData->text->empty()) {
[_pasteboard addTypes:@[ NSStringPboardType ]
owner:_contentsView];
}