Align displaced remote content origin through AppKit coordinate conversion (build 49)
这个提交包含在:
1 父节点
3ba2c0b823
当前提交
2688b22f99
6 个文件已更改
+52
-3
没有与搜索条件相匹配的文件
@@ -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>
|
||||
|
||||
在新工单中引用
屏蔽一个用户