Separate the DOM and layout into separate crates.

This commit is contained in:
Patrick Walton 2013-05-28 17:13:40 -07:00
parent 0ea1a94f8e
commit bf82bc54f3
156 changed files with 192 additions and 157 deletions

View file

@ -192,14 +192,21 @@ DONE_gfx = $(B)src/components/gfx/libgfx.dummy
DEPS_gfx = $(CRATE_gfx) $(SRC_gfx) $(DONE_SUBMODULES) $(DONE_util) $(DONE_net)
RFLAGS_servo = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/components/gfx -L $(B)src/components/util -L $(B)src/components/net
RFLAGS_script = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/components/util -L $(B)src/components/net -L $(B)src/components/gfx
WEBIDL_script = $(call rwildcard,$(S)src/components/script/,*.webidl)
AUTOGEN_SRC_script = $(patsubst %.webidl, %Binding.rs, $(WEBIDL_script))
SRC_script = $(call rwildcard,$(S)src/components/script/,*.rs) $(AUTOGEN_SRC_script)
CRATE_script = $(S)src/components/script/script.rc
DONE_script = $(B)src/components/script/libscript.dummy
WEBIDL_servo = $(call rwildcard,$(S)src/components/main/,*.webidl)
AUTOGEN_SRC_servo = $(patsubst %.webidl, %Binding.rs, $(WEBIDL_servo))
SRC_servo = $(call rwildcard,$(S)src/components/main/,*.rs) $(AUTOGEN_SRC_servo)
DEPS_script = $(CRATE_script) $(SRC_script) $(DONE_SUBMODULES) $(DONE_util) $(DONE_net)
RFLAGS_servo = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/components/gfx -L $(B)src/components/util -L $(B)src/components/net -L $(B)src/components/script
SRC_servo = $(call rwildcard,$(S)src/components/main/,*.rs)
CRATE_servo = $(S)src/components/main/servo.rc
DEPS_servo = $(CRATE_servo) $(SRC_servo) $(DONE_SUBMODULES) $(DONE_util) $(DONE_gfx) $(DONE_net)
DEPS_servo = $(CRATE_servo) $(SRC_servo) $(DONE_SUBMODULES) $(DONE_util) $(DONE_gfx) $(DONE_script) $(DONE_net)
# rules that depend on having correct meta-target vars (DEPS_CLEAN, DEPS_servo, etc)
include $(S)mk/check.mk
@ -220,13 +227,16 @@ $(DONE_net): $(DEPS_net)
$(DONE_gfx): $(DEPS_gfx)
$(RUSTC) $(RFLAGS_gfx) -o $@ $< && touch $@
BINDINGS_SRC = $(S)/src/components/main/dom/bindings/codegen
$(DONE_script): $(DEPS_script)
$(RUSTC) $(RFLAGS_script) -o $@ $< && touch $@
BINDINGS_SRC = $(S)/src/components/script/dom/bindings/codegen
CACHE_DIR = $(BINDINGS_SRC)/_cache
bindinggen_dependencies := $(addprefix $(BINDINGS_SRC)/, BindingGen.py Bindings.conf Configuration.py CodegenRust.py parser/WebIDL.py ParserResults.pkl)
$(AUTOGEN_SRC_servo): %Binding.rs: $(bindinggen_dependencies) \
$(AUTOGEN_SRC_script): %Binding.rs: $(bindinggen_dependencies) \
%.webidl
PYTHONDONTWRITEBYTECODE=1 $(CFG_PYTHON2) $(BINDINGS_SRC)/pythonpath.py \
-I$(BINDINGS_SRC)/parser -I$(BINDINGS_SRC)/ply \
@ -241,13 +251,13 @@ $(CACHE_DIR)/.done:
@touch $@
$(BINDINGS_SRC)/ParserResults.pkl: $(globalgen_dependencies) \
$(WEBIDL_servo)
$(WEBIDL_script)
PYTHONDONTWRITEBYTECODE=1 $(CFG_PYTHON2) $(BINDINGS_SRC)/pythonpath.py \
-I$(BINDINGS_SRC)/parser -I$(BINDINGS_SRC)/ply \
-D$(BINDINGS_SRC) \
$(BINDINGS_SRC)/GlobalGen.py $(BINDINGS_SRC)/Bindings.conf . \
--cachedir=$(CACHE_DIR) \
$(WEBIDL_servo)
$(WEBIDL_script)
# Servo binaries
@ -268,7 +278,7 @@ package: servo
else
bindings: $(AUTOGEN_SRC_servo)
bindings: $(AUTOGEN_SRC_script)
.PHONY: package
package:

1
configure vendored
View file

@ -452,6 +452,7 @@ done
make_dir ${CFG_BUILD_DIR}src/components/util
make_dir ${CFG_BUILD_DIR}src/components/net
make_dir ${CFG_BUILD_DIR}src/components/gfx
make_dir ${CFG_BUILD_DIR}src/components/script
make_dir ${CFG_BUILD_DIR}src/components/main
make_dir src/test/html/ref
make_dir src/compiler/rust

View file

@ -34,5 +34,8 @@ clean-net:
clean-gfx:
cd $(B)/src/components/gfx/ && rm -rf libservo_gfx*.dylib $(DONE_servo_gfx)
clean-servo: clean-gfx clean-util clean-net
clean-script:
cd $(B)/src/components/script/ && rm -rf libservo_script*.dylib $(DONE_servo_script)
clean-servo: clean-gfx clean-util clean-net clean-script
rm -f servo servo-test

View file

@ -4,7 +4,7 @@
use compositing::resize_rate_limiter::ResizeRateLimiter;
use platform::{Application, Window};
use scripting::script_task::{LoadMsg, ScriptMsg};
use script::script_task::{LoadMsg, ScriptMsg};
use windowing::{ApplicationMethods, WindowMethods};
use azure::azure_hl::{DataSourceSurface, DrawTarget, SourceSurfaceMethods};

View file

@ -7,10 +7,9 @@
/// before sending the next. If the window is resized multiple times before an event is handled
/// then some events will never be sent.
use dom::event::ResizeEvent;
use scripting::script_task::{ScriptMsg, SendEventMsg};
use core::comm::{Port, SharedChan};
use script::dom::event::ResizeEvent;
use script::script_task::{ScriptMsg, SendEventMsg};
pub struct ResizeRateLimiter {
/// The channel we send resize events on

View file

@ -6,10 +6,10 @@
use css::node_util::NodeUtil;
use css::select_handler::NodeSelectHandler;
use dom::node::{AbstractNode, LayoutView};
use script::dom::node::{AbstractNode, LayoutView};
use newcss::complete::CompleteSelectResults;
use newcss::select::{SelectCtx, SelectResults};
use servo_util::tree::TreeUtils;
pub trait MatchMethods {

View file

@ -5,9 +5,9 @@
// Style retrieval from DOM elements.
use css::node_util::NodeUtil;
use dom::node::{AbstractNode, LayoutView};
use newcss::complete::CompleteStyle;
use script::dom::node::{AbstractNode, LayoutView};
/// Node mixin providing `style` method that returns a `NodeStyle`
pub trait StyledNode {

View file

@ -2,11 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::node::{AbstractNode, LayoutView};
use layout::aux::LayoutAuxMethods;
use core::cast::transmute;
use newcss::complete::CompleteSelectResults;
use script::dom::node::{AbstractNode, LayoutView};
pub trait NodeUtil<'self> {
fn get_css_select_results(self) -> &'self CompleteSelectResults;

View file

@ -1,28 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! CSS library requires that DOM nodes be convertable to *c_void through this trait
extern mod netsurfcss;
use dom::node::{AbstractNode, LayoutView};
use core::cast;
// FIXME: Rust #3908. rust-css can't reexport VoidPtrLike
use css::node_void_ptr::netsurfcss::util::VoidPtrLike;
impl VoidPtrLike for AbstractNode<LayoutView> {
fn from_void_ptr(node: *libc::c_void) -> AbstractNode<LayoutView> {
assert!(node.is_not_null());
unsafe {
cast::transmute(node)
}
}
fn to_void_ptr(&self) -> *libc::c_void {
unsafe {
cast::transmute(*self)
}
}
}

View file

@ -6,10 +6,9 @@
/// Implementation of the callbacks that the CSS selector engine uses to query the DOM.
///
use dom::node::{AbstractNode, LayoutView};
use newcss::select::SelectHandler;
use core::str::eq_slice;
use newcss::select::SelectHandler;
use script::dom::node::{AbstractNode, LayoutView};
pub struct NodeSelectHandler {
node: AbstractNode<LayoutView>,

View file

@ -4,10 +4,6 @@
use compositing::CompositorTask;
use layout::layout_task;
use layout_interface::LayoutTask;
use layout_interface;
use scripting::script_task::{ExecuteMsg, LoadMsg, ScriptMsg, ScriptTask};
use scripting::script_task;
use util::task::spawn_listener;
use core::cell::Cell;
@ -15,6 +11,10 @@ use core::comm::{Chan, Port, SharedChan};
use gfx::opts::Opts;
use gfx::render_task::RenderTask;
use gfx::render_task;
use script::layout_interface::LayoutTask;
use script::layout_interface;
use script::script_task::{ExecuteMsg, LoadMsg, ScriptMsg, ScriptTask};
use script::script_task;
use servo_net::image_cache_task::{ImageCacheTask, ImageCacheTaskClient};
use servo_net::resource_task::ResourceTask;
use servo_net::resource_task;

View file

@ -4,10 +4,10 @@
//! Code for managing the layout data in the DOM.
use dom::node::{AbstractNode, LayoutView};
use layout::flow::FlowContext;
use newcss::complete::CompleteSelectResults;
use script::dom::node::{AbstractNode, LayoutView};
use servo_util::tree::TreeUtils;
/// Data that layout associates with a node.

View file

@ -5,7 +5,6 @@
//! The `RenderBox` type, which represents the leaves of the layout tree.
use css::node_style::StyledNode;
use dom::node::{AbstractNode, LayoutView};
use layout::context::LayoutContext;
use layout::display_list_builder::{DisplayListBuilder, ToGfxColor};
use layout::flow::FlowContext;
@ -28,6 +27,7 @@ use newcss::values::{CSSFontSizeLength, CSSFontStyleItalic, CSSFontStyleNormal};
use newcss::values::{CSSFontStyleOblique, CSSTextAlign, CSSTextDecoration};
use newcss::values::{CSSTextDecorationNone, CSSFloatNone, CSSPositionStatic};
use newcss::values::{CSSDisplayInlineBlock, CSSDisplayInlineTable};
use script::dom::node::{AbstractNode, LayoutView};
use servo_net::image::holder::ImageHolder;
use servo_net::local_image_cache::LocalImageCache;
use servo_util::range::*;

View file

@ -4,9 +4,6 @@
//! Creates CSS boxes from a DOM tree.
use dom::element::*;
use dom::node::{AbstractNode, CommentNodeTypeId, DoctypeNodeTypeId};
use dom::node::{ElementNodeTypeId, LayoutView, TextNodeTypeId};
use layout::aux::LayoutAuxMethods;
use layout::block::BlockFlowData;
use layout::box::{GenericRenderBoxClass, ImageRenderBox, ImageRenderBoxClass, RenderBox};
@ -20,6 +17,9 @@ use layout::inline::{InlineFlowData, InlineLayout};
use newcss::values::{CSSDisplay, CSSDisplayBlock, CSSDisplayInline, CSSDisplayInlineBlock};
use newcss::values::{CSSDisplayNone};
use script::dom::element::*;
use script::dom::node::{AbstractNode, CommentNodeTypeId, DoctypeNodeTypeId};
use script::dom::node::{ElementNodeTypeId, LayoutView, TextNodeTypeId};
use servo_util::range::Range;
use servo_util::tree::{TreeNodeRef, TreeUtils};

View file

@ -25,7 +25,6 @@
/// line breaks and mapping to CSS boxes, for the purpose of handling `getClientRects()` and
/// similar methods.
use dom::node::{AbstractNode, LayoutView};
use layout::block::BlockFlowData;
use layout::box::RenderBox;
use layout::context::LayoutContext;
@ -37,6 +36,7 @@ use geom::point::Point2D;
use geom::rect::Rect;
use gfx::display_list::DisplayList;
use gfx::geometry::Au;
use script::dom::node::{AbstractNode, LayoutView};
use servo_util::tree::{TreeNode, TreeNodeRef, TreeUtils};
/// The type of the formatting context and data specific to each context, such as line box

View file

@ -4,7 +4,6 @@
use core::cell::Cell;
use core;
use dom::node::{AbstractNode, LayoutView};
use layout::box::{CannotSplit, GenericRenderBoxClass, ImageRenderBoxClass, RenderBox};
use layout::box::{SplitDidFit, SplitDidNotFit, TextRenderBoxClass, UnscannedTextRenderBoxClass};
use layout::context::LayoutContext;
@ -19,9 +18,8 @@ use gfx::geometry::Au;
use gfx::text::text_run::TextRun;
use gfx::text::util::*;
use newcss::values::{CSSTextAlignCenter, CSSTextAlignJustify, CSSTextAlignLeft};
use newcss::values::{CSSTextAlignRight};
use newcss::values::CSSTextDecorationUnderline;
use newcss::values::CSSTextDecoration;
use newcss::values::{CSSTextAlignRight, CSSTextDecoration, CSSTextDecorationUnderline};
use script::dom::node::{AbstractNode, LayoutView};
use servo_util::range::Range;
use std::deque::Deque;

View file

@ -7,18 +7,11 @@
use css::matching::MatchMethods;
use css::select::new_css_select_ctx;
use dom::event::ReflowEvent;
use dom::node::{AbstractNode, LayoutView};
use layout::aux::{LayoutData, LayoutAuxMethods};
use layout::box_builder::LayoutTreeBuilder;
use layout::context::LayoutContext;
use layout::display_list_builder::{DisplayListBuilder, FlowDisplayListBuilderMethods};
use layout::flow::FlowContext;
use layout_interface::{AddStylesheetMsg, BuildData, BuildMsg, ContentBoxQuery, ContentBoxResponse};
use layout_interface::{ContentBoxesQuery, ContentBoxesResponse, ExitMsg, LayoutQuery};
use layout_interface::{LayoutResponse, LayoutTask, MatchSelectorsDamage, Msg, NoDamage, QueryMsg};
use layout_interface::{ReflowDamage};
use scripting::script_task::{ScriptMsg, SendEventMsg};
use util::task::spawn_listener;
use servo_util::time;
use servo_util::time::time;
@ -40,6 +33,13 @@ use gfx::render_task::{RenderMsg, RenderTask};
use newcss::select::SelectCtx;
use newcss::stylesheet::Stylesheet;
use newcss::types::OriginAuthor;
use script::dom::event::ReflowEvent;
use script::dom::node::{AbstractNode, LayoutView};
use script::layout_interface::{AddStylesheetMsg, BuildData, BuildMsg, ContentBoxQuery};
use script::layout_interface::{ContentBoxResponse, ContentBoxesQuery, ContentBoxesResponse};
use script::layout_interface::{ExitMsg, LayoutQuery, LayoutResponse, LayoutTask};
use script::layout_interface::{MatchSelectorsDamage, Msg, NoDamage, QueryMsg, ReflowDamage};
use script::script_task::{ScriptMsg, SendEventMsg};
use servo_net::image_cache_task::{ImageCacheTask, ImageResponseMsg};
use servo_net::local_image_cache::LocalImageCache;
use servo_util::tree::TreeUtils;

View file

@ -17,11 +17,11 @@ extern mod geom;
extern mod gfx (name = "gfx");
extern mod glut;
extern mod http_client;
extern mod hubbub;
extern mod js;
extern mod layers;
extern mod newcss (name = "css");
extern mod opengles;
extern mod script;
extern mod servo_net (name = "net");
extern mod servo_util (name = "util");
extern mod sharegl;
@ -48,58 +48,15 @@ pub use servo_util::url::make_url;
#[path="compositing/mod.rs"]
pub mod compositing;
pub mod scripting {
pub mod script_task;
}
pub mod css {
priv mod select_handler;
priv mod node_util;
priv mod node_void_ptr;
pub mod select;
pub mod matching;
pub mod node_style;
}
pub mod dom {
pub mod bindings {
pub mod document;
pub mod element;
pub mod event;
pub mod eventtarget;
pub mod node;
pub mod text;
pub mod utils;
pub mod conversions;
pub mod window;
pub mod proxyhandler;
pub mod clientrect;
pub mod clientrectlist;
pub mod domparser;
pub mod htmlcollection;
pub mod codegen {
pub mod ClientRectBinding;
pub mod ClientRectListBinding;
pub mod DOMParserBinding;
pub mod EventBinding;
pub mod EventTargetBinding;
pub mod HTMLCollectionBinding;
}
}
pub mod characterdata;
pub mod clientrect;
pub mod clientrectlist;
pub mod document;
pub mod domparser;
pub mod element;
pub mod event;
pub mod eventtarget;
pub mod htmlcollection;
pub mod node;
pub mod window;
}
pub mod engine;
pub mod layout {
@ -115,12 +72,6 @@ pub mod layout {
mod aux;
}
pub mod html {
pub mod cssparse;
pub mod hubbub_html_parser;
}
pub mod layout_interface;
pub mod windowing;
#[path="platform/mod.rs"]

View file

@ -5,9 +5,10 @@
use dom::bindings::utils::{CacheableWrapper, WrapperCache, BindingObject, DerivedWrapper};
use dom::bindings::codegen::ClientRectBinding;
use dom::clientrect::ClientRect;
use script_task::{task_from_context, global_script_context};
use js::jsapi::{JSObject, JSContext, JSVal};
use js::glue::bindgen::RUST_OBJECT_TO_JSVAL;
use scripting::script_task::{task_from_context, global_script_context};
pub impl ClientRect {
pub fn init_wrapper(@mut self) {

View file

@ -5,8 +5,9 @@
use dom::bindings::codegen::ClientRectListBinding;
use dom::bindings::utils::{WrapperCache, CacheableWrapper, BindingObject};
use dom::clientrectlist::ClientRectList;
use script_task::{task_from_context, global_script_context};
use js::jsapi::{JSObject, JSContext};
use scripting::script_task::{task_from_context, global_script_context};
pub impl ClientRectList {
fn init_wrapper(@mut self) {

View file

@ -4147,7 +4147,7 @@ class CGBindingRoot(CGThing):
'dom::domparser::*', #XXXjdm
'dom::event::*', #XXXjdm
'dom::eventtarget::*', #XXXjdm
'scripting::script_task::task_from_context',
'script_task::task_from_context',
'dom::bindings::utils::EnumEntry',
'dom::node::ScriptView',
],

Some files were not shown because too many files have changed in this diff Show more