From 1ffe0d359087d18b8e6010ed9109129d47df075a Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Tue, 29 Aug 2023 09:03:02 -0400 Subject: [PATCH] Ladybird: Explicitly handle setting the AppKit web view's first viewport We were relying on TabController setting the web view's initial viewport in [TabController windowDidResize], which has been triggered when the Tab is first created. However, it turns out that only happens due to the toolbar being added to the Tab window, causing a resize event. When the web view is embedded in a window without a toolbar, this resize event is not triggered. Therefore, we must set the viewport ourselves when the web view is added to a window. --- Ladybird/AppKit/UI/LadybirdWebView.mm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Ladybird/AppKit/UI/LadybirdWebView.mm b/Ladybird/AppKit/UI/LadybirdWebView.mm index 14d44ff42f0..ce49a5ce4c9 100644 --- a/Ladybird/AppKit/UI/LadybirdWebView.mm +++ b/Ladybird/AppKit/UI/LadybirdWebView.mm @@ -907,6 +907,12 @@ static void copy_text_to_clipboard(StringView text) [super drawRect:rect]; } +- (void)viewDidMoveToWindow +{ + [super viewDidMoveToWindow]; + [self handleResize]; +} + - (void)viewDidEndLiveResize { [super viewDidEndLiveResize];