diff --git a/tools/verify_browser_remote_geometry.mm b/tools/verify_browser_remote_geometry.mm index a769152..1ee6e3f 100644 --- a/tools/verify_browser_remote_geometry.mm +++ b/tools/verify_browser_remote_geometry.mm @@ -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]; diff --git a/verification/MoreSpaceRegression1.7.3.json b/verification/MoreSpaceRegression1.7.3.json new file mode 100644 index 0000000..e8ae969 --- /dev/null +++ b/verification/MoreSpaceRegression1.7.3.json @@ -0,0 +1,13 @@ +{ + "baselineSource": "3ba2c0b823120da65e9b08f32928e73f7c6e962c", + "baselineFailures": [ + "displaced service content is aligned to the actual window viewport", + "a later bridge-origin displacement is realigned without a green-button resize", + "content-origin repair also respects nonzero content bounds" + ], + "geometryChecks": 27, + "geometryPass": true, + "browserChecks": 23, + "browserPass": true, + "scope": "Hidden native AppKit reproduction using the observed service content origin (789,521); visible final host validation still pending." +} diff --git a/大鱼调色/Plugin/DYDiagnostics.mm b/大鱼调色/Plugin/DYDiagnostics.mm index 617330b..dde1808 100644 --- a/大鱼调色/Plugin/DYDiagnostics.mm +++ b/大鱼调色/Plugin/DYDiagnostics.mm @@ -218,6 +218,14 @@ extern "C" int DYRunDiagnostics(void) { @autoreleasepool { [geometryParent setBoundsOrigin:NSMakePoint(17,23)];run.record(@"browser-remote-tracks-bounds-origin",NSEqualRects(geometryRoot.frame,geometryParent.bounds)); [geometryHost setFrame:NSMakeRect(140,160,1000,700) display:NO];run.record(@"browser-remote-keeps-local-history-isolated",[[NSUserDefaults.standardUserDefaults stringForKey:geometryKey]isEqual:staleGeometry]); [geometryBrowser close];[geometryBrowser close];run.record(@"browser-remote-close-once-without-visible-test-window",geometryCloses==1&&!geometryHost.visible); + NSPanel *serviceGeometry=[[[NSPanel alloc]initWithContentRect:NSMakeRect(60,100,1800,1200) styleMask:NSWindowStyleMaskBorderless backing:NSBackingStoreBuffered defer:NO]autorelease]; + NSView *serviceContent=serviceGeometry.contentView;[serviceContent setFrameOrigin:NSMakePoint(789,521)];NSRect serviceFrame=serviceGeometry.frame; + DYLUTBrowser *serviceBrowser=[[[DYLUTBrowser alloc]initWithLibrary:geometryLibrary preview:nil selectedPath:nil palette:@{} selection:nil]autorelease];[serviceBrowser showInRemoteParent:serviceContent close:nil]; + NSView *serviceRoot=[serviceBrowser valueForKey:@"root"];NSRect serviceViewport=[serviceGeometry convertRectFromScreen:[serviceGeometry contentRectForFrameRect:serviceGeometry.frame]]; + run.record(@"browser-remote-displaced-content-aligns-with-window",NSEqualRects([serviceRoot convertRect:serviceRoot.bounds toView:nil],serviceViewport)); + [serviceContent setFrameOrigin:NSMakePoint(123,77)]; + run.record(@"browser-remote-later-content-origin-is-repaired",NSEqualRects([serviceRoot convertRect:serviceRoot.bounds toView:nil],serviceViewport)); + run.record(@"browser-remote-origin-repair-keeps-host-frame-and-hidden-fixture",NSEqualRects(serviceGeometry.frame,serviceFrame)&&!serviceGeometry.visible);[serviceBrowser close]; for(NSString *key in NSUserDefaults.standardUserDefaults.dictionaryRepresentation.allKeys)if([key containsString:geometryLibrary.rootURL.path])[NSUserDefaults.standardUserDefaults removeObjectForKey:key]; DYDiagnosticManager *uiHost=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(uiHost,nil); DYInspector *inspector=[[[DYInspector alloc]initWithAPIManager:uiHost]autorelease];[inspector refresh]; diff --git a/大鱼调色/Plugin/DYLUTBrowser.mm b/大鱼调色/Plugin/DYLUTBrowser.mm index 3a7a8b3..02569a4 100644 --- a/大鱼调色/Plugin/DYLUTBrowser.mm +++ b/大鱼调色/Plugin/DYLUTBrowser.mm @@ -264,7 +264,7 @@ static NSButton *BrowserButton(NSString *title,id target,SEL action){NSButton *b // Follow the supplied parent without changing the bridge's resize policy. parent.postsFrameChangedNotifications=YES;parent.postsBoundsChangedNotifications=YES; for(NSNotificationName name in @[NSViewFrameDidChangeNotification,NSViewBoundsDidChangeNotification])[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(remoteParentGeometryChanged:) name:name object:parent]; - [parent addSubview:_root];[self layoutBrowser];[_root setNeedsDisplay:YES]; + [parent addSubview:_root];DYBrowserGeometrySample(_root,@"before-content-origin-alignment");[self fitRemoteParent]; DYBrowserGeometrySample(_root,@"attached-before-sdk-reply"); // Attach synchronously: the SDK reads the first child before reply returns. dispatch_async(dispatch_get_main_queue(),^{if(!_closed){[self configurePresentationWindow];DYBrowserGeometrySample(_root,@"after-sdk-reply");}}); @@ -273,6 +273,18 @@ static NSButton *BrowserButton(NSString *title,id target,SEL action){NSButton *b } - (void)fitRemoteParent{ NSView *parent=_root.superview;if(_closed||!_remoteMode||!parent)return; + // A scaled-display ViewBridge service can hand us its top-level content + // view with a stale frame origin (observed: 789,521 in an 1800x1200 window). + // Matching only its bounds keeps our child correct inside a displaced + // container. Align that content origin using AppKit's coordinate APIs; + // leave the host's window, content size and bridge resize policy intact. + NSWindow *window=parent.window; + if(window&&parent==window.contentView&&parent.superview){ + NSRect screenContent=[window contentRectForFrameRect:window.frame]; + NSRect windowContent=[window convertRectFromScreen:screenContent]; + NSPoint origin=[parent.superview convertPoint:windowContent.origin fromView:nil]; + if(std::isfinite(origin.x)&&std::isfinite(origin.y)&&!NSEqualPoints(parent.frame.origin,origin))[parent setFrameOrigin:origin]; + } if(!NSEqualRects(_root.frame,parent.bounds))_root.frame=parent.bounds; [self layoutBrowser];[_root setNeedsDisplay:YES]; } diff --git a/大鱼调色/Plugin/Info.plist b/大鱼调色/Plugin/Info.plist index 30f10a5..67dbb96 100644 --- a/大鱼调色/Plugin/Info.plist +++ b/大鱼调色/Plugin/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 1.7.3 CFBundleVersion - 48 + 49 NSHumanReadableCopyright PlugInKit diff --git a/大鱼调色/Wrapper Application/Info.plist b/大鱼调色/Wrapper Application/Info.plist index aa2e25e..3cb5549 100644 --- a/大鱼调色/Wrapper Application/Info.plist +++ b/大鱼调色/Wrapper Application/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 1.7.3 CFBundleVersion - 48 + 49 LSMinimumSystemVersion $(MACOSX_DEPLOYMENT_TARGET) NSHumanReadableCopyright