diff options
Diffstat (limited to 'components/layout')
31 files changed, 120 insertions, 153 deletions
diff --git a/components/layout/animation.rs b/components/layout/animation.rs index 26c40bade35..dcb860308ef 100644 --- a/components/layout/animation.rs +++ b/components/layout/animation.rs @@ -4,11 +4,10 @@ //! CSS transitions and animations. -use flow::{self, Flow}; -use incremental::{self, RestyleDamage}; - use clock_ticks; +use flow::{self, Flow}; use gfx::display_list::OpaqueNode; +use incremental::{self, RestyleDamage}; use layout_task::{LayoutTask, LayoutTaskData}; use msg::constellation_msg::{AnimationState, Msg, PipelineId}; use script::layout_interface::Animation; diff --git a/components/layout/block.rs b/components/layout/block.rs index af37b5d0938..19bd4fcac3d 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -30,6 +30,7 @@ use context::LayoutContext; use display_list_builder::{BlockFlowDisplayListBuilding, BorderPaintingMode}; use display_list_builder::{FragmentDisplayListBuilding}; +use euclid::{Point2D, Rect, Size2D}; use floats::{ClearType, FloatKind, Floats, PlacementInfo}; use flow::{BLOCK_POSITION_IS_STATIC}; use flow::{CLEARS_LEFT, CLEARS_RIGHT}; @@ -43,15 +44,12 @@ use flow::{self, BaseFlow, EarlyAbsolutePositionInfo, ForceNonfloatedFlag, FlowC use flow_ref; use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, HAS_LAYER}; use fragment::{SpecificFragmentInfo}; +use gfx::display_list::{ClippingRegion, DisplayList}; use incremental::{REFLOW, REFLOW_OUT_OF_FLOW}; use layout_debug; use layout_task::DISPLAY_PORT_SIZE_FACTOR; use model::{IntrinsicISizes, MarginCollapseInfo}; use model::{MaybeAuto, CollapsibleMargins, specified, specified_or_none}; -use wrapper::PseudoElementType; - -use euclid::{Point2D, Rect, Size2D}; -use gfx::display_list::{ClippingRegion, DisplayList}; use msg::compositor_msg::{LayerId, LayerType}; use rustc_serialize::{Encoder, Encodable}; use std::cmp::{max, min}; @@ -65,6 +63,7 @@ use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto}; use util::geometry::{Au, MAX_AU, MAX_RECT}; use util::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize, WritingMode}; use util::opts; +use wrapper::PseudoElementType; /// Information specific to floated blocks. #[derive(Clone, RustcEncodable)] diff --git a/components/layout/construct.rs b/components/layout/construct.rs index d13fd01bb02..28a7ec7c2e1 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -26,24 +26,13 @@ use fragment::{Fragment, GeneratedContentInfo, IframeFragmentInfo}; use fragment::{InlineAbsoluteHypotheticalFragmentInfo, TableColumnFragmentInfo}; use fragment::{InlineBlockFragmentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo}; use fragment::{WhitespaceStrippingResult}; +use gfx::display_list::OpaqueNode; use incremental::{RECONSTRUCT_FLOW, RestyleDamage}; use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFlow, InlineFragmentNodeFlags}; use inline::{InlineFragmentNodeInfo, LAST_FRAGMENT_OF_ELEMENT}; use list_item::{ListItemFlow, ListStyleTypeContent}; use multicol::MulticolFlow; use parallel; -use table::TableFlow; -use table_caption::TableCaptionFlow; -use table_cell::TableCellFlow; -use table_colgroup::TableColGroupFlow; -use table_row::TableRowFlow; -use table_rowgroup::TableRowGroupFlow; -use table_wrapper::TableWrapperFlow; -use text::TextRunScanner; -use traversal::PostorderNodeMutTraversal; -use wrapper::{PseudoElementType, TextContent, ThreadSafeLayoutNode}; - -use gfx::display_list::OpaqueNode; use script::dom::characterdata::CharacterDataTypeId; use script::dom::element::ElementTypeId; use script::dom::htmlelement::HTMLElementTypeId; @@ -58,9 +47,19 @@ use style::computed_values::content::ContentItem; use style::computed_values::{caption_side, display, empty_cells, float, list_style_position}; use style::computed_values::{position}; use style::properties::{self, ComputedValues}; +use table::TableFlow; +use table_caption::TableCaptionFlow; +use table_cell::TableCellFlow; +use table_colgroup::TableColGroupFlow; +use table_row::TableRowFlow; +use table_rowgroup::TableRowGroupFlow; +use table_wrapper::TableWrapperFlow; +use text::TextRunScanner; +use traversal::PostorderNodeMutTraversal; use url::Url; use util::linked_list; use util::opts; +use wrapper::{PseudoElementType, TextContent, ThreadSafeLayoutNode}; /// The results of flow construction for a DOM node. #[derive(Clone)] diff --git a/components/layout/context.rs b/components/layout/context.rs index 3003c6cf56a..5497fab803c 100644 --- a/components/layout/context.rs +++ b/components/layout/context.rs @@ -6,9 +6,8 @@ #![deny(unsafe_code)] -use css::matching::{ApplicableDeclarationsCache, StyleSharingCandidateCache}; - use canvas_traits::CanvasMsg; +use css::matching::{ApplicableDeclarationsCache, StyleSharingCandidateCache}; use euclid::{Rect, Size2D}; use fnv::FnvHasher; use gfx::display_list::OpaqueNode; diff --git a/components/layout/css/matching.rs b/components/layout/css/matching.rs index ded2d27842b..388a64ea645 100644 --- a/components/layout/css/matching.rs +++ b/components/layout/css/matching.rs @@ -10,9 +10,6 @@ use animation; use context::SharedLayoutContext; use data::LayoutDataWrapper; use incremental::{self, RestyleDamage}; -use smallvec::SmallVec; -use wrapper::{LayoutElement, LayoutNode}; - use script::dom::characterdata::CharacterDataTypeId; use script::dom::node::NodeTypeId; use script::layout_interface::Animation; @@ -21,6 +18,7 @@ use selectors::matching::{CommonStyleAffectingAttributeMode, CommonStyleAffectin use selectors::matching::{common_style_affecting_attributes, rare_style_affecting_attributes}; use selectors::parser::PseudoElement; use selectors::{Element}; +use smallvec::SmallVec; use std::borrow::ToOwned; use std::hash::{Hash, Hasher}; use std::slice::Iter; @@ -34,6 +32,7 @@ use util::arc_ptr_eq; use util::cache::{LRUCache, SimpleHashCache}; use util::opts; use util::vec::ForgetfulSink; +use wrapper::{LayoutElement, LayoutNode}; pub struct ApplicableDeclarations { pub normal: SmallVec<[DeclarationBlock; 16]>, diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs index 31cf9d5d231..4b5f0e8052b 100644 --- a/components/layout/display_list_builder.rs +++ b/components/layout/display_list_builder.rs @@ -12,20 +12,15 @@ use azure::azure_hl::Color; use block::BlockFlow; +use canvas_traits::{CanvasMsg, FromLayoutMsg}; use context::LayoutContext; +use euclid::Matrix4; +use euclid::{Point2D, Point3D, Rect, Size2D, SideOffsets2D}; use flex::FlexFlow; use flow::{self, BaseFlow, Flow, IS_ABSOLUTELY_POSITIONED}; use flow_ref; use fragment::{CoordinateSystem, Fragment, HAS_LAYER, IframeFragmentInfo, ImageFragmentInfo}; use fragment::{ScannedTextFragmentInfo, SpecificFragmentInfo}; -use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFlow, LAST_FRAGMENT_OF_ELEMENT}; -use list_item::ListItemFlow; -use model::{self, MaybeAuto, ToGfxMatrix}; -use table_cell::CollapsedBordersForCell; - -use canvas_traits::{CanvasMsg, FromLayoutMsg}; -use euclid::Matrix4; -use euclid::{Point2D, Point3D, Rect, Size2D, SideOffsets2D}; use gfx::display_list::{BLUR_INFLATION_FACTOR, BaseDisplayItem, BorderDisplayItem}; use gfx::display_list::{BorderRadii, BoxShadowClipMode, BoxShadowDisplayItem, ClippingRegion}; use gfx::display_list::{DisplayItem, DisplayList, DisplayItemMetadata}; @@ -36,7 +31,10 @@ use gfx::display_list::{StackingContext, TextDisplayItem, TextOrientation}; use gfx::paint_task::THREAD_TINT_COLORS; use gfx::text::glyph::CharIndex; use gfx_traits::color; +use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFlow, LAST_FRAGMENT_OF_ELEMENT}; use ipc_channel::ipc::{self, IpcSharedMemory}; +use list_item::ListItemFlow; +use model::{self, MaybeAuto, ToGfxMatrix}; use msg::compositor_msg::{ScrollPolicy, LayerId}; use msg::constellation_msg::ConstellationChan; use msg::constellation_msg::Msg as ConstellationMsg; @@ -59,6 +57,7 @@ use style::values::computed; use style::values::computed::LinearGradient; use style::values::computed::{LengthOrNone, LengthOrPercentage, LengthOrPercentageOrAuto}; use style::values::specified::{AngleOrCorner, HorizontalDirection, VerticalDirection}; +use table_cell::CollapsedBordersForCell; use url::Url; use util::cursor::Cursor; use util::geometry::{AU_PER_PX, Au, ZERO_POINT}; diff --git a/components/layout/flex.rs b/components/layout/flex.rs index d9a9b5d9ff9..a5b55e37833 100644 --- a/components/layout/flex.rs +++ b/components/layout/flex.rs @@ -9,6 +9,7 @@ use block::BlockFlow; use context::LayoutContext; use display_list_builder::FlexFlowDisplayListBuilding; +use euclid::{Point2D, Rect}; use floats::FloatKind; use flow; use flow::INLINE_POSITION_IS_STATIC; @@ -18,19 +19,17 @@ use flow::mut_base; use flow::{Flow, FlowClass, OpaqueFlow}; use flow::{HAS_LEFT_FLOATED_DESCENDANTS, HAS_RIGHT_FLOATED_DESCENDANTS}; use fragment::{Fragment, FragmentBorderBoxIterator}; +use gfx::display_list::DisplayList; use incremental::{REFLOW, REFLOW_OUT_OF_FLOW}; use layout_debug; -use model::{IntrinsicISizes}; -use style::computed_values::{flex_direction, float}; -use style::properties::style_structs; -use style::values::computed::LengthOrPercentageOrAuto; - -use euclid::{Point2D, Rect}; -use gfx::display_list::DisplayList; use model::MaybeAuto; +use model::{IntrinsicISizes}; use std::cmp::max; use std::sync::Arc; +use style::computed_values::{flex_direction, float}; use style::properties::ComputedValues; +use style::properties::style_structs; +use style::values::computed::LengthOrPercentageOrAuto; use util::geometry::Au; use util::logical_geometry::LogicalSize; use util::opts; diff --git a/components/layout/flow.rs b/components/layout/flow.rs index 578a95fb05c..3c14fab304c 100644 --- a/components/layout/flow.rs +++ b/components/layout/flow.rs @@ -28,28 +28,19 @@ use block::BlockFlow; use context::LayoutContext; use display_list_builder::DisplayListBuildingResult; +use euclid::{Point2D, Rect, Size2D}; use floats::Floats; use flow_list::{FlowList, FlowListIterator, MutFlowListIterator}; use flow_ref::{self, FlowRef, WeakFlowRef}; use fragment::{Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo}; +use gfx::display_list::ClippingRegion; use incremental::{self, RECONSTRUCT_FLOW, REFLOW, REFLOW_OUT_OF_FLOW, RestyleDamage}; use inline::InlineFlow; use model::{CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo}; -use multicol::MulticolFlow; -use parallel::FlowParallelInfo; -use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, TableFlow}; -use table_caption::TableCaptionFlow; -use table_cell::TableCellFlow; -use table_colgroup::TableColGroupFlow; -use table_row::TableRowFlow; -use table_rowgroup::TableRowGroupFlow; -use table_wrapper::TableWrapperFlow; -use wrapper::{PseudoElementType, ThreadSafeLayoutNode}; - -use euclid::{Point2D, Rect, Size2D}; -use gfx::display_list::ClippingRegion; use msg::compositor_msg::{LayerId, LayerType}; use msg::constellation_msg::ConstellationChan; +use multicol::MulticolFlow; +use parallel::FlowParallelInfo; use rustc_serialize::{Encoder, Encodable}; use std::fmt; use std::iter::Zip; @@ -61,8 +52,16 @@ use std::sync::atomic::Ordering; use style::computed_values::{clear, display, empty_cells, float, position, text_align}; use style::properties::{self, ComputedValues}; use style::values::computed::LengthOrPercentageOrAuto; +use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, TableFlow}; +use table_caption::TableCaptionFlow; +use table_cell::TableCellFlow; +use table_colgroup::TableColGroupFlow; +use table_row::TableRowFlow; +use table_rowgroup::TableRowGroupFlow; +use table_wrapper::TableWrapperFlow; use util::geometry::{Au, ZERO_RECT}; use util::logical_geometry::{LogicalRect, LogicalSize, WritingMode}; +use wrapper::{PseudoElementType, ThreadSafeLayoutNode}; /// Virtual methods that make up a float context. /// diff --git a/components/layout/flow_list.rs b/components/layout/flow_list.rs index af54dddee9d..8f16fc0fa3d 100644 --- a/components/layout/flow_list.rs +++ b/components/layout/flow_list.rs @@ -4,7 +4,6 @@ use flow::Flow; use flow_ref::{self, FlowRef}; - use std::collections::{linked_list, LinkedList}; // This needs to be reworked now that we have dynamically-sized types in Rust. diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index f73e6013c57..f4a95e64108 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -8,24 +8,21 @@ use canvas_traits::CanvasMsg; use context::LayoutContext; +use euclid::{Point2D, Rect, Size2D}; use floats::ClearType; use flow; use flow::Flow; use flow_ref::{self, FlowRef}; -use incremental::{self, RestyleDamage}; -use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFragmentContext, InlineFragmentNodeInfo}; -use inline::{InlineMetrics, LAST_FRAGMENT_OF_ELEMENT}; -use layout_debug; -use model::{self, IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto, specified}; -use text; -use wrapper::{PseudoElementType, ThreadSafeLayoutNode}; - -use euclid::{Point2D, Rect, Size2D}; use gfx; use gfx::display_list::{BLUR_INFLATION_FACTOR, OpaqueNode}; use gfx::text::glyph::CharIndex; use gfx::text::text_run::{TextRun, TextRunSlice}; +use incremental::{self, RestyleDamage}; +use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFragmentContext, InlineFragmentNodeInfo}; +use inline::{InlineMetrics, LAST_FRAGMENT_OF_ELEMENT}; use ipc_channel::ipc::IpcSender; +use layout_debug; +use model::{self, IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto, specified}; use msg::constellation_msg::{ConstellationChan, Msg, PipelineId, SubpageId}; use net_traits::image::base::Image; use net_traits::image_cache_task::UsePlaceholder; @@ -43,6 +40,7 @@ use style::computed_values::{word_break, z_index}; use style::properties::ComputedValues; use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto}; use style::values::computed::{LengthOrPercentageOrNone}; +use text; use text::TextRunScanner; use url::Url; use util; @@ -50,6 +48,7 @@ use util::geometry::{Au, ZERO_POINT}; use util::logical_geometry::{LogicalRect, LogicalSize, LogicalMargin, WritingMode}; use util::range::*; use util::str::{is_whitespace, slice_chars}; +use wrapper::{PseudoElementType, ThreadSafeLayoutNode}; /// Fragments (`struct Fragment`) are the leaves of the layout tree. They cannot position /// themselves. In general, fragments do not have a simple correspondence with CSS fragments in the diff --git a/components/layout/generated_content.rs b/components/layout/generated_content.rs index 2e823d3bc1d..5a907bb6ac7 100644 --- a/components/layout/generated_content.rs +++ b/components/layout/generated_content.rs @@ -12,17 +12,16 @@ use context::LayoutContext; use flow::{InorderFlowTraversal}; use flow::{self, AFFECTS_COUNTERS, Flow, HAS_COUNTER_AFFECTING_CHILDREN, ImmutableFlowUtils}; use fragment::{Fragment, GeneratedContentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo}; +use gfx::display_list::OpaqueNode; use incremental::{self, RESOLVE_GENERATED_CONTENT}; use smallvec::SmallVec; -use text::TextRunScanner; -use wrapper::PseudoElementType; - -use gfx::display_list::OpaqueNode; use std::collections::{LinkedList, HashMap}; use std::sync::Arc; use style::computed_values::content::ContentItem; use style::computed_values::{display, list_style_type}; use style::properties::ComputedValues; +use text::TextRunScanner; +use wrapper::PseudoElementType; // Decimal styles per CSS-COUNTER-STYLES § 6.1: static DECIMAL: [char; 10] = [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' ]; diff --git a/components/layout/incremental.rs b/components/layout/incremental.rs index adabc4bb471..6f60e9a2ab8 100644 --- a/components/layout/incremental.rs +++ b/components/layout/incremental.rs @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use flow::{self, AFFECTS_COUNTERS, Flow, HAS_COUNTER_AFFECTING_CHILDREN, IS_ABSOLUTELY_POSITIONED}; - use std::fmt; use std::sync::Arc; use style::computed_values::float; diff --git a/components/layout/inline.rs b/components/layout/inline.rs index 00043037f9d..b91cfd790bc 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -7,21 +7,18 @@ use block::{AbsoluteAssignBSizesTraversal, AbsoluteStoreOverflowTraversal}; use context::LayoutContext; use display_list_builder::{FragmentDisplayListBuilding, InlineFlowDisplayListBuilding}; +use euclid::{Point2D, Rect, Size2D}; use floats::{FloatKind, Floats, PlacementInfo}; use flow::{MutableFlowUtils, EarlyAbsolutePositionInfo, OpaqueFlow}; use flow::{self, BaseFlow, FlowClass, Flow, ForceNonfloatedFlag, IS_ABSOLUTELY_POSITIONED}; use flow_ref; use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo}; -use incremental::{REFLOW, REFLOW_OUT_OF_FLOW, RESOLVE_GENERATED_CONTENT}; -use layout_debug; -use model::IntrinsicISizesContribution; -use text; -use wrapper::PseudoElementType; - -use euclid::{Point2D, Rect, Size2D}; use gfx::display_list::OpaqueNode; use gfx::font::FontMetrics; use gfx::font_context::FontContext; +use incremental::{REFLOW, REFLOW_OUT_OF_FLOW, RESOLVE_GENERATED_CONTENT}; +use layout_debug; +use model::IntrinsicISizesContribution; use std::cmp::max; use std::collections::VecDeque; use std::fmt; @@ -31,11 +28,13 @@ use std::sync::Arc; use style::computed_values::{display, overflow_x, position, text_align, text_justify}; use style::computed_values::{text_overflow, vertical_align, white_space}; use style::properties::ComputedValues; +use text; use unicode_bidi; use util; use util::geometry::{Au, MAX_AU, ZERO_RECT}; use util::logical_geometry::{LogicalRect, LogicalSize, WritingMode}; use util::range::{Range, RangeIndex}; +use wrapper::PseudoElementType; // From gfxFontConstants.h in Firefox static FONT_SUBSCRIPT_OFFSET_RATIO: f32 = 0.20; diff --git a/components/layout/layout_debug.rs b/components/layout/layout_debug.rs index 93e68f7fbe0..24d20442457 100644 --- a/components/layout/layout_debug.rs +++ b/components/layout/layout_debug.rs @@ -10,7 +10,6 @@ use flow; use flow_ref::FlowRef; use rustc_serialize::json; - use std::borrow::ToOwned; use std::cell::RefCell; use std::fs::File; diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs index 25bbb4bf487..2bf311647c0 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -8,26 +8,13 @@ #![allow(unsafe_code)] use animation; +use azure::azure::AzColor; +use canvas_traits::CanvasMsg; use construct::ConstructionResult; use context::{SharedLayoutContext, heap_size_of_local_context}; use cssparser::ToCss; use data::LayoutDataWrapper; use display_list_builder::ToGfxColor; -use flow::{self, Flow, ImmutableFlowUtils, MutableFlowUtils, MutableOwnedFlowUtils}; -use flow_ref::{self, FlowRef}; -use fragment::{Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo}; -use incremental::{LayoutDamageComputation, REFLOW, REFLOW_ENTIRE_DOCUMENT, REPAINT}; -use layout_debug; -use opaque_node::OpaqueNodeMethods; -use parallel::{self, WorkQueueData}; -use query::{LayoutRPCImpl, process_content_box_request, process_content_boxes_request}; -use query::{MarginPadding, MarginRetrievingFragmentBorderBoxIterator, PositionProperty}; -use query::{PositionRetrievingFragmentBorderBoxIterator, Side}; -use sequential; -use wrapper::LayoutNode; - -use azure::azure::AzColor; -use canvas_traits::CanvasMsg; use encoding::EncodingRef; use encoding::all::UTF_8; use euclid::Matrix4; @@ -35,14 +22,19 @@ use euclid::point::Point2D; use euclid::rect::Rect; use euclid::scale_factor::ScaleFactor; use euclid::size::Size2D; +use flow::{self, Flow, ImmutableFlowUtils, MutableFlowUtils, MutableOwnedFlowUtils}; +use flow_ref::{self, FlowRef}; use fnv::FnvHasher; +use fragment::{Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo}; use gfx::display_list::StackingContext; use gfx::display_list::{ClippingRegion, DisplayList, OpaqueNode}; use gfx::font_cache_task::FontCacheTask; use gfx::paint_task::{LayoutToPaintMsg, PaintLayer}; use gfx_traits::color; +use incremental::{LayoutDamageComputation, REFLOW, REFLOW_ENTIRE_DOCUMENT, REPAINT}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::router::ROUTER; +use layout_debug; use layout_traits::LayoutTaskFactory; use log; use msg::compositor_msg::{Epoch, ScrollPolicy, LayerId}; @@ -50,9 +42,14 @@ use msg::constellation_msg::Msg as ConstellationMsg; use msg::constellation_msg::{ConstellationChan, Failure, PipelineExitType, PipelineId}; use net_traits::image_cache_task::{ImageCacheTask, ImageCacheResult, ImageCacheChan}; use net_traits::{load_bytes_iter, PendingAsyncLoad}; +use opaque_node::OpaqueNodeMethods; +use parallel::{self, WorkQueueData}; use profile_traits::mem::{self, Report, ReportKind, ReportsChan}; use profile_traits::time::{TimerMetadataFrameType, TimerMetadataReflowType}; use profile_traits::time::{self, ProfilerMetadata, profile}; +use query::{LayoutRPCImpl, process_content_box_request, process_content_boxes_request}; +use query::{MarginPadding, MarginRetrievingFragmentBorderBoxIterator, PositionProperty}; +use query::{PositionRetrievingFragmentBorderBoxIterator, Side}; use script::dom::bindings::js::LayoutJS; use script::dom::node::{LayoutData, Node}; use script::layout_interface::Animation; @@ -62,6 +59,7 @@ use script::layout_interface::{ScriptLayoutChan, ScriptReflow, TrustedNodeAddres use script_traits::StylesheetLoadResponder; use script_traits::{ConstellationControlMsg, LayoutControlMsg, OpaqueScriptLayoutChannel}; use selectors::parser::PseudoElement; +use sequential; use serde_json; use std::borrow::ToOwned; use std::cell::Cell; @@ -87,6 +85,7 @@ use util::opts; use util::task::spawn_named_with_send_on_failure; use util::task_state; use util::workqueue::WorkQueue; +use wrapper::LayoutNode; use wrapper::ThreadSafeLayoutNode; /// The number of screens of data we're allowed to generate display lists for in each direction. diff --git a/components/layout/list_item.rs b/components/layout/list_item.rs index d120016dce7..630453e0b09 100644 --- a/components/layout/list_item.rs +++ b/components/layout/list_item.rs @@ -10,19 +10,18 @@ use block::BlockFlow; use context::LayoutContext; use display_list_builder::ListItemFlowDisplayListBuilding; +use euclid::{Point2D, Rect}; use floats::FloatKind; use flow::{Flow, FlowClass, OpaqueFlow}; use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, GeneratedContentInfo}; use generated_content; +use gfx::display_list::DisplayList; use incremental::RESOLVE_GENERATED_CONTENT; use inline::InlineMetrics; -use text; - -use euclid::{Point2D, Rect}; -use gfx::display_list::DisplayList; use std::sync::Arc; use style::computed_values::{list_style_type, position}; use style::properties::ComputedValues; +use text; use util::geometry::Au; use util::logical_geometry::LogicalSize; use util::opts; diff --git a/components/layout/model.rs b/components/layout/model.rs index ebdc32aa497..3be66aec4fc 100644 --- a/components/layout/model.rs +++ b/components/layout/model.rs @@ -6,9 +6,8 @@ #![deny(unsafe_code)] -use fragment::Fragment; - use euclid::{Matrix4, SideOffsets2D, Size2D}; +use fragment::Fragment; use std::cmp::{max, min}; use std::fmt; use style::computed_values::transform::ComputedMatrix; diff --git a/components/layout/multicol.rs b/components/layout/multicol.rs index 6de9e051b44..5198dbdf0fe 100644 --- a/components/layout/multicol.rs +++ b/components/layout/multicol.rs @@ -8,11 +8,10 @@ use block::BlockFlow; use context::LayoutContext; +use euclid::{Point2D, Rect}; use floats::FloatKind; use flow::{FlowClass, Flow, OpaqueFlow}; use fragment::{Fragment, FragmentBorderBoxIterator}; - -use euclid::{Point2D, Rect}; use std::fmt; use std::sync::Arc; use style::properties::ComputedValues; diff --git a/components/layout/parallel.rs b/components/layout/parallel.rs index 576e9ae9f21..8b63159bec8 100644 --- a/components/layout/parallel.rs +++ b/components/layout/parallel.rs @@ -12,19 +12,18 @@ use context::{LayoutContext, SharedLayoutContext}; use flow; use flow::{Flow, MutableFlowUtils, PreorderFlowTraversal, PostorderFlowTraversal}; use flow_ref::{self, FlowRef}; +use profile_traits::time::{self, ProfilerMetadata, profile}; +use std::mem; +use std::sync::atomic::{AtomicIsize, Ordering}; use traversal::PostorderNodeMutTraversal; use traversal::{BubbleISizes, AssignISizes, AssignBSizesAndStoreOverflow}; use traversal::{ComputeAbsolutePositions, BuildDisplayList}; use traversal::{PreorderDomTraversal, PostorderDomTraversal}; use traversal::{RecalcStyleForNode, ConstructFlows}; -use wrapper::UnsafeLayoutNode; -use wrapper::{layout_node_to_unsafe_layout_node, layout_node_from_unsafe_layout_node, LayoutNode}; - -use profile_traits::time::{self, ProfilerMetadata, profile}; -use std::mem; -use std::sync::atomic::{AtomicIsize, Ordering}; use util::opts; use util::workqueue::{WorkQueue, WorkUnit, WorkerProxy}; +use wrapper::UnsafeLayoutNode; +use wrapper::{layout_node_to_unsafe_layout_node, layout_node_from_unsafe_layout_node, LayoutNode}; const CHUNK_SIZE: usize = 64; diff --git a/components/layout/query.rs b/components/layout/query.rs index 80ea4c534ca..1f1eb3e6a3b 100644 --- a/components/layout/query.rs +++ b/components/layout/query.rs @@ -4,13 +4,12 @@ //! Utilities for querying the layout, as needed by the layout task. -use layout_task::{LayoutTaskData, RWGuard}; - use euclid::point::Point2D; use euclid::rect::Rect; use flow_ref::FlowRef; use fragment::{Fragment, FragmentBorderBoxIterator}; use gfx::display_list::{DisplayItemMetadata, OpaqueNode}; +use layout_task::{LayoutTaskData, RWGuard}; use msg::constellation_msg::ConstellationChan; use msg::constellation_msg::Msg as ConstellationMsg; use opaque_node::OpaqueNodeMethods; @@ -18,7 +17,6 @@ use script::layout_interface::{ContentBoxResponse, ContentBoxesResponse, NodeGeo use script::layout_interface::{HitTestResponse, LayoutRPC, MouseOverResponse, OffsetParentResponse}; use script::layout_interface::{ResolvedStyleResponse, ScriptLayoutChan, TrustedNodeAddress}; use sequential; - use std::sync::{Arc, Mutex}; use util::cursor::Cursor; use util::geometry::Au; diff --git a/components/layout/sequential.rs b/components/layout/sequential.rs index e1ceeb2714e..7cb3f28a89d 100644 --- a/components/layout/sequential.rs +++ b/components/layout/sequential.rs @@ -5,6 +5,7 @@ //! Implements sequential traversals over the DOM and flow trees. use context::{LayoutContext, SharedLayoutContext}; +use euclid::point::Point2D; use flow::{PostorderFlowTraversal, PreorderFlowTraversal}; use flow::{self, Flow, ImmutableFlowUtils, InorderFlowTraversal, MutableFlowUtils}; use flow_ref::{self, FlowRef}; @@ -15,11 +16,9 @@ use traversal::{AssignBSizesAndStoreOverflow, AssignISizes}; use traversal::{BubbleISizes, RecalcStyleForNode, ConstructFlows}; use traversal::{ComputeAbsolutePositions, BuildDisplayList}; use traversal::{PreorderDomTraversal, PostorderDomTraversal}; -use wrapper::LayoutNode; - -use euclid::point::Point2D; use util::geometry::{Au, ZERO_POINT}; use util::opts; +use wrapper::LayoutNode; pub fn traverse_dom_preorder(root: LayoutNode, shared_layout_context: &SharedLayoutContext) { diff --git a/components/layout/table.rs b/components/layout/table.rs index b214e6d3ddc..eabe20f335f 100644 --- a/components/layout/table.rs +++ b/components/layout/table.rs @@ -10,18 +10,14 @@ use block::{ISizeConstraintInput, ISizeConstraintSolution}; use block::{self, BlockFlow, CandidateBSizeIterator, ISizeAndMarginsComputer}; use context::LayoutContext; use display_list_builder::{BlockFlowDisplayListBuilding, BorderPaintingMode}; +use euclid::{Point2D, Rect}; use flow::{IMPACTED_BY_RIGHT_FLOATS, ImmutableFlowUtils, MutableFlowUtils, OpaqueFlow}; use flow::{self, EarlyAbsolutePositionInfo, Flow, FlowClass, IMPACTED_BY_LEFT_FLOATS}; use fragment::{Fragment, FragmentBorderBoxIterator}; +use gfx::display_list::DisplayList; use incremental::{REFLOW, REFLOW_OUT_OF_FLOW}; use layout_debug; use model::{IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto}; -use table_row::{TableRowFlow}; -use table_row::{self, CellIntrinsicInlineSize, CollapsedBorder, CollapsedBorderProvenance}; -use table_wrapper::TableLayout; - -use euclid::{Point2D, Rect}; -use gfx::display_list::DisplayList; use std::cmp; use std::fmt; use std::sync::Arc; @@ -29,6 +25,9 @@ use style::computed_values::{border_collapse, border_spacing, table_layout}; use style::properties::ComputedValues; use style::values::CSSFloat; use style::values::computed::LengthOrPercentageOrAuto; +use table_row::{TableRowFlow}; +use table_row::{self, CellIntrinsicInlineSize, CollapsedBorder, CollapsedBorderProvenance}; +use table_wrapper::TableLayout; use util::geometry::Au; use util::logical_geometry::LogicalSize; diff --git a/components/layout/table_caption.rs b/components/layout/table_caption.rs index afce73b44c5..646a4498568 100644 --- a/components/layout/table_caption.rs +++ b/components/layout/table_caption.rs @@ -8,10 +8,9 @@ use block::BlockFlow; use context::LayoutContext; +use euclid::{Point2D, Rect}; use flow::{FlowClass, Flow, OpaqueFlow}; use fragment::{Fragment, FragmentBorderBoxIterator}; - -use euclid::{Point2D, Rect}; use std::fmt; use std::sync::Arc; use style::properties::ComputedValues; diff --git a/components/layout/table_cell.rs b/components/layout/table_cell.rs index f0f1495d8bb..1cdd22bada1 100644 --- a/components/layout/table_cell.rs +++ b/components/layout/table_cell.rs @@ -8,25 +8,24 @@ use block::{BlockFlow, ISizeAndMarginsComputer, MarginsMayCollapseFlag}; use context::LayoutContext; +use cssparser::Color; use display_list_builder::{BlockFlowDisplayListBuilding, BorderPaintingMode}; +use euclid::{Point2D, Rect, SideOffsets2D, Size2D}; use flow::{Flow, FlowClass, OpaqueFlow}; use fragment::{Fragment, FragmentBorderBoxIterator}; +use gfx::display_list::DisplayList; use layout_debug; use model::MaybeAuto; -use table::InternalTable; -use table_row::{CollapsedBorder, CollapsedBorderProvenance}; -use wrapper::ThreadSafeLayoutNode; - -use cssparser::Color; -use euclid::{Point2D, Rect, SideOffsets2D, Size2D}; -use gfx::display_list::DisplayList; use std::fmt; use std::sync::Arc; use style::computed_values::{border_collapse, border_top_style}; use style::legacy::UnsignedIntegerAttribute; use style::properties::ComputedValues; +use table::InternalTable; +use table_row::{CollapsedBorder, CollapsedBorderProvenance}; use util::geometry::Au; use util::logical_geometry::{LogicalMargin, LogicalRect, LogicalSize, WritingMode}; +use wrapper::ThreadSafeLayoutNode; /// A table formatting context. #[derive(RustcEncodable)] diff --git a/components/layout/table_colgroup.rs b/components/layout/table_colgroup.rs index f62083cc649..987ee717417 100644 --- a/components/layout/table_colgroup.rs +++ b/components/layout/table_colgroup.rs @@ -7,11 +7,10 @@ #![deny(unsafe_code)] use context::LayoutContext; +use euclid::{Point2D, Rect}; use flow::{BaseFlow, FlowClass, Flow, ForceNonfloatedFlag, OpaqueFlow}; use fragment::{Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo}; use layout_debug; - -use euclid::{Point2D, Rect}; use std::cmp::max; use std::fmt; use std::sync::Arc; diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs index 5a4d10b47d7..4824d89aea6 100644 --- a/components/layout/table_row.rs +++ b/components/layout/table_row.rs @@ -8,18 +8,15 @@ use block::{BlockFlow, ISizeAndMarginsComputer}; use context::LayoutContext; +use cssparser::{Color, RGBA}; use display_list_builder::{BlockFlowDisplayListBuilding, BorderPaintingMode}; +use euclid::{Point2D, Rect}; use flow::{self, EarlyAbsolutePositionInfo, FlowClass, Flow, ImmutableFlowUtils, OpaqueFlow}; use flow_list::MutFlowListIterator; use fragment::{Fragment, FragmentBorderBoxIterator}; +use gfx::display_list::DisplayList; use layout_debug; use model::MaybeAuto; -use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, VecExt}; -use table_cell::{CollapsedBordersForCell, TableCellFlow}; - -use cssparser::{Color, RGBA}; -use euclid::{Point2D, Rect}; -use gfx::display_list::DisplayList; use rustc_serialize::{Encoder, Encodable}; use std::cmp::max; use std::fmt; @@ -28,6 +25,8 @@ use std::sync::Arc; use style::computed_values::{border_collapse, border_spacing, border_top_style}; use style::properties::ComputedValues; use style::values::computed::LengthOrPercentageOrAuto; +use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, VecExt}; +use table_cell::{CollapsedBordersForCell, TableCellFlow}; use util::geometry::Au; use util::logical_geometry::{LogicalSize, PhysicalSide, WritingMode}; diff --git a/components/layout/table_rowgroup.rs b/components/layout/table_rowgroup.rs index 9c91ea1f3bb..29497e28ad6 100644 --- a/components/layout/table_rowgroup.rs +++ b/components/layout/table_rowgroup.rs @@ -8,19 +8,18 @@ use block::{BlockFlow, ISizeAndMarginsComputer}; use context::LayoutContext; +use euclid::{Point2D, Rect}; use flow::{FlowClass, Flow, OpaqueFlow}; use fragment::{Fragment, FragmentBorderBoxIterator}; use layout_debug; -use style::computed_values::{border_collapse, border_spacing}; -use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, TableLikeFlow}; -use table_row::{self, CollapsedBordersForRow}; - -use euclid::{Point2D, Rect}; use rustc_serialize::{Encoder, Encodable}; use std::fmt; use std::iter::{IntoIterator, Iterator, Peekable}; use std::sync::Arc; +use style::computed_values::{border_collapse, border_spacing}; use style::properties::ComputedValues; +use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, TableLikeFlow}; +use table_row::{self, CollapsedBordersForRow}; use util::geometry::Au; use util::logical_geometry::{LogicalSize, WritingMode}; diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs index 9ed64e8ec6a..a3c08a07e1a 100644 --- a/components/layout/table_wrapper.rs +++ b/components/layout/table_wrapper.rs @@ -16,15 +16,12 @@ use block::{BlockFlow, FloatNonReplaced, AbsoluteNonReplaced, ISizeAndMarginsComputer, ISizeConstraintInput}; use block::{ISizeConstraintSolution, MarginsMayCollapseFlag}; use context::LayoutContext; +use euclid::{Point2D, Rect}; use floats::FloatKind; use flow::{FlowClass, Flow, ImmutableFlowUtils}; use flow::{IMPACTED_BY_LEFT_FLOATS, IMPACTED_BY_RIGHT_FLOATS, INLINE_POSITION_IS_STATIC, OpaqueFlow}; use fragment::{Fragment, FragmentBorderBoxIterator}; use model::MaybeAuto; -use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize}; -use table_row; - -use euclid::{Point2D, Rect}; use std::cmp::{max, min}; use std::fmt; use std::ops::Add; @@ -33,6 +30,8 @@ use style::computed_values::{border_collapse, table_layout}; use style::properties::ComputedValues; use style::values::CSSFloat; use style::values::computed::LengthOrPercentageOrAuto; +use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize}; +use table_row; use util::geometry::Au; use util::logical_geometry::LogicalSize; diff --git a/components/layout/text.rs b/components/layout/text.rs index 4657dc86e23..e90a1d639df 100644 --- a/components/layout/text.rs +++ b/components/layout/text.rs @@ -7,14 +7,13 @@ #![deny(unsafe_code)] use fragment::{Fragment, SpecificFragmentInfo, ScannedTextFragmentInfo, UnscannedTextFragmentInfo}; -use inline::InlineFragments; - use gfx::font::{DISABLE_KERNING_SHAPING_FLAG, FontMetrics, IGNORE_LIGATURES_SHAPING_FLAG}; use gfx::font::{RTL_FLAG, RunMetrics, ShapingFlags, ShapingOptions}; use gfx::font_context::FontContext; use gfx::text::glyph::CharIndex; use gfx::text::text_run::TextRun; use gfx::text::util::{self, CompressionMode}; +use inline::InlineFragments; use std::borrow::ToOwned; use std::collections::LinkedList; use std::mem; diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs index ed8ae6ab76a..33cd978ae37 100644 --- a/components/layout/traversal.rs +++ b/components/layout/traversal.rs @@ -11,15 +11,13 @@ use flow::{MutableFlowUtils, PreorderFlowTraversal, PostorderFlowTraversal}; use flow::{self, Flow}; use incremental::{self, BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW, RestyleDamage}; use script::layout_interface::ReflowGoal; -use wrapper::{ThreadSafeLayoutNode, UnsafeLayoutNode}; -use wrapper::{layout_node_to_unsafe_layout_node, LayoutNode}; - use selectors::bloom::BloomFilter; -use util::opts; -use util::tid::tid; - use std::cell::RefCell; use std::mem; +use util::opts; +use util::tid::tid; +use wrapper::{ThreadSafeLayoutNode, UnsafeLayoutNode}; +use wrapper::{layout_node_to_unsafe_layout_node, LayoutNode}; /// Every time we do another layout, the old bloom filters are invalid. This is /// detected by ticking a generation number every layout. diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index 8dfa9907770..0cfe3dd9399 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -33,13 +33,12 @@ use canvas_traits::CanvasMsg; use context::SharedLayoutContext; use data::{LayoutDataFlags, LayoutDataWrapper, PrivateLayoutData}; -use incremental::RestyleDamage; -use opaque_node::OpaqueNodeMethods; - use gfx::display_list::OpaqueNode; use gfx::text::glyph::CharIndex; +use incremental::RestyleDamage; use ipc_channel::ipc::IpcSender; use msg::constellation_msg::{PipelineId, SubpageId}; +use opaque_node::OpaqueNodeMethods; use script::dom::attr::AttrValue; use script::dom::bindings::codegen::InheritTypes::{CharacterDataCast, ElementCast}; use script::dom::bindings::codegen::InheritTypes::{HTMLIFrameElementCast, HTMLCanvasElementCast}; |