CEFBrowser don't resize properly if container NSView resize

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Re: CEFBrowser don't resize properly if container NSView res

Postby stallent » Fri May 21, 2021 11:19 am

Finally figured this out, btw. Figured i'd post up for posterity.

Much like others, I'm using a CEF view that is hosted in a StackView inside an NSSPlitView. When doing this, its common for AutoLayout to set your view to a size that isn't whole numbers. Seems that when the frame's .height isn't whole, CEF internally scrolls the web content when it shouldn't.

My fix was to basically have a wrapper view with a single child (with no layout constraints or autoresizing mask). The child (targetView in my example) is what i hand to CEF to draw into and then do this in the wrapper view's layout:

Code: Select all
override func layout() {

  self.targetView.frame = self.bounds.integral

The key being the .integral. This ensures the view CEF is interacting with never has fractional size and no longer scrolls into oblivion.

Hope this helps.
Posts: 1
Joined: Fri May 21, 2021 9:52 am


Return to Support Forum

Who is online

Users browsing this forum: amaitland and 17 guests