render_widget_host_view_mac.patch 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Cheng Zhao <[email protected]>
  3. Date: Thu, 20 Sep 2018 17:46:28 -0700
  4. Subject: render_widget_host_view_mac.patch
  5. diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
  6. index f583a0a6eaacc63941c7bf281534d9d7baeb7f1e..46fcb918f42654ec1d7d2c5c5ea70e4a402dede1 100644
  7. --- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
  8. +++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
  9. @@ -142,6 +142,11 @@ void ExtractUnderlines(NSAttributedString* string,
  10. } // namespace
  11. +@interface NSWindow (AtomCustomMethods)
  12. +- (BOOL)acceptsFirstMouse;
  13. +- (BOOL)disableAutoHideCursor;
  14. +@end
  15. +
  16. // These are not documented, so use only after checking -respondsToSelector:.
  17. @interface NSApplication (UndocumentedSpeechMethods)
  18. - (void)speakString:(NSString*)string;
  19. @@ -403,6 +408,9 @@ void ExtractUnderlines(NSAttributedString* string,
  20. }
  21. - (BOOL)acceptsFirstMouse:(NSEvent*)theEvent {
  22. + if ([self.window respondsToSelector:@selector(acceptsFirstMouse)] &&
  23. + [self.window acceptsFirstMouse])
  24. + return YES;
  25. return [self acceptsMouseEventsWhenInactive];
  26. }
  27. @@ -785,6 +793,10 @@ void ExtractUnderlines(NSAttributedString* string,
  28. eventType == NSKeyDown &&
  29. !(modifierFlags & NSCommandKeyMask);
  30. + if ([theEvent.window respondsToSelector:@selector(disableAutoHideCursor)] &&
  31. + [theEvent.window disableAutoHideCursor])
  32. + shouldAutohideCursor = NO;
  33. +
  34. // We only handle key down events and just simply forward other events.
  35. if (eventType != NSKeyDown) {
  36. clientHelper_->ForwardKeyboardEvent(event, latency_info);
  37. @@ -1498,9 +1510,11 @@ void ExtractUnderlines(NSAttributedString* string,
  38. // Since this implementation doesn't have to wait any IPC calls, this doesn't
  39. // make any key-typing jank. --hbono 7/23/09
  40. //
  41. +#ifndef MAS_BUILD
  42. extern "C" {
  43. extern NSString* NSTextInputReplacementRangeAttributeName;
  44. }
  45. +#endif
  46. - (NSArray*)validAttributesForMarkedText {
  47. // This code is just copied from WebKit except renaming variables.
  48. @@ -1509,7 +1523,10 @@ extern NSString* NSTextInputReplacementRangeAttributeName;
  49. initWithObjects:NSUnderlineStyleAttributeName,
  50. NSUnderlineColorAttributeName,
  51. NSMarkedClauseSegmentAttributeName,
  52. - NSTextInputReplacementRangeAttributeName, nil]);
  53. +#ifndef MAS_BUILD
  54. + NSTextInputReplacementRangeAttributeName,
  55. +#endif
  56. + nil]);
  57. }
  58. return validAttributesForMarkedText_.get();
  59. }
  60. diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
  61. index 19b52c4e90dabefe3043c2871a26d7538b7c6e31..a1138408c0985efc1334c9a92f7e875680b69a4a 100644
  62. --- a/content/browser/renderer_host/render_widget_host_view_mac.mm
  63. +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
  64. @@ -62,6 +62,7 @@
  65. #include "ui/events/keycodes/dom/dom_keyboard_layout_map.h"
  66. #include "ui/gfx/geometry/dip_util.h"
  67. #include "ui/gfx/mac/coordinate_conversion.h"
  68. +#include "ui/gl/gpu_switching_manager.h"
  69. using blink::WebInputEvent;
  70. using blink::WebMouseEvent;