cefsharp / CefSharp

.NET (WPF and Windows Forms) bindings for the Chromium Embedded Framework
http://cefsharp.github.io/
Other
9.89k stars 2.92k forks source link

Disable rendering #1483

Closed dejanberic closed 8 years ago

dejanberic commented 8 years ago

How to completely disable rendering of pages (disable graphical objects, OnPaint etc.) but keep the execution of javascript as if the site is normally loading? Basically, I want something that "renders" the page but does not produce any image output (I will not call TakeScreenshot), I just need the correct page source after all javacript code is executed. I want to save as much as possible CPU time. Will this be achieved by setting the browser Size to 0x0? I am using Offscreen CefSharp 45.0.1.

amaitland commented 8 years ago

http://magpcss.org/ceforum/viewtopic.php?f=10&t=13684

I am using Offscreen CefSharp 45.0.1.

No such version exists, do you mean 43.0.1? or 45.0.0?

dejanberic commented 8 years ago

Sorry, the version is 45.0.0.

dejanberic commented 8 years ago

So I am guessing that even though something like this does not exist: browser.GetHost().WasHidden(true); This will do the trick: "Return 0x0 sized CefRect in CefRenderHandler::GetViewRect() and CefRenderHandler::OnPaint() will not be called. "

Thanks.

amaitland commented 8 years ago

So I am guessing that even though something like this does not exist: browser.GetHost().WasHidden(true);

Can be implemented with minimal effort. Looks like WasHidden was never exposed.

This will do the trick: "Return 0x0 sized CefRect in CefRenderHandler::GetViewRect() and CefRenderHandler::OnPaint() will not be called. "

With the Offscreen version you should be able to just set the Size property.

amaitland commented 8 years ago

Resolved with https://github.com/cefsharp/CefSharp/commit/1d9ce8d4dee882f6a69efd7e807f4deba72cfca1