DOM changes in OnLoadEnd not instantly visible

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.

DOM changes in OnLoadEnd not instantly visible

Postby Nikosch » Fri Jul 22, 2016 1:44 am

Hi,

I am using CEF Version 3.2556.1368 on Windows in Off-Screen Rendering mode.

I am trying to inject custom CSS styles into loaded websites using the DOMVisitor.

As recommended in other posts I am calling the VisitDOM() Method in OnLoadEnd() of the render process. But it seems to me that a least one frame of the texture is rendered without the changes. Any suggestions how I can achieve that the DOM changes are taken into account right away.

Thanks a lot.
Nico
Nikosch
Newbie
 
Posts: 2
Joined: Thu Jul 21, 2016 8:36 am

Re: DOM changes in OnLoadEnd not instantly visible

Postby fddima » Fri Jul 22, 2016 8:31 am

What you mean by frame of texture?
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Re: DOM changes in OnLoadEnd not instantly visible

Postby fddima » Fri Jul 22, 2016 8:46 am

I'm feel from post that page is rendered wuthout updated styles some time. If so, then it is expected... All modern browsers supports continious rendering. I.e. rendered frames generated during document parsing stage. OnLoadEnd is about when parser stops. Put huge input document and it can parse it a minute, and it will be fully operable. But your css will be applied only when document completely loaded.

From my understanding, the only way is inject styles at network level (by CEF's response filtering feature it is not too complex). Or implement some other way (something like overriding author styles), but this may require deep knowledge of chromium code.

Depending from task, if page loads are really fast you can defer actual rendering until custom styles applied.
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Re: DOM changes in OnLoadEnd not instantly visible

Postby Nikosch » Mon Jul 25, 2016 1:36 am

You are right. The css style is applied as soon as the page is fully loaded. So as I understand you there is no "easy" way to get access to the DOM right at the beginning of the loading process?

Thanks a lot
Nico
Nikosch
Newbie
 
Posts: 2
Joined: Thu Jul 21, 2016 8:36 am

Re: DOM changes in OnLoadEnd not instantly visible

Postby fddima » Mon Jul 25, 2016 1:58 am

As for me - easiest and reliable way is inject custom content via filter (CefRequestHandler::GetResourceResponseFilter).

Probably it is possible just execute script and/or modify DOM during parsing, but this will be unstable, depends on timings, and finally not possible for every document (XHTML if i remember correctly disallow any dom changes during parsing even with inlined scripts, but i'm not sure, touched here some years ago).
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am


Return to Support Forum

Who is online

Users browsing this forum: Devyre and 95 guests