Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert windowLevel hack and instead use transparent image context. #1946

Open
wants to merge 8 commits into
base: chrome-fix
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions AppFramework/Keyboard/GREYKeyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ NS_ASSUME_NONNULL_BEGIN
inFirstResponder:(id)firstResponder
error:(__strong NSError **)errorOrNil;

/**
* @return @c YES if the keyboard is visible, @c NO otherwise.
*/
+ (BOOL)isKeyboardVisible;

/**
* Waits until the keyboard is visible on the screen.
*
Expand Down
4 changes: 0 additions & 4 deletions AppFramework/Keyboard/GREYKeyboard.m
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,6 @@ + (BOOL)typeString:(NSString *)string
return YES;
}

+ (BOOL)isKeyboardVisible {
return atomic_load(&gIsKeyboardShown);
}

+ (BOOL)waitForKeyboardToAppear {
if (atomic_load(&gIsKeyboardShown)) {
return YES;
Expand Down
7 changes: 2 additions & 5 deletions UILib/GREYScreenshotter.m
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ + (UIImage *)grey_takeScreenshotAfterScreenUpdates:(BOOL)afterScreenUpdates
inScreenRect:(CGRect)screenRect
withStatusBar:(BOOL)includeStatusBar
forDebugging:(BOOL)forDebugging {
UIGraphicsBeginImageContextWithOptions(screenRect.size, YES, 0);
UIGraphicsBeginImageContextWithOptions(screenRect.size, NO, 0);
[self drawScreenInContext:UIGraphicsGetCurrentContext()
afterScreenUpdates:afterScreenUpdates
inScreenRect:screenRect
Expand All @@ -151,11 +151,8 @@ + (void)drawScreenInContext:(CGContextRef)bitmapContextRef
// The bitmap context width and height are scaled, so we need to undo the scale adjustment.
NSEnumerator *allWindowsInReverse =
[[GREYUIWindowProvider allWindowsWithStatusBar:includeStatusBar] reverseObjectEnumerator];
CGFloat maxLevel = [GREYKeyboard isKeyboardVisible] ? 1 : 0;
for (UIWindow *window in allWindowsInReverse) {
if (window.hidden || window.alpha == 0 ||
(iOS17_OR_ABOVE() && [window respondsToSelector:@selector(windowLevel)] &&
window.windowLevel > maxLevel)) {
if (window.hidden || window.alpha == 0) {
continue;
}
[self drawViewInContext:bitmapContextRef
Expand Down