mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
UI/AppKit: Convert window origins sent from WebDriver to AppKit's origin
Window origins in AppKit are the bottom-left position of the NSWindow, relative to the bottom-left of the screen. So we must do some alignment of the top-left position received from WebDriver.
This commit is contained in:
parent
102a125ea5
commit
00a486d072
|
|
@ -1004,19 +1004,20 @@ static void copy_data_to_clipboard(StringView data, NSPasteboardType pasteboard_
|
|||
[[self window] orderFront:nil];
|
||||
};
|
||||
|
||||
m_web_view_bridge->on_reposition_window = [weak_self](auto const& position) {
|
||||
m_web_view_bridge->on_reposition_window = [weak_self](auto position) {
|
||||
LadybirdWebView* self = weak_self;
|
||||
if (self == nil) {
|
||||
return Gfx::IntPoint {};
|
||||
}
|
||||
auto frame = [[self window] frame];
|
||||
frame.origin = Ladybird::gfx_point_to_ns_point(position);
|
||||
[[self window] setFrame:frame display:YES];
|
||||
|
||||
return Ladybird::ns_point_to_gfx_point([[self window] frame].origin);
|
||||
position = Ladybird::compute_origin_relative_to_window([self window], position);
|
||||
[[self window] setFrameOrigin:Ladybird::gfx_point_to_ns_point(position)];
|
||||
|
||||
position = Ladybird::ns_point_to_gfx_point([[self window] frame].origin);
|
||||
return Ladybird::compute_origin_relative_to_window([self window], position);
|
||||
};
|
||||
|
||||
m_web_view_bridge->on_resize_window = [weak_self](auto const& size) {
|
||||
m_web_view_bridge->on_resize_window = [weak_self](auto size) {
|
||||
LadybirdWebView* self = weak_self;
|
||||
if (self == nil) {
|
||||
return Gfx::IntSize {};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user