@@ -5034,10 +5034,12 @@ struct WebViewRepresentable: NSViewRepresentable {
50345034 // Origin-only frame churn is common while the surrounding split layout
50355035 // settles. Reapplying the side-docked inspector at the same size fights
50365036 // WebKit's own dock layout and shows up as visible flicker.
5037- if !isHostedInspectorSideDockActive( ) &&
5038- !isHostedInspectorDividerDragActive &&
5039- !hasStoredHostedInspectorWidthPreference {
5040- captureHostedInspectorPreferredWidthFromCurrentLayout ( reason: " host.layout.sameSize " )
5037+ if !isHostedInspectorDividerDragActive {
5038+ if hasStoredHostedInspectorWidthPreference {
5039+ reapplyHostedInspectorDividerToStoredWidthIfNeeded ( reason: " host.layout.sameSize " )
5040+ } else if !isHostedInspectorSideDockActive( ) {
5041+ captureHostedInspectorPreferredWidthFromCurrentLayout ( reason: " host.layout.sameSize " )
5042+ }
50415043 }
50425044 updateHostedInspectorDockControlAvailabilityIfNeeded ( reason: " host.layout.sameSize " )
50435045 notifyGeometryChangedIfNeeded ( )
@@ -5049,7 +5051,9 @@ struct WebViewRepresentable: NSViewRepresentable {
50495051 lastHostedInspectorLayoutBoundsSize = bounds. size
50505052 if isHostedInspectorSideDockActive ( ) {
50515053 layoutHostedInspectorSideDockIfNeeded ( reason: " host.layout.sideDock " )
5052- } else if !hasStoredHostedInspectorWidthPreference {
5054+ } else if hasStoredHostedInspectorWidthPreference {
5055+ reapplyHostedInspectorDividerToStoredWidthIfNeeded ( reason: " host.layout " )
5056+ } else {
50535057 captureHostedInspectorPreferredWidthFromCurrentLayout ( reason: " host.layout " )
50545058 }
50555059 updateHostedInspectorDockControlAvailabilityIfNeeded ( reason: " host.layout " )
@@ -5127,26 +5131,24 @@ struct WebViewRepresentable: NSViewRepresentable {
51275131 return nil
51285132 }
51295133 if let hostedInspectorHit {
5130- let isSideDockHit = isHostedInspectorSideDockHit ( hostedInspectorHit)
51315134 if let nativeHit = nativeHostedInspectorHit ( at: point, hostedInspectorHit: hostedInspectorHit) {
51325135#if DEBUG
51335136 debugLogHitTest ( stage: " hitTest.hostedInspectorNative " , point: point, passThrough: false , hitView: nativeHit)
51345137#endif
5135- if !isSideDockHit ||
5136- ( nativeHit !== hostedInspectorHit. inspectorView &&
5137- !hostedInspectorHit. inspectorView. isDescendant ( of: nativeHit) ) {
5138+ if nativeHit !== hostedInspectorHit. inspectorView &&
5139+ !hostedInspectorHit. inspectorView. isDescendant ( of: nativeHit) {
51385140 return nativeHit
51395141 }
51405142 }
51415143#if DEBUG
51425144 debugLogHitTest (
5143- stage: isSideDockHit ? " hitTest.hostedInspectorManual " : " hitTest.hostedInspectorFallback " ,
5145+ stage: " hitTest.hostedInspectorManual " ,
51445146 point: point,
51455147 passThrough: false ,
5146- hitView: hostedInspectorHit . inspectorView
5148+ hitView: self
51475149 )
51485150#endif
5149- return isSideDockHit ? self : hostedInspectorHit . inspectorView
5151+ return self
51505152 }
51515153 let hit = super. hitTest ( point)
51525154#if DEBUG
@@ -5157,8 +5159,7 @@ struct WebViewRepresentable: NSViewRepresentable {
51575159
51585160 override func mouseDown( with event: NSEvent ) {
51595161 let point = convert ( event. locationInWindow, from: nil )
5160- guard let hostedInspectorHit = hostedInspectorDividerHit ( at: point) ,
5161- isHostedInspectorSideDockHit ( hostedInspectorHit) else {
5162+ guard let hostedInspectorHit = hostedInspectorDividerHit ( at: point) else {
51625163 super. mouseDown ( with: event)
51635164 return
51645165 }
@@ -5255,7 +5256,7 @@ struct WebViewRepresentable: NSViewRepresentable {
52555256 )
52565257 )
52575258#endif
5258- layoutHostedInspectorSideDockIfNeeded ( reason: " drag.end " )
5259+ reapplyHostedInspectorDividerToStoredWidthIfNeeded ( reason: " drag.end " )
52595260 }
52605261 super. mouseUp ( with: event)
52615262 }
@@ -5492,9 +5493,9 @@ struct WebViewRepresentable: NSViewRepresentable {
54925493 guard let self else { return }
54935494 self . hostedInspectorReapplyWorkItem = nil
54945495 _ = self . promoteHostedInspectorSideDockFromCurrentLayoutIfNeeded ( )
5495- if self . isHostedInspectorSideDockActive ( ) {
5496+ if self . hasStoredHostedInspectorWidthPreference {
54965497 self . reapplyHostedInspectorDividerToStoredWidthIfNeeded ( reason: reason)
5497- } else if ! self . hasStoredHostedInspectorWidthPreference {
5498+ } else {
54985499 self . captureHostedInspectorPreferredWidthFromCurrentLayout ( reason: reason)
54995500 }
55005501 }
@@ -5555,7 +5556,6 @@ struct WebViewRepresentable: NSViewRepresentable {
55555556 private func reapplyHostedInspectorDividerToStoredWidthIfNeeded( reason: String ) {
55565557 guard !isApplyingHostedInspectorLayout else { return }
55575558 guard let hit = hostedInspectorDividerCandidate ( ) else { return }
5558- guard isHostedInspectorSideDockHit ( hit) else { return }
55595559 guard let preferredWidth = resolvedPreferredHostedInspectorWidth ( in: hit. containerView. bounds) else {
55605560 return
55615561 }
0 commit comments