mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
Auto merge of #22126 - pyfisch:autoformat, r=jdm
Enforce rustfmt on CI <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22126) <!-- Reviewable:end -->
This commit is contained in:
commit
da2d9b2228
609 changed files with 7934 additions and 5334 deletions
|
@ -11,10 +11,10 @@ use crate::opaque_node::OpaqueNodeMethods;
|
|||
use fxhash::FxHashMap;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use script_traits::{AnimationState, ConstellationControlMsg, LayoutMsg as ConstellationMsg};
|
||||
use script_traits::UntrustedNodeAddress;
|
||||
use script_traits::{AnimationState, ConstellationControlMsg, LayoutMsg as ConstellationMsg};
|
||||
use servo_channel::Receiver;
|
||||
use style::animation::{Animation, update_style_for_animation};
|
||||
use style::animation::{update_style_for_animation, Animation};
|
||||
use style::dom::TElement;
|
||||
use style::font_metrics::ServoMetricsProvider;
|
||||
use style::selector_parser::RestyleDamage;
|
||||
|
@ -89,7 +89,10 @@ pub fn update_animation_state<E>(
|
|||
},
|
||||
};
|
||||
|
||||
debug!("update_animation_state({:?}): {:?}", still_running, running_animation);
|
||||
debug!(
|
||||
"update_animation_state({:?}): {:?}",
|
||||
still_running, running_animation
|
||||
);
|
||||
|
||||
if still_running {
|
||||
animations_still_running.push(running_animation);
|
||||
|
@ -97,11 +100,13 @@ pub fn update_animation_state<E>(
|
|||
}
|
||||
|
||||
if let Animation::Transition(node, _, ref frame) = running_animation {
|
||||
script_chan.send(ConstellationControlMsg::TransitionEnd(
|
||||
node.to_untrusted_node_address(),
|
||||
frame.property_animation.property_name().into(),
|
||||
frame.duration,
|
||||
)).unwrap();
|
||||
script_chan
|
||||
.send(ConstellationControlMsg::TransitionEnd(
|
||||
node.to_untrusted_node_address(),
|
||||
frame.property_animation.property_name().into(),
|
||||
frame.duration,
|
||||
))
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
expired_animations
|
||||
|
@ -150,7 +155,8 @@ pub fn update_animation_state<E>(
|
|||
.send(ConstellationMsg::ChangeRunningAnimationsState(
|
||||
pipeline_id,
|
||||
animation_state,
|
||||
)).unwrap();
|
||||
))
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
/// Recalculates style for a set of animations. This does *not* run with the DOM
|
||||
|
|
|
@ -27,18 +27,26 @@
|
|||
|
||||
use app_units::{Au, MAX_AU};
|
||||
use crate::context::LayoutContext;
|
||||
use crate::display_list::items::DisplayListSection;
|
||||
use crate::display_list::StackingContextCollectionState;
|
||||
use crate::display_list::{BlockFlowDisplayListBuilding, BorderPaintingMode};
|
||||
use crate::display_list::{DisplayListBuildState, StackingContextCollectionFlags};
|
||||
use crate::display_list::StackingContextCollectionState;
|
||||
use crate::display_list::items::DisplayListSection;
|
||||
use crate::floats::{ClearType, FloatKind, Floats, PlacementInfo};
|
||||
use crate::flow::{BaseFlow, EarlyAbsolutePositionInfo, Flow, FlowClass, ForceNonfloatedFlag, GetBaseFlow};
|
||||
use crate::flow::{ImmutableFlowUtils, LateAbsolutePositionInfo, OpaqueFlow, FragmentationContext, FlowFlags};
|
||||
use crate::flow::{
|
||||
BaseFlow, EarlyAbsolutePositionInfo, Flow, FlowClass, ForceNonfloatedFlag, GetBaseFlow,
|
||||
};
|
||||
use crate::flow::{
|
||||
FlowFlags, FragmentationContext, ImmutableFlowUtils, LateAbsolutePositionInfo, OpaqueFlow,
|
||||
};
|
||||
use crate::flow_list::FlowList;
|
||||
use crate::fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow, FragmentFlags};
|
||||
use crate::fragment::{
|
||||
CoordinateSystem, Fragment, FragmentBorderBoxIterator, FragmentFlags, Overflow,
|
||||
};
|
||||
use crate::incremental::RelayoutMode;
|
||||
use crate::layout_debug;
|
||||
use crate::model::{AdjoiningMargins, CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo, MaybeAuto};
|
||||
use crate::model::{
|
||||
AdjoiningMargins, CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo, MaybeAuto,
|
||||
};
|
||||
use crate::sequential;
|
||||
use crate::traversal::PreorderFlowTraversal;
|
||||
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
|
||||
|
@ -58,8 +66,8 @@ use style::context::SharedStyleContext;
|
|||
use style::logical_geometry::{LogicalMargin, LogicalPoint, LogicalRect, LogicalSize, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use style::values::computed::{LengthOrPercentageOrNone, LengthOrPercentage};
|
||||
use style::values::computed::LengthOrPercentageOrAuto;
|
||||
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrNone};
|
||||
|
||||
/// Information specific to floated blocks.
|
||||
#[derive(Clone, Serialize)]
|
||||
|
@ -1334,7 +1342,8 @@ impl BlockFlow {
|
|||
self.fragment.style.writing_mode,
|
||||
inline_size_for_float_placement,
|
||||
block_size + self.fragment.margin.block_start_end(),
|
||||
).convert(
|
||||
)
|
||||
.convert(
|
||||
self.fragment.style.writing_mode,
|
||||
self.base.floats.writing_mode,
|
||||
),
|
||||
|
@ -1361,7 +1370,8 @@ impl BlockFlow {
|
|||
self.base.floats.writing_mode,
|
||||
self.base.writing_mode,
|
||||
container_size,
|
||||
).start;
|
||||
)
|
||||
.start;
|
||||
let margin_offset = LogicalPoint::new(
|
||||
self.base.writing_mode,
|
||||
Au(0),
|
||||
|
@ -2626,7 +2636,8 @@ impl Flow for BlockFlow {
|
|||
.early_absolute_position_info
|
||||
.relative_containing_block_mode,
|
||||
CoordinateSystem::Own,
|
||||
).translate(&stacking_context_position.to_vector()),
|
||||
)
|
||||
.translate(&stacking_context_position.to_vector()),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,21 +11,28 @@
|
|||
//! maybe it's an absolute or fixed position thing that hasn't found its containing block yet.
|
||||
//! Construction items bubble up the tree from children to parents until they find their homes.
|
||||
|
||||
use crate::ServoArc;
|
||||
use crate::block::BlockFlow;
|
||||
use crate::context::{LayoutContext, with_thread_local_font_context};
|
||||
use crate::data::{LayoutDataFlags, LayoutData};
|
||||
use crate::context::{with_thread_local_font_context, LayoutContext};
|
||||
use crate::data::{LayoutData, LayoutDataFlags};
|
||||
use crate::display_list::items::OpaqueNode;
|
||||
use crate::flex::FlexFlow;
|
||||
use crate::floats::FloatKind;
|
||||
use crate::flow::{AbsoluteDescendants, Flow, FlowClass, GetBaseFlow, ImmutableFlowUtils};
|
||||
use crate::flow::{FlowFlags, MutableFlowUtils, MutableOwnedFlowUtils};
|
||||
use crate::flow_ref::FlowRef;
|
||||
use crate::fragment::{CanvasFragmentInfo, Fragment, FragmentFlags, GeneratedContentInfo, IframeFragmentInfo};
|
||||
use crate::fragment::{ImageFragmentInfo, InlineAbsoluteFragmentInfo, InlineAbsoluteHypotheticalFragmentInfo};
|
||||
use crate::fragment::{InlineBlockFragmentInfo, MediaFragmentInfo, SpecificFragmentInfo, SvgFragmentInfo};
|
||||
use crate::fragment::{TableColumnFragmentInfo, UnscannedTextFragmentInfo, WhitespaceStrippingResult};
|
||||
use crate::inline::{InlineFlow, InlineFragmentNodeInfo, InlineFragmentNodeFlags};
|
||||
use crate::fragment::{
|
||||
CanvasFragmentInfo, Fragment, FragmentFlags, GeneratedContentInfo, IframeFragmentInfo,
|
||||
};
|
||||
use crate::fragment::{
|
||||
ImageFragmentInfo, InlineAbsoluteFragmentInfo, InlineAbsoluteHypotheticalFragmentInfo,
|
||||
};
|
||||
use crate::fragment::{
|
||||
InlineBlockFragmentInfo, MediaFragmentInfo, SpecificFragmentInfo, SvgFragmentInfo,
|
||||
};
|
||||
use crate::fragment::{
|
||||
TableColumnFragmentInfo, UnscannedTextFragmentInfo, WhitespaceStrippingResult,
|
||||
};
|
||||
use crate::inline::{InlineFlow, InlineFragmentNodeFlags, InlineFragmentNodeInfo};
|
||||
use crate::linked_list::prepend_from;
|
||||
use crate::list_item::{ListItemFlow, ListStyleTypeContent};
|
||||
use crate::multicol::{MulticolColumnFlow, MulticolFlow};
|
||||
|
@ -40,15 +47,18 @@ use crate::table_wrapper::TableWrapperFlow;
|
|||
use crate::text::TextRunScanner;
|
||||
use crate::traversal::PostorderNodeMutTraversal;
|
||||
use crate::wrapper::{LayoutNodeLayoutData, TextContent, ThreadSafeLayoutNodeHelpers};
|
||||
use script_layout_interface::{LayoutElementType, LayoutNodeType, is_image_data};
|
||||
use script_layout_interface::wrapper_traits::{PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode};
|
||||
use crate::ServoArc;
|
||||
use script_layout_interface::wrapper_traits::{
|
||||
PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode,
|
||||
};
|
||||
use script_layout_interface::{is_image_data, LayoutElementType, LayoutNodeType};
|
||||
use servo_config::opts;
|
||||
use servo_url::ServoUrl;
|
||||
use std::collections::LinkedList;
|
||||
use std::marker::PhantomData;
|
||||
use std::mem;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::sync::Arc;
|
||||
use style::computed_values::caption_side::T as CaptionSide;
|
||||
use style::computed_values::display::T as Display;
|
||||
use style::computed_values::empty_cells::T as EmptyCells;
|
||||
|
@ -185,7 +195,8 @@ impl InlineBlockSplit {
|
|||
predecessors: mem::replace(
|
||||
fragment_accumulator,
|
||||
InlineFragmentsAccumulator::from_inline_node(node, style_context),
|
||||
).to_intermediate_inline_fragments::<ConcreteThreadSafeLayoutNode>(style_context),
|
||||
)
|
||||
.to_intermediate_inline_fragments::<ConcreteThreadSafeLayoutNode>(style_context),
|
||||
flow: flow,
|
||||
};
|
||||
|
||||
|
@ -402,7 +413,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
&self.layout_context,
|
||||
));
|
||||
SpecificFragmentInfo::Image(image_info)
|
||||
}
|
||||
},
|
||||
Some(LayoutNodeType::Element(LayoutElementType::HTMLMediaElement)) => {
|
||||
let data = node.media_data().unwrap();
|
||||
SpecificFragmentInfo::Media(Box::new(MediaFragmentInfo::new(data)))
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
//! Data needed by the layout thread.
|
||||
|
||||
use crate::display_list::items::{WebRenderImageInfo, OpaqueNode};
|
||||
use crate::display_list::items::{OpaqueNode, WebRenderImageInfo};
|
||||
use crate::opaque_node::OpaqueNodeMethods;
|
||||
use fnv::FnvHasher;
|
||||
use gfx::font_cache_thread::FontCacheThread;
|
||||
|
|
|
@ -13,8 +13,8 @@ use style::computed_values::background_clip::single_value::T as BackgroundClip;
|
|||
use style::computed_values::background_origin::single_value::T as BackgroundOrigin;
|
||||
use style::properties::style_structs::Background;
|
||||
use style::values::computed::{BackgroundSize, LengthOrPercentageOrAuto};
|
||||
use style::values::generics::NonNegative;
|
||||
use style::values::generics::background::BackgroundSize as GenericBackgroundSize;
|
||||
use style::values::generics::NonNegative;
|
||||
use style::values::specified::background::BackgroundRepeatKeyword;
|
||||
use webrender_api::BorderRadius;
|
||||
|
||||
|
|
|
@ -9,14 +9,14 @@ use crate::display_list::ToLayout;
|
|||
use euclid::{Rect, SideOffsets2D, Size2D};
|
||||
use style::computed_values::border_image_outset::T as BorderImageOutset;
|
||||
use style::properties::style_structs::Border;
|
||||
use style::values::Either;
|
||||
use style::values::computed::NumberOrPercentage;
|
||||
use style::values::computed::{BorderCornerRadius, BorderImageWidth};
|
||||
use style::values::computed::{BorderImageSideWidth, LengthOrNumber};
|
||||
use style::values::computed::NumberOrPercentage;
|
||||
use style::values::generics::border::{BorderImageSideWidth as GenericBorderImageSideWidth};
|
||||
use style::values::generics::border::BorderImageSideWidth as GenericBorderImageSideWidth;
|
||||
use style::values::generics::rect::Rect as StyleRect;
|
||||
use style::values::Either;
|
||||
use webrender_api::{BorderRadius, BorderSide, BorderStyle, ColorF};
|
||||
use webrender_api::{LayoutSize, LayoutSideOffsets, NormalBorder};
|
||||
use webrender_api::{LayoutSideOffsets, LayoutSize, NormalBorder};
|
||||
|
||||
/// Computes a border radius size against the containing size.
|
||||
///
|
||||
|
|
|
@ -12,31 +12,31 @@ use app_units::{Au, AU_PER_PX};
|
|||
use canvas_traits::canvas::{CanvasMsg, FromLayoutMsg};
|
||||
use crate::block::BlockFlow;
|
||||
use crate::context::LayoutContext;
|
||||
use crate::display_list::ToLayout;
|
||||
use crate::display_list::background::{self, get_cyclic};
|
||||
use crate::display_list::border;
|
||||
use crate::display_list::gradient;
|
||||
use crate::display_list::items::{BaseDisplayItem, BLUR_INFLATION_FACTOR, ClipScrollNode};
|
||||
use crate::display_list::items::{BaseDisplayItem, ClipScrollNode, BLUR_INFLATION_FACTOR};
|
||||
use crate::display_list::items::{ClipScrollNodeIndex, ClipScrollNodeType, ClippingAndScrolling};
|
||||
use crate::display_list::items::{ClippingRegion, DisplayItem, DisplayItemMetadata, DisplayList};
|
||||
use crate::display_list::items::{DisplayListSection, CommonDisplayItem};
|
||||
use crate::display_list::items::{CommonDisplayItem, DisplayListSection};
|
||||
use crate::display_list::items::{IframeDisplayItem, OpaqueNode};
|
||||
use crate::display_list::items::{PopAllTextShadowsDisplayItem, PushTextShadowDisplayItem};
|
||||
use crate::display_list::items::{StackingContext, StackingContextType, StickyFrameData};
|
||||
use crate::display_list::items::{TextOrientation, WebRenderImageInfo};
|
||||
use crate::display_list::ToLayout;
|
||||
use crate::flex::FlexFlow;
|
||||
use crate::flow::{BaseFlow, Flow, FlowFlags};
|
||||
use crate::flow_ref::FlowRef;
|
||||
use crate::fragment::{CanvasFragmentSource, CoordinateSystem, Fragment, ScannedTextFragmentInfo};
|
||||
use crate::fragment::SpecificFragmentInfo;
|
||||
use crate::fragment::{CanvasFragmentSource, CoordinateSystem, Fragment, ScannedTextFragmentInfo};
|
||||
use crate::inline::{InlineFlow, InlineFragmentNodeFlags};
|
||||
use crate::list_item::ListItemFlow;
|
||||
use crate::model::MaybeAuto;
|
||||
use crate::table_cell::CollapsedBordersForCell;
|
||||
use euclid::{rect, Point2D, Rect, SideOffsets2D, Size2D, TypedSize2D, Vector2D};
|
||||
use fnv::FnvHashMap;
|
||||
use gfx::text::TextRun;
|
||||
use gfx::text::glyph::ByteIndex;
|
||||
use gfx::text::TextRun;
|
||||
use gfx_traits::{combine_id_with_fragment_type, FragmentType, StackingContextId};
|
||||
use ipc_channel::ipc;
|
||||
use msg::constellation_msg::{BrowsingContextId, PipelineId};
|
||||
|
@ -56,20 +56,20 @@ use style::computed_values::visibility::T as Visibility;
|
|||
use style::logical_geometry::{LogicalMargin, LogicalPoint, LogicalRect};
|
||||
use style::properties::{style_structs, ComputedValues};
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use style::values::{Either, RGBA};
|
||||
use style::values::computed::Gradient;
|
||||
use style::values::computed::effects::SimpleShadow;
|
||||
use style::values::computed::image::Image as ComputedImage;
|
||||
use style::values::computed::Gradient;
|
||||
use style::values::generics::background::BackgroundSize;
|
||||
use style::values::generics::image::{GradientKind, Image, PaintWorklet};
|
||||
use style::values::generics::ui::Cursor;
|
||||
use style::values::{Either, RGBA};
|
||||
use style_traits::cursor::CursorKind;
|
||||
use style_traits::CSSPixel;
|
||||
use style_traits::ToCss;
|
||||
use style_traits::cursor::CursorKind;
|
||||
use webrender_api::{self, BorderDetails, BorderRadius, BorderSide, BoxShadowClipMode, ColorF};
|
||||
use webrender_api::{ExternalScrollId, FilterOp, GlyphInstance, ImageRendering, LayoutRect};
|
||||
use webrender_api::{LayoutSize, LayoutTransform, LayoutVector2D, LineStyle, NinePatchBorder};
|
||||
use webrender_api::{NinePatchBorderSource, NormalBorder, StickyOffsetBounds, ScrollSensitivity};
|
||||
use webrender_api::{NinePatchBorderSource, NormalBorder, ScrollSensitivity, StickyOffsetBounds};
|
||||
|
||||
fn establishes_containing_block_for_absolute(
|
||||
flags: StackingContextCollectionFlags,
|
||||
|
|
|
@ -7,10 +7,10 @@ use euclid::{Point2D, Rect, SideOffsets2D, Size2D, Vector2D};
|
|||
use style::computed_values::image_rendering::T as ImageRendering;
|
||||
use style::computed_values::mix_blend_mode::T as MixBlendMode;
|
||||
use style::computed_values::transform_style::T as TransformStyle;
|
||||
use style::values::RGBA;
|
||||
use style::values::computed::{BorderStyle, Filter};
|
||||
use style::values::generics::effects::Filter as GenericFilter;
|
||||
use style::values::specified::border::BorderImageRepeatKeyword;
|
||||
use style::values::RGBA;
|
||||
use webrender_api as wr;
|
||||
|
||||
pub trait ToLayout {
|
||||
|
|
|
@ -8,11 +8,11 @@ use app_units::Au;
|
|||
use crate::display_list::ToLayout;
|
||||
use euclid::{Point2D, Size2D, Vector2D};
|
||||
use style::properties::ComputedValues;
|
||||
use style::values::computed::{Angle, GradientItem, LengthOrPercentage, Percentage, Position};
|
||||
use style::values::computed::image::{EndingShape, LineDirection};
|
||||
use style::values::generics::image::{Circle, Ellipse, ShapeExtent};
|
||||
use style::values::computed::{Angle, GradientItem, LengthOrPercentage, Percentage, Position};
|
||||
use style::values::generics::image::EndingShape as GenericEndingShape;
|
||||
use style::values::generics::image::GradientItem as GenericGradientItem;
|
||||
use style::values::generics::image::{Circle, Ellipse, ShapeExtent};
|
||||
use style::values::specified::position::{X, Y};
|
||||
use webrender_api::{ExtendMode, Gradient, GradientBuilder, GradientStop, RadialGradient};
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
//! low-level drawing primitives.
|
||||
|
||||
use euclid::{SideOffsets2D, TypedRect, Vector2D};
|
||||
use gfx_traits::{self, StackingContextId};
|
||||
use gfx_traits::print_tree::PrintTree;
|
||||
use gfx_traits::{self, StackingContextId};
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use net_traits::image::base::Image;
|
||||
use servo_geometry::MaxRect;
|
||||
|
@ -590,7 +590,8 @@ impl ClippingRegion {
|
|||
rect: complex.rect.translate(delta),
|
||||
radii: complex.radii,
|
||||
mode: complex.mode,
|
||||
}).collect(),
|
||||
})
|
||||
.collect(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
use app_units::{Au, MAX_AU};
|
||||
use crate::block::{AbsoluteAssignBSizesTraversal, BlockFlow, MarginsMayCollapseFlag};
|
||||
use crate::context::LayoutContext;
|
||||
use crate::display_list::{DisplayListBuildState, FlexFlowDisplayListBuilding};
|
||||
use crate::display_list::StackingContextCollectionState;
|
||||
use crate::display_list::{DisplayListBuildState, FlexFlowDisplayListBuilding};
|
||||
use crate::floats::FloatKind;
|
||||
use crate::flow::{Flow, FlowClass, GetBaseFlow, ImmutableFlowUtils, OpaqueFlow, FlowFlags};
|
||||
use crate::flow::{Flow, FlowClass, FlowFlags, GetBaseFlow, ImmutableFlowUtils, OpaqueFlow};
|
||||
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||
use crate::layout_debug;
|
||||
use crate::model::{AdjoiningMargins, CollapsibleMargins};
|
||||
|
@ -27,8 +27,10 @@ use style::computed_values::justify_content::T as JustifyContent;
|
|||
use style::logical_geometry::{Direction, LogicalSize};
|
||||
use style::properties::ComputedValues;
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
|
||||
use style::values::computed::flex::FlexBasis;
|
||||
use style::values::computed::{
|
||||
LengthOrPercentage, LengthOrPercentageOrAuto, LengthOrPercentageOrNone,
|
||||
};
|
||||
use style::values::generics::flex::FlexBasis as GenericFlexBasis;
|
||||
|
||||
/// The size of an axis. May be a specified size, a min/max
|
||||
|
@ -922,7 +924,8 @@ impl Flow for FlexFlow {
|
|||
.base
|
||||
.flags
|
||||
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
|
||||
}).map(|(index, flow)| FlexItem::new(index, flow))
|
||||
})
|
||||
.map(|(index, flow)| FlexItem::new(index, flow))
|
||||
.collect();
|
||||
|
||||
items.sort_by_key(|item| item.order);
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
use app_units::Au;
|
||||
use crate::block::{BlockFlow, FormattingContextType};
|
||||
use crate::context::LayoutContext;
|
||||
use crate::display_list::{DisplayListBuildState, StackingContextCollectionState};
|
||||
use crate::display_list::items::ClippingAndScrolling;
|
||||
use crate::display_list::{DisplayListBuildState, StackingContextCollectionState};
|
||||
use crate::flex::FlexFlow;
|
||||
use crate::floats::{Floats, SpeculatedFloatPlacement};
|
||||
use crate::flow_list::{FlowList, FlowListIterator, MutFlowListIterator};
|
||||
|
@ -46,16 +46,16 @@ use crate::table_colgroup::TableColGroupFlow;
|
|||
use crate::table_row::TableRowFlow;
|
||||
use crate::table_rowgroup::TableRowGroupFlow;
|
||||
use crate::table_wrapper::TableWrapperFlow;
|
||||
use euclid::{Point2D, Vector2D, Rect, Size2D};
|
||||
use gfx_traits::StackingContextId;
|
||||
use euclid::{Point2D, Rect, Size2D, Vector2D};
|
||||
use gfx_traits::print_tree::PrintTree;
|
||||
use gfx_traits::StackingContextId;
|
||||
use serde::ser::{Serialize, SerializeStruct, Serializer};
|
||||
use servo_geometry::{au_rect_to_f32_rect, f32_rect_to_au_rect, MaxRect};
|
||||
use std::fmt;
|
||||
use std::iter::Zip;
|
||||
use std::slice::IterMut;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::sync::Arc;
|
||||
use style::computed_values::clear::T as Clear;
|
||||
use style::computed_values::float::T as Float;
|
||||
use style::computed_values::overflow_x::T as StyleOverflow;
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
use crate::flow::{Flow, FlowClass};
|
||||
use crate::flow_ref::FlowRef;
|
||||
use serde::ser::{Serialize, SerializeSeq, Serializer};
|
||||
use serde_json::{Map, Value, to_value};
|
||||
use std::collections::{LinkedList, linked_list};
|
||||
use serde_json::{to_value, Map, Value};
|
||||
use std::collections::{linked_list, LinkedList};
|
||||
use std::ops::Deref;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
|
|
@ -5,24 +5,24 @@
|
|||
//! The `Fragment` type, which represents the leaves of the layout tree.
|
||||
|
||||
use app_units::Au;
|
||||
use canvas_traits::canvas::{CanvasMsg, CanvasId};
|
||||
use crate::ServoArc;
|
||||
use crate::context::{LayoutContext, with_thread_local_font_context};
|
||||
use canvas_traits::canvas::{CanvasId, CanvasMsg};
|
||||
use crate::context::{with_thread_local_font_context, LayoutContext};
|
||||
use crate::display_list::items::{ClipScrollNodeIndex, OpaqueNode, BLUR_INFLATION_FACTOR};
|
||||
use crate::display_list::ToLayout;
|
||||
use crate::display_list::items::{BLUR_INFLATION_FACTOR, ClipScrollNodeIndex, OpaqueNode};
|
||||
use crate::floats::ClearType;
|
||||
use crate::flow::{GetBaseFlow, ImmutableFlowUtils};
|
||||
use crate::flow_ref::FlowRef;
|
||||
use crate::inline::{InlineFragmentNodeFlags, InlineFragmentContext, InlineFragmentNodeInfo};
|
||||
use crate::inline::{InlineFragmentContext, InlineFragmentNodeFlags, InlineFragmentNodeInfo};
|
||||
use crate::inline::{InlineMetrics, LineMetrics};
|
||||
#[cfg(debug_assertions)]
|
||||
use crate::layout_debug;
|
||||
use crate::model::{self, IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto, SizeConstraint};
|
||||
use crate::model::style_length;
|
||||
use crate::model::{self, IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto, SizeConstraint};
|
||||
use crate::text;
|
||||
use crate::text::TextRunScanner;
|
||||
use crate::wrapper::ThreadSafeLayoutNodeHelpers;
|
||||
use euclid::{Point2D, Vector2D, Rect, Size2D};
|
||||
use crate::ServoArc;
|
||||
use euclid::{Point2D, Rect, Size2D, Vector2D};
|
||||
use gfx;
|
||||
use gfx::text::glyph::ByteIndex;
|
||||
use gfx::text::text_run::{TextRun, TextRunSlice};
|
||||
|
@ -32,15 +32,17 @@ use msg::constellation_msg::{BrowsingContextId, PipelineId};
|
|||
use net_traits::image::base::{Image, ImageMetadata};
|
||||
use net_traits::image_cache::{ImageOrMetadataAvailable, UsePlaceholder};
|
||||
use range::*;
|
||||
use script_layout_interface::wrapper_traits::{
|
||||
PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode,
|
||||
};
|
||||
use script_layout_interface::{HTMLCanvasData, HTMLCanvasDataSource, HTMLMediaData, SVGSVGData};
|
||||
use script_layout_interface::wrapper_traits::{PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode};
|
||||
use serde::ser::{Serialize, SerializeStruct, Serializer};
|
||||
use servo_url::ServoUrl;
|
||||
use std::{f32, fmt};
|
||||
use std::borrow::ToOwned;
|
||||
use std::cmp::{Ordering, max, min};
|
||||
use std::cmp::{max, min, Ordering};
|
||||
use std::collections::LinkedList;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::{f32, fmt};
|
||||
use style::computed_values::border_collapse::T as BorderCollapse;
|
||||
use style::computed_values::box_sizing::T as BoxSizing;
|
||||
use style::computed_values::clear::T as Clear;
|
||||
|
@ -59,8 +61,8 @@ use style::properties::ComputedValues;
|
|||
use style::selector_parser::RestyleDamage;
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use style::str::char_is_whitespace;
|
||||
use style::values::computed::{Length, LengthOrPercentage, LengthOrPercentageOrAuto};
|
||||
use style::values::computed::counters::ContentItem;
|
||||
use style::values::computed::{Length, LengthOrPercentage, LengthOrPercentageOrAuto};
|
||||
use style::values::generics::box_::{Perspective, VerticalAlign};
|
||||
use style::values::generics::transform;
|
||||
use webrender_api::{self, LayoutTransform};
|
||||
|
@ -416,23 +418,28 @@ impl ImageFragmentInfo {
|
|||
layout_context: &LayoutContext,
|
||||
) -> ImageFragmentInfo {
|
||||
// First use any image data present in the element...
|
||||
let image_or_metadata = node.image_data().and_then(|(image, metadata)| {
|
||||
match (image, metadata) {
|
||||
let image_or_metadata = node
|
||||
.image_data()
|
||||
.and_then(|(image, metadata)| match (image, metadata) {
|
||||
(Some(image), _) => Some(ImageOrMetadata::Image(image)),
|
||||
(None, Some(metadata)) => Some(ImageOrMetadata::Metadata(metadata)),
|
||||
_ => None,
|
||||
}
|
||||
}).or_else(|| url.and_then(|url| {
|
||||
// Otherwise query the image cache for anything known about the associated source URL.
|
||||
layout_context.get_or_request_image_or_meta(
|
||||
node.opaque(),
|
||||
url,
|
||||
UsePlaceholder::Yes
|
||||
).map(|result| match result {
|
||||
ImageOrMetadataAvailable::ImageAvailable(i, _) => ImageOrMetadata::Image(i),
|
||||
ImageOrMetadataAvailable::MetadataAvailable(m) => ImageOrMetadata::Metadata(m),
|
||||
})
|
||||
}));
|
||||
.or_else(|| {
|
||||
url.and_then(|url| {
|
||||
// Otherwise query the image cache for anything known about the associated source URL.
|
||||
layout_context
|
||||
.get_or_request_image_or_meta(node.opaque(), url, UsePlaceholder::Yes)
|
||||
.map(|result| match result {
|
||||
ImageOrMetadataAvailable::ImageAvailable(i, _) => {
|
||||
ImageOrMetadata::Image(i)
|
||||
},
|
||||
ImageOrMetadataAvailable::MetadataAvailable(m) => {
|
||||
ImageOrMetadata::Metadata(m)
|
||||
},
|
||||
})
|
||||
})
|
||||
});
|
||||
|
||||
let current_pixel_density = density.unwrap_or(1f64);
|
||||
|
||||
|
@ -452,15 +459,13 @@ impl ImageFragmentInfo {
|
|||
}),
|
||||
)
|
||||
},
|
||||
Some(ImageOrMetadata::Metadata(m)) => {
|
||||
(
|
||||
None,
|
||||
Some(ImageMetadata {
|
||||
height: (m.height as f64 / current_pixel_density) as u32,
|
||||
width: (m.width as f64 / current_pixel_density) as u32,
|
||||
}),
|
||||
)
|
||||
},
|
||||
Some(ImageOrMetadata::Metadata(m)) => (
|
||||
None,
|
||||
Some(ImageMetadata {
|
||||
height: (m.height as f64 / current_pixel_density) as u32,
|
||||
width: (m.width as f64 / current_pixel_density) as u32,
|
||||
}),
|
||||
),
|
||||
None => (None, None),
|
||||
};
|
||||
|
||||
|
@ -1012,7 +1017,7 @@ impl Fragment {
|
|||
} else {
|
||||
Au(0)
|
||||
}
|
||||
}
|
||||
},
|
||||
SpecificFragmentInfo::Media(ref info) => {
|
||||
if let Some((_, width, _)) = info.current_frame {
|
||||
Au::from_px(width as i32)
|
||||
|
@ -1042,7 +1047,7 @@ impl Fragment {
|
|||
} else {
|
||||
Au(0)
|
||||
}
|
||||
}
|
||||
},
|
||||
SpecificFragmentInfo::Media(ref info) => {
|
||||
if let Some((_, _, height)) = info.current_frame {
|
||||
Au::from_px(height as i32)
|
||||
|
@ -1174,17 +1179,21 @@ impl Fragment {
|
|||
(_, Ordering::Equal) => (first_isize, first_bsize),
|
||||
// When both rectangles grow (smaller than min sizes),
|
||||
// Choose the larger one;
|
||||
(Ordering::Greater, Ordering::Greater) => if first_isize > second_isize {
|
||||
(first_isize, first_bsize)
|
||||
} else {
|
||||
(second_isize, second_bsize)
|
||||
(Ordering::Greater, Ordering::Greater) => {
|
||||
if first_isize > second_isize {
|
||||
(first_isize, first_bsize)
|
||||
} else {
|
||||
(second_isize, second_bsize)
|
||||
}
|
||||
},
|
||||
// When both rectangles shrink (larger than max sizes),
|
||||
// Choose the smaller one;
|
||||
(Ordering::Less, Ordering::Less) => if first_isize > second_isize {
|
||||
(second_isize, second_bsize)
|
||||
} else {
|
||||
(first_isize, first_bsize)
|
||||
(Ordering::Less, Ordering::Less) => {
|
||||
if first_isize > second_isize {
|
||||
(second_isize, second_bsize)
|
||||
} else {
|
||||
(first_isize, first_bsize)
|
||||
}
|
||||
},
|
||||
// It does not matter which we choose here, because both sizes
|
||||
// will be clamped to constraint;
|
||||
|
@ -3173,7 +3182,8 @@ impl Fragment {
|
|||
perspective_origin
|
||||
.vertical
|
||||
.to_used_value(stacking_relative_border_box.size.height),
|
||||
).to_layout();
|
||||
)
|
||||
.to_layout();
|
||||
|
||||
let pre_transform = LayoutTransform::create_translation(
|
||||
perspective_origin.x,
|
||||
|
|
|
@ -8,10 +8,12 @@
|
|||
//! done in parallel and is therefore a sequential pass that runs on as little of the flow tree
|
||||
//! as possible.
|
||||
|
||||
use crate::context::{LayoutContext, with_thread_local_font_context};
|
||||
use crate::context::{with_thread_local_font_context, LayoutContext};
|
||||
use crate::display_list::items::OpaqueNode;
|
||||
use crate::flow::{Flow, FlowFlags, GetBaseFlow, ImmutableFlowUtils};
|
||||
use crate::fragment::{Fragment, GeneratedContentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo};
|
||||
use crate::fragment::{
|
||||
Fragment, GeneratedContentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo,
|
||||
};
|
||||
use crate::text::TextRunScanner;
|
||||
use crate::traversal::InorderFlowTraversal;
|
||||
use script_layout_interface::wrapper_traits::PseudoElementType;
|
||||
|
|
|
@ -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 crate::flow::{FlowFlags, Flow, GetBaseFlow};
|
||||
use crate::flow::{Flow, FlowFlags, GetBaseFlow};
|
||||
use style::computed_values::float::T as Float;
|
||||
use style::selector_parser::RestyleDamage;
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
|
|
|
@ -3,32 +3,32 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use app_units::{Au, MIN_AU};
|
||||
use crate::ServoArc;
|
||||
use crate::block::AbsoluteAssignBSizesTraversal;
|
||||
use crate::context::{LayoutContext, LayoutFontContext};
|
||||
use crate::display_list::{DisplayListBuildState, InlineFlowDisplayListBuilding};
|
||||
use crate::display_list::StackingContextCollectionState;
|
||||
use crate::display_list::items::OpaqueNode;
|
||||
use crate::display_list::StackingContextCollectionState;
|
||||
use crate::display_list::{DisplayListBuildState, InlineFlowDisplayListBuilding};
|
||||
use crate::floats::{FloatKind, Floats, PlacementInfo};
|
||||
use crate::flow::{BaseFlow, Flow, FlowClass, ForceNonfloatedFlag};
|
||||
use crate::flow::{FlowFlags, EarlyAbsolutePositionInfo, GetBaseFlow, OpaqueFlow};
|
||||
use crate::flow::{EarlyAbsolutePositionInfo, FlowFlags, GetBaseFlow, OpaqueFlow};
|
||||
use crate::flow_ref::FlowRef;
|
||||
use crate::fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow};
|
||||
use crate::fragment::FragmentFlags;
|
||||
use crate::fragment::SpecificFragmentInfo;
|
||||
use crate::fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow};
|
||||
use crate::layout_debug;
|
||||
use crate::model::IntrinsicISizesContribution;
|
||||
use crate::text;
|
||||
use crate::traversal::PreorderFlowTraversal;
|
||||
use crate::ServoArc;
|
||||
use euclid::{Point2D, Size2D};
|
||||
use gfx::font::FontMetrics;
|
||||
use gfx_traits::print_tree::PrintTree;
|
||||
use range::{Range, RangeIndex};
|
||||
use script_layout_interface::wrapper_traits::PseudoElementType;
|
||||
use std::{fmt, i32, isize, mem};
|
||||
use std::cmp::max;
|
||||
use std::collections::VecDeque;
|
||||
use std::sync::Arc;
|
||||
use std::{fmt, i32, isize, mem};
|
||||
use style::computed_values::display::T as Display;
|
||||
use style::computed_values::overflow_x::T as StyleOverflow;
|
||||
use style::computed_values::position::T as Position;
|
||||
|
@ -316,7 +316,8 @@ impl LineBreaker {
|
|||
.map(|fragment| match fragment.specific {
|
||||
SpecificFragmentInfo::ScannedText(ref info) => info.run.bidi_level,
|
||||
_ => para_level,
|
||||
}).collect();
|
||||
})
|
||||
.collect();
|
||||
|
||||
let mut lines = mem::replace(&mut self.lines, Vec::new());
|
||||
|
||||
|
@ -336,7 +337,8 @@ impl LineBreaker {
|
|||
let start = FragmentIndex(run.start as isize);
|
||||
let len = FragmentIndex(run.len() as isize);
|
||||
(Range::new(start, len), levels[run.start])
|
||||
}).collect(),
|
||||
})
|
||||
.collect(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1719,7 +1721,8 @@ impl Flow for InlineFlow {
|
|||
debug_assert!(first_fragment_index < self.fragments.fragments.len());
|
||||
let first_fragment = &self.fragments.fragments[first_fragment_index];
|
||||
let padding_box_origin = (first_fragment.border_box -
|
||||
first_fragment.style.logical_border_width()).start;
|
||||
first_fragment.style.logical_border_width())
|
||||
.start;
|
||||
containing_block_positions.push(
|
||||
padding_box_origin.to_physical(self.base.writing_mode, container_size),
|
||||
);
|
||||
|
@ -1733,7 +1736,8 @@ impl Flow for InlineFlow {
|
|||
debug_assert!(first_fragment_index < self.fragments.fragments.len());
|
||||
let first_fragment = &self.fragments.fragments[first_fragment_index];
|
||||
let padding_box_origin = (first_fragment.border_box -
|
||||
first_fragment.style.logical_border_width()).start;
|
||||
first_fragment.style.logical_border_width())
|
||||
.start;
|
||||
containing_block_positions.push(
|
||||
padding_box_origin.to_physical(self.base.writing_mode, container_size),
|
||||
);
|
||||
|
@ -1878,7 +1882,8 @@ impl Flow for InlineFlow {
|
|||
relative_containing_block_size,
|
||||
relative_containing_block_mode,
|
||||
CoordinateSystem::Own,
|
||||
).translate(&stacking_context_position.to_vector()),
|
||||
)
|
||||
.translate(&stacking_context_position.to_vector()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ use std::cell::RefCell;
|
|||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
#[cfg(debug_assertions)]
|
||||
use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize, Ordering};
|
||||
use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT};
|
||||
|
||||
thread_local!(static STATE_KEY: RefCell<Option<State>> = RefCell::new(None));
|
||||
|
||||
|
|
|
@ -87,9 +87,9 @@ pub mod traversal;
|
|||
pub mod wrapper;
|
||||
|
||||
// For unit tests:
|
||||
pub use self::data::LayoutData;
|
||||
pub use crate::fragment::Fragment;
|
||||
pub use crate::fragment::SpecificFragmentInfo;
|
||||
pub use self::data::LayoutData;
|
||||
|
||||
// We can't use servo_arc for everything in layout, because the Flow stuff uses
|
||||
// weak references.
|
||||
|
|
|
@ -7,13 +7,15 @@
|
|||
|
||||
use app_units::Au;
|
||||
use crate::block::BlockFlow;
|
||||
use crate::context::{LayoutContext, with_thread_local_font_context};
|
||||
use crate::display_list::{DisplayListBuildState, ListItemFlowDisplayListBuilding};
|
||||
use crate::context::{with_thread_local_font_context, LayoutContext};
|
||||
use crate::display_list::StackingContextCollectionState;
|
||||
use crate::display_list::{DisplayListBuildState, ListItemFlowDisplayListBuilding};
|
||||
use crate::floats::FloatKind;
|
||||
use crate::flow::{Flow, FlowClass, OpaqueFlow};
|
||||
use crate::fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, GeneratedContentInfo};
|
||||
use crate::fragment::Overflow;
|
||||
use crate::fragment::{
|
||||
CoordinateSystem, Fragment, FragmentBorderBoxIterator, GeneratedContentInfo,
|
||||
};
|
||||
use crate::generated_content;
|
||||
use crate::inline::InlineFlow;
|
||||
use euclid::Point2D;
|
||||
|
@ -257,7 +259,8 @@ impl Flow for ListItemFlow {
|
|||
.early_absolute_position_info
|
||||
.relative_containing_block_mode,
|
||||
CoordinateSystem::Own,
|
||||
).translate(&stacking_context_position.to_vector()),
|
||||
)
|
||||
.translate(&stacking_context_position.to_vector()),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@ use std::cmp::{max, min};
|
|||
use std::fmt;
|
||||
use style::logical_geometry::{LogicalMargin, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::values::computed::{LengthOrPercentageOrAuto, LengthOrPercentage};
|
||||
use style::values::computed::LengthOrPercentageOrNone;
|
||||
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto};
|
||||
|
||||
/// A collapsible margin. See CSS 2.1 § 8.3.1.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
|
@ -505,10 +505,12 @@ pub fn style_length(
|
|||
) -> MaybeAuto {
|
||||
match container_size {
|
||||
Some(length) => MaybeAuto::from_style(style_length, length),
|
||||
None => if let LengthOrPercentageOrAuto::Length(length) = style_length {
|
||||
MaybeAuto::Specified(Au::from(length))
|
||||
} else {
|
||||
MaybeAuto::Auto
|
||||
None => {
|
||||
if let LengthOrPercentageOrAuto::Length(length) = style_length {
|
||||
MaybeAuto::Specified(Au::from(length))
|
||||
} else {
|
||||
MaybeAuto::Auto
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -580,19 +582,23 @@ impl SizeConstraint {
|
|||
) -> SizeConstraint {
|
||||
let mut min_size = match container_size {
|
||||
Some(container_size) => min_size.to_used_value(container_size),
|
||||
None => if let LengthOrPercentage::Length(length) = min_size {
|
||||
Au::from(length)
|
||||
} else {
|
||||
Au(0)
|
||||
None => {
|
||||
if let LengthOrPercentage::Length(length) = min_size {
|
||||
Au::from(length)
|
||||
} else {
|
||||
Au(0)
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
let mut max_size = match container_size {
|
||||
Some(container_size) => max_size.to_used_value(container_size),
|
||||
None => if let LengthOrPercentageOrNone::Length(length) = max_size {
|
||||
Some(Au::from(length))
|
||||
} else {
|
||||
None
|
||||
None => {
|
||||
if let LengthOrPercentageOrNone::Length(length) = max_size {
|
||||
Some(Au::from(length))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
},
|
||||
};
|
||||
// Make sure max size is not smaller than min size.
|
||||
|
|
|
@ -5,23 +5,23 @@
|
|||
//! CSS Multi-column layout http://dev.w3.org/csswg/css-multicol/
|
||||
|
||||
use app_units::Au;
|
||||
use crate::ServoArc;
|
||||
use crate::block::BlockFlow;
|
||||
use crate::context::LayoutContext;
|
||||
use crate::display_list::{DisplayListBuildState, StackingContextCollectionState};
|
||||
use crate::floats::FloatKind;
|
||||
use crate::flow::{Flow, FlowClass, OpaqueFlow, FragmentationContext, GetBaseFlow};
|
||||
use crate::flow::{Flow, FlowClass, FragmentationContext, GetBaseFlow, OpaqueFlow};
|
||||
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||
use crate::ServoArc;
|
||||
use euclid::{Point2D, Vector2D};
|
||||
use gfx_traits::print_tree::PrintTree;
|
||||
use std::cmp::{min, max};
|
||||
use std::cmp::{max, min};
|
||||
use std::fmt;
|
||||
use std::sync::Arc;
|
||||
use style::logical_geometry::LogicalSize;
|
||||
use style::properties::ComputedValues;
|
||||
use style::values::Either;
|
||||
use style::values::computed::{LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
|
||||
use style::values::generics::column::ColumnCount;
|
||||
use style::values::Either;
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
unsafe impl crate::flow::HasBaseFlow for MulticolFlow {}
|
||||
|
@ -164,7 +164,8 @@ impl Flow for MulticolFlow {
|
|||
LogicalSize::from_physical(
|
||||
self.block_flow.base.writing_mode,
|
||||
ctx.shared_context().viewport_size(),
|
||||
).block
|
||||
)
|
||||
.block
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -14,7 +14,7 @@ use crate::flow::{Flow, GetBaseFlow};
|
|||
use crate::flow_ref::FlowRef;
|
||||
use crate::traversal::{AssignBSizes, AssignISizes, BubbleISizes};
|
||||
use crate::traversal::{PostorderFlowTraversal, PreorderFlowTraversal};
|
||||
use profile_traits::time::{self, TimerMetadata, profile};
|
||||
use profile_traits::time::{self, profile, TimerMetadata};
|
||||
use rayon;
|
||||
use servo_config::opts;
|
||||
use smallvec::SmallVec;
|
||||
|
|
|
@ -7,27 +7,29 @@
|
|||
use app_units::Au;
|
||||
use crate::construct::ConstructionResult;
|
||||
use crate::context::LayoutContext;
|
||||
use crate::display_list::IndexableText;
|
||||
use crate::display_list::items::{DisplayList, OpaqueNode, ScrollOffsetMap};
|
||||
use crate::display_list::IndexableText;
|
||||
use crate::flow::{Flow, GetBaseFlow};
|
||||
use crate::fragment::{Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo};
|
||||
use crate::inline::InlineFragmentNodeFlags;
|
||||
use crate::opaque_node::OpaqueNodeMethods;
|
||||
use crate::sequential;
|
||||
use crate::wrapper::LayoutNodeLayoutData;
|
||||
use euclid::{Point2D, Vector2D, Rect, Size2D};
|
||||
use euclid::{Point2D, Rect, Size2D, Vector2D};
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use script_layout_interface::{LayoutElementType, LayoutNodeType};
|
||||
use script_layout_interface::StyleData;
|
||||
use script_layout_interface::rpc::TextIndexResponse;
|
||||
use script_layout_interface::rpc::{ContentBoxResponse, ContentBoxesResponse, LayoutRPC};
|
||||
use script_layout_interface::rpc::{NodeGeometryResponse, NodeScrollIdResponse};
|
||||
use script_layout_interface::rpc::{OffsetParentResponse, ResolvedStyleResponse, StyleResponse};
|
||||
use script_layout_interface::rpc::TextIndexResponse;
|
||||
use script_layout_interface::wrapper_traits::{LayoutNode, ThreadSafeLayoutElement, ThreadSafeLayoutNode};
|
||||
use script_layout_interface::wrapper_traits::{
|
||||
LayoutNode, ThreadSafeLayoutElement, ThreadSafeLayoutNode,
|
||||
};
|
||||
use script_layout_interface::StyleData;
|
||||
use script_layout_interface::{LayoutElementType, LayoutNodeType};
|
||||
use script_traits::LayoutMsg as ConstellationMsg;
|
||||
use script_traits::UntrustedNodeAddress;
|
||||
use std::cmp::{min, max};
|
||||
use std::cmp::{max, min};
|
||||
use std::ops::Deref;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use style::computed_values::display::T as Display;
|
||||
|
@ -35,8 +37,8 @@ use style::computed_values::position::T as Position;
|
|||
use style::computed_values::visibility::T as Visibility;
|
||||
use style::context::{StyleContext, ThreadLocalStyleContext};
|
||||
use style::dom::TElement;
|
||||
use style::logical_geometry::{WritingMode, BlockFlowDirection, InlineBaseDirection};
|
||||
use style::properties::{style_structs, PropertyId, PropertyDeclarationId, LonghandId};
|
||||
use style::logical_geometry::{BlockFlowDirection, InlineBaseDirection, WritingMode};
|
||||
use style::properties::{style_structs, LonghandId, PropertyDeclarationId, PropertyId};
|
||||
use style::selector_parser::PseudoElement;
|
||||
use style_traits::ToCss;
|
||||
use webrender_api::ExternalScrollId;
|
||||
|
@ -603,7 +605,7 @@ impl FragmentBorderBoxIterator for ParentOffsetBorderBoxIterator {
|
|||
// cause this assertion to fail sometimes, so it's
|
||||
// commented out for now.
|
||||
/*assert!(node.flags.contains(FIRST_FRAGMENT_OF_ELEMENT),
|
||||
"First fragment of inline node found wasn't its first fragment!");*/
|
||||
"First fragment of inline node found wasn't its first fragment!");*/
|
||||
|
||||
self.node_offset_box = Some(NodeOffsetBoxInfo {
|
||||
offset: border_box.origin,
|
||||
|
@ -840,12 +842,11 @@ where
|
|||
let applies = true;
|
||||
|
||||
fn used_value_for_position_property<N: LayoutNode>(
|
||||
layout_el: <N::ConcreteThreadSafeLayoutNode as ThreadSafeLayoutNode>::ConcreteThreadSafeLayoutElement,
|
||||
layout_root: &mut Flow,
|
||||
requested_node: N,
|
||||
longhand_id: LonghandId,
|
||||
) -> String
|
||||
{
|
||||
layout_el: <N::ConcreteThreadSafeLayoutNode as ThreadSafeLayoutNode>::ConcreteThreadSafeLayoutElement,
|
||||
layout_root: &mut Flow,
|
||||
requested_node: N,
|
||||
longhand_id: LonghandId,
|
||||
) -> String {
|
||||
let maybe_data = layout_el.borrow_layout_data();
|
||||
let position = maybe_data.map_or(Point2D::zero(), |data| {
|
||||
match (*data).flow_construction_result {
|
||||
|
|
|
@ -8,8 +8,8 @@ use app_units::Au;
|
|||
use crate::context::LayoutContext;
|
||||
use crate::display_list::{DisplayListBuildState, StackingContextCollectionState};
|
||||
use crate::floats::SpeculatedFloatPlacement;
|
||||
use crate::flow::{Flow, ImmutableFlowUtils, FlowFlags, GetBaseFlow};
|
||||
use crate::fragment::{FragmentBorderBoxIterator, CoordinateSystem};
|
||||
use crate::flow::{Flow, FlowFlags, GetBaseFlow, ImmutableFlowUtils};
|
||||
use crate::fragment::{CoordinateSystem, FragmentBorderBoxIterator};
|
||||
use crate::generated_content::ResolveGeneratedContent;
|
||||
use crate::incremental::RelayoutMode;
|
||||
use crate::traversal::{AssignBSizes, AssignISizes, BubbleISizes, BuildDisplayList};
|
||||
|
|
|
@ -9,8 +9,13 @@ use crate::block::{BlockFlow, CandidateBSizeIterator, ISizeAndMarginsComputer};
|
|||
use crate::block::{ISizeConstraintInput, ISizeConstraintSolution};
|
||||
use crate::context::LayoutContext;
|
||||
use crate::display_list::{BlockFlowDisplayListBuilding, BorderPaintingMode};
|
||||
use crate::display_list::{DisplayListBuildState, StackingContextCollectionFlags, StackingContextCollectionState};
|
||||
use crate::flow::{BaseFlow, EarlyAbsolutePositionInfo, Flow, FlowClass, ImmutableFlowUtils, GetBaseFlow, OpaqueFlow};
|
||||
use crate::display_list::{
|
||||
DisplayListBuildState, StackingContextCollectionFlags, StackingContextCollectionState,
|
||||
};
|
||||
use crate::flow::{
|
||||
BaseFlow, EarlyAbsolutePositionInfo, Flow, FlowClass, GetBaseFlow, ImmutableFlowUtils,
|
||||
OpaqueFlow,
|
||||
};
|
||||
use crate::flow_list::{FlowListIterator, MutFlowListIterator};
|
||||
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||
use crate::layout_debug;
|
||||
|
@ -25,11 +30,11 @@ use std::{cmp, fmt};
|
|||
use style::computed_values::{border_collapse, border_spacing, table_layout};
|
||||
use style::context::SharedStyleContext;
|
||||
use style::logical_geometry::LogicalSize;
|
||||
use style::properties::ComputedValues;
|
||||
use style::properties::style_structs::Background;
|
||||
use style::properties::ComputedValues;
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use style::values::CSSFloat;
|
||||
use style::values::computed::LengthOrPercentageOrAuto;
|
||||
use style::values::CSSFloat;
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
unsafe impl crate::flow::HasBaseFlow for TableFlow {}
|
||||
|
|
|
@ -197,7 +197,8 @@ impl Flow for TableCellFlow {
|
|||
let specified_inline_size = MaybeAuto::from_style(
|
||||
self.block_flow.fragment.style().content_inline_size(),
|
||||
Au(0),
|
||||
).specified_or_zero();
|
||||
)
|
||||
.specified_or_zero();
|
||||
if self
|
||||
.block_flow
|
||||
.base
|
||||
|
|
|
@ -9,7 +9,9 @@ use crate::block::{BlockFlow, ISizeAndMarginsComputer};
|
|||
use crate::context::LayoutContext;
|
||||
use crate::display_list::{BlockFlowDisplayListBuilding, DisplayListBuildState};
|
||||
use crate::display_list::{StackingContextCollectionFlags, StackingContextCollectionState};
|
||||
use crate::flow::{EarlyAbsolutePositionInfo, Flow, FlowClass, ImmutableFlowUtils, GetBaseFlow, OpaqueFlow};
|
||||
use crate::flow::{
|
||||
EarlyAbsolutePositionInfo, Flow, FlowClass, GetBaseFlow, ImmutableFlowUtils, OpaqueFlow,
|
||||
};
|
||||
use crate::flow_list::MutFlowListIterator;
|
||||
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||
use crate::layout_debug;
|
||||
|
|
|
@ -12,13 +12,17 @@
|
|||
//! Hereafter this document is referred to as INTRINSIC.
|
||||
|
||||
use app_units::Au;
|
||||
use crate::block::{AbsoluteNonReplaced, BlockFlow, FloatNonReplaced, ISizeAndMarginsComputer, ISizeConstraintInput};
|
||||
use crate::block::{
|
||||
AbsoluteNonReplaced, BlockFlow, FloatNonReplaced, ISizeAndMarginsComputer, ISizeConstraintInput,
|
||||
};
|
||||
use crate::block::{ISizeConstraintSolution, MarginsMayCollapseFlag};
|
||||
use crate::context::LayoutContext;
|
||||
use crate::display_list::{BlockFlowDisplayListBuilding, DisplayListBuildState, StackingContextCollectionFlags};
|
||||
use crate::display_list::StackingContextCollectionState;
|
||||
use crate::display_list::{
|
||||
BlockFlowDisplayListBuilding, DisplayListBuildState, StackingContextCollectionFlags,
|
||||
};
|
||||
use crate::floats::FloatKind;
|
||||
use crate::flow::{Flow, FlowClass, ImmutableFlowUtils, FlowFlags, OpaqueFlow};
|
||||
use crate::flow::{Flow, FlowClass, FlowFlags, ImmutableFlowUtils, OpaqueFlow};
|
||||
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||
use crate::model::MaybeAuto;
|
||||
use crate::table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize};
|
||||
|
@ -31,8 +35,8 @@ use style::computed_values::{position, table_layout};
|
|||
use style::context::SharedStyleContext;
|
||||
use style::logical_geometry::{LogicalRect, LogicalSize};
|
||||
use style::properties::ComputedValues;
|
||||
use style::values::CSSFloat;
|
||||
use style::values::computed::LengthOrPercentageOrAuto;
|
||||
use style::values::CSSFloat;
|
||||
|
||||
#[derive(Clone, Copy, Debug, Serialize)]
|
||||
pub enum TableLayout {
|
||||
|
@ -143,7 +147,8 @@ impl TableWrapperFlow {
|
|||
);
|
||||
total_guess = &total_guess + &guess;
|
||||
guess
|
||||
}).collect();
|
||||
})
|
||||
.collect();
|
||||
|
||||
// Assign inline sizes.
|
||||
let selection =
|
||||
|
@ -385,7 +390,8 @@ impl Flow for TableWrapperFlow {
|
|||
size: column_intrinsic_inline_size.minimum_length,
|
||||
percentage: column_intrinsic_inline_size.percentage,
|
||||
},
|
||||
).collect::<Vec<_>>();
|
||||
)
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
// Our inline-size was set to the inline-size of the containing block by the flow's parent.
|
||||
// Now compute the real value.
|
||||
|
@ -753,17 +759,17 @@ impl ExcessInlineSizeDistributionInfo {
|
|||
if !column_intrinsic_inline_size.constrained &&
|
||||
column_intrinsic_inline_size.percentage == 0.0
|
||||
{
|
||||
self.preferred_inline_size_of_nonconstrained_columns_with_no_percentage =
|
||||
self.preferred_inline_size_of_nonconstrained_columns_with_no_percentage +
|
||||
column_intrinsic_inline_size.preferred;
|
||||
self.preferred_inline_size_of_nonconstrained_columns_with_no_percentage = self
|
||||
.preferred_inline_size_of_nonconstrained_columns_with_no_percentage +
|
||||
column_intrinsic_inline_size.preferred;
|
||||
self.count_of_nonconstrained_columns_with_no_percentage += 1
|
||||
}
|
||||
if column_intrinsic_inline_size.constrained &&
|
||||
column_intrinsic_inline_size.percentage == 0.0
|
||||
{
|
||||
self.preferred_inline_size_of_constrained_columns_with_no_percentage =
|
||||
self.preferred_inline_size_of_constrained_columns_with_no_percentage +
|
||||
column_intrinsic_inline_size.preferred
|
||||
self.preferred_inline_size_of_constrained_columns_with_no_percentage = self
|
||||
.preferred_inline_size_of_constrained_columns_with_no_percentage +
|
||||
column_intrinsic_inline_size.preferred
|
||||
}
|
||||
self.total_percentage += column_intrinsic_inline_size.percentage;
|
||||
self.column_count += 1
|
||||
|
|
|
@ -10,7 +10,7 @@ use crate::fragment::{Fragment, ScannedTextFlags};
|
|||
use crate::fragment::{ScannedTextFragmentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo};
|
||||
use crate::inline::{InlineFragmentNodeFlags, InlineFragments};
|
||||
use crate::linked_list::split_off_head;
|
||||
use gfx::font::{FontRef, FontMetrics, RunMetrics, ShapingFlags, ShapingOptions};
|
||||
use gfx::font::{FontMetrics, FontRef, RunMetrics, ShapingFlags, ShapingOptions};
|
||||
use gfx::text::glyph::ByteIndex;
|
||||
use gfx::text::text_run::TextRun;
|
||||
use gfx::text::util::{self, CompressionMode};
|
||||
|
@ -26,11 +26,11 @@ use style::computed_values::text_transform::T as TextTransform;
|
|||
use style::computed_values::white_space::T as WhiteSpace;
|
||||
use style::computed_values::word_break::T as WordBreak;
|
||||
use style::logical_geometry::{LogicalSize, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::properties::style_structs::Font as FontStyleStruct;
|
||||
use style::properties::ComputedValues;
|
||||
use style::values::generics::text::LineHeight;
|
||||
use unicode_bidi as bidi;
|
||||
use unicode_script::{Script, get_script};
|
||||
use unicode_script::{get_script, Script};
|
||||
use xi_unicode::LineBreakLeafIter;
|
||||
|
||||
/// Returns the concatenated text of a list of unscanned text fragments.
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
use crate::construct::FlowConstructor;
|
||||
use crate::context::LayoutContext;
|
||||
use crate::display_list::DisplayListBuildState;
|
||||
use crate::flow::{FlowFlags, Flow, GetBaseFlow, ImmutableFlowUtils};
|
||||
use crate::wrapper::{GetRawData, LayoutNodeLayoutData};
|
||||
use crate::flow::{Flow, FlowFlags, GetBaseFlow, ImmutableFlowUtils};
|
||||
use crate::wrapper::ThreadSafeLayoutNodeHelpers;
|
||||
use crate::wrapper::{GetRawData, LayoutNodeLayoutData};
|
||||
use script_layout_interface::wrapper_traits::{LayoutNode, ThreadSafeLayoutNode};
|
||||
use servo_config::opts;
|
||||
use style::context::{SharedStyleContext, StyleContext};
|
||||
|
@ -17,8 +17,8 @@ use style::data::ElementData;
|
|||
use style::dom::{NodeInfo, TElement, TNode};
|
||||
use style::selector_parser::RestyleDamage;
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use style::traversal::{DomTraversal, recalc_style_at};
|
||||
use style::traversal::PerLevelTraversalData;
|
||||
use style::traversal::{recalc_style_at, DomTraversal};
|
||||
|
||||
pub struct RecalcStyleAndConstructFlows<'a> {
|
||||
context: LayoutContext<'a>,
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
|
||||
use atomic_refcell::{AtomicRef, AtomicRefMut};
|
||||
use crate::data::{LayoutData, LayoutDataFlags, StyleAndLayoutData};
|
||||
use script_layout_interface::wrapper_traits::{ThreadSafeLayoutElement, ThreadSafeLayoutNode};
|
||||
use script_layout_interface::wrapper_traits::GetLayoutData;
|
||||
use script_layout_interface::wrapper_traits::{ThreadSafeLayoutElement, ThreadSafeLayoutNode};
|
||||
use style::dom::{NodeInfo, TNode};
|
||||
use style::selector_parser::RestyleDamage;
|
||||
use style::values::computed::counters::ContentItem;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue