UI/AppKit: Handle window resize events during live resizing
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Build Dev Container Image / build (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run

This lets us redraw the WebView while live resize events are ongoing. By
doing so, we can also update the window rect from within the WebView,
rather than requiring a separate method invocation (which the Inspector
and Task Manager windows were missing).
This commit is contained in:
Timothy Flynn 2024-11-08 13:36:20 -05:00 committed by Tim Flynn
parent 3bbe1b0c62
commit 4ae1bca67d
Notes: github-actions[bot] 2024-11-08 20:32:04 +00:00
4 changed files with 6 additions and 12 deletions

View file

@ -55,9 +55,7 @@
- (void)windowDidResize:(NSNotification*)notification - (void)windowDidResize:(NSNotification*)notification
{ {
if (![[self window] inLiveResize]) { [[[self inspector] web_view] handleResize];
[[[self inspector] web_view] handleResize];
}
} }
- (void)windowDidChangeBackingProperties:(NSNotification*)notification - (void)windowDidChangeBackingProperties:(NSNotification*)notification

View file

@ -196,6 +196,9 @@ struct HideCursor {
- (void)handleResize - (void)handleResize
{ {
auto size = Ladybird::ns_size_to_gfx_size([[self window] frame].size);
[self setWindowSize:size];
[self updateViewportRect]; [self updateViewportRect];
[self updateStatusLabelPosition]; [self updateStatusLabelPosition];
} }

View file

@ -623,12 +623,7 @@ static NSString* const TOOLBAR_TAB_OVERVIEW_IDENTIFIER = @"ToolbarTabOverviewIde
self.location_toolbar_item_width = [[[self.location_toolbar_item view] widthAnchor] constraintEqualToConstant:width]; self.location_toolbar_item_width = [[[self.location_toolbar_item view] widthAnchor] constraintEqualToConstant:width];
self.location_toolbar_item_width.active = YES; self.location_toolbar_item_width.active = YES;
if (![[self window] inLiveResize]) { [[[self tab] web_view] handleResize];
[[[self tab] web_view] handleResize];
}
auto size = Ladybird::ns_size_to_gfx_size([[self tab] frame].size);
[[[self tab] web_view] setWindowSize:size];
} }
- (void)windowDidChangeBackingProperties:(NSNotification*)notification - (void)windowDidChangeBackingProperties:(NSNotification*)notification

View file

@ -54,9 +54,7 @@
- (void)windowDidResize:(NSNotification*)notification - (void)windowDidResize:(NSNotification*)notification
{ {
if (![[self window] inLiveResize]) { [[[self taskManager] web_view] handleResize];
[[[self taskManager] web_view] handleResize];
}
} }
- (void)windowDidChangeBackingProperties:(NSNotification*)notification - (void)windowDidChangeBackingProperties:(NSNotification*)notification