Commit 18af61b5 authored by Robert Sesek's avatar Robert Sesek Committed by Chromium LUCI CQ

mac: Remove code to support OS X 10.10 in //content

AX-Relnotes: n/a.
Bug: 1153883
Change-Id: Iff9f2d2dd72314f04c11b0b87ff2438655a16335
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2572177Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833503}
parent 39448275
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "base/debug/crash_logging.h" #include "base/debug/crash_logging.h"
#import "base/mac/foundation_util.h" #import "base/mac/foundation_util.h"
#include "base/mac/mac_util.h"
#include "base/numerics/ranges.h" #include "base/numerics/ranges.h"
#include "base/stl_util.h" #include "base/stl_util.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
...@@ -1215,38 +1214,6 @@ void ExtractUnderlines(NSAttributedString* string, ...@@ -1215,38 +1214,6 @@ void ExtractUnderlines(NSAttributedString* string,
} }
} }
- (void)beginGestureWithEvent:(NSEvent*)event {
// This method must be handled when linking with the 10.10 SDK or earlier, or
// when the app is running on 10.10 or earlier. In other circumstances, the
// event will be handled by |magnifyWithEvent:|, so this method should do
// nothing.
bool shouldHandle = true;
#if defined(MAC_OS_X_VERSION_10_11) && \
MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_11
shouldHandle = base::mac::IsAtMostOS10_10();
#endif
if (shouldHandle) {
[self handleBeginGestureWithEvent:event isSyntheticallyInjected:NO];
}
}
- (void)endGestureWithEvent:(NSEvent*)event {
// This method must be handled when linking with the 10.10 SDK or earlier, or
// when the app is running on 10.10 or earlier. In other circumstances, the
// event will be handled by |magnifyWithEvent:|, so this method should do
// nothing.
bool shouldHandle = true;
#if defined(MAC_OS_X_VERSION_10_11) && \
MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_11
shouldHandle = base::mac::IsAtMostOS10_10();
#endif
if (shouldHandle) {
[self handleEndGestureWithEvent:event];
}
}
- (void)touchesMovedWithEvent:(NSEvent*)event { - (void)touchesMovedWithEvent:(NSEvent*)event {
[_responderDelegate touchesMovedWithEvent:event]; [_responderDelegate touchesMovedWithEvent:event];
} }
...@@ -1304,22 +1271,14 @@ void ExtractUnderlines(NSAttributedString* string, ...@@ -1304,22 +1271,14 @@ void ExtractUnderlines(NSAttributedString* string,
// cancels the gesture, all remaining touches are forwarded to the content // cancels the gesture, all remaining touches are forwarded to the content
// scroll logic. The user cannot trigger the navigation logic again. // scroll logic. The user cannot trigger the navigation logic again.
- (void)scrollWheel:(NSEvent*)event { - (void)scrollWheel:(NSEvent*)event {
#if defined(MAC_OS_X_VERSION_10_11) && \ if (event.phase == NSEventPhaseBegan) {
MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_11 [self handleBeginGestureWithEvent:event isSyntheticallyInjected:NO];
// When linking against the 10.11 (or later) SDK and running on 10.11 or }
// later, check the phase of the event and specially handle the "begin" and
// "end" phases.
if (base::mac::IsAtLeastOS10_11()) {
if (event.phase == NSEventPhaseBegan) {
[self handleBeginGestureWithEvent:event isSyntheticallyInjected:NO];
}
if (event.phase == NSEventPhaseEnded || if (event.phase == NSEventPhaseEnded ||
event.phase == NSEventPhaseCancelled) { event.phase == NSEventPhaseCancelled) {
[self handleEndGestureWithEvent:event]; [self handleEndGestureWithEvent:event];
}
} }
#endif
if (_responderDelegate && if (_responderDelegate &&
[_responderDelegate respondsToSelector:@selector(handleEvent:)]) { [_responderDelegate respondsToSelector:@selector(handleEvent:)]) {
...@@ -1350,24 +1309,16 @@ void ExtractUnderlines(NSAttributedString* string, ...@@ -1350,24 +1309,16 @@ void ExtractUnderlines(NSAttributedString* string,
// Called repeatedly during a pinch gesture, with incremental change values. // Called repeatedly during a pinch gesture, with incremental change values.
- (void)magnifyWithEvent:(NSEvent*)event { - (void)magnifyWithEvent:(NSEvent*)event {
#if defined(MAC_OS_X_VERSION_10_11) && \ if (event.phase == NSEventPhaseBegan) {
MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_11 [self handleBeginGestureWithEvent:event isSyntheticallyInjected:NO];
// When linking against the 10.11 (or later) SDK and running on 10.11 or return;
// later, check the phase of the event and specially handle the "begin" and }
// "end" phases.
if (base::mac::IsAtLeastOS10_11()) {
if (event.phase == NSEventPhaseBegan) {
[self handleBeginGestureWithEvent:event isSyntheticallyInjected:NO];
return;
}
if (event.phase == NSEventPhaseEnded || if (event.phase == NSEventPhaseEnded ||
event.phase == NSEventPhaseCancelled) { event.phase == NSEventPhaseCancelled) {
[self handleEndGestureWithEvent:event]; [self handleEndGestureWithEvent:event];
return; return;
}
} }
#endif
// If this conditional evalutes to true, and the function has not // If this conditional evalutes to true, and the function has not
// short-circuited from the previous block, then this event is a duplicate of // short-circuited from the previous block, then this event is a duplicate of
......
...@@ -183,31 +183,21 @@ void BrowserAccessibilityManagerMac::FireGeneratedEvent( ...@@ -183,31 +183,21 @@ void BrowserAccessibilityManagerMac::FireGeneratedEvent(
if (!focus) if (!focus)
break; // Just fire a notification on the root. break; // Just fire a notification on the root.
if (base::mac::IsAtLeastOS10_11()) { NSDictionary* user_info =
// |NSAccessibilityPostNotificationWithUserInfo| should be used on OS X GetUserInfoForSelectedTextChangedNotification(focus_changed);
// 10.11 or later to notify Voiceover about text selection changes. This
// API has been present on versions of OS X since 10.7 but doesn't
// appear to be needed by Voiceover before version 10.11.
NSDictionary* user_info =
GetUserInfoForSelectedTextChangedNotification(focus_changed);
BrowserAccessibilityManager* root_manager = GetRootManager();
if (!root_manager)
return;
BrowserAccessibility* root = root_manager->GetRoot();
if (!root)
return;
NSAccessibilityPostNotificationWithUserInfo( BrowserAccessibilityManager* root_manager = GetRootManager();
ToBrowserAccessibilityCocoa(focus), mac_notification, user_info); if (!root_manager)
NSAccessibilityPostNotificationWithUserInfo(
ToBrowserAccessibilityCocoa(root), mac_notification, user_info);
return; return;
} else { BrowserAccessibility* root = root_manager->GetRoot();
NSAccessibilityPostNotification(ToBrowserAccessibilityCocoa(focus), if (!root)
mac_notification); return;
}
break; NSAccessibilityPostNotificationWithUserInfo(
ToBrowserAccessibilityCocoa(focus), mac_notification, user_info);
NSAccessibilityPostNotificationWithUserInfo(
ToBrowserAccessibilityCocoa(root), mac_notification, user_info);
return;
} }
case ui::AXEventGenerator::Event::EXPANDED: case ui::AXEventGenerator::Event::EXPANDED:
if (node->GetRole() == ax::mojom::Role::kRow || if (node->GetRole() == ax::mojom::Role::kRow ||
...@@ -330,7 +320,7 @@ void BrowserAccessibilityManagerMac::FireGeneratedEvent( ...@@ -330,7 +320,7 @@ void BrowserAccessibilityManagerMac::FireGeneratedEvent(
case ui::AXEventGenerator::Event::VALUE_IN_TEXT_FIELD_CHANGED: case ui::AXEventGenerator::Event::VALUE_IN_TEXT_FIELD_CHANGED:
DCHECK(node->IsTextField()); DCHECK(node->IsTextField());
mac_notification = NSAccessibilityValueChangedNotification; mac_notification = NSAccessibilityValueChangedNotification;
if (base::mac::IsAtLeastOS10_11() && !text_edits_.empty()) { if (!text_edits_.empty()) {
base::string16 deleted_text; base::string16 deleted_text;
base::string16 inserted_text; base::string16 inserted_text;
int32_t node_id = node->GetId(); int32_t node_id = node->GetId();
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/containers/queue.h" #include "base/containers/queue.h"
#include "base/mac/mac_util.h"
#include "base/mac/scoped_nsautorelease_pool.h" #include "base/mac/scoped_nsautorelease_pool.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
...@@ -1507,26 +1506,14 @@ class RenderWidgetHostViewMacPinchTest ...@@ -1507,26 +1506,14 @@ class RenderWidgetHostViewMacPinchTest
} }
} }
bool ShouldSendGestureEvents() {
#if defined(MAC_OS_X_VERSION_10_11) && \
MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_11
return base::mac::IsAtMostOS10_10();
#endif
return true;
}
void SendBeginPinchEvent() { void SendBeginPinchEvent() {
NSEvent* pinchBeginEvent = MockPinchEvent(NSEventPhaseBegan, 0); NSEvent* pinchBeginEvent = MockPinchEvent(NSEventPhaseBegan, 0);
if (ShouldSendGestureEvents())
[rwhv_cocoa_ beginGestureWithEvent:pinchBeginEvent];
[rwhv_cocoa_ magnifyWithEvent:pinchBeginEvent]; [rwhv_cocoa_ magnifyWithEvent:pinchBeginEvent];
} }
void SendEndPinchEvent() { void SendEndPinchEvent() {
NSEvent* pinchEndEvent = MockPinchEvent(NSEventPhaseEnded, 0); NSEvent* pinchEndEvent = MockPinchEvent(NSEventPhaseEnded, 0);
[rwhv_cocoa_ magnifyWithEvent:pinchEndEvent]; [rwhv_cocoa_ magnifyWithEvent:pinchEndEvent];
if (ShouldSendGestureEvents())
[rwhv_cocoa_ endGestureWithEvent:pinchEndEvent];
} }
const bool async_events_enabled_; const bool async_events_enabled_;
......
...@@ -81,10 +81,8 @@ ...@@ -81,10 +81,8 @@
[attrs setObject:paragraphStyle forKey:NSParagraphStyleAttributeName]; [attrs setObject:paragraphStyle forKey:NSParagraphStyleAttributeName];
if (item->has_text_direction_override) { if (item->has_text_direction_override) {
if (@available(macOS 10.11, *)) { [attrs setObject:@[ @(writingDirection | NSWritingDirectionOverride) ]
[attrs setObject:@[ @(writingDirection | NSWritingDirectionOverride) ] forKey:NSWritingDirectionAttributeName];
forKey:NSWritingDirectionAttributeName];
}
} }
[attrs setObject:[NSFont menuFontOfSize:_fontSize] [attrs setObject:[NSFont menuFontOfSize:_fontSize]
......
...@@ -264,10 +264,10 @@ TEST_F(SandboxMacTest, FontLoadingTest) { ...@@ -264,10 +264,10 @@ TEST_F(SandboxMacTest, FontLoadingTest) {
MULTIPROCESS_TEST_MAIN(BuiltinAvailable) { MULTIPROCESS_TEST_MAIN(BuiltinAvailable) {
CheckCreateSeatbeltServer(); CheckCreateSeatbeltServer();
if (__builtin_available(macOS 10.10, *)) { if (__builtin_available(macOS 10.11, *)) {
// Can't negate a __builtin_available condition. But success! // Can't negate a __builtin_available condition. But success!
} else { } else {
return 10; return 11;
} }
if (base::mac::IsAtLeastOS10_13()) { if (base::mac::IsAtLeastOS10_13()) {
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include <Cocoa/Cocoa.h> #include <Cocoa/Cocoa.h>
#include "base/bind.h" #include "base/bind.h"
#include "base/mac/mac_util.h"
#include "content/browser/renderer_host/render_widget_host_input_event_router.h" #include "content/browser/renderer_host/render_widget_host_input_event_router.h"
#include "content/browser/renderer_host/render_widget_host_view_mac.h" #include "content/browser/renderer_host/render_widget_host_view_mac.h"
#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_task_traits.h"
...@@ -252,14 +251,6 @@ id MockGestureEvent(NSEventType type, ...@@ -252,14 +251,6 @@ id MockGestureEvent(NSEventType type,
return event; return event;
} }
bool ShouldSendGestureEvents() {
#if defined(MAC_OS_X_VERSION_10_11) && \
MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_11
return base::mac::IsAtMostOS10_10();
#endif
return true;
}
void SendMacTouchpadPinchSequenceWithExpectedTarget( void SendMacTouchpadPinchSequenceWithExpectedTarget(
RenderWidgetHostViewBase* root_view, RenderWidgetHostViewBase* root_view,
const gfx::Point& gesture_point, const gfx::Point& gesture_point,
...@@ -271,8 +262,6 @@ void SendMacTouchpadPinchSequenceWithExpectedTarget( ...@@ -271,8 +262,6 @@ void SendMacTouchpadPinchSequenceWithExpectedTarget(
NSEvent* pinchBeginEvent = NSEvent* pinchBeginEvent =
MockGestureEvent(NSEventTypeMagnify, 0, gesture_point.x(), MockGestureEvent(NSEventTypeMagnify, 0, gesture_point.x(),
gesture_point.y(), NSEventPhaseBegan); gesture_point.y(), NSEventPhaseBegan);
if (ShouldSendGestureEvents())
[cocoa_view beginGestureWithEvent:pinchBeginEvent];
[cocoa_view magnifyWithEvent:pinchBeginEvent]; [cocoa_view magnifyWithEvent:pinchBeginEvent];
// We don't check the gesture target yet, since on mac the GesturePinchBegin // We don't check the gesture target yet, since on mac the GesturePinchBegin
// isn't sent until the first PinchUpdate. // isn't sent until the first PinchUpdate.
...@@ -290,8 +279,6 @@ void SendMacTouchpadPinchSequenceWithExpectedTarget( ...@@ -290,8 +279,6 @@ void SendMacTouchpadPinchSequenceWithExpectedTarget(
MockGestureEvent(NSEventTypeMagnify, 0, gesture_point.x(), MockGestureEvent(NSEventTypeMagnify, 0, gesture_point.x(),
gesture_point.y(), NSEventPhaseEnded); gesture_point.y(), NSEventPhaseEnded);
[cocoa_view magnifyWithEvent:pinchEndEvent]; [cocoa_view magnifyWithEvent:pinchEndEvent];
if (ShouldSendGestureEvents())
[cocoa_view endGestureWithEvent:pinchEndEvent];
EXPECT_EQ(nullptr, router_touchpad_gesture_target); EXPECT_EQ(nullptr, router_touchpad_gesture_target);
} }
......
...@@ -21,7 +21,7 @@ void SystemColorsDidChange(int aqua_color_variant, ...@@ -21,7 +21,7 @@ void SystemColorsDidChange(int aqua_color_variant,
// Register the defaults in the NSArgumentDomain, which is considered // Register the defaults in the NSArgumentDomain, which is considered
// volatile. Registering in the normal application domain fails from within // volatile. Registering in the normal application domain fails from within
// the sandbox on 10.10+. // the sandbox.
[defaults removeVolatileDomainForName:NSArgumentDomain]; [defaults removeVolatileDomainForName:NSArgumentDomain];
NSDictionary* domain_values = @{ NSDictionary* domain_values = @{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment