Align displaced remote content origin through AppKit coordinate conversion (build 49)
这个提交包含在:
1 父节点
3ba2c0b823
当前提交
2688b22f99
6 个文件已更改
+52
-3
没有与搜索条件相匹配的文件
@@ -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];
|
||||
|
||||
@@ -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."
|
||||
}
|
||||
@@ -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];
|
||||
|
||||
+13
-1
@@ -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];
|
||||
}
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.7.3</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>48</string>
|
||||
<string>49</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string></string>
|
||||
<key>PlugInKit</key>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.7.3</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>48</string>
|
||||
<string>49</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
||||
在新工单中引用
屏蔽一个用户