@@ -193,12 +193,11 @@ void store(WKWebView* webView)
193
193
static constexpr CGFloat kFullScreenWindowCornerRadius = 12 ;
194
194
static constexpr CGFloat kDarknessAnimationDuration = 0.6 ;
195
195
static constexpr CGFloat kOutgoingWindowFadeDuration = 0.4 ;
196
- static constexpr CGFloat kOutgoingWindowTranslationDuration = 0.6 ;
197
196
static constexpr CGFloat kOutgoingWindowZOffset = -150 ;
198
197
static constexpr CGFloat kIncomingWindowFadeDuration = 0.6 ;
199
198
static constexpr CGFloat kIncomingWindowFadeDelay = 0.2 ;
200
- static constexpr CGFloat kIncomingWindowTranslationDuration = 0.6 ;
201
199
static constexpr CGFloat kIncomingWindowZOffset = -170 ;
200
+ static constexpr CGFloat kWindowTranslationDuration = 0.6 ;
202
201
static constexpr NSString *kPrefersFullScreenDimmingKey = @" WebKitPrefersFullScreenDimming" ;
203
202
#endif
204
203
@@ -476,12 +475,17 @@ @interface WKFullScreenParentWindowState : NSObject
476
475
@property (nonatomic , readonly ) RSSSceneChromeOptions sceneChromeOptions;
477
476
@property (nonatomic , readonly ) MRUISceneResizingBehavior sceneResizingBehavior;
478
477
@property (nonatomic , readonly ) MRUIDarknessPreference preferredDarkness;
478
+ @property (nonatomic , readonly ) BOOL prefersOrnamentsHidden;
479
+
480
+ @property (nonatomic , readonly ) NSMapTable <MRUIPlatterOrnament *, NSNumber *> *ornamentDepths;
479
481
480
482
- (id )initWithWindow : (UIWindow *)window ;
481
483
482
484
@end
483
485
484
- @implementation WKFullScreenParentWindowState
486
+ @implementation WKFullScreenParentWindowState {
487
+ RetainPtr<NSMapTable <MRUIPlatterOrnament *, NSNumber *>> _ornamentDepths;
488
+ }
485
489
486
490
- (id )initWithWindow : (UIWindow *)window
487
491
{
@@ -490,14 +494,28 @@ - (id)initWithWindow:(UIWindow *)window
490
494
491
495
_transform3D = window.transform3D ;
492
496
_windowClass = object_getClass (window);
493
- _sceneMinimumSize = window.windowScene .sizeRestrictions .minimumSize ;
494
- _sceneChromeOptions = window.windowScene .mrui_placement .preferredChromeOptions ;
495
- _sceneResizingBehavior = window.windowScene .mrui_placement .preferredResizingBehavior ;
496
497
_preferredDarkness = UIApplication.sharedApplication .mrui_activeStage .preferredDarkness ;
497
498
499
+ UIWindowScene *windowScene = window.windowScene ;
500
+ _sceneMinimumSize = windowScene.sizeRestrictions .minimumSize ;
501
+ _sceneChromeOptions = windowScene.mrui_placement .preferredChromeOptions ;
502
+ _sceneResizingBehavior = windowScene.mrui_placement .preferredResizingBehavior ;
503
+ _prefersOrnamentsHidden = windowScene.prefersOrnamentsHidden_forLMKOnly ;
504
+
505
+ _ornamentDepths = [NSMapTable weakToStrongObjectsMapTable ];
506
+
507
+ MRUIPlatterOrnamentManager *ornamentManager = windowScene._mrui_platterOrnamentManager ;
508
+ for (MRUIPlatterOrnament *ornament in ornamentManager.ornaments )
509
+ [_ornamentDepths setObject: @(ornament._depthDisplacement) forKey: ornament];
510
+
498
511
return self;
499
512
}
500
513
514
+ - (NSMapTable <MRUIPlatterOrnament *, NSNumber *> *)ornamentDepths
515
+ {
516
+ return _ornamentDepths.get ();
517
+ }
518
+
501
519
@end
502
520
503
521
@interface WKFullscreenWindowSceneDelegate : NSObject <MRUIWindowSceneDelegate>
@@ -1557,16 +1575,31 @@ - (void)_performSpatialFullScreenTransition:(BOOL)enter completionHandler:(Compl
1557
1575
1558
1576
[UIView animateWithDuration: kOutgoingWindowFadeDuration delay: 0 options: UIViewAnimationOptionCurveEaseInOut animations: ^{
1559
1577
outWindow.alpha = 0 ;
1578
+ if (enter)
1579
+ outWindow.windowScene .prefersOrnamentsHidden_forLMKOnly = YES ;
1560
1580
} completion: nil ];
1561
1581
1562
- [UIView animateWithDuration: kOutgoingWindowTranslationDuration delay: 0 options: UIViewAnimationOptionCurveEaseInOut animations: ^{
1582
+ [UIView animateWithDuration: kWindowTranslationDuration delay: 0 options: UIViewAnimationOptionCurveEaseInOut animations: ^{
1563
1583
outWindow.transform3D = CATransform3DTranslate (outWindow.transform3D , 0 , 0 , kOutgoingWindowZOffset );
1564
1584
} completion: nil ];
1565
1585
1566
- [UIView animateWithDuration: kIncomingWindowTranslationDuration delay: 0 options: UIViewAnimationOptionCurveEaseInOut animations: ^{
1586
+ [UIView animateWithDuration: kWindowTranslationDuration delay: 0 options: UIViewAnimationOptionCurveEaseInOut animations: ^{
1567
1587
inWindow.transform3D = originalState.transform3D ;
1568
1588
} completion: nil ];
1569
1589
1590
+ for (MRUIPlatterOrnament *ornament in originalState.ornamentDepths ) {
1591
+ CGFloat originalDepth = [[originalState.ornamentDepths objectForKey: ornament] floatValue ];
1592
+ CGFloat finalDepth = originalDepth;
1593
+ if (enter)
1594
+ finalDepth += kOutgoingWindowZOffset ;
1595
+ else
1596
+ [ornament _setDepthDisplacement: originalDepth + kIncomingWindowZOffset ];
1597
+
1598
+ [UIView animateWithDuration: kWindowTranslationDuration delay: 0 options: UIViewAnimationOptionCurveEaseInOut animations: ^{
1599
+ [ornament _setDepthDisplacement: finalDepth];
1600
+ } completion: nil ];
1601
+ }
1602
+
1570
1603
auto completion = makeBlockPtr ([controller = retainPtr (controller), inWindow = retainPtr (inWindow), originalState = retainPtr (originalState), enter, completionHandler = WTFMove (completionHandler)] (BOOL finished) mutable {
1571
1604
WebKit::resizeScene ([inWindow windowScene ], [inWindow bounds ].size , [controller, inWindow, originalState, enter, completionHandler = WTFMove (completionHandler)]() mutable {
1572
1605
Class inWindowClass = enter ? [UIWindow class ] : [originalState windowClass ];
@@ -1594,6 +1627,8 @@ - (void)_performSpatialFullScreenTransition:(BOOL)enter completionHandler:(Compl
1594
1627
1595
1628
[UIView animateWithDuration: kIncomingWindowFadeDuration delay: kIncomingWindowFadeDelay options: UIViewAnimationOptionCurveEaseInOut animations: ^{
1596
1629
inWindow.alpha = 1 ;
1630
+ if (!enter)
1631
+ inWindow.windowScene .prefersOrnamentsHidden_forLMKOnly = originalState.prefersOrnamentsHidden ;
1597
1632
} completion: completion.get ()];
1598
1633
}
1599
1634
0 commit comments