From 23968efbd187de0bf19e766fd3fea8eebe432172 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Sat, 28 Jun 2014 08:12:34 -0400 Subject: [PATCH 1/3] Split layout code into a separate crate. --- Makefile.in | 18 +++-- configure | 1 + src/components/{main => }/layout/block.rs | 24 +++---- src/components/{main => }/layout/construct.rs | 50 +++++++------- src/components/{main => }/layout/context.rs | 0 .../{main => layout}/css/matching.rs | 10 +-- .../{main => layout}/css/node_style.rs | 4 +- .../{main => layout}/css/node_util.rs | 8 +-- src/components/{main => layout}/css/select.rs | 0 .../{main => layout}/css/user-agent.css | 0 src/components/{main => }/layout/extra.rs | 4 +- src/components/{main => }/layout/floats.rs | 0 src/components/{main => }/layout/flow.rs | 36 +++++----- src/components/{main => }/layout/flow_list.rs | 4 +- src/components/{main => }/layout/flow_ref.rs | 4 +- src/components/{main => }/layout/fragment.rs | 22 +++--- .../{main => }/layout/incremental.rs | 0 src/components/{main => }/layout/inline.rs | 18 ++--- src/components/layout/layout.rs | 68 +++++++++++++++++++ .../{main => }/layout/layout_task.rs | 22 +++--- src/components/{main => }/layout/model.rs | 2 +- src/components/{main => }/layout/parallel.rs | 22 +++--- src/components/{main => }/layout/table.rs | 18 ++--- .../{main => }/layout/table_caption.rs | 10 +-- .../{main => }/layout/table_cell.rs | 14 ++-- .../{main => }/layout/table_colgroup.rs | 10 +-- src/components/{main => }/layout/table_row.rs | 20 +++--- .../{main => }/layout/table_rowgroup.rs | 18 ++--- .../{main => }/layout/table_wrapper.rs | 18 ++--- src/components/{main => }/layout/text.rs | 4 +- src/components/{main => }/layout/util.rs | 8 +-- src/components/{main => }/layout/wrapper.rs | 2 +- src/components/main/servo.rs | 36 +--------- 33 files changed, 259 insertions(+), 216 deletions(-) rename src/components/{main => }/layout/block.rs (99%) rename src/components/{main => }/layout/construct.rs (97%) rename src/components/{main => }/layout/context.rs (100%) rename src/components/{main => layout}/css/matching.rs (98%) rename src/components/{main => layout}/css/node_style.rs (90%) rename src/components/{main => layout}/css/node_util.rs (94%) rename src/components/{main => layout}/css/select.rs (100%) rename src/components/{main => layout}/css/user-agent.css (100%) rename src/components/{main => }/layout/extra.rs (93%) rename src/components/{main => }/layout/floats.rs (100%) rename src/components/{main => }/layout/flow.rs (97%) rename src/components/{main => }/layout/flow_list.rs (99%) rename src/components/{main => }/layout/flow_ref.rs (97%) rename src/components/{main => }/layout/fragment.rs (99%) rename src/components/{main => }/layout/incremental.rs (100%) rename src/components/{main => }/layout/inline.rs (99%) create mode 100644 src/components/layout/layout.rs rename src/components/{main => }/layout/layout_task.rs (98%) rename src/components/{main => }/layout/model.rs (99%) rename src/components/{main => }/layout/parallel.rs (96%) rename src/components/{main => }/layout/table.rs (96%) rename src/components/{main => }/layout/table_caption.rs (90%) rename src/components/{main => }/layout/table_cell.rs (93%) rename src/components/{main => }/layout/table_colgroup.rs (91%) rename src/components/{main => }/layout/table_row.rs (95%) rename src/components/{main => }/layout/table_rowgroup.rs (95%) rename src/components/{main => }/layout/table_wrapper.rs (96%) rename src/components/{main => }/layout/text.rs (99%) rename src/components/{main => }/layout/util.rs (96%) rename src/components/{main => }/layout/wrapper.rs (99%) diff --git a/Makefile.in b/Makefile.in index 712fab9253c..b82aa4fa075 100644 --- a/Makefile.in +++ b/Makefile.in @@ -274,14 +274,22 @@ DONE_style = $(B)src/components/style/libstyle.dummy DEPS_style = $(CRATE_style) $(SRC_style) $(DONE_SUBMODULES) $(DONE_util) $(DONE_macros) -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 -L $(B)src/components/style -L $(B)src/components/msg -L$(B)src/components/macros +RFLAGS_layout = $(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 -L $(B)src/components/style -L $(B)src/components/msg -L$(B)src/components/macros -SRC_servo = $(call rwildcard,$(S)src/components/main/,*.rs) $(S)src/components/main/css/user-agent.css +SRC_layout = $(call rwildcard,$(S)src/components/layout/,*.rs) $(S)src/components/layout/css/user-agent.css +CRATE_layout = $(S)src/components/layout/layout.rs +DONE_layout = $(B)src/components/layout/liblayout.dummy + +DEPS_layout = $(CRATE_layout) $(SRC_layout) $(DONE_script) $(DONE_style) $(DONE_msg) $(DONE_macros) $(DONE_gfx) $(DONE_util) + +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 -L $(B)src/components/layout -L $(B)src/components/style -L $(B)src/components/msg -L$(B)src/components/macros + +SRC_servo = $(call rwildcard,$(S)src/components/main/,*.rs) CRATE_servo = $(S)src/components/main/servo.rs -DEPS_servo = $(CRATE_servo) $(SRC_servo) $(DONE_SUBMODULES) $(DONE_util) $(DONE_gfx) $(DONE_script) $(DONE_net) $(DONE_msg) $(DONE_style) $(DONE_macros) +DEPS_servo = $(CRATE_servo) $(SRC_servo) $(DONE_SUBMODULES) $(DONE_util) $(DONE_gfx) $(DONE_script) $(DONE_net) $(DONE_msg) $(DONE_style) $(DONE_macros) $(DONE_layout) -SERVO_LIB_CRATES = macros util net msg gfx script style +SERVO_LIB_CRATES = macros util net msg gfx script style layout # rules that depend on having correct meta-target vars (DEPS_CLEAN, DEPS_servo, etc) # and SERVO_LIB_CRATES @@ -348,7 +356,7 @@ servo: $(DEPS_servo) @$(call E, compile: $@) $(Q)$(RUSTC) $(RFLAGS_servo) $< --crate-type bin,dylib,rlib -RFLAGS_embedding = $(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 -L $(B)src/components/style -L $(B)src/components/msg -L $(B).. -L $(B)src/components/main -L $(B)src/components/macros -A non_camel_case_types -A unused_variable +RFLAGS_embedding = $(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 -L $(B)src/components/layout -L $(B)src/components/style -L $(B)src/components/msg -L $(B).. -L $(B)src/components/main -L $(B)src/components/macros -A non_camel_case_types -A unused_variable ifeq ($(CFG_OSTYPE),apple-darwin) RFLAGS_embedding += -C link-args="-Wl,-U,_tc_new -Wl,-U,_tc_newarray -Wl,-U,_tc_delete -Wl,-U,_tc_deletearray" diff --git a/configure b/configure index 4325fc8e5a8..d73359243b2 100755 --- a/configure +++ b/configure @@ -608,6 +608,7 @@ make_dir ${CFG_BUILD_DIR}src/components/embedding make_dir ${CFG_BUILD_DIR}src/components/msg make_dir ${CFG_BUILD_DIR}src/components/net make_dir ${CFG_BUILD_DIR}src/components/gfx +make_dir ${CFG_BUILD_DIR}src/components/layout make_dir ${CFG_BUILD_DIR}src/components/script make_dir ${CFG_BUILD_DIR}src/components/style make_dir ${CFG_BUILD_DIR}src/components/main diff --git a/src/components/main/layout/block.rs b/src/components/layout/block.rs similarity index 99% rename from src/components/main/layout/block.rs rename to src/components/layout/block.rs index 0d033934f4f..5e0b4a23670 100644 --- a/src/components/main/layout/block.rs +++ b/src/components/layout/block.rs @@ -14,18 +14,18 @@ #![deny(unsafe_block)] -use layout::construct::FlowConstructor; -use layout::context::LayoutContext; -use layout::floats::{ClearBoth, ClearLeft, ClearRight, FloatKind, Floats, PlacementInfo}; -use layout::flow::{BaseFlow, BlockFlowClass, FlowClass, Flow, ImmutableFlowUtils}; -use layout::flow::{MutableFlowUtils, PreorderFlowTraversal, PostorderFlowTraversal, mut_base}; -use layout::flow; -use layout::fragment::{Fragment, ImageFragment, ScannedTextFragment}; -use layout::model::{Auto, IntrinsicWidths, MarginCollapseInfo, MarginsCollapse}; -use layout::model::{MarginsCollapseThrough, MaybeAuto, NoCollapsibleMargins, Specified, specified}; -use layout::model::{specified_or_none}; -use layout::model; -use layout::wrapper::ThreadSafeLayoutNode; +use construct::FlowConstructor; +use context::LayoutContext; +use floats::{ClearBoth, ClearLeft, ClearRight, FloatKind, Floats, PlacementInfo}; +use flow::{BaseFlow, BlockFlowClass, FlowClass, Flow, ImmutableFlowUtils}; +use flow::{MutableFlowUtils, PreorderFlowTraversal, PostorderFlowTraversal, mut_base}; +use flow; +use fragment::{Fragment, ImageFragment, ScannedTextFragment}; +use model::{Auto, IntrinsicWidths, MarginCollapseInfo, MarginsCollapse}; +use model::{MarginsCollapseThrough, MaybeAuto, NoCollapsibleMargins, Specified, specified}; +use model::{specified_or_none}; +use model; +use wrapper::ThreadSafeLayoutNode; use style::ComputedValues; use style::computed_values::{clear, position}; diff --git a/src/components/main/layout/construct.rs b/src/components/layout/construct.rs similarity index 97% rename from src/components/main/layout/construct.rs rename to src/components/layout/construct.rs index 5f999eb2663..ffce4986baa 100644 --- a/src/components/main/layout/construct.rs +++ b/src/components/layout/construct.rs @@ -20,31 +20,31 @@ #![deny(unsafe_block)] use css::node_style::StyledNode; -use layout::block::BlockFlow; -use layout::context::LayoutContext; -use layout::floats::FloatKind; -use layout::flow::{Flow, ImmutableFlowUtils, MutableOwnedFlowUtils}; -use layout::flow::{Descendants, AbsDescendants}; -use layout::flow; -use layout::flow_ref::FlowRef; -use layout::fragment::{Fragment, GenericFragment, IframeFragment, IframeFragmentInfo}; -use layout::fragment::{ImageFragment, ImageFragmentInfo, SpecificFragmentInfo, TableFragment}; -use layout::fragment::{TableCellFragment, TableColumnFragment, TableColumnFragmentInfo}; -use layout::fragment::{TableRowFragment, TableWrapperFragment, UnscannedTextFragment}; -use layout::fragment::{UnscannedTextFragmentInfo}; -use layout::inline::{FragmentIndex, InlineFragments, InlineFlow}; -use layout::parallel; -use layout::table_wrapper::TableWrapperFlow; -use layout::table::TableFlow; -use layout::table_caption::TableCaptionFlow; -use layout::table_colgroup::TableColGroupFlow; -use layout::table_rowgroup::TableRowGroupFlow; -use layout::table_row::TableRowFlow; -use layout::table_cell::TableCellFlow; -use layout::text::TextRunScanner; -use layout::util::{LayoutDataAccess, OpaqueNodeMethods}; -use layout::wrapper::{PostorderNodeMutTraversal, TLayoutNode, ThreadSafeLayoutNode}; -use layout::wrapper::{Before, BeforeBlock, After, AfterBlock, Normal}; +use block::BlockFlow; +use context::LayoutContext; +use floats::FloatKind; +use flow::{Flow, ImmutableFlowUtils, MutableOwnedFlowUtils}; +use flow::{Descendants, AbsDescendants}; +use flow; +use flow_ref::FlowRef; +use fragment::{Fragment, GenericFragment, IframeFragment, IframeFragmentInfo}; +use fragment::{ImageFragment, ImageFragmentInfo, SpecificFragmentInfo, TableFragment}; +use fragment::{TableCellFragment, TableColumnFragment, TableColumnFragmentInfo}; +use fragment::{TableRowFragment, TableWrapperFragment, UnscannedTextFragment}; +use fragment::{UnscannedTextFragmentInfo}; +use inline::{FragmentIndex, InlineFragments, InlineFlow}; +use parallel; +use table_wrapper::TableWrapperFlow; +use table::TableFlow; +use table_caption::TableCaptionFlow; +use table_colgroup::TableColGroupFlow; +use table_rowgroup::TableRowGroupFlow; +use table_row::TableRowFlow; +use table_cell::TableCellFlow; +use text::TextRunScanner; +use util::{LayoutDataAccess, OpaqueNodeMethods}; +use wrapper::{PostorderNodeMutTraversal, TLayoutNode, ThreadSafeLayoutNode}; +use wrapper::{Before, BeforeBlock, After, AfterBlock, Normal}; use gfx::display_list::OpaqueNode; use gfx::font_context::FontContext; diff --git a/src/components/main/layout/context.rs b/src/components/layout/context.rs similarity index 100% rename from src/components/main/layout/context.rs rename to src/components/layout/context.rs diff --git a/src/components/main/css/matching.rs b/src/components/layout/css/matching.rs similarity index 98% rename from src/components/main/css/matching.rs rename to src/components/layout/css/matching.rs index 94dacb79cbd..514a4767dc8 100644 --- a/src/components/main/css/matching.rs +++ b/src/components/layout/css/matching.rs @@ -5,11 +5,11 @@ // High-level interface to CSS selector matching. use css::node_style::StyledNode; -use layout::construct::FlowConstructor; -use layout::context::LayoutContext; -use layout::extra::LayoutAuxMethods; -use layout::util::{LayoutDataAccess, LayoutDataWrapper}; -use layout::wrapper::{LayoutElement, LayoutNode, PostorderNodeMutTraversal, ThreadSafeLayoutNode}; +use construct::FlowConstructor; +use context::LayoutContext; +use extra::LayoutAuxMethods; +use util::{LayoutDataAccess, LayoutDataWrapper}; +use wrapper::{LayoutElement, LayoutNode, PostorderNodeMutTraversal, ThreadSafeLayoutNode}; use gfx::font_context::FontContext; use servo_util::cache::{Cache, LRUCache, SimpleHashCache}; diff --git a/src/components/main/css/node_style.rs b/src/components/layout/css/node_style.rs similarity index 90% rename from src/components/main/css/node_style.rs rename to src/components/layout/css/node_style.rs index 2acbf67dcd2..e201b0050aa 100644 --- a/src/components/main/css/node_style.rs +++ b/src/components/layout/css/node_style.rs @@ -5,8 +5,8 @@ // Style retrieval from DOM elements. use css::node_util::NodeUtil; -use layout::incremental::RestyleDamage; -use layout::wrapper::ThreadSafeLayoutNode; +use incremental::RestyleDamage; +use wrapper::ThreadSafeLayoutNode; use style::ComputedValues; use sync::Arc; diff --git a/src/components/main/css/node_util.rs b/src/components/layout/css/node_util.rs similarity index 94% rename from src/components/main/css/node_util.rs rename to src/components/layout/css/node_util.rs index 4fd5fa5d1b2..150995428ea 100644 --- a/src/components/main/css/node_util.rs +++ b/src/components/layout/css/node_util.rs @@ -2,10 +2,10 @@ * 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 layout::incremental::RestyleDamage; -use layout::util::LayoutDataAccess; -use layout::wrapper::{TLayoutNode, ThreadSafeLayoutNode}; -use layout::wrapper::{After, AfterBlock, Before, BeforeBlock, Normal}; +use incremental::RestyleDamage; +use util::LayoutDataAccess; +use wrapper::{TLayoutNode, ThreadSafeLayoutNode}; +use wrapper::{After, AfterBlock, Before, BeforeBlock, Normal}; use std::mem; use style::ComputedValues; use sync::Arc; diff --git a/src/components/main/css/select.rs b/src/components/layout/css/select.rs similarity index 100% rename from src/components/main/css/select.rs rename to src/components/layout/css/select.rs diff --git a/src/components/main/css/user-agent.css b/src/components/layout/css/user-agent.css similarity index 100% rename from src/components/main/css/user-agent.css rename to src/components/layout/css/user-agent.css diff --git a/src/components/main/layout/extra.rs b/src/components/layout/extra.rs similarity index 93% rename from src/components/main/layout/extra.rs rename to src/components/layout/extra.rs index b6e57ad252f..7b731185272 100644 --- a/src/components/main/layout/extra.rs +++ b/src/components/layout/extra.rs @@ -4,8 +4,8 @@ //! Code for managing the layout data in the DOM. -use layout::util::{PrivateLayoutData, LayoutDataAccess, LayoutDataWrapper}; -use layout::wrapper::LayoutNode; +use util::{PrivateLayoutData, LayoutDataAccess, LayoutDataWrapper}; +use wrapper::LayoutNode; use script::dom::node::SharedLayoutData; use script::layout_interface::LayoutChan; diff --git a/src/components/main/layout/floats.rs b/src/components/layout/floats.rs similarity index 100% rename from src/components/main/layout/floats.rs rename to src/components/layout/floats.rs diff --git a/src/components/main/layout/flow.rs b/src/components/layout/flow.rs similarity index 97% rename from src/components/main/layout/flow.rs rename to src/components/layout/flow.rs index 20c8d2db965..71924bf13b0 100644 --- a/src/components/main/layout/flow.rs +++ b/src/components/layout/flow.rs @@ -26,24 +26,24 @@ /// similar methods. use css::node_style::StyledNode; -use layout::block::BlockFlow; -use layout::context::LayoutContext; -use layout::floats::Floats; -use layout::flow_list::{FlowList, Link, FlowListIterator, MutFlowListIterator}; -use layout::flow_ref::FlowRef; -use layout::fragment::{Fragment, TableRowFragment, TableCellFragment}; -use layout::incremental::RestyleDamage; -use layout::inline::InlineFlow; -use layout::model::{CollapsibleMargins, IntrinsicWidths, MarginCollapseInfo}; -use layout::parallel::FlowParallelInfo; -use layout::table_wrapper::TableWrapperFlow; -use layout::table::TableFlow; -use layout::table_colgroup::TableColGroupFlow; -use layout::table_rowgroup::TableRowGroupFlow; -use layout::table_row::TableRowFlow; -use layout::table_caption::TableCaptionFlow; -use layout::table_cell::TableCellFlow; -use layout::wrapper::ThreadSafeLayoutNode; +use block::BlockFlow; +use context::LayoutContext; +use floats::Floats; +use flow_list::{FlowList, Link, FlowListIterator, MutFlowListIterator}; +use flow_ref::FlowRef; +use fragment::{Fragment, TableRowFragment, TableCellFragment}; +use incremental::RestyleDamage; +use inline::InlineFlow; +use model::{CollapsibleMargins, IntrinsicWidths, MarginCollapseInfo}; +use parallel::FlowParallelInfo; +use table_wrapper::TableWrapperFlow; +use table::TableFlow; +use table_colgroup::TableColGroupFlow; +use table_rowgroup::TableRowGroupFlow; +use table_row::TableRowFlow; +use table_caption::TableCaptionFlow; +use table_cell::TableCellFlow; +use wrapper::ThreadSafeLayoutNode; use collections::dlist::DList; use geom::point::Point2D; diff --git a/src/components/main/layout/flow_list.rs b/src/components/layout/flow_list.rs similarity index 99% rename from src/components/main/layout/flow_list.rs rename to src/components/layout/flow_list.rs index 3d1cccbdce1..e136c29282f 100644 --- a/src/components/main/layout/flow_list.rs +++ b/src/components/layout/flow_list.rs @@ -5,8 +5,8 @@ //! A variant of `DList` specialized to store `Flow`s without an extra //! indirection. -use layout::flow::{Flow, base, mut_base}; -use layout::flow_ref::FlowRef; +use flow::{Flow, base, mut_base}; +use flow_ref::FlowRef; use std::mem; use std::ptr; diff --git a/src/components/main/layout/flow_ref.rs b/src/components/layout/flow_ref.rs similarity index 97% rename from src/components/main/layout/flow_ref.rs rename to src/components/layout/flow_ref.rs index 3ad20a9b6f0..f17de19c809 100644 --- a/src/components/main/layout/flow_ref.rs +++ b/src/components/layout/flow_ref.rs @@ -6,8 +6,8 @@ /// /// Eventually, with dynamically sized types in Rust, much of this code will be superfluous. -use layout::flow::Flow; -use layout::flow; +use flow::Flow; +use flow; use std::mem; use std::ptr; diff --git a/src/components/main/layout/fragment.rs b/src/components/layout/fragment.rs similarity index 99% rename from src/components/main/layout/fragment.rs rename to src/components/layout/fragment.rs index 3ee3f7586c9..3fea9cb9afa 100644 --- a/src/components/main/layout/fragment.rs +++ b/src/components/layout/fragment.rs @@ -7,17 +7,17 @@ #![deny(unsafe_block)] use css::node_style::StyledNode; -use layout::construct::FlowConstructor; -use layout::context::LayoutContext; -use layout::floats::{ClearBoth, ClearLeft, ClearRight, ClearType}; -use layout::flow::Flow; -use layout::flow; -use layout::inline::{InlineFragmentContext, InlineMetrics}; -use layout::model::{Auto, IntrinsicWidths, MaybeAuto, Specified, specified}; -use layout::model; -use layout::text; -use layout::util::{OpaqueNodeMethods, ToGfxColor}; -use layout::wrapper::{TLayoutNode, ThreadSafeLayoutNode}; +use construct::FlowConstructor; +use context::LayoutContext; +use floats::{ClearBoth, ClearLeft, ClearRight, ClearType}; +use flow::Flow; +use flow; +use inline::{InlineFragmentContext, InlineMetrics}; +use model::{Auto, IntrinsicWidths, MaybeAuto, Specified, specified}; +use model; +use text; +use util::{OpaqueNodeMethods, ToGfxColor}; +use wrapper::{TLayoutNode, ThreadSafeLayoutNode}; use geom::{Point2D, Rect, Size2D, SideOffsets2D}; use geom::approxeq::ApproxEq; diff --git a/src/components/main/layout/incremental.rs b/src/components/layout/incremental.rs similarity index 100% rename from src/components/main/layout/incremental.rs rename to src/components/layout/incremental.rs diff --git a/src/components/main/layout/inline.rs b/src/components/layout/inline.rs similarity index 99% rename from src/components/main/layout/inline.rs rename to src/components/layout/inline.rs index e3080340c59..350eb52d1ce 100644 --- a/src/components/main/layout/inline.rs +++ b/src/components/layout/inline.rs @@ -5,15 +5,15 @@ #![deny(unsafe_block)] use css::node_style::StyledNode; -use layout::context::LayoutContext; -use layout::floats::{FloatLeft, Floats, PlacementInfo}; -use layout::flow::{BaseFlow, FlowClass, Flow, InlineFlowClass}; -use layout::flow; -use layout::fragment::{Fragment, ScannedTextFragment, ScannedTextFragmentInfo, SplitInfo}; -use layout::model::IntrinsicWidths; -use layout::model; -use layout::text; -use layout::wrapper::ThreadSafeLayoutNode; +use context::LayoutContext; +use floats::{FloatLeft, Floats, PlacementInfo}; +use flow::{BaseFlow, FlowClass, Flow, InlineFlowClass}; +use flow; +use fragment::{Fragment, ScannedTextFragment, ScannedTextFragmentInfo, SplitInfo}; +use model::IntrinsicWidths; +use model; +use text; +use wrapper::ThreadSafeLayoutNode; use collections::{Deque, RingBuf}; use geom::{Point2D, Rect, SideOffsets2D, Size2D}; diff --git a/src/components/layout/layout.rs b/src/components/layout/layout.rs new file mode 100644 index 00000000000..d864ec9d848 --- /dev/null +++ b/src/components/layout/layout.rs @@ -0,0 +1,68 @@ +/* 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/. */ + +#![crate_id = "github.com/mozilla/servo#layout:0.1"] +#![crate_type = "lib"] +#![crate_type = "dylib"] +#![crate_type = "rlib"] + +#![comment = "The Servo Parallel Browser Project"] +#![license = "MPL"] + +#![feature(globs, macro_rules, phase, thread_local)] + +#[phase(plugin, link)] +extern crate log; + +extern crate debug; + +extern crate geom; +extern crate gfx; +extern crate script; +extern crate style; +#[phase(plugin)] +extern crate servo_macros = "macros"; +extern crate servo_net = "net"; +extern crate servo_msg = "msg"; +#[phase(plugin, link)] +extern crate servo_util = "util"; + +extern crate collections; +extern crate green; +extern crate libc; +extern crate sync; +extern crate url; + +pub mod block; +pub mod construct; +pub mod context; +pub mod floats; +pub mod flow; +pub mod flow_list; +pub mod flow_ref; +pub mod fragment; +pub mod layout_task; +pub mod inline; +pub mod model; +pub mod parallel; +pub mod table_wrapper; +pub mod table; +pub mod table_caption; +pub mod table_colgroup; +pub mod table_rowgroup; +pub mod table_row; +pub mod table_cell; +pub mod text; +pub mod util; +pub mod incremental; +pub mod wrapper; +pub mod extra; + +pub mod css { + mod node_util; + + pub mod select; + pub mod matching; + pub mod node_style; +} diff --git a/src/components/main/layout/layout_task.rs b/src/components/layout/layout_task.rs similarity index 98% rename from src/components/main/layout/layout_task.rs rename to src/components/layout/layout_task.rs index cb86cf92020..f7fd408fd6e 100644 --- a/src/components/main/layout/layout_task.rs +++ b/src/components/layout/layout_task.rs @@ -9,17 +9,17 @@ use css::matching::{ApplicableDeclarations, ApplicableDeclarationsCache, MatchMe use css::matching::{StyleSharingCandidateCache}; use css::select::new_stylist; use css::node_style::StyledNode; -use layout::construct::{FlowConstructionResult, NoConstructionResult}; -use layout::context::LayoutContext; -use layout::flow::{Flow, ImmutableFlowUtils, MutableFlowUtils, MutableOwnedFlowUtils}; -use layout::flow::{PreorderFlowTraversal, PostorderFlowTraversal}; -use layout::flow; -use layout::flow_ref::FlowRef; -use layout::incremental::RestyleDamage; -use layout::parallel::UnsafeFlow; -use layout::parallel; -use layout::util::{LayoutDataAccess, LayoutDataWrapper, OpaqueNodeMethods, ToGfxColor}; -use layout::wrapper::{LayoutNode, TLayoutNode, ThreadSafeLayoutNode}; +use construct::{FlowConstructionResult, NoConstructionResult}; +use context::LayoutContext; +use flow::{Flow, ImmutableFlowUtils, MutableFlowUtils, MutableOwnedFlowUtils}; +use flow::{PreorderFlowTraversal, PostorderFlowTraversal}; +use flow; +use flow_ref::FlowRef; +use incremental::RestyleDamage; +use parallel::UnsafeFlow; +use parallel; +use util::{LayoutDataAccess, LayoutDataWrapper, OpaqueNodeMethods, ToGfxColor}; +use wrapper::{LayoutNode, TLayoutNode, ThreadSafeLayoutNode}; use collections::dlist::DList; use geom::point::Point2D; diff --git a/src/components/main/layout/model.rs b/src/components/layout/model.rs similarity index 99% rename from src/components/main/layout/model.rs rename to src/components/layout/model.rs index 855dda384ec..dc147b77c8b 100644 --- a/src/components/main/layout/model.rs +++ b/src/components/layout/model.rs @@ -6,7 +6,7 @@ #![deny(unsafe_block)] -use layout::fragment::Fragment; +use fragment::Fragment; use computed = style::computed_values; use geom::SideOffsets2D; diff --git a/src/components/main/layout/parallel.rs b/src/components/layout/parallel.rs similarity index 96% rename from src/components/main/layout/parallel.rs rename to src/components/layout/parallel.rs index 9d46370f024..e99d948d63d 100644 --- a/src/components/main/layout/parallel.rs +++ b/src/components/layout/parallel.rs @@ -7,17 +7,17 @@ //! This code is highly unsafe. Keep this file small and easy to audit. use css::matching::{ApplicableDeclarations, CannotShare, MatchMethods, StyleWasShared}; -use layout::construct::FlowConstructor; -use layout::context::LayoutContext; -use layout::extra::LayoutAuxMethods; -use layout::flow::{Flow, MutableFlowUtils, PreorderFlowTraversal, PostorderFlowTraversal}; -use layout::flow; -use layout::flow_ref::FlowRef; -use layout::layout_task::{AssignHeightsAndStoreOverflowTraversal, AssignWidthsTraversal}; -use layout::layout_task::{BubbleWidthsTraversal}; -use layout::util::{LayoutDataAccess, LayoutDataWrapper, OpaqueNodeMethods}; -use layout::wrapper::{layout_node_to_unsafe_layout_node, layout_node_from_unsafe_layout_node, LayoutNode, PostorderNodeMutTraversal}; -use layout::wrapper::{ThreadSafeLayoutNode, UnsafeLayoutNode}; +use construct::FlowConstructor; +use context::LayoutContext; +use extra::LayoutAuxMethods; +use flow::{Flow, MutableFlowUtils, PreorderFlowTraversal, PostorderFlowTraversal}; +use flow; +use flow_ref::FlowRef; +use layout_task::{AssignHeightsAndStoreOverflowTraversal, AssignWidthsTraversal}; +use layout_task::{BubbleWidthsTraversal}; +use util::{LayoutDataAccess, LayoutDataWrapper, OpaqueNodeMethods}; +use wrapper::{layout_node_to_unsafe_layout_node, layout_node_from_unsafe_layout_node, LayoutNode, PostorderNodeMutTraversal}; +use wrapper::{ThreadSafeLayoutNode, UnsafeLayoutNode}; use gfx::display_list::OpaqueNode; use servo_util::time::{TimeProfilerChan, profile}; diff --git a/src/components/main/layout/table.rs b/src/components/layout/table.rs similarity index 96% rename from src/components/main/layout/table.rs rename to src/components/layout/table.rs index 88dc99562c2..e9ac3cb412c 100644 --- a/src/components/main/layout/table.rs +++ b/src/components/layout/table.rs @@ -6,15 +6,15 @@ #![deny(unsafe_block)] -use layout::block::{BlockFlow, MarginsMayNotCollapse, WidthAndMarginsComputer}; -use layout::block::{WidthConstraintInput, WidthConstraintSolution}; -use layout::construct::FlowConstructor; -use layout::context::LayoutContext; -use layout::floats::FloatKind; -use layout::flow::{TableFlowClass, FlowClass, Flow, ImmutableFlowUtils}; -use layout::fragment::Fragment; -use layout::table_wrapper::{TableLayout, FixedLayout, AutoLayout}; -use layout::wrapper::ThreadSafeLayoutNode; +use block::{BlockFlow, MarginsMayNotCollapse, WidthAndMarginsComputer}; +use block::{WidthConstraintInput, WidthConstraintSolution}; +use construct::FlowConstructor; +use context::LayoutContext; +use floats::FloatKind; +use flow::{TableFlowClass, FlowClass, Flow, ImmutableFlowUtils}; +use fragment::Fragment; +use table_wrapper::{TableLayout, FixedLayout, AutoLayout}; +use wrapper::ThreadSafeLayoutNode; use servo_util::geometry::Au; use servo_util::geometry; diff --git a/src/components/main/layout/table_caption.rs b/src/components/layout/table_caption.rs similarity index 90% rename from src/components/main/layout/table_caption.rs rename to src/components/layout/table_caption.rs index 658da63e603..63fbf672681 100644 --- a/src/components/main/layout/table_caption.rs +++ b/src/components/layout/table_caption.rs @@ -6,11 +6,11 @@ #![deny(unsafe_block)] -use layout::block::BlockFlow; -use layout::construct::FlowConstructor; -use layout::context::LayoutContext; -use layout::flow::{TableCaptionFlowClass, FlowClass, Flow}; -use layout::wrapper::ThreadSafeLayoutNode; +use block::BlockFlow; +use construct::FlowConstructor; +use context::LayoutContext; +use flow::{TableCaptionFlowClass, FlowClass, Flow}; +use wrapper::ThreadSafeLayoutNode; use std::fmt; diff --git a/src/components/main/layout/table_cell.rs b/src/components/layout/table_cell.rs similarity index 93% rename from src/components/main/layout/table_cell.rs rename to src/components/layout/table_cell.rs index 43847539781..1538bab5df5 100644 --- a/src/components/main/layout/table_cell.rs +++ b/src/components/layout/table_cell.rs @@ -6,13 +6,13 @@ #![deny(unsafe_block)] -use layout::block::{BlockFlow, MarginsMayNotCollapse, WidthAndMarginsComputer}; -use layout::context::LayoutContext; -use layout::flow::{TableCellFlowClass, FlowClass, Flow}; -use layout::fragment::Fragment; -use layout::model::{MaybeAuto}; -use layout::table::InternalTable; -use layout::wrapper::ThreadSafeLayoutNode; +use block::{BlockFlow, MarginsMayNotCollapse, WidthAndMarginsComputer}; +use context::LayoutContext; +use flow::{TableCellFlowClass, FlowClass, Flow}; +use fragment::Fragment; +use model::{MaybeAuto}; +use table::InternalTable; +use wrapper::ThreadSafeLayoutNode; use servo_util::geometry::Au; use std::fmt; diff --git a/src/components/main/layout/table_colgroup.rs b/src/components/layout/table_colgroup.rs similarity index 91% rename from src/components/main/layout/table_colgroup.rs rename to src/components/layout/table_colgroup.rs index 6c3c0189ebe..212629303c9 100644 --- a/src/components/main/layout/table_colgroup.rs +++ b/src/components/layout/table_colgroup.rs @@ -6,11 +6,11 @@ #![deny(unsafe_block)] -use layout::context::LayoutContext; -use layout::flow::{BaseFlow, TableColGroupFlowClass, FlowClass, Flow}; -use layout::fragment::{Fragment, TableColumnFragment}; -use layout::model::{MaybeAuto}; -use layout::wrapper::ThreadSafeLayoutNode; +use context::LayoutContext; +use flow::{BaseFlow, TableColGroupFlowClass, FlowClass, Flow}; +use fragment::{Fragment, TableColumnFragment}; +use model::{MaybeAuto}; +use wrapper::ThreadSafeLayoutNode; use servo_util::geometry::Au; use std::fmt; diff --git a/src/components/main/layout/table_row.rs b/src/components/layout/table_row.rs similarity index 95% rename from src/components/main/layout/table_row.rs rename to src/components/layout/table_row.rs index 065d43dc291..d4935c1c0ed 100644 --- a/src/components/main/layout/table_row.rs +++ b/src/components/layout/table_row.rs @@ -6,16 +6,16 @@ #![deny(unsafe_block)] -use layout::block::BlockFlow; -use layout::block::WidthAndMarginsComputer; -use layout::construct::FlowConstructor; -use layout::context::LayoutContext; -use layout::flow::{TableRowFlowClass, FlowClass, Flow, ImmutableFlowUtils}; -use layout::flow; -use layout::fragment::Fragment; -use layout::table::InternalTable; -use layout::model::{MaybeAuto, Specified, Auto}; -use layout::wrapper::ThreadSafeLayoutNode; +use block::BlockFlow; +use block::WidthAndMarginsComputer; +use construct::FlowConstructor; +use context::LayoutContext; +use flow::{TableRowFlowClass, FlowClass, Flow, ImmutableFlowUtils}; +use flow; +use fragment::Fragment; +use table::InternalTable; +use model::{MaybeAuto, Specified, Auto}; +use wrapper::ThreadSafeLayoutNode; use servo_util::geometry::Au; use servo_util::geometry; diff --git a/src/components/main/layout/table_rowgroup.rs b/src/components/layout/table_rowgroup.rs similarity index 95% rename from src/components/main/layout/table_rowgroup.rs rename to src/components/layout/table_rowgroup.rs index c669dc79b6e..e36f58bf482 100644 --- a/src/components/main/layout/table_rowgroup.rs +++ b/src/components/layout/table_rowgroup.rs @@ -6,15 +6,15 @@ #![deny(unsafe_block)] -use layout::block::BlockFlow; -use layout::block::WidthAndMarginsComputer; -use layout::construct::FlowConstructor; -use layout::context::LayoutContext; -use layout::flow::{TableRowGroupFlowClass, FlowClass, Flow, ImmutableFlowUtils}; -use layout::flow; -use layout::fragment::Fragment; -use layout::table::{InternalTable, TableFlow}; -use layout::wrapper::ThreadSafeLayoutNode; +use block::BlockFlow; +use block::WidthAndMarginsComputer; +use construct::FlowConstructor; +use context::LayoutContext; +use flow::{TableRowGroupFlowClass, FlowClass, Flow, ImmutableFlowUtils}; +use flow; +use fragment::Fragment; +use table::{InternalTable, TableFlow}; +use wrapper::ThreadSafeLayoutNode; use servo_util::geometry::Au; use servo_util::geometry; diff --git a/src/components/main/layout/table_wrapper.rs b/src/components/layout/table_wrapper.rs similarity index 96% rename from src/components/main/layout/table_wrapper.rs rename to src/components/layout/table_wrapper.rs index 6f8cc8fcc57..7c04847faf1 100644 --- a/src/components/main/layout/table_wrapper.rs +++ b/src/components/layout/table_wrapper.rs @@ -6,15 +6,15 @@ #![deny(unsafe_block)] -use layout::block::{BlockFlow, MarginsMayNotCollapse, WidthAndMarginsComputer}; -use layout::block::{WidthConstraintInput, WidthConstraintSolution}; -use layout::construct::FlowConstructor; -use layout::context::LayoutContext; -use layout::floats::FloatKind; -use layout::flow::{TableWrapperFlowClass, FlowClass, Flow, ImmutableFlowUtils}; -use layout::fragment::Fragment; -use layout::model::{Specified, Auto, specified}; -use layout::wrapper::ThreadSafeLayoutNode; +use block::{BlockFlow, MarginsMayNotCollapse, WidthAndMarginsComputer}; +use block::{WidthConstraintInput, WidthConstraintSolution}; +use construct::FlowConstructor; +use context::LayoutContext; +use floats::FloatKind; +use flow::{TableWrapperFlowClass, FlowClass, Flow, ImmutableFlowUtils}; +use fragment::Fragment; +use model::{Specified, Auto, specified}; +use wrapper::ThreadSafeLayoutNode; use servo_util::geometry::Au; use servo_util::geometry; diff --git a/src/components/main/layout/text.rs b/src/components/layout/text.rs similarity index 99% rename from src/components/main/layout/text.rs rename to src/components/layout/text.rs index 54fef44714f..4f354c96703 100644 --- a/src/components/main/layout/text.rs +++ b/src/components/layout/text.rs @@ -6,8 +6,8 @@ #![deny(unsafe_block)] -use layout::flow::Flow; -use layout::fragment::{Fragment, ScannedTextFragment, ScannedTextFragmentInfo, UnscannedTextFragment}; +use flow::Flow; +use fragment::{Fragment, ScannedTextFragment, ScannedTextFragmentInfo, UnscannedTextFragment}; use gfx::font::{FontMetrics, FontStyle}; use gfx::font_context::FontContext; diff --git a/src/components/main/layout/util.rs b/src/components/layout/util.rs similarity index 96% rename from src/components/main/layout/util.rs rename to src/components/layout/util.rs index 486cb204804..4f05a18f5ce 100644 --- a/src/components/main/layout/util.rs +++ b/src/components/layout/util.rs @@ -2,10 +2,10 @@ * 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 layout::construct::{ConstructionResult, NoConstructionResult}; -use layout::incremental::RestyleDamage; -use layout::parallel::DomParallelInfo; -use layout::wrapper::{LayoutNode, TLayoutNode, ThreadSafeLayoutNode}; +use construct::{ConstructionResult, NoConstructionResult}; +use incremental::RestyleDamage; +use parallel::DomParallelInfo; +use wrapper::{LayoutNode, TLayoutNode, ThreadSafeLayoutNode}; use gfx::display_list::OpaqueNode; use gfx; diff --git a/src/components/main/layout/wrapper.rs b/src/components/layout/wrapper.rs similarity index 99% rename from src/components/main/layout/wrapper.rs rename to src/components/layout/wrapper.rs index 71b6b2b6d6b..4fd202c9b1f 100644 --- a/src/components/main/layout/wrapper.rs +++ b/src/components/layout/wrapper.rs @@ -34,7 +34,7 @@ //! `html_element_in_html_document_for_layout()`. use css::node_style::StyledNode; -use layout::util::LayoutDataWrapper; +use util::LayoutDataWrapper; use script::dom::bindings::codegen::InheritTypes::{HTMLIFrameElementDerived}; use script::dom::bindings::codegen::InheritTypes::{HTMLImageElementDerived, TextDerived}; diff --git a/src/components/main/servo.rs b/src/components/main/servo.rs index c32060852b2..96cd12224c8 100644 --- a/src/components/main/servo.rs +++ b/src/components/main/servo.rs @@ -23,6 +23,7 @@ extern crate glfw; extern crate glut; extern crate js; extern crate layers; +extern crate layout; extern crate opengles; extern crate png; extern crate rustuv; @@ -87,44 +88,9 @@ use url::Url; #[path="compositing/compositor_task.rs"] pub mod compositing; -pub mod css { - mod node_util; - - pub mod select; - pub mod matching; - pub mod node_style; -} - pub mod constellation; pub mod pipeline; -pub mod layout { - pub mod block; - pub mod construct; - pub mod context; - pub mod floats; - pub mod flow; - pub mod flow_list; - pub mod flow_ref; - pub mod fragment; - pub mod layout_task; - pub mod inline; - pub mod model; - pub mod parallel; - pub mod table_wrapper; - pub mod table; - pub mod table_caption; - pub mod table_colgroup; - pub mod table_rowgroup; - pub mod table_row; - pub mod table_cell; - pub mod text; - pub mod util; - pub mod incremental; - pub mod wrapper; - pub mod extra; -} - pub mod windowing; #[path="platform/mod.rs"] From cc7493ea2f42ae0da476a96a9503e8066c666399 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Sat, 28 Jun 2014 09:00:43 -0400 Subject: [PATCH 2/3] Split compositing/pipeline/constellation code into separate crate. --- Makefile.in | 16 +++-- configure | 1 + src/components/compositing/compositing.rs | 64 +++++++++++++++++++ .../{main => }/compositing/compositor.rs | 9 ++- .../compositing/compositor_layer.rs | 2 +- .../{main => }/compositing/compositor_task.rs | 12 ++-- .../{main => compositing}/constellation.rs | 3 +- .../{main => }/compositing/headless.rs | 6 +- .../{main => compositing}/pipeline.rs | 2 +- .../platform/common/glfw_windowing.rs | 0 .../platform/common/glut_windowing.rs | 0 .../{main => compositing}/platform/mod.rs | 0 .../{main => }/compositing/quadtree.rs | 0 .../{main => compositing}/windowing.rs | 0 src/components/main/image.rs | 13 ---- src/components/main/servo.rs | 45 +------------ 16 files changed, 98 insertions(+), 75 deletions(-) create mode 100644 src/components/compositing/compositing.rs rename src/components/{main => }/compositing/compositor.rs (98%) rename src/components/{main => }/compositing/compositor_layer.rs (99%) rename src/components/{main => }/compositing/compositor_task.rs (97%) rename src/components/{main => compositing}/constellation.rs (99%) rename src/components/{main => }/compositing/headless.rs (89%) rename src/components/{main => compositing}/pipeline.rs (99%) rename src/components/{main => compositing}/platform/common/glfw_windowing.rs (100%) rename src/components/{main => compositing}/platform/common/glut_windowing.rs (100%) rename src/components/{main => compositing}/platform/mod.rs (100%) rename src/components/{main => }/compositing/quadtree.rs (100%) rename src/components/{main => compositing}/windowing.rs (100%) delete mode 100644 src/components/main/image.rs diff --git a/Makefile.in b/Makefile.in index b82aa4fa075..799ca67f15f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -282,14 +282,22 @@ DONE_layout = $(B)src/components/layout/liblayout.dummy DEPS_layout = $(CRATE_layout) $(SRC_layout) $(DONE_script) $(DONE_style) $(DONE_msg) $(DONE_macros) $(DONE_gfx) $(DONE_util) -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 -L $(B)src/components/layout -L $(B)src/components/style -L $(B)src/components/msg -L$(B)src/components/macros +RFLAGS_compositing = $(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 -L $(B)src/components/layout -L $(B)src/components/style -L $(B)src/components/msg + +SRC_compositing = $(call rwildcard,$(S)src/components/compositing/,*.rs) +CRATE_compositing = $(S)src/components/compositing/compositing.rs +DONE_compositing = $(B)src/components/compositing/libcompositing.dummy + +DEPS_compositing = $(CRATE_compositing) $(SRC_compositing) $(DONE_util) $(DONE_msg) $(DONE_gfx) + +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 -L $(B)src/components/layout -L $(B)src/components/compositing -L $(B)src/components/style -L $(B)src/components/msg -L$(B)src/components/macros SRC_servo = $(call rwildcard,$(S)src/components/main/,*.rs) CRATE_servo = $(S)src/components/main/servo.rs -DEPS_servo = $(CRATE_servo) $(SRC_servo) $(DONE_SUBMODULES) $(DONE_util) $(DONE_gfx) $(DONE_script) $(DONE_net) $(DONE_msg) $(DONE_style) $(DONE_macros) $(DONE_layout) +DEPS_servo = $(CRATE_servo) $(SRC_servo) $(DONE_SUBMODULES) $(DONE_util) $(DONE_gfx) $(DONE_script) $(DONE_net) $(DONE_msg) $(DONE_style) $(DONE_macros) $(DONE_layout) $(DONE_compositing) -SERVO_LIB_CRATES = macros util net msg gfx script style layout +SERVO_LIB_CRATES = macros util net msg gfx script style layout compositing # rules that depend on having correct meta-target vars (DEPS_CLEAN, DEPS_servo, etc) # and SERVO_LIB_CRATES @@ -356,7 +364,7 @@ servo: $(DEPS_servo) @$(call E, compile: $@) $(Q)$(RUSTC) $(RFLAGS_servo) $< --crate-type bin,dylib,rlib -RFLAGS_embedding = $(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 -L $(B)src/components/layout -L $(B)src/components/style -L $(B)src/components/msg -L $(B).. -L $(B)src/components/main -L $(B)src/components/macros -A non_camel_case_types -A unused_variable +RFLAGS_embedding = $(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 -L $(B)src/components/layout -L $(B)src/components/compositing -L $(B)src/components/style -L $(B)src/components/msg -L $(B).. -L $(B)src/components/main -L $(B)src/components/macros -A non_camel_case_types -A unused_variable ifeq ($(CFG_OSTYPE),apple-darwin) RFLAGS_embedding += -C link-args="-Wl,-U,_tc_new -Wl,-U,_tc_newarray -Wl,-U,_tc_delete -Wl,-U,_tc_deletearray" diff --git a/configure b/configure index d73359243b2..56af9f2de52 100755 --- a/configure +++ b/configure @@ -604,6 +604,7 @@ done make_dir ${CFG_BUILD_DIR}src/components/macros make_dir ${CFG_BUILD_DIR}src/components/util +make_dir ${CFG_BUILD_DIR}src/components/compositing make_dir ${CFG_BUILD_DIR}src/components/embedding make_dir ${CFG_BUILD_DIR}src/components/msg make_dir ${CFG_BUILD_DIR}src/components/net diff --git a/src/components/compositing/compositing.rs b/src/components/compositing/compositing.rs new file mode 100644 index 00000000000..b807559aa30 --- /dev/null +++ b/src/components/compositing/compositing.rs @@ -0,0 +1,64 @@ +/* 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/. */ + +#![crate_id = "github.com/mozilla/servo#compositing:0.1"] +#![crate_type = "lib"] +#![crate_type = "dylib"] +#![crate_type = "rlib"] + +#![comment = "The Servo Parallel Browser Project"] +#![license = "MPL"] + +#![feature(globs, phase, macro_rules)] + +#[phase(plugin, link)] +extern crate log; + +extern crate debug; + +extern crate alert; +extern crate azure; +extern crate geom; +extern crate gfx; +#[cfg(not(target_os="android"))] +extern crate glfw; +#[cfg(target_os="android")] +extern crate glut; +extern crate layers; +extern crate layout; +extern crate opengles; +extern crate png; +extern crate script; +extern crate servo_msg = "msg"; +extern crate servo_net = "net"; +#[phase(plugin, link)] +extern crate servo_util = "util"; + +extern crate libc; +extern crate time; +extern crate url; + +#[cfg(target_os="macos")] +extern crate core_graphics; +#[cfg(target_os="macos")] +extern crate core_text; + +pub use compositor_task::{CompositorChan, CompositorTask}; +pub use constellation::Constellation; + +mod compositor_task; + +mod quadtree; +mod compositor_layer; + +mod compositor; +mod headless; + +mod pipeline; +mod constellation; + +mod windowing; + +#[path="platform/mod.rs"] +pub mod platform; diff --git a/src/components/main/compositing/compositor.rs b/src/components/compositing/compositor.rs similarity index 98% rename from src/components/main/compositing/compositor.rs rename to src/components/compositing/compositor.rs index 6272a688b5b..e1a9bbc0c76 100644 --- a/src/components/main/compositing/compositor.rs +++ b/src/components/compositing/compositor.rs @@ -2,11 +2,16 @@ * 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 compositor_task::{Msg, CompositorTask, Exit, ChangeReadyState, SetUnRenderedColor}; +use compositor_task::{SetIds, GetGraphicsMetadata, CreateRootCompositorLayerIfNecessary}; +use compositor_task::{CreateDescendantCompositorLayerIfNecessary, SetLayerPageSize}; +use compositor_task::{SetLayerClipRect, Paint, ScrollFragmentPoint, LoadComplete}; +use compositor_task::{ShutdownComplete, ChangeRenderState}; use constellation::SendableFrameTree; -use compositing::compositor_layer::CompositorLayer; -use compositing::*; +use compositor_layer::CompositorLayer; use pipeline::CompositionPipeline; use platform::{Application, Window}; +use windowing; use windowing::{FinishedWindowEvent, IdleWindowEvent, LoadUrlWindowEvent, MouseWindowClickEvent}; use windowing::{MouseWindowEvent, MouseWindowEventClass, MouseWindowMouseDownEvent}; use windowing::{MouseWindowMouseUpEvent, MouseWindowMoveEventClass, NavigationWindowEvent}; diff --git a/src/components/main/compositing/compositor_layer.rs b/src/components/compositing/compositor_layer.rs similarity index 99% rename from src/components/main/compositing/compositor_layer.rs rename to src/components/compositing/compositor_layer.rs index 268236efdce..eb3c56fd188 100644 --- a/src/components/main/compositing/compositor_layer.rs +++ b/src/components/compositing/compositor_layer.rs @@ -2,7 +2,7 @@ * 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 compositing::quadtree::{Quadtree, Normal, Hidden}; +use quadtree::{Quadtree, Normal, Hidden}; use pipeline::CompositionPipeline; use windowing::{MouseWindowEvent, MouseWindowClickEvent, MouseWindowMouseDownEvent}; use windowing::{MouseWindowMouseUpEvent}; diff --git a/src/components/main/compositing/compositor_task.rs b/src/components/compositing/compositor_task.rs similarity index 97% rename from src/components/main/compositing/compositor_task.rs rename to src/components/compositing/compositor_task.rs index 601ce2e7294..e4e1654f200 100644 --- a/src/components/main/compositing/compositor_task.rs +++ b/src/components/compositing/compositor_task.rs @@ -4,6 +4,8 @@ pub use windowing; +use compositor; +use headless; use constellation::SendableFrameTree; use windowing::{ApplicationMethods, WindowMethods}; use platform::Application; @@ -26,12 +28,6 @@ use url::Url; #[cfg(target_os="linux")] use azure::azure_hl; -mod quadtree; -mod compositor_layer; - -mod compositor; -mod headless; - /// The implementation of the layers-based compositor. #[deriving(Clone)] pub struct CompositorChan { @@ -214,11 +210,11 @@ impl CompositorTask { /// /// FIXME(pcwalton): Probably could be less platform-specific, using the metadata abstraction. #[cfg(target_os="linux")] - fn create_graphics_context() -> NativeCompositingGraphicsContext { + pub fn create_graphics_context() -> NativeCompositingGraphicsContext { NativeCompositingGraphicsContext::from_display(azure_hl::current_display()) } #[cfg(not(target_os="linux"))] - fn create_graphics_context() -> NativeCompositingGraphicsContext { + pub fn create_graphics_context() -> NativeCompositingGraphicsContext { NativeCompositingGraphicsContext::new() } diff --git a/src/components/main/constellation.rs b/src/components/compositing/constellation.rs similarity index 99% rename from src/components/main/constellation.rs rename to src/components/compositing/constellation.rs index c70bc948b5a..f5215be1555 100644 --- a/src/components/main/constellation.rs +++ b/src/components/compositing/constellation.rs @@ -2,8 +2,7 @@ * 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 compositing::{CompositorChan, LoadComplete, SetIds, SetLayerClipRect, ShutdownComplete}; - +use compositor_task::{CompositorChan, LoadComplete, ShutdownComplete, SetLayerClipRect, SetIds}; use std::collections::hashmap::{HashMap, HashSet}; use geom::rect::{Rect, TypedRect}; use geom::scale_factor::ScaleFactor; diff --git a/src/components/main/compositing/headless.rs b/src/components/compositing/headless.rs similarity index 89% rename from src/components/main/compositing/headless.rs rename to src/components/compositing/headless.rs index a19e3b55c2c..c588b57cfad 100644 --- a/src/components/main/compositing/headless.rs +++ b/src/components/compositing/headless.rs @@ -2,7 +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 compositing::*; +use compositor_task::{Msg, Exit, ChangeReadyState, SetUnRenderedColor}; +use compositor_task::{SetIds, GetGraphicsMetadata, CreateRootCompositorLayerIfNecessary}; +use compositor_task::{CreateDescendantCompositorLayerIfNecessary, SetLayerPageSize}; +use compositor_task::{SetLayerClipRect, Paint, ScrollFragmentPoint, LoadComplete}; +use compositor_task::{ShutdownComplete, ChangeRenderState}; use geom::scale_factor::ScaleFactor; use geom::size::TypedSize2D; diff --git a/src/components/main/pipeline.rs b/src/components/compositing/pipeline.rs similarity index 99% rename from src/components/main/pipeline.rs rename to src/components/compositing/pipeline.rs index 145abba9a8d..cabf2984b15 100644 --- a/src/components/main/pipeline.rs +++ b/src/components/compositing/pipeline.rs @@ -2,7 +2,7 @@ * 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 compositing::CompositorChan; +use CompositorChan; use layout::layout_task::LayoutTask; use gfx::render_task::{PaintPermissionGranted, PaintPermissionRevoked}; diff --git a/src/components/main/platform/common/glfw_windowing.rs b/src/components/compositing/platform/common/glfw_windowing.rs similarity index 100% rename from src/components/main/platform/common/glfw_windowing.rs rename to src/components/compositing/platform/common/glfw_windowing.rs diff --git a/src/components/main/platform/common/glut_windowing.rs b/src/components/compositing/platform/common/glut_windowing.rs similarity index 100% rename from src/components/main/platform/common/glut_windowing.rs rename to src/components/compositing/platform/common/glut_windowing.rs diff --git a/src/components/main/platform/mod.rs b/src/components/compositing/platform/mod.rs similarity index 100% rename from src/components/main/platform/mod.rs rename to src/components/compositing/platform/mod.rs diff --git a/src/components/main/compositing/quadtree.rs b/src/components/compositing/quadtree.rs similarity index 100% rename from src/components/main/compositing/quadtree.rs rename to src/components/compositing/quadtree.rs diff --git a/src/components/main/windowing.rs b/src/components/compositing/windowing.rs similarity index 100% rename from src/components/main/windowing.rs rename to src/components/compositing/windowing.rs diff --git a/src/components/main/image.rs b/src/components/main/image.rs deleted file mode 100644 index 99d07a0f4ee..00000000000 --- a/src/components/main/image.rs +++ /dev/null @@ -1,13 +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/. */ - -/* This file exists just to make it easier to import things inside of - ./images/ without specifying the file they came out of imports. - -Note that you still must define each of the files as a module in -servo.rc. This is not ideal and may be changed in the future. */ - -pub use holder::ImageHolder; -pub use base::Image; - diff --git a/src/components/main/servo.rs b/src/components/main/servo.rs index 96cd12224c8..49f68a2bf1b 100644 --- a/src/components/main/servo.rs +++ b/src/components/main/servo.rs @@ -13,50 +13,20 @@ extern crate log; extern crate debug; -extern crate alert; -extern crate azure; -extern crate geom; -extern crate gfx; -#[cfg(not(target_os="android"))] -extern crate glfw; -#[cfg(target_os="android")] -extern crate glut; -extern crate js; -extern crate layers; -extern crate layout; -extern crate opengles; -extern crate png; +extern crate compositing; extern crate rustuv; -extern crate script; -#[phase(plugin)] -extern crate servo_macros = "macros"; extern crate servo_net = "net"; extern crate servo_msg = "msg"; #[phase(plugin, link)] extern crate servo_util = "util"; -extern crate style; -extern crate sharegl; -extern crate stb_image; - -extern crate collections; extern crate green; extern crate libc; extern crate native; extern crate rustrt; -extern crate serialize; -extern crate sync; -extern crate time; extern crate url; -#[cfg(target_os="macos")] -extern crate core_graphics; -#[cfg(target_os="macos")] -extern crate core_text; - #[cfg(not(test))] -use compositing::{CompositorChan, CompositorTask}; -#[cfg(not(test))] -use constellation::Constellation; +use compositing::{CompositorChan, CompositorTask, Constellation}; #[cfg(not(test))] use servo_msg::constellation_msg::{ConstellationChan, InitLoadUrlMsg}; @@ -85,17 +55,6 @@ use rustrt::task::TaskOpts; use url::Url; -#[path="compositing/compositor_task.rs"] -pub mod compositing; - -pub mod constellation; -pub mod pipeline; - -pub mod windowing; - -#[path="platform/mod.rs"] -pub mod platform; - #[cfg(not(test), target_os="linux")] #[cfg(not(test), target_os="macos")] #[start] From dab73057f168e46a888af02ae307419aefef21f6 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Sat, 28 Jun 2014 09:16:51 -0400 Subject: [PATCH 3/3] Fix incorrect libcompositing dep. --- Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index 799ca67f15f..dcc55e264e1 100644 --- a/Makefile.in +++ b/Makefile.in @@ -288,7 +288,7 @@ SRC_compositing = $(call rwildcard,$(S)src/components/compositing/,*.rs) CRATE_compositing = $(S)src/components/compositing/compositing.rs DONE_compositing = $(B)src/components/compositing/libcompositing.dummy -DEPS_compositing = $(CRATE_compositing) $(SRC_compositing) $(DONE_util) $(DONE_msg) $(DONE_gfx) +DEPS_compositing = $(CRATE_compositing) $(SRC_compositing) $(DONE_util) $(DONE_msg) $(DONE_gfx) $(DONE_script) $(DONE_layout) $(DONE_style) 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 -L $(B)src/components/layout -L $(B)src/components/compositing -L $(B)src/components/style -L $(B)src/components/msg -L$(B)src/components/macros