Skip to content

Fix windowDidResize using window frame instead of content rect#217

Open
jensb1 wants to merge 1 commit intoblackboardsh:mainfrom
jensb1:fix/window-resize-content-rect
Open

Fix windowDidResize using window frame instead of content rect#217
jensb1 wants to merge 1 commit intoblackboardsh:mainfrom
jensb1:fix/window-resize-content-rect

Conversation

@jensb1
Copy link

@jensb1 jensb1 commented Feb 25, 2026

Summary

  • Fix windowDidResize: using [window frame] (outer dimensions including title bar) instead of the content rect for webview resize and resize handler callback
  • This caused window.innerHeight to jump by 28px (macOS title bar height) on any resize event

Root Cause

The window is created with initWithContentRect: which correctly interprets the size as the content area. However, windowDidResize: used [window frame] for both:

  1. Resizing the webview ([abstractView resize:fullFrame ...]) — making the webview 28px taller than the content area
  2. Reporting dimensions to JavaScript via self.resizeHandler — reporting the outer frame size instead of content size

Fix

  • Use [containerView bounds] for webview resize (matches the actual content area)
  • Use [window contentRectForFrameRect:] for the resize handler dimensions

Testing

Built and tested the patched libNativeWrapper.dylib locally on macOS arm64 (Sequoia). Verified:

  • Horizontal-only resize no longer changes window.innerHeight
  • Growing and shrinking the window both work correctly
  • window.innerHeight stays consistent between initial load and after resize

Fixes #215

windowDidResize was using [window frame] which includes the title bar
height (28px on macOS). This caused the webview to be resized to the
outer frame dimensions and window.innerHeight to jump by 28px on any
resize event.

The window is created with initWithContentRect: which correctly uses
the content area, but windowDidResize used [window frame] for both
the webview resize and the resize handler callback, creating an
inconsistency.

Fix: use [containerView bounds] for webview resize and
contentRectForFrameRect: for the resize handler dimensions.

Fixes blackboardsh#215
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Window height changes unexpectedly during horizontal-only resize

1 participant