Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add skeleton for layout thread reflow #283

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions src/compositing.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
use crate::layout::LayoutSize;
use crate::types::Result;

// See https://github.com/servo/servo/blob/5d7ed76b79de359ef1de2bdee83b32bd497d7cd8/third_party/webrender/webrender_api/src/display_list.rs#L112
pub struct BuiltDisplayList;

impl BuiltDisplayList {
pub fn into_data(self) -> (Vec<u8>, BuiltDisplayListDescriptor) {
(Vec::new(), BuiltDisplayListDescriptor)
}
}

// See https://github.com/servo/servo/blob/5d7ed76b79de359ef1de2bdee83b32bd497d7cd8/third_party/webrender/webrender_api/src/display_list.rs#L136
pub struct BuiltDisplayListDescriptor;

// See ipc_channel crate
pub struct IpcSender;

impl IpcSender {
pub fn send(&self, _message: ScriptToCompositorMsg) -> Result<()> {
todo!()
}
}

// See https://github.com/servo/servo/blob/5d7ed76b79de359ef1de2bdee83b32bd497d7cd8/components/shared/script/compositor.rs#L216
pub struct CompositorDisplayListInfo {
pub content_size: LayoutSize,
}

// See https://github.com/servo/servo/blob/5d7ed76b79de359ef1de2bdee83b32bd497d7cd8/components/shared/script/lib.rs#L1119
pub enum ScriptToCompositorMsg {
SendDisplayList {
display_list_info: CompositorDisplayListInfo,
display_list_descriptor: BuiltDisplayListDescriptor,
},
}

// See https://github.com/servo/servo/blob/5d7ed76b79de359ef1de2bdee83b32bd497d7cd8/components/shared/compositing/lib.rs#L182
pub enum ForwardedToCompositorMsg {
Layout(ScriptToCompositorMsg),
}

// See https://github.com/servo/servo/blob/5d7ed76b79de359ef1de2bdee83b32bd497d7cd8/components/compositing/compositor.rs#L128
pub struct IOCompositor;

impl IOCompositor {
#[allow(unused)]
fn handle_webrender_message(&self, _message: ForwardedToCompositorMsg) {
todo!()
}
}
7 changes: 7 additions & 0 deletions src/css3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,17 @@
//! ;
//! ```
//!
use self::{node::StyleSheet, parser::CSS3Parser};
use crate::types::Result;

pub mod new_parser;
pub mod new_tokenizer;
pub mod node;
pub mod parser;
pub mod tokenizer;
pub mod tokens;
pub mod unicode;

pub fn parse(s: &str) -> Result<StyleSheet> {
CSS3Parser::new().parse(s)
}
Loading