Bug 1847154 - cocoa: remove some unnecessary OnMojaveOrLater() and OnCatalinaOrLater() version checks. r=mac-reviewers,bradwerth

Firefox versions >= 116 only support macOS >= 10.15. Mojave is macOS 10.14. Catalina is macOS 10.15.

Also stop including unused "nsCocoaFeatures.h" in files with no macOS version checks.

Differential Revision: https://phabricator.services.mozilla.com/D185505
This commit is contained in:
Chris Peterson 2023-08-10 15:27:05 +00:00
parent 0625a2a435
commit d34094627d
15 changed files with 6 additions and 62 deletions

View File

@ -9,7 +9,6 @@
#include <ApplicationServices/ApplicationServices.h>
#include "../../../xpcom/io/CocoaFileUtils.h"
#include "nsCocoaFeatures.h"
#include "nsString.h"
using namespace mozilla;

View File

@ -9,7 +9,6 @@
#include "nsIConsoleService.h"
#include "nsServiceManagerUtils.h"
#include "CoreLocationLocationProvider.h"
#include "nsCocoaFeatures.h"
#include "prtime.h"
#include "mozilla/FloatingPoint.h"
#include "mozilla/Telemetry.h"

View File

@ -7,7 +7,6 @@
#include "nsOSPermissionRequest.h"
#include "mozilla/dom/Promise.h"
#include "nsCocoaFeatures.h"
#include "nsCocoaUtils.h"
using namespace mozilla;
@ -17,42 +16,23 @@ using mozilla::dom::Promise;
NS_IMETHODIMP
nsOSPermissionRequest::GetAudioCapturePermissionState(uint16_t* aAudio) {
MOZ_ASSERT(aAudio);
if (!nsCocoaFeatures::OnMojaveOrLater()) {
return nsOSPermissionRequestBase::GetAudioCapturePermissionState(aAudio);
}
return nsCocoaUtils::GetAudioCapturePermissionState(*aAudio);
}
NS_IMETHODIMP
nsOSPermissionRequest::GetVideoCapturePermissionState(uint16_t* aVideo) {
MOZ_ASSERT(aVideo);
if (!nsCocoaFeatures::OnMojaveOrLater()) {
return nsOSPermissionRequestBase::GetVideoCapturePermissionState(aVideo);
}
return nsCocoaUtils::GetVideoCapturePermissionState(*aVideo);
}
NS_IMETHODIMP
nsOSPermissionRequest::GetScreenCapturePermissionState(uint16_t* aScreen) {
MOZ_ASSERT(aScreen);
if (!nsCocoaFeatures::OnCatalinaOrLater()) {
return nsOSPermissionRequestBase::GetScreenCapturePermissionState(aScreen);
}
return nsCocoaUtils::GetScreenCapturePermissionState(*aScreen);
}
NS_IMETHODIMP
nsOSPermissionRequest::RequestVideoCapturePermission(JSContext* aCx, Promise** aPromiseOut) {
if (!nsCocoaFeatures::OnMojaveOrLater()) {
return nsOSPermissionRequestBase::RequestVideoCapturePermission(aCx, aPromiseOut);
}
RefPtr<Promise> promiseHandle;
nsresult rv = GetPromise(aCx, promiseHandle);
if (NS_FAILED(rv)) {
@ -66,10 +46,6 @@ nsOSPermissionRequest::RequestVideoCapturePermission(JSContext* aCx, Promise** a
NS_IMETHODIMP
nsOSPermissionRequest::RequestAudioCapturePermission(JSContext* aCx, Promise** aPromiseOut) {
if (!nsCocoaFeatures::OnMojaveOrLater()) {
return nsOSPermissionRequestBase::RequestAudioCapturePermission(aCx, aPromiseOut);
}
RefPtr<Promise> promiseHandle;
nsresult rv = GetPromise(aCx, promiseHandle);
if (NS_FAILED(rv)) {
@ -83,9 +59,5 @@ nsOSPermissionRequest::RequestAudioCapturePermission(JSContext* aCx, Promise** a
NS_IMETHODIMP
nsOSPermissionRequest::MaybeRequestScreenCapturePermission() {
if (!nsCocoaFeatures::OnCatalinaOrLater()) {
return nsOSPermissionRequestBase::MaybeRequestScreenCapturePermission();
}
return nsCocoaUtils::MaybeRequestScreenCapturePermission();
}

View File

@ -10,10 +10,6 @@
#include "nsTextNode.h"
#include "imgIContainer.h"
#ifdef XP_MACOSX
# include "nsCocoaFeatures.h"
#endif
using namespace mozilla::dom;
namespace mozilla::widget {
@ -121,10 +117,7 @@ auto TextRecognition::DoFindText(gfx::DataSourceSurface&,
bool TextRecognition::IsSupported() {
#ifdef XP_MACOSX
// Catalina (10.15) or higher is required because of the following API:
// VNRecognizeTextRequest - macOS 10.15+
// https://developer.apple.com/documentation/vision/vnrecognizetextrequest?language=objc
return nsCocoaFeatures::OnCatalinaOrLater();
return true;
#else
return false;
#endif

View File

@ -6,17 +6,12 @@
#include "MediaHardwareKeysEventSourceMac.h"
#include "MediaHardwareKeysEventSourceMacMediaCenter.h"
#include "nsCocoaFeatures.h"
namespace mozilla {
namespace widget {
mozilla::dom::MediaControlKeySource* CreateMediaControlKeySource() {
if (nsCocoaFeatures::IsAtLeastVersion(10, 12, 2)) {
return new MediaHardwareKeysEventSourceMacMediaCenter();
} else {
return new MediaHardwareKeysEventSourceMac();
}
return new MediaHardwareKeysEventSourceMacMediaCenter();
}
} // namespace widget

View File

@ -28,7 +28,6 @@
#include "nsIFrame.h"
#include "nsPresContext.h"
#include "nsDeviceContext.h"
#include "nsCocoaFeatures.h"
namespace mozilla {

View File

@ -19,7 +19,6 @@
#include "mozilla/ToString.h"
#include "nsChildView.h"
#include "nsCocoaFeatures.h"
#include "nsObjCExceptions.h"
#include "nsBidiUtils.h"
#include "nsToolkit.h"
@ -4681,7 +4680,7 @@ bool IMEInputHandler::OnHandleEvent(NSEvent* aEvent) {
}
bool allowConsumeEvent = true;
if (nsCocoaFeatures::OnCatalinaOrLater() && !IsIMEComposing()) {
if (!IsIMEComposing()) {
// Hack for bug of Korean IMEs on Catalina (10.15).
// If we are inactivated during composition, active Korean IME keeps
// consuming all mousedown events of any mouse buttons. So, we should

View File

@ -9,7 +9,6 @@
#import <objc/message.h>
#include "nsChildView.h"
#include "nsCocoaFeatures.h"
#include "SDKDeclarations.h"
using namespace mozilla;

View File

@ -52,7 +52,6 @@
#include "nsClipboard.h"
#include "nsCursorManager.h"
#include "nsWindowMap.h"
#include "nsCocoaFeatures.h"
#include "nsCocoaUtils.h"
#include "nsMenuUtilsX.h"
#include "nsMenuBarX.h"

View File

@ -17,7 +17,6 @@
#include "nsCocoaUtils.h"
#include "nsChildView.h"
#include "nsMenuBarX.h"
#include "nsCocoaFeatures.h"
#include "nsCocoaWindow.h"
#include "nsCOMPtr.h"
#include "nsIInterfaceRequestorUtils.h"

View File

@ -4210,7 +4210,8 @@ static bool ShouldShiftByMenubarHeightInFullscreen(nsCocoaWindow* aWindow) {
// shadowOptions method on the various window types.
static const NSUInteger kWindowShadowOptionsNoShadow = 0;
static const NSUInteger kWindowShadowOptionsMenu = 2;
static const NSUInteger kWindowShadowOptionsTooltipMojaveOrLater = 4;
static const NSUInteger kWindowShadowOptionsTooltip = 4;
- (NSUInteger)shadowOptions {
if (!self.hasShadow) {
return kWindowShadowOptionsNoShadow;
@ -4225,10 +4226,7 @@ static const NSUInteger kWindowShadowOptionsTooltipMojaveOrLater = 4;
return kWindowShadowOptionsMenu;
case StyleWindowShadow::Tooltip:
if (nsCocoaFeatures::OnMojaveOrLater()) {
return kWindowShadowOptionsTooltipMojaveOrLater;
}
return kWindowShadowOptionsMenu;
return kWindowShadowOptionsTooltip;
}
}

View File

@ -9,7 +9,6 @@
#include "nsCocoaFeatures.h"
#include "nsNativeThemeColors.h"
#include "nsStyleConsts.h"
#include "nsCocoaFeatures.h"
#include "nsIContent.h"
#include "gfxFont.h"
#include "gfxFontConstants.h"

View File

@ -8,7 +8,6 @@
#import <Cocoa/Cocoa.h>
#include "nsCocoaFeatures.h"
#include "SDKDeclarations.h"
#include "mozilla/ColorScheme.h"

View File

@ -101,10 +101,6 @@ static void debug_RegisterPrefCallbacks();
static int32_t gNumWidgets;
#endif
#ifdef XP_MACOSX
# include "nsCocoaFeatures.h"
#endif
using namespace mozilla::dom;
using namespace mozilla::layers;
using namespace mozilla::ipc;

View File

@ -5,7 +5,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "CocoaFileUtils.h"
#include "nsCocoaFeatures.h"
#include "nsCocoaUtils.h"
#include <Cocoa/Cocoa.h>
#include "nsObjCExceptions.h"