add back browser_host::composite() method for embedding

this changes the way that applications will use servo. whereas previously
it was only necessary to call initialize() -> makecurrent, it's now necessary
to explicitly call the composite() method in order to trigger the gl rendering.

any other composite attempts (by servo) will trigger the on_paint() method,
informing the app that a frame is ready. it's then up to the app to schedule
the composite() such that the frame is rendered in a timely manner
This commit is contained in:
Mike Blumenkrantz 2015-05-19 13:10:23 -04:00
parent 12d792f427
commit 5697d9ff2c
2 changed files with 22 additions and 4 deletions

View file

@ -296,12 +296,21 @@ impl WindowMethods for Window {
fn prepare_for_composite(&self, width: usize, height: usize) -> bool {
let browser = self.cef_browser.borrow();
match *browser {
None => {}
None => {
panic!("No browser?!?");
}
Some(ref browser) => {
browser.get_host().get_client().get_render_handler().paint(browser.clone(), width, height);
if browser.downcast().host.downcast().composite_ok.get() == true {
true
} else {
if check_ptr_exist!(browser.get_host().get_client(), get_render_handler) &&
check_ptr_exist!(browser.get_host().get_client().get_render_handler(), on_paint) {
browser.get_host().get_client().get_render_handler().paint(browser.clone(), width, height);
}
false
}
}
}
true
}
fn load_end(&self) {