Commit 5bef59f0 authored by Javier Ernesto Flores Robles's avatar Javier Ernesto Flores Robles Committed by Commit Bot

[iOS][MF] Consider iPad Pro Keyboard

On iPad Pro the keyboard layout is 3 points above the bottom, but not
one of its superview. The new checks goes up all the hierarchy until
the first view that is the size of the window. Then checks that it is
anchored to the bottom of the window.

Change-Id: I514910cd17253f9ad1f80ba11a2ba66aff6028a2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1860033Reviewed-by: default avatarOlivier Robin <olivierrobin@chromium.org>
Commit-Queue: Javier Ernesto Flores Robles <javierrobles@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705922}
parent 3279d13e
......@@ -172,12 +172,21 @@ id<GREYMatcher> KeyboardWindow(UIView* layout) {
// Returns YES if the keyboard is docked at the bottom. NO otherwise.
BOOL IsKeyboardDockedForLayout(UIView* layout) {
CGRect keyboardFrameInWindow = [layout.window convertRect:layout.bounds
fromView:layout];
CGRect windowBounds = layout.window.bounds;
CGFloat maxY = CGRectGetMaxY(keyboardFrameInWindow);
return [@(maxY) isEqualToNumber:@(windowBounds.size.height)];
UIView* viewToCompare = layout;
while (viewToCompare &&
viewToCompare.bounds.size.height < windowBounds.size.height) {
CGRect keyboardFrameInWindow =
[viewToCompare.window convertRect:viewToCompare.bounds
fromView:viewToCompare];
CGFloat maxY = CGRectGetMaxY(keyboardFrameInWindow);
if ([@(maxY) isEqualToNumber:@(windowBounds.size.height)]) {
return YES;
}
viewToCompare = viewToCompare.superview;
}
return NO;
}
// Undocks and split the keyboard by swiping it up. Does nothing if already
......
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