Fix windowDidResize using window frame instead of content rect#217
Open
jensb1 wants to merge 1 commit intoblackboardsh:mainfrom
Open
Fix windowDidResize using window frame instead of content rect#217jensb1 wants to merge 1 commit intoblackboardsh:mainfrom
jensb1 wants to merge 1 commit intoblackboardsh:mainfrom
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
windowDidResize:using[window frame](outer dimensions including title bar) instead of the content rect for webview resize and resize handler callbackwindow.innerHeightto jump by 28px (macOS title bar height) on any resize eventRoot Cause
The window is created with
initWithContentRect:which correctly interprets the size as the content area. However,windowDidResize:used[window frame]for both:[abstractView resize:fullFrame ...]) — making the webview 28px taller than the content areaself.resizeHandler— reporting the outer frame size instead of content sizeFix
[containerView bounds]for webview resize (matches the actual content area)[window contentRectForFrameRect:]for the resize handler dimensionsTesting
Built and tested the patched
libNativeWrapper.dyliblocally on macOS arm64 (Sequoia). Verified:window.innerHeightwindow.innerHeightstays consistent between initial load and after resizeFixes #215