diff options
Diffstat (limited to 'components/layout_thread/lib.rs')
-rw-r--r-- | components/layout_thread/lib.rs | 73 |
1 files changed, 36 insertions, 37 deletions
diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs index dfac9089a69..515648e21e3 100644 --- a/components/layout_thread/lib.rs +++ b/components/layout_thread/lib.rs @@ -8,24 +8,32 @@ //! The layout thread. Performs layout on the DOM, builds display lists and sends them to be //! painted. +use std::borrow::ToOwned; +use std::cell::{Cell, RefCell}; +use std::collections::HashMap; +use std::ops::{Deref, DerefMut}; +use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; +use std::sync::{Arc, Mutex, MutexGuard}; +use std::time::Duration; +use std::{process, thread}; + use app_units::Au; use crossbeam_channel::{select, Receiver, Sender}; use embedder_traits::resources::{self, Resource}; -use euclid::{default::Size2D as UntypedSize2D, Point2D, Rect, Scale, Size2D}; +use euclid::default::Size2D as UntypedSize2D; +use euclid::{Point2D, Rect, Scale, Size2D}; use fnv::FnvHashMap; use fxhash::{FxHashMap, FxHashSet}; -use gfx::font; use gfx::font_cache_thread::FontCacheThread; -use gfx::font_context; +use gfx::{font, font_context}; use gfx_traits::{node_id_from_scroll_id, Epoch}; use histogram::Histogram; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::router::ROUTER; use layout::construct::ConstructionResult; -use layout::context::malloc_size_of_persistent_local_context; -use layout::context::LayoutContext; -use layout::context::RegisteredPainter; -use layout::context::RegisteredPainters; +use layout::context::{ + malloc_size_of_persistent_local_context, LayoutContext, RegisteredPainter, RegisteredPainters, +}; use layout::display_list::items::WebRenderImageInfo; use layout::display_list::{IndexableText, ToLayout}; use layout::flow::{Flow, FlowFlags, GetBaseFlow, ImmutableFlowUtils, MutableOwnedFlowUtils}; @@ -38,56 +46,49 @@ use layout::query::{ process_resolved_font_style_request, process_resolved_style_request, LayoutRPCImpl, LayoutThreadData, }; -use layout::sequential; use layout::traversal::{ construct_flows_at_ancestors, ComputeStackingRelativePositions, PreorderFlowTraversal, RecalcStyleAndConstructFlows, }; use layout::wrapper::LayoutNodeLayoutData; -use layout::{layout_debug, LayoutData}; -use layout::{layout_debug_scope, parallel}; +use layout::{layout_debug, layout_debug_scope, parallel, sequential, LayoutData}; use layout_traits::LayoutThreadFactory; use lazy_static::lazy_static; use log::{debug, error, trace, warn}; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; use metrics::{PaintTimeMetrics, ProfilerMetadataFactory, ProgressiveWebMetric}; use msg::constellation_msg::{ - BackgroundHangMonitor, BackgroundHangMonitorRegister, HangAnnotation, + BackgroundHangMonitor, BackgroundHangMonitorRegister, BrowsingContextId, HangAnnotation, + LayoutHangAnnotation, MonitoredComponentId, MonitoredComponentType, PipelineId, + TopLevelBrowsingContextId, }; -use msg::constellation_msg::{BrowsingContextId, MonitoredComponentId, TopLevelBrowsingContextId}; -use msg::constellation_msg::{LayoutHangAnnotation, MonitoredComponentType, PipelineId}; use net_traits::image_cache::{ImageCache, UsePlaceholder}; use parking_lot::RwLock; use profile_traits::mem::{self as profile_mem, Report, ReportKind, ReportsChan}; use profile_traits::path; -use profile_traits::time::{self as profile_time, profile, TimerMetadata}; -use profile_traits::time::{TimerMetadataFrameType, TimerMetadataReflowType}; +use profile_traits::time::{ + self as profile_time, profile, TimerMetadata, TimerMetadataFrameType, TimerMetadataReflowType, +}; use script::layout_dom::{ServoLayoutDocument, ServoLayoutElement, ServoLayoutNode}; -use script_layout_interface::message::{LayoutThreadInit, Msg, NodesFromPointQueryType, Reflow}; -use script_layout_interface::message::{QueryMsg, ReflowComplete, ReflowGoal, ScriptReflow}; -use script_layout_interface::rpc::TextIndexResponse; -use script_layout_interface::rpc::{LayoutRPC, OffsetParentResponse}; +use script_layout_interface::message::{ + LayoutThreadInit, Msg, NodesFromPointQueryType, QueryMsg, Reflow, ReflowComplete, ReflowGoal, + ScriptReflow, +}; +use script_layout_interface::rpc::{LayoutRPC, OffsetParentResponse, TextIndexResponse}; use script_layout_interface::wrapper_traits::LayoutNode; -use script_traits::{ConstellationControlMsg, LayoutControlMsg, LayoutMsg as ConstellationMsg}; -use script_traits::{DrawAPaintImageResult, IFrameSizeMsg, PaintWorkletError, WindowSizeType}; -use script_traits::{Painter, WebrenderIpcSender}; -use script_traits::{ScrollState, UntrustedNodeAddress, WindowSizeData}; +use script_traits::{ + ConstellationControlMsg, DrawAPaintImageResult, IFrameSizeMsg, LayoutControlMsg, + LayoutMsg as ConstellationMsg, PaintWorkletError, Painter, ScrollState, UntrustedNodeAddress, + WebrenderIpcSender, WindowSizeData, WindowSizeType, +}; use servo_arc::Arc as ServoArc; use servo_atoms::Atom; use servo_config::opts::{self, DebugOptions}; use servo_url::{ImmutableOrigin, ServoUrl}; -use std::borrow::ToOwned; -use std::cell::{Cell, RefCell}; -use std::collections::HashMap; -use std::ops::{Deref, DerefMut}; -use std::process; -use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; -use std::sync::{Arc, Mutex, MutexGuard}; -use std::thread; -use std::time::Duration; use style::animation::{AnimationSetKey, DocumentAnimationSet, ElementAnimationSet}; -use style::context::SharedStyleContext; -use style::context::{QuirksMode, RegisteredSpeculativePainter, RegisteredSpeculativePainters}; +use style::context::{ + QuirksMode, RegisteredSpeculativePainter, RegisteredSpeculativePainters, SharedStyleContext, +}; use style::dom::{ShowSubtree, ShowSubtreeDataAndPrimaryValues, TElement, TNode}; use style::driver; use style::error_reporting::RustLogReporter; @@ -106,9 +107,7 @@ use style::stylist::Stylist; use style::thread_state::{self, ThreadState}; use style::traversal::DomTraversal; use style::traversal_flags::TraversalFlags; -use style_traits::CSSPixel; -use style_traits::DevicePixel; -use style_traits::SpeculativePainter; +use style_traits::{CSSPixel, DevicePixel, SpeculativePainter}; use webrender_api::{units, ColorF, HitTestFlags}; /// Information needed by the layout thread. |