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

Respond to safe area inset changes (#4330)

On iOS 11 and above, update viewport padding and notify the framework
when changes to safe area insets occur.
上级 179bd4a7
......@@ -607,6 +607,28 @@ static inline blink::PointerData::DeviceKind DeviceKindFromTouchType(UITouch* to
_viewportMetrics.physical_width = viewSize.width * scale;
_viewportMetrics.physical_height = viewSize.height * scale;
[self updateViewportPadding];
[self updateViewportMetrics];
// This must run after updateViewportMetrics so that the surface creation tasks are queued after
// the viewport metrics update tasks.
if (firstViewBoundsUpdate)
[self surfaceUpdated:YES];
}
- (void)viewSafeAreaInsetsDidChange {
if (_platformSupportsSafeAreaInsets) {
[self updateViewportPadding];
[self updateViewportMetrics];
[super viewSafeAreaInsetsDidChange];
}
}
// Updates _viewportMetrics physical padding.
//
// Viewport padding represents the iOS safe area insets.
- (void)updateViewportPadding {
CGFloat scale = [UIScreen mainScreen].scale;
// TODO(cbracken) once clang toolchain compiler-rt has been updated, replace with
// if (@available(iOS 11, *)) {
if (_platformSupportsSafeAreaInsets) {
......@@ -623,12 +645,6 @@ static inline blink::PointerData::DeviceKind DeviceKindFromTouchType(UITouch* to
} else {
_viewportMetrics.physical_padding_top = [self statusBarPadding] * scale;
}
[self updateViewportMetrics];
// This must run after updateViewportMetrics so that the surface creation tasks are queued after
// the viewport metrics update tasks.
if (firstViewBoundsUpdate)
[self surfaceUpdated:YES];
}
#pragma mark - Keyboard events
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册