@@ -5037,10 +5037,12 @@ struct WebViewRepresentable: NSViewRepresentable {
50375037 // Origin-only frame churn is common while the surrounding split layout
50385038 // settles. Reapplying the side-docked inspector at the same size fights
50395039 // WebKit's own dock layout and shows up as visible flicker.
5040- if !isHostedInspectorSideDockActive( ) &&
5041- !isHostedInspectorDividerDragActive &&
5042- !hasStoredHostedInspectorWidthPreference {
5043- captureHostedInspectorPreferredWidthFromCurrentLayout ( reason: " host.layout.sameSize " )
5040+ if !isHostedInspectorDividerDragActive {
5041+ if hasStoredHostedInspectorWidthPreference {
5042+ reapplyHostedInspectorDividerToStoredWidthIfNeeded ( reason: " host.layout.sameSize " )
5043+ } else if !isHostedInspectorSideDockActive( ) {
5044+ captureHostedInspectorPreferredWidthFromCurrentLayout ( reason: " host.layout.sameSize " )
5045+ }
50445046 }
50455047 updateHostedInspectorDockControlAvailabilityIfNeeded ( reason: " host.layout.sameSize " )
50465048 notifyGeometryChangedIfNeeded ( )
@@ -5052,7 +5054,9 @@ struct WebViewRepresentable: NSViewRepresentable {
50525054 lastHostedInspectorLayoutBoundsSize = bounds. size
50535055 if isHostedInspectorSideDockActive ( ) {
50545056 layoutHostedInspectorSideDockIfNeeded ( reason: " host.layout.sideDock " )
5055- } else if !hasStoredHostedInspectorWidthPreference {
5057+ } else if hasStoredHostedInspectorWidthPreference {
5058+ reapplyHostedInspectorDividerToStoredWidthIfNeeded ( reason: " host.layout " )
5059+ } else {
50565060 captureHostedInspectorPreferredWidthFromCurrentLayout ( reason: " host.layout " )
50575061 }
50585062 updateHostedInspectorDockControlAvailabilityIfNeeded ( reason: " host.layout " )
@@ -5130,26 +5134,24 @@ struct WebViewRepresentable: NSViewRepresentable {
51305134 return nil
51315135 }
51325136 if let hostedInspectorHit {
5133- let isSideDockHit = isHostedInspectorSideDockHit ( hostedInspectorHit)
51345137 if let nativeHit = nativeHostedInspectorHit ( at: point, hostedInspectorHit: hostedInspectorHit) {
51355138#if DEBUG
51365139 debugLogHitTest ( stage: " hitTest.hostedInspectorNative " , point: point, passThrough: false , hitView: nativeHit)
51375140#endif
5138- if !isSideDockHit ||
5139- ( nativeHit !== hostedInspectorHit. inspectorView &&
5140- !hostedInspectorHit. inspectorView. isDescendant ( of: nativeHit) ) {
5141+ if nativeHit !== hostedInspectorHit. inspectorView &&
5142+ !hostedInspectorHit. inspectorView. isDescendant ( of: nativeHit) {
51415143 return nativeHit
51425144 }
51435145 }
51445146#if DEBUG
51455147 debugLogHitTest (
5146- stage: isSideDockHit ? " hitTest.hostedInspectorManual " : " hitTest.hostedInspectorFallback " ,
5148+ stage: " hitTest.hostedInspectorManual " ,
51475149 point: point,
51485150 passThrough: false ,
5149- hitView: hostedInspectorHit . inspectorView
5151+ hitView: self
51505152 )
51515153#endif
5152- return isSideDockHit ? self : hostedInspectorHit . inspectorView
5154+ return self
51535155 }
51545156 let hit = super. hitTest ( point)
51555157#if DEBUG
@@ -5160,8 +5162,7 @@ struct WebViewRepresentable: NSViewRepresentable {
51605162
51615163 override func mouseDown( with event: NSEvent ) {
51625164 let point = convert ( event. locationInWindow, from: nil )
5163- guard let hostedInspectorHit = hostedInspectorDividerHit ( at: point) ,
5164- isHostedInspectorSideDockHit ( hostedInspectorHit) else {
5165+ guard let hostedInspectorHit = hostedInspectorDividerHit ( at: point) else {
51655166 super. mouseDown ( with: event)
51665167 return
51675168 }
@@ -5258,7 +5259,7 @@ struct WebViewRepresentable: NSViewRepresentable {
52585259 )
52595260 )
52605261#endif
5261- layoutHostedInspectorSideDockIfNeeded ( reason: " drag.end " )
5262+ reapplyHostedInspectorDividerToStoredWidthIfNeeded ( reason: " drag.end " )
52625263 }
52635264 super. mouseUp ( with: event)
52645265 }
@@ -5273,7 +5274,7 @@ struct WebViewRepresentable: NSViewRepresentable {
52735274 // Pass through a narrow leading-edge band so the shared sidebar divider
52745275 // handle can receive hover/click even when WKWebView is attached here.
52755276 // Keeping this deterministic avoids flicker from dynamic left-edge scans.
5276- guard point. x >= 0 , point. x <= SidebarResizeInteraction . hitWidthPerSide else {
5277+ guard point. x >= 0 , point. x <= SidebarResizeInteraction . contentSideHitWidth else {
52775278 return false
52785279 }
52795280 guard let window, let contentView = window. contentView else {
@@ -5495,9 +5496,9 @@ struct WebViewRepresentable: NSViewRepresentable {
54955496 guard let self else { return }
54965497 self . hostedInspectorReapplyWorkItem = nil
54975498 _ = self . promoteHostedInspectorSideDockFromCurrentLayoutIfNeeded ( )
5498- if self . isHostedInspectorSideDockActive ( ) {
5499+ if self . hasStoredHostedInspectorWidthPreference {
54995500 self . reapplyHostedInspectorDividerToStoredWidthIfNeeded ( reason: reason)
5500- } else if ! self . hasStoredHostedInspectorWidthPreference {
5501+ } else {
55015502 self . captureHostedInspectorPreferredWidthFromCurrentLayout ( reason: reason)
55025503 }
55035504 }
@@ -5558,7 +5559,6 @@ struct WebViewRepresentable: NSViewRepresentable {
55585559 private func reapplyHostedInspectorDividerToStoredWidthIfNeeded( reason: String ) {
55595560 guard !isApplyingHostedInspectorLayout else { return }
55605561 guard let hit = hostedInspectorDividerCandidate ( ) else { return }
5561- guard isHostedInspectorSideDockHit ( hit) else { return }
55625562 guard let preferredWidth = resolvedPreferredHostedInspectorWidth ( in: hit. containerView. bounds) else {
55635563 return
55645564 }
0 commit comments