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 @@
#include "base/debug/crash_logging.h"
#import "base/mac/foundation_util.h"
#include "base/mac/mac_util.h"
#include "base/numerics/ranges.h"
#include "base/stl_util.h"
#include "base/strings/sys_string_conversions.h"
......@@ -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 {
[_responderDelegate touchesMovedWithEvent:event];
}
......@@ -1304,22 +1271,14 @@ void ExtractUnderlines(NSAttributedString* string,
// cancels the gesture, all remaining touches are forwarded to the content
// scroll logic. The user cannot trigger the navigation logic again.
- (void)scrollWheel:(NSEvent*)event {
#if defined(MAC_OS_X_VERSION_10_11) && \
MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_11
// 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 == NSEventPhaseBegan) {
[self handleBeginGestureWithEvent:event isSyntheticallyInjected:NO];
}
if (event.phase == NSEventPhaseEnded ||
event.phase == NSEventPhaseCancelled) {
[self handleEndGestureWithEvent:event];
}
if (event.phase == NSEventPhaseEnded ||
event.phase == NSEventPhaseCancelled) {
[self handleEndGestureWithEvent:event];
}
#endif
if (_responderDelegate &&
[_responderDelegate respondsToSelector:@selector(handleEvent:)]) {
......@@ -1350,24 +1309,16 @@ void ExtractUnderlines(NSAttributedString* string,
// Called repeatedly during a pinch gesture, with incremental change values.
- (void)magnifyWithEvent:(NSEvent*)event {
#if defined(MAC_OS_X_VERSION_10_11) && \
MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_11
// 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];
return;
}
if (event.phase == NSEventPhaseBegan) {
[self handleBeginGestureWithEvent:event isSyntheticallyInjected:NO];
return;
}
if (event.phase == NSEventPhaseEnded ||
event.phase == NSEventPhaseCancelled) {
[self handleEndGestureWithEvent:event];
return;
}
if (event.phase == NSEventPhaseEnded ||
event.phase == NSEventPhaseCancelled) {
[self handleEndGestureWithEvent:event];
return;
}
#endif
// If this conditional evalutes to true, and the function has not
// short-circuited from the previous block, then this event is a duplicate of
......
......@@ -183,31 +183,21 @@ void BrowserAccessibilityManagerMac::FireGeneratedEvent(
if (!focus)
break; // Just fire a notification on the root.
if (base::mac::IsAtLeastOS10_11()) {
// |NSAccessibilityPostNotificationWithUserInfo| should be used on OS X
// 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;
NSDictionary* user_info =
GetUserInfoForSelectedTextChangedNotification(focus_changed);
NSAccessibilityPostNotificationWithUserInfo(
ToBrowserAccessibilityCocoa(focus), mac_notification, user_info);
NSAccessibilityPostNotificationWithUserInfo(
ToBrowserAccessibilityCocoa(root), mac_notification, user_info);
BrowserAccessibilityManager* root_manager = GetRootManager();
if (!root_manager)
return;
} else {
NSAccessibilityPostNotification(ToBrowserAccessibilityCocoa(focus),
mac_notification);
}
break;
BrowserAccessibility* root = root_manager->GetRoot();
if (!root)
return;
NSAccessibilityPostNotificationWithUserInfo(
ToBrowserAccessibilityCocoa(focus), mac_notification, user_info);
NSAccessibilityPostNotificationWithUserInfo(
ToBrowserAccessibilityCocoa(root), mac_notification, user_info);
return;
}
case ui::AXEventGenerator::Event::EXPANDED:
if (node->GetRole() == ax::mojom::Role::kRow ||
......@@ -330,7 +320,7 @@ void BrowserAccessibilityManagerMac::FireGeneratedEvent(
case ui::AXEventGenerator::Event::VALUE_IN_TEXT_FIELD_CHANGED:
DCHECK(node->IsTextField());
mac_notification = NSAccessibilityValueChangedNotification;
if (base::mac::IsAtLeastOS10_11() && !text_edits_.empty()) {
if (!text_edits_.empty()) {
base::string16 deleted_text;
base::string16 inserted_text;
int32_t node_id = node->GetId();
......
......@@ -11,7 +11,6 @@
#include "base/command_line.h"
#include "base/containers/queue.h"
#include "base/mac/mac_util.h"
#include "base/mac/scoped_nsautorelease_pool.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
......@@ -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() {
NSEvent* pinchBeginEvent = MockPinchEvent(NSEventPhaseBegan, 0);
if (ShouldSendGestureEvents())
[rwhv_cocoa_ beginGestureWithEvent:pinchBeginEvent];
[rwhv_cocoa_ magnifyWithEvent:pinchBeginEvent];
}
void SendEndPinchEvent() {
NSEvent* pinchEndEvent = MockPinchEvent(NSEventPhaseEnded, 0);
[rwhv_cocoa_ magnifyWithEvent:pinchEndEvent];
if (ShouldSendGestureEvents())
[rwhv_cocoa_ endGestureWithEvent:pinchEndEvent];
}
const bool async_events_enabled_;
......
......@@ -81,10 +81,8 @@
[attrs setObject:paragraphStyle forKey:NSParagraphStyleAttributeName];
if (item->has_text_direction_override) {
if (@available(macOS 10.11, *)) {
[attrs setObject:@[ @(writingDirection | NSWritingDirectionOverride) ]
forKey:NSWritingDirectionAttributeName];
}
[attrs setObject:@[ @(writingDirection | NSWritingDirectionOverride) ]
forKey:NSWritingDirectionAttributeName];
}
[attrs setObject:[NSFont menuFontOfSize:_fontSize]
......
......@@ -264,10 +264,10 @@ TEST_F(SandboxMacTest, FontLoadingTest) {
MULTIPROCESS_TEST_MAIN(BuiltinAvailable) {
CheckCreateSeatbeltServer();
if (__builtin_available(macOS 10.10, *)) {
if (__builtin_available(macOS 10.11, *)) {
// Can't negate a __builtin_available condition. But success!
} else {
return 10;
return 11;
}
if (base::mac::IsAtLeastOS10_13()) {
......
......@@ -7,7 +7,6 @@
#include <Cocoa/Cocoa.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_view_mac.h"
#include "content/public/browser/browser_task_traits.h"
......@@ -252,14 +251,6 @@ id MockGestureEvent(NSEventType type,
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(
RenderWidgetHostViewBase* root_view,
const gfx::Point& gesture_point,
......@@ -271,8 +262,6 @@ void SendMacTouchpadPinchSequenceWithExpectedTarget(
NSEvent* pinchBeginEvent =
MockGestureEvent(NSEventTypeMagnify, 0, gesture_point.x(),
gesture_point.y(), NSEventPhaseBegan);
if (ShouldSendGestureEvents())
[cocoa_view beginGestureWithEvent:pinchBeginEvent];
[cocoa_view magnifyWithEvent:pinchBeginEvent];
// We don't check the gesture target yet, since on mac the GesturePinchBegin
// isn't sent until the first PinchUpdate.
......@@ -290,8 +279,6 @@ void SendMacTouchpadPinchSequenceWithExpectedTarget(
MockGestureEvent(NSEventTypeMagnify, 0, gesture_point.x(),
gesture_point.y(), NSEventPhaseEnded);
[cocoa_view magnifyWithEvent:pinchEndEvent];
if (ShouldSendGestureEvents())
[cocoa_view endGestureWithEvent:pinchEndEvent];
EXPECT_EQ(nullptr, router_touchpad_gesture_target);
}
......
......@@ -21,7 +21,7 @@ void SystemColorsDidChange(int aqua_color_variant,
// Register the defaults in the NSArgumentDomain, which is considered
// volatile. Registering in the normal application domain fails from within
// the sandbox on 10.10+.
// the sandbox.
[defaults removeVolatileDomainForName:NSArgumentDomain];
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