未验证 提交 521c73de 编写于 作者: C Chris Bracken 提交者: GitHub

Revert "Use @Available checks for iOS 11 features (#4596)" (#4597)

This reverts commit 89b6d435.

Apparently the clang toolchain is still hitting issues. Will give this
another go after the next clang toolchain update.
上级 89b6d435
...@@ -81,6 +81,7 @@ class PlatformMessageResponseDarwin : public blink::PlatformMessageResponse { ...@@ -81,6 +81,7 @@ class PlatformMessageResponseDarwin : public blink::PlatformMessageResponse {
bool _platformSupportsTouchTypes; bool _platformSupportsTouchTypes;
bool _platformSupportsTouchPressure; bool _platformSupportsTouchPressure;
bool _platformSupportsTouchOrientationAndTilt; bool _platformSupportsTouchOrientationAndTilt;
bool _platformSupportsSafeAreaInsets;
BOOL _initialized; BOOL _initialized;
BOOL _connected; BOOL _connected;
} }
...@@ -129,6 +130,7 @@ class PlatformMessageResponseDarwin : public blink::PlatformMessageResponse { ...@@ -129,6 +130,7 @@ class PlatformMessageResponseDarwin : public blink::PlatformMessageResponse {
_platformSupportsTouchTypes = fml::IsPlatformVersionAtLeast(9); _platformSupportsTouchTypes = fml::IsPlatformVersionAtLeast(9);
_platformSupportsTouchPressure = fml::IsPlatformVersionAtLeast(9); _platformSupportsTouchPressure = fml::IsPlatformVersionAtLeast(9);
_platformSupportsTouchOrientationAndTilt = fml::IsPlatformVersionAtLeast(9, 1); _platformSupportsTouchOrientationAndTilt = fml::IsPlatformVersionAtLeast(9, 1);
_platformSupportsSafeAreaInsets = fml::IsPlatformVersionAtLeast(11, 0);
_orientationPreferences = UIInterfaceOrientationMaskAll; _orientationPreferences = UIInterfaceOrientationMaskAll;
_statusBarStyle = UIStatusBarStyleDefault; _statusBarStyle = UIStatusBarStyleDefault;
...@@ -619,9 +621,11 @@ static inline blink::PointerData::DeviceKind DeviceKindFromTouchType(UITouch* to ...@@ -619,9 +621,11 @@ static inline blink::PointerData::DeviceKind DeviceKindFromTouchType(UITouch* to
} }
- (void)viewSafeAreaInsetsDidChange { - (void)viewSafeAreaInsetsDidChange {
[self updateViewportPadding]; if (_platformSupportsSafeAreaInsets) {
[self updateViewportMetrics]; [self updateViewportPadding];
[super viewSafeAreaInsetsDidChange]; [self updateViewportMetrics];
[super viewSafeAreaInsetsDidChange];
}
} }
// Updates _viewportMetrics physical padding. // Updates _viewportMetrics physical padding.
...@@ -629,11 +633,16 @@ static inline blink::PointerData::DeviceKind DeviceKindFromTouchType(UITouch* to ...@@ -629,11 +633,16 @@ static inline blink::PointerData::DeviceKind DeviceKindFromTouchType(UITouch* to
// Viewport padding represents the iOS safe area insets. // Viewport padding represents the iOS safe area insets.
- (void)updateViewportPadding { - (void)updateViewportPadding {
CGFloat scale = [UIScreen mainScreen].scale; CGFloat scale = [UIScreen mainScreen].scale;
if (@available(iOS 11, *)) { // TODO(cbracken) once clang toolchain compiler-rt has been updated, replace with
// if (@available(iOS 11, *)) {
if (_platformSupportsSafeAreaInsets) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunguarded-availability-new"
_viewportMetrics.physical_padding_top = self.view.safeAreaInsets.top * scale; _viewportMetrics.physical_padding_top = self.view.safeAreaInsets.top * scale;
_viewportMetrics.physical_padding_left = self.view.safeAreaInsets.left * scale; _viewportMetrics.physical_padding_left = self.view.safeAreaInsets.left * scale;
_viewportMetrics.physical_padding_right = self.view.safeAreaInsets.right * scale; _viewportMetrics.physical_padding_right = self.view.safeAreaInsets.right * scale;
_viewportMetrics.physical_padding_bottom = self.view.safeAreaInsets.bottom * scale; _viewportMetrics.physical_padding_bottom = self.view.safeAreaInsets.bottom * scale;
#pragma clang diagnostic pop
} else { } else {
_viewportMetrics.physical_padding_top = [self statusBarPadding] * scale; _viewportMetrics.physical_padding_top = [self statusBarPadding] * scale;
} }
...@@ -819,8 +828,11 @@ constexpr CGFloat kStandardStatusBarHeight = 20.0; ...@@ -819,8 +828,11 @@ constexpr CGFloat kStandardStatusBarHeight = 20.0;
- (void)handleStatusBarTouches:(UIEvent*)event { - (void)handleStatusBarTouches:(UIEvent*)event {
CGFloat standardStatusBarHeight = kStandardStatusBarHeight; CGFloat standardStatusBarHeight = kStandardStatusBarHeight;
if (@available(iOS 11, *)) { if (_platformSupportsSafeAreaInsets) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunguarded-availability-new"
standardStatusBarHeight = self.view.safeAreaInsets.top; standardStatusBarHeight = self.view.safeAreaInsets.top;
#pragma clang diagnostic pop
} }
// If the status bar is double-height, don't handle status bar taps. iOS // If the status bar is double-height, don't handle status bar taps. iOS
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册