mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Introduce a layout_thread crate; drop the dependency of layout on script.
This commit is contained in:
parent
7414edab05
commit
6528bee84f
8 changed files with 169 additions and 52 deletions
|
@ -21,7 +21,6 @@ gfx_traits = {path = "../gfx_traits"}
|
|||
heapsize = "0.3.0"
|
||||
heapsize_plugin = "0.1.2"
|
||||
ipc-channel = {git = "https://github.com/servo/ipc-channel"}
|
||||
layout_traits = {path = "../layout_traits"}
|
||||
libc = "0.2"
|
||||
log = "0.3.5"
|
||||
msg = {path = "../msg"}
|
||||
|
@ -30,11 +29,9 @@ plugins = {path = "../plugins"}
|
|||
profile_traits = {path = "../profile_traits"}
|
||||
range = {path = "../range"}
|
||||
rustc-serialize = "0.3"
|
||||
script = {path = "../script"}
|
||||
script_layout_interface = {path = "../script_layout_interface"}
|
||||
script_traits = {path = "../script_traits"}
|
||||
selectors = {version = "0.6", features = ["heap_size"]}
|
||||
serde_json = "0.7"
|
||||
serde_macros = "0.7"
|
||||
smallvec = "0.1"
|
||||
string_cache = {version = "0.2.20", features = ["heap_size"]}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#![feature(box_patterns)]
|
||||
#![feature(box_syntax)]
|
||||
#![feature(custom_derive)]
|
||||
#![feature(mpsc_select)]
|
||||
#![feature(nonzero)]
|
||||
#![feature(plugin)]
|
||||
#![feature(raw)]
|
||||
|
@ -32,7 +31,6 @@ extern crate gfx;
|
|||
extern crate gfx_traits;
|
||||
extern crate heapsize;
|
||||
extern crate ipc_channel;
|
||||
extern crate layout_traits;
|
||||
extern crate libc;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
|
@ -46,11 +44,9 @@ extern crate profile_traits;
|
|||
#[macro_use]
|
||||
extern crate range;
|
||||
extern crate rustc_serialize;
|
||||
extern crate script;
|
||||
extern crate script_layout_interface;
|
||||
extern crate script_traits;
|
||||
extern crate selectors;
|
||||
extern crate serde_json;
|
||||
extern crate smallvec;
|
||||
#[macro_use(atom, ns)] extern crate string_cache;
|
||||
extern crate style;
|
||||
|
@ -63,32 +59,31 @@ extern crate util;
|
|||
extern crate webrender_traits;
|
||||
|
||||
#[macro_use]
|
||||
mod layout_debug;
|
||||
pub mod layout_debug;
|
||||
|
||||
mod animation;
|
||||
pub mod animation;
|
||||
mod block;
|
||||
mod construct;
|
||||
mod context;
|
||||
pub mod construct;
|
||||
pub mod context;
|
||||
mod data;
|
||||
mod display_list_builder;
|
||||
pub mod display_list_builder;
|
||||
mod flex;
|
||||
mod floats;
|
||||
mod flow;
|
||||
pub mod flow;
|
||||
mod flow_list;
|
||||
mod flow_ref;
|
||||
pub mod flow_ref;
|
||||
mod fragment;
|
||||
mod generated_content;
|
||||
mod incremental;
|
||||
pub mod incremental;
|
||||
mod inline;
|
||||
pub mod layout_thread;
|
||||
mod list_item;
|
||||
mod model;
|
||||
mod multicol;
|
||||
mod opaque_node;
|
||||
mod parallel;
|
||||
pub mod parallel;
|
||||
mod persistent_list;
|
||||
mod query;
|
||||
mod sequential;
|
||||
pub mod query;
|
||||
pub mod sequential;
|
||||
mod table;
|
||||
mod table_caption;
|
||||
mod table_cell;
|
||||
|
@ -97,9 +92,9 @@ mod table_row;
|
|||
mod table_rowgroup;
|
||||
mod table_wrapper;
|
||||
mod text;
|
||||
mod traversal;
|
||||
mod webrender_helpers;
|
||||
mod wrapper;
|
||||
pub mod traversal;
|
||||
pub mod webrender_helpers;
|
||||
pub mod wrapper;
|
||||
|
||||
// For unit tests:
|
||||
pub use fragment::Fragment;
|
||||
|
|
36
components/layout_thread/Cargo.toml
Normal file
36
components/layout_thread/Cargo.toml
Normal file
|
@ -0,0 +1,36 @@
|
|||
[package]
|
||||
name = "layout_thread"
|
||||
version = "0.0.1"
|
||||
authors = ["The Servo Project Developers"]
|
||||
publish = false
|
||||
|
||||
[lib]
|
||||
name = "layout_thread"
|
||||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
app_units = {version = "0.2.3", features = ["plugins"]}
|
||||
azure = {git = "https://github.com/servo/rust-azure", features = ["plugins"]}
|
||||
euclid = {version = "0.6.4", features = ["plugins"]}
|
||||
fnv = "1.0"
|
||||
gfx = {path = "../gfx"}
|
||||
gfx_traits = {path = "../gfx_traits"}
|
||||
heapsize = "0.3.0"
|
||||
heapsize_plugin = "0.1.2"
|
||||
ipc-channel = {git = "https://github.com/servo/ipc-channel"}
|
||||
layout = {path = "../layout"}
|
||||
layout_traits = {path = "../layout_traits"}
|
||||
log = "0.3.5"
|
||||
msg = {path = "../msg"}
|
||||
net_traits = {path = "../net_traits"}
|
||||
plugins = {path = "../plugins"}
|
||||
profile_traits = {path = "../profile_traits"}
|
||||
script = {path = "../script"}
|
||||
script_layout_interface = {path = "../script_layout_interface"}
|
||||
script_traits = {path = "../script_traits"}
|
||||
serde_json = "0.7"
|
||||
serde_macros = "0.7"
|
||||
style = {path = "../style"}
|
||||
url = {version = "1.0.0", features = ["heap_size"]}
|
||||
util = {path = "../util"}
|
||||
webrender_traits = {git = "https://github.com/servo/webrender_traits"}
|
|
@ -5,21 +5,48 @@
|
|||
//! The layout thread. Performs layout on the DOM, builds display lists and sends them to be
|
||||
//! painted.
|
||||
|
||||
#![allow(unsafe_code)]
|
||||
#![feature(box_syntax)]
|
||||
#![feature(custom_derive)]
|
||||
#![feature(mpsc_select)]
|
||||
#![feature(plugin)]
|
||||
|
||||
#![plugin(heapsize_plugin)]
|
||||
#![plugin(plugins)]
|
||||
|
||||
extern crate app_units;
|
||||
extern crate azure;
|
||||
extern crate core;
|
||||
extern crate euclid;
|
||||
extern crate fnv;
|
||||
extern crate gfx;
|
||||
extern crate gfx_traits;
|
||||
extern crate heapsize;
|
||||
extern crate ipc_channel;
|
||||
#[macro_use]
|
||||
extern crate layout;
|
||||
extern crate layout_traits;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
extern crate msg;
|
||||
extern crate net_traits;
|
||||
#[macro_use]
|
||||
extern crate profile_traits;
|
||||
extern crate script;
|
||||
extern crate script_layout_interface;
|
||||
extern crate script_traits;
|
||||
extern crate serde_json;
|
||||
extern crate style;
|
||||
extern crate url;
|
||||
extern crate util;
|
||||
extern crate webrender_traits;
|
||||
|
||||
use animation;
|
||||
use app_units::Au;
|
||||
use azure::azure::AzColor;
|
||||
use construct::ConstructionResult;
|
||||
use context::{LayoutContext, SharedLayoutContext, heap_size_of_local_context};
|
||||
use display_list_builder::ToGfxColor;
|
||||
use euclid::Matrix4D;
|
||||
use euclid::point::Point2D;
|
||||
use euclid::rect::Rect;
|
||||
use euclid::scale_factor::ScaleFactor;
|
||||
use euclid::size::Size2D;
|
||||
use flow::{self, Flow, ImmutableFlowUtils, MutableOwnedFlowUtils};
|
||||
use flow_ref::{self, FlowRef};
|
||||
use fnv::FnvHasher;
|
||||
use gfx::display_list::{ClippingRegion, DisplayList, LayerInfo, OpaqueNode};
|
||||
use gfx::display_list::{StackingContext, StackingContextType, WebRenderImageInfo};
|
||||
|
@ -29,23 +56,32 @@ use gfx::font_context;
|
|||
use gfx::paint_thread::LayoutToPaintMsg;
|
||||
use gfx_traits::{color, Epoch, FragmentType, LayerId, ScrollPolicy, StackingContextId};
|
||||
use heapsize::HeapSizeOf;
|
||||
use incremental::{LayoutDamageComputation, REFLOW_ENTIRE_DOCUMENT};
|
||||
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
|
||||
use ipc_channel::router::ROUTER;
|
||||
use layout_debug;
|
||||
use layout::animation;
|
||||
use layout::construct::ConstructionResult;
|
||||
use layout::context::{LayoutContext, SharedLayoutContext, heap_size_of_local_context};
|
||||
use layout::display_list_builder::ToGfxColor;
|
||||
use layout::flow::{self, Flow, ImmutableFlowUtils, MutableOwnedFlowUtils};
|
||||
use layout::flow_ref::{self, FlowRef};
|
||||
use layout::incremental::{LayoutDamageComputation, REFLOW_ENTIRE_DOCUMENT};
|
||||
use layout::layout_debug;
|
||||
use layout::parallel;
|
||||
use layout::query::process_offset_parent_query;
|
||||
use layout::query::{LayoutRPCImpl, LayoutThreadData, process_content_box_request, process_content_boxes_request};
|
||||
use layout::query::{process_node_geometry_request, process_node_layer_id_request, process_node_scroll_area_request};
|
||||
use layout::query::{process_node_overflow_request, process_resolved_style_request, process_margin_style_query};
|
||||
use layout::sequential;
|
||||
use layout::traversal::RecalcStyleAndConstructFlows;
|
||||
use layout::webrender_helpers::{WebRenderDisplayListConverter, WebRenderFrameBuilder};
|
||||
use layout::wrapper::{LayoutNodeLayoutData, NonOpaqueStyleAndLayoutData};
|
||||
use layout_traits::LayoutThreadFactory;
|
||||
use log;
|
||||
use msg::constellation_msg::{PanicMsg, PipelineId};
|
||||
use net_traits::image_cache_thread::UsePlaceholder;
|
||||
use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheResult, ImageCacheThread};
|
||||
use parallel;
|
||||
use profile_traits::mem::{self, Report, ReportKind, ReportsChan};
|
||||
use profile_traits::time::{TimerMetadataFrameType, TimerMetadataReflowType};
|
||||
use profile_traits::time::{self, TimerMetadata, profile};
|
||||
use query::process_offset_parent_query;
|
||||
use query::{LayoutRPCImpl, LayoutThreadData, process_content_box_request, process_content_boxes_request};
|
||||
use query::{process_node_geometry_request, process_node_layer_id_request, process_node_scroll_area_request};
|
||||
use query::{process_node_overflow_request, process_resolved_style_request, process_margin_style_query};
|
||||
use script::layout_wrapper::ServoLayoutNode;
|
||||
use script_layout_interface::message::{Msg, NewLayoutThreadInfo, Reflow, ReflowQueryType, ScriptReflow};
|
||||
use script_layout_interface::reporter::CSSErrorReporter;
|
||||
|
@ -55,8 +91,6 @@ use script_layout_interface::wrapper_traits::LayoutNode;
|
|||
use script_layout_interface::{OpaqueStyleAndLayoutData, PartialStyleAndLayoutData};
|
||||
use script_traits::{ConstellationControlMsg, LayoutControlMsg, LayoutMsg as ConstellationMsg};
|
||||
use script_traits::{StackingContextScrollState, UntrustedNodeAddress};
|
||||
use sequential;
|
||||
use serde_json;
|
||||
use std::borrow::ToOwned;
|
||||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
|
@ -77,7 +111,6 @@ use style::properties::ComputedValues;
|
|||
use style::selector_matching::USER_OR_USER_AGENT_STYLESHEETS;
|
||||
use style::servo::{SharedStyleContext, Stylesheet, Stylist};
|
||||
use style::stylesheets::CSSRuleIteratorExt;
|
||||
use traversal::RecalcStyleAndConstructFlows;
|
||||
use url::Url;
|
||||
use util::geometry::MAX_RECT;
|
||||
use util::ipc::OptionalIpcSender;
|
||||
|
@ -85,9 +118,6 @@ use util::opts;
|
|||
use util::thread;
|
||||
use util::thread_state;
|
||||
use util::workqueue::WorkQueue;
|
||||
use webrender_helpers::{WebRenderDisplayListConverter, WebRenderFrameBuilder};
|
||||
use webrender_traits;
|
||||
use wrapper::{LayoutNodeLayoutData, NonOpaqueStyleAndLayoutData};
|
||||
|
||||
/// The number of screens we have to traverse before we decide to generate new display lists.
|
||||
const DISPLAY_PORT_THRESHOLD_SIZE_FACTOR: i32 = 4;
|
35
components/servo/Cargo.lock
generated
35
components/servo/Cargo.lock
generated
|
@ -21,6 +21,7 @@ dependencies = [
|
|||
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
|
||||
"layout 0.0.1",
|
||||
"layout_tests 0.0.1",
|
||||
"layout_thread 0.0.1",
|
||||
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"msg 0.0.1",
|
||||
|
@ -1148,7 +1149,6 @@ dependencies = [
|
|||
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
|
||||
"layout_traits 0.0.1",
|
||||
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"msg 0.0.1",
|
||||
|
@ -1157,11 +1157,9 @@ dependencies = [
|
|||
"profile_traits 0.0.1",
|
||||
"range 0.0.1",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"script 0.0.1",
|
||||
"script_layout_interface 0.0.1",
|
||||
"script_traits 0.0.1",
|
||||
"selectors 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_macros 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"string_cache 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1182,6 +1180,37 @@ dependencies = [
|
|||
"layout 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "layout_thread"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"app_units 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"azure 0.4.5 (git+https://github.com/servo/rust-azure)",
|
||||
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fnv 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gfx 0.0.1",
|
||||
"gfx_traits 0.0.1",
|
||||
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
|
||||
"layout 0.0.1",
|
||||
"layout_traits 0.0.1",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"msg 0.0.1",
|
||||
"net_traits 0.0.1",
|
||||
"plugins 0.0.1",
|
||||
"profile_traits 0.0.1",
|
||||
"script 0.0.1",
|
||||
"script_layout_interface 0.0.1",
|
||||
"script_traits 0.0.1",
|
||||
"serde_json 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_macros 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"style 0.0.1",
|
||||
"url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "layout_traits"
|
||||
version = "0.0.1"
|
||||
|
|
|
@ -57,6 +57,7 @@ util = {path = "../util"}
|
|||
script = {path = "../script"}
|
||||
script_traits = {path = "../script_traits"}
|
||||
layout = {path = "../layout"}
|
||||
layout_thread = {path = "../layout_thread"}
|
||||
gfx = {path = "../gfx"}
|
||||
style = {path = "../style"}
|
||||
canvas = {path = "../canvas"}
|
||||
|
|
|
@ -31,7 +31,7 @@ pub extern crate devtools_traits;
|
|||
pub extern crate euclid;
|
||||
pub extern crate gfx;
|
||||
pub extern crate ipc_channel;
|
||||
pub extern crate layout;
|
||||
pub extern crate layout_thread;
|
||||
pub extern crate msg;
|
||||
pub extern crate net;
|
||||
pub extern crate net_traits;
|
||||
|
@ -231,7 +231,7 @@ fn create_constellation(opts: opts::Opts,
|
|||
};
|
||||
let constellation_chan =
|
||||
Constellation::<script_layout_interface::message::Msg,
|
||||
layout::layout_thread::LayoutThread,
|
||||
layout_thread::LayoutThread,
|
||||
script::script_thread::ScriptThread>::start(initial_state);
|
||||
|
||||
// Send the URL command to the constellation.
|
||||
|
@ -265,7 +265,7 @@ pub fn run_content_process(token: String) {
|
|||
script::init();
|
||||
|
||||
unprivileged_content.start_all::<script_layout_interface::message::Msg,
|
||||
layout::layout_thread::LayoutThread,
|
||||
layout_thread::LayoutThread,
|
||||
script::script_thread::ScriptThread>(true);
|
||||
}
|
||||
|
||||
|
|
35
ports/cef/Cargo.lock
generated
35
ports/cef/Cargo.lock
generated
|
@ -1060,7 +1060,6 @@ dependencies = [
|
|||
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
|
||||
"layout_traits 0.0.1",
|
||||
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"msg 0.0.1",
|
||||
|
@ -1069,11 +1068,9 @@ dependencies = [
|
|||
"profile_traits 0.0.1",
|
||||
"range 0.0.1",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"script 0.0.1",
|
||||
"script_layout_interface 0.0.1",
|
||||
"script_traits 0.0.1",
|
||||
"selectors 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_macros 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"string_cache 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1087,6 +1084,37 @@ dependencies = [
|
|||
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "layout_thread"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"app_units 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"azure 0.4.5 (git+https://github.com/servo/rust-azure)",
|
||||
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fnv 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gfx 0.0.1",
|
||||
"gfx_traits 0.0.1",
|
||||
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
|
||||
"layout 0.0.1",
|
||||
"layout_traits 0.0.1",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"msg 0.0.1",
|
||||
"net_traits 0.0.1",
|
||||
"plugins 0.0.1",
|
||||
"profile_traits 0.0.1",
|
||||
"script 0.0.1",
|
||||
"script_layout_interface 0.0.1",
|
||||
"script_traits 0.0.1",
|
||||
"serde_json 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_macros 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"style 0.0.1",
|
||||
"url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "layout_traits"
|
||||
version = "0.0.1"
|
||||
|
@ -1913,6 +1941,7 @@ dependencies = [
|
|||
"glutin_app 0.0.1",
|
||||
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
|
||||
"layout 0.0.1",
|
||||
"layout_thread 0.0.1",
|
||||
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"msg 0.0.1",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue