mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
WR multi-document support
This commit is contained in:
parent
d1e4fdb7fa
commit
ba214bcec5
8 changed files with 90 additions and 71 deletions
|
@ -329,12 +329,21 @@ impl webrender_api::RenderNotifier for RenderNotifier {
|
|||
Box::new(RenderNotifier::new(self.compositor_proxy.clone()))
|
||||
}
|
||||
|
||||
fn new_frame_ready(&self) {
|
||||
fn wake_up(&self) {
|
||||
self.compositor_proxy.recomposite(CompositingReason::NewWebRenderFrame);
|
||||
}
|
||||
|
||||
fn new_scroll_frame_ready(&self, composite_needed: bool) {
|
||||
self.compositor_proxy.send(Msg::NewScrollFrameReady(composite_needed));
|
||||
fn new_document_ready(
|
||||
&self,
|
||||
_document_id: webrender_api::DocumentId,
|
||||
scrolled: bool,
|
||||
composite_needed: bool,
|
||||
) {
|
||||
if scrolled {
|
||||
self.compositor_proxy.send(Msg::NewScrollFrameReady(composite_needed));
|
||||
} else {
|
||||
self.wake_up();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,8 +48,8 @@ xi-unicode = "0.1.0"
|
|||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
byteorder = "1.0"
|
||||
core-foundation = "0.4"
|
||||
core-graphics = "0.9"
|
||||
core-text = "7.0"
|
||||
core-graphics = "0.12.2"
|
||||
core-text = "8.0"
|
||||
|
||||
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies]
|
||||
freetype = "0.3"
|
||||
|
|
|
@ -17,7 +17,7 @@ use std::fmt;
|
|||
use std::fs::File;
|
||||
use std::io::{Read, Error as IoError};
|
||||
use std::ops::Deref;
|
||||
use std::sync::Mutex;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use webrender_api::NativeFontHandle;
|
||||
|
||||
/// Platform specific font representation for mac.
|
||||
|
@ -36,7 +36,7 @@ pub struct FontTemplateData {
|
|||
ctfont: CachedCTFont,
|
||||
|
||||
pub identifier: Atom,
|
||||
pub font_data: Option<Vec<u8>>
|
||||
pub font_data: Option<Arc<Vec<u8>>>
|
||||
}
|
||||
|
||||
unsafe impl Send for FontTemplateData {}
|
||||
|
@ -47,7 +47,7 @@ impl FontTemplateData {
|
|||
Ok(FontTemplateData {
|
||||
ctfont: CachedCTFont(Mutex::new(HashMap::new())),
|
||||
identifier: identifier.to_owned(),
|
||||
font_data: font_data
|
||||
font_data: font_data.map(Arc::new)
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ impl FontTemplateData {
|
|||
let clamped_pt_size = pt_size.max(0.01);
|
||||
let ctfont = match self.font_data {
|
||||
Some(ref bytes) => {
|
||||
let fontprov = CGDataProvider::from_buffer(bytes);
|
||||
let fontprov = CGDataProvider::from_buffer(bytes.clone());
|
||||
let cgfont_result = CGFont::from_data_provider(fontprov);
|
||||
match cgfont_result {
|
||||
Ok(cgfont) => {
|
||||
|
@ -103,7 +103,7 @@ impl FontTemplateData {
|
|||
/// Returns a clone of the bytes in this font if they are in memory. This function never
|
||||
/// performs disk I/O.
|
||||
pub fn bytes_if_in_memory(&self) -> Option<Vec<u8>> {
|
||||
self.font_data.clone()
|
||||
self.font_data.as_ref().map(|bytes| (**bytes).clone())
|
||||
}
|
||||
|
||||
/// Returns the native font that underlies this font template, if applicable.
|
||||
|
|
|
@ -204,7 +204,8 @@ impl<Window> Servo<Window> where Window: WindowMethods + 'static {
|
|||
};
|
||||
|
||||
let webrender_api = webrender_api_sender.create_api();
|
||||
let webrender_document = webrender_api.add_document(window.framebuffer_size());
|
||||
let wr_document_layer = 0; //TODO
|
||||
let webrender_document = webrender_api.add_document(window.framebuffer_size(), wr_document_layer);
|
||||
|
||||
// Important that this call is done in a single-threaded fashion, we
|
||||
// can't defer it after `create_constellation` has started.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue