Align displaced remote content origin through AppKit coordinate conversion (build 49)

这个提交包含在:
mac 于 2026-11-02 22:41:37 +08:00 提交
1 父节点 3ba2c0b823
当前提交 2688b22f99
6 个文件已更改
+52 -3

没有与搜索条件相匹配的文件

+16
查看文件
@@ -53,6 +53,22 @@ int main(int argc,const char **argv){@autoreleasepool{
NSRect chosen=[local frameRectForContentRect:NSMakeRect(180,200,900,620)];[local setFrame:chosen display:NO];pump();
check(NSEqualRects(NSRectFromString([NSUserDefaults.standardUserDefaults stringForKey:key]),local.frame),@"local detached window still remembers user position and size");
check(!local.visible,@"local fallback geometry checks also remain invisible");[browser close];[browser release];
// Real More Space reproduction: the service window's content view itself
// arrives displaced, while its bounds and the plug-in child's frame agree.
// A frame==bounds assertion alone cannot detect the resulting gray area.
NSPanel *service=[[[NSPanel alloc]initWithContentRect:NSMakeRect(60,100,1800,1200) styleMask:NSWindowStyleMaskBorderless backing:NSBackingStoreBuffered defer:NO]autorelease];
NSView *content=service.contentView;content.autoresizingMask=NSViewMinXMargin|NSViewMaxXMargin|NSViewMinYMargin|NSViewMaxYMargin;
[content setFrameOrigin:NSMakePoint(789,521)];NSRect serviceFrame=service.frame;NSSize contentSize=content.frame.size;NSUInteger bridgeMask=content.autoresizingMask;
browser=[[DYLUTBrowser alloc]initWithLibrary:library preview:nil selectedPath:nil palette:@{} selection:nil];[browser showInRemoteParent:content close:nil];pump();root=[browser valueForKey:@"root"];
NSRect viewport=[service convertRectFromScreen:[service contentRectForFrameRect:service.frame]];
check(NSEqualRects([root convertRect:root.bounds toView:nil],viewport),@"displaced service content is aligned to the actual window viewport");
check(NSEqualRects(service.frame,serviceFrame)&&NSEqualSizes(content.frame.size,contentSize),@"content-origin repair never moves or resizes the host window or content");
check(content.autoresizingMask==bridgeMask,@"content-origin repair preserves the bridge's margin policy");
[content setFrameOrigin:NSMakePoint(123,77)];pump();
check(NSEqualRects([root convertRect:root.bounds toView:nil],viewport),@"a later bridge-origin displacement is realigned without a green-button resize");
[content setBoundsOrigin:NSMakePoint(17,23)];pump();
check(NSEqualRects([root convertRect:root.bounds toView:nil],viewport),@"content-origin repair also respects nonzero content bounds");
check(!service.visible,@"service-origin reproduction remains invisible");[browser close];[browser release];
for(NSString *item in NSUserDefaults.standardUserDefaults.dictionaryRepresentation.allKeys)if([item containsString:library.rootURL.path])[NSUserDefaults.standardUserDefaults removeObjectForKey:item];
[NSFileManager.defaultManager removeItemAtURL:directory error:nil];
BOOL pass=YES;for(NSDictionary *item in checks)pass&=[item[@"pass"]boolValue];