Size differences in GetViewRect(..) and OnPaint(..)

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.

Size differences in GetViewRect(..) and OnPaint(..)

Postby callum » Mon Dec 04, 2017 4:57 pm

Using CEF Win64 3.3202.1686.

Under some conditions, changing the size of my off-screen browser (e.g. when a video is playing - IE contents of screen changing every frame) I see a discrepancy between the width/height set in my implementation of CefRenderHandler::GetViewRect() and what is passed into my implementation of CefRenderHandler::OnPaint(..)

I change the size of the browser when my app windows is resized by updating the variables I pass back in CefRenderHandler::GetViewRect() and subsequently calling CefBrowser::GetHost()::WasResized();

Is this the correct procedure for resizing a CefBrowser on Windows?
callum
Expert
 
Posts: 326
Joined: Mon Feb 23, 2015 6:19 pm

Re: Size differences in GetViewRect(..) and OnPaint(..)

Postby magreenblatt » Mon Dec 04, 2017 5:18 pm

Your procedure sounds correct. The size change is asynchronous so you might receive a few frames at the old size before the new size takes affect.
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: Size differences in GetViewRect(..) and OnPaint(..)

Postby callum » Mon Dec 04, 2017 5:26 pm

Yep, understood and I take account of that and don't update pixels if the sizes differ on the basis I'll eventually get a size in OnPaint that matches.
callum
Expert
 
Posts: 326
Joined: Mon Feb 23, 2015 6:19 pm

Re: Size differences in GetViewRect(..) and OnPaint(..)

Postby callum » Mon Dec 04, 2017 10:39 pm

The really odd thing is that if I open my app to google.com then, from there, visit the YouTube URL, I see the mismatch but if I open into the YouTube URL directly, everything works as expected. The behavior is very reproducible and doesn't appear to do the same thing for start URLs other than google.com

I can't think of a reason why that would be.
callum
Expert
 
Posts: 326
Joined: Mon Feb 23, 2015 6:19 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 63 guests