mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Rustfmt has changed its default style :/
This commit is contained in:
parent
82fc6d9f49
commit
be69f9c3e6
207 changed files with 1200 additions and 1339 deletions
|
@ -78,16 +78,17 @@ pub fn update_animation_state<E>(
|
|||
for (key, running_animations) in running_animations.iter_mut() {
|
||||
let mut animations_still_running = vec![];
|
||||
for mut running_animation in running_animations.drain(..) {
|
||||
let still_running = !running_animation.is_expired() && match running_animation {
|
||||
Animation::Transition(_, started_at, ref frame) => {
|
||||
now < started_at + frame.duration
|
||||
},
|
||||
Animation::Keyframes(_, _, _, ref mut state) => {
|
||||
// This animation is still running, or we need to keep
|
||||
// iterating.
|
||||
now < state.started_at + state.duration || state.tick()
|
||||
},
|
||||
};
|
||||
let still_running = !running_animation.is_expired() &&
|
||||
match running_animation {
|
||||
Animation::Transition(_, started_at, ref frame) => {
|
||||
now < started_at + frame.duration
|
||||
},
|
||||
Animation::Keyframes(_, _, _, ref mut state) => {
|
||||
// This animation is still running, or we need to keep
|
||||
// iterating.
|
||||
now < state.started_at + state.duration || state.tick()
|
||||
},
|
||||
};
|
||||
|
||||
debug!(
|
||||
"update_animation_state({:?}): {:?}",
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
//!
|
||||
//! http://dev.w3.org/csswg/css-sizing/
|
||||
|
||||
use app_units::{Au, MAX_AU};
|
||||
use crate::context::LayoutContext;
|
||||
use crate::display_list::items::DisplayListSection;
|
||||
use crate::display_list::StackingContextCollectionState;
|
||||
|
@ -49,6 +48,7 @@ use crate::model::{
|
|||
};
|
||||
use crate::sequential;
|
||||
use crate::traversal::PreorderFlowTraversal;
|
||||
use app_units::{Au, MAX_AU};
|
||||
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
|
||||
use gfx_traits::print_tree::PrintTree;
|
||||
use serde::{Serialize, Serializer};
|
||||
|
@ -809,11 +809,10 @@ impl BlockFlow {
|
|||
viewport_size: &Size2D<Au>,
|
||||
descendant: OpaqueFlow,
|
||||
) -> LogicalSize<Au> {
|
||||
debug_assert!(
|
||||
self.base
|
||||
.flags
|
||||
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
|
||||
);
|
||||
debug_assert!(self
|
||||
.base
|
||||
.flags
|
||||
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED));
|
||||
if self.is_fixed() || self.is_root() {
|
||||
// Initial containing block is the CB for the root
|
||||
LogicalSize::from_physical(self.base.writing_mode, *viewport_size)
|
||||
|
@ -1176,10 +1175,11 @@ impl BlockFlow {
|
|||
let mut block_size = cur_b - block_start_offset;
|
||||
let is_root = self.is_root();
|
||||
|
||||
if is_root || self.formatting_context_type() != FormattingContextType::None || self
|
||||
.base
|
||||
.flags
|
||||
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
|
||||
if is_root ||
|
||||
self.formatting_context_type() != FormattingContextType::None ||
|
||||
self.base
|
||||
.flags
|
||||
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
|
||||
{
|
||||
// The content block-size includes all the floats per CSS 2.1 § 10.6.7. The easiest
|
||||
// way to handle this is to just treat it as clearance.
|
||||
|
@ -1953,14 +1953,12 @@ impl BlockFlow {
|
|||
)
|
||||
},
|
||||
(Float::Left, _) => {
|
||||
left_float_width_accumulator = left_float_width_accumulator + child_base
|
||||
.intrinsic_inline_sizes
|
||||
.preferred_inline_size;
|
||||
left_float_width_accumulator = left_float_width_accumulator +
|
||||
child_base.intrinsic_inline_sizes.preferred_inline_size;
|
||||
},
|
||||
(Float::Right, _) => {
|
||||
right_float_width_accumulator = right_float_width_accumulator + child_base
|
||||
.intrinsic_inline_sizes
|
||||
.preferred_inline_size;
|
||||
right_float_width_accumulator = right_float_width_accumulator +
|
||||
child_base.intrinsic_inline_sizes.preferred_inline_size;
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -763,17 +763,20 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
node: &ConcreteThreadSafeLayoutNode,
|
||||
) -> ConstructionResult {
|
||||
let mut fragments = IntermediateInlineFragments::new();
|
||||
let node_is_input_or_text_area =
|
||||
node.type_id() == Some(LayoutNodeType::Element(LayoutElementType::HTMLInputElement)) ||
|
||||
node.type_id() == Some(LayoutNodeType::Element(
|
||||
let node_is_input_or_text_area = node.type_id() ==
|
||||
Some(LayoutNodeType::Element(LayoutElementType::HTMLInputElement)) ||
|
||||
node.type_id() ==
|
||||
Some(LayoutNodeType::Element(
|
||||
LayoutElementType::HTMLTextAreaElement,
|
||||
));
|
||||
if node.get_pseudo_element_type().is_replaced_content() || node_is_input_or_text_area {
|
||||
// A TextArea's text contents are displayed through the input text
|
||||
// box, so don't construct them.
|
||||
if node.type_id() == Some(LayoutNodeType::Element(
|
||||
LayoutElementType::HTMLTextAreaElement,
|
||||
)) {
|
||||
if node.type_id() ==
|
||||
Some(LayoutNodeType::Element(
|
||||
LayoutElementType::HTMLTextAreaElement,
|
||||
))
|
||||
{
|
||||
for kid in node.children() {
|
||||
self.set_flow_construction_result(&kid, ConstructionResult::None)
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use atomic_refcell::AtomicRefCell;
|
||||
use crate::construct::ConstructionResult;
|
||||
use atomic_refcell::AtomicRefCell;
|
||||
use script_layout_interface::StyleData;
|
||||
|
||||
#[repr(C)]
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
// FIXME(rust-lang/rust#26264): Remove GenericBackgroundSize.
|
||||
|
||||
use app_units::Au;
|
||||
use crate::display_list::border;
|
||||
use crate::model::MaybeAuto;
|
||||
use app_units::Au;
|
||||
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
|
||||
use style::computed_values::background_attachment::single_value::T as BackgroundAttachment;
|
||||
use style::computed_values::background_clip::single_value::T as BackgroundClip;
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
// FIXME(rust-lang/rust#26264): Remove GenericBorderImageSideWidth.
|
||||
|
||||
use app_units::Au;
|
||||
use crate::display_list::ToLayout;
|
||||
use app_units::Au;
|
||||
use euclid::{Rect, SideOffsets2D, Size2D};
|
||||
use style::computed_values::border_image_outset::T as BorderImageOutset;
|
||||
use style::properties::style_structs::Border;
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
//! list building, as the actual painting does not happen here—only deciding *what* we're going to
|
||||
//! paint.
|
||||
|
||||
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::background::{self, get_cyclic};
|
||||
|
@ -33,6 +31,8 @@ use crate::inline::{InlineFlow, InlineFragmentNodeFlags};
|
|||
use crate::list_item::ListItemFlow;
|
||||
use crate::model::MaybeAuto;
|
||||
use crate::table_cell::CollapsedBordersForCell;
|
||||
use app_units::{Au, AU_PER_PX};
|
||||
use canvas_traits::canvas::{CanvasMsg, FromLayoutMsg};
|
||||
use euclid::{rect, Point2D, Rect, SideOffsets2D, Size2D, TypedRect, TypedSize2D, Vector2D};
|
||||
use fnv::FnvHashMap;
|
||||
use gfx::text::glyph::ByteIndex;
|
||||
|
@ -2172,13 +2172,10 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
// FIXME(pcwalton): Get the real container size.
|
||||
let container_size = Size2D::zero();
|
||||
let metrics = &text_fragment.run.font_metrics;
|
||||
let baseline_origin = stacking_relative_content_box.origin + LogicalPoint::new(
|
||||
self.style.writing_mode,
|
||||
Au(0),
|
||||
metrics.ascent,
|
||||
)
|
||||
.to_physical(self.style.writing_mode, container_size)
|
||||
.to_vector();
|
||||
let baseline_origin = stacking_relative_content_box.origin +
|
||||
LogicalPoint::new(self.style.writing_mode, Au(0), metrics.ascent)
|
||||
.to_physical(self.style.writing_mode, container_size)
|
||||
.to_vector();
|
||||
|
||||
// Base item for all text/shadows
|
||||
let base = state.create_base_display_item(
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
// FIXME(rust-lang/rust#26264): Remove GenericEndingShape and GenericGradientItem.
|
||||
|
||||
use app_units::Au;
|
||||
use crate::display_list::ToLayout;
|
||||
use app_units::Au;
|
||||
use euclid::{Point2D, Size2D, Vector2D};
|
||||
use style::properties::ComputedValues;
|
||||
use style::values::computed::image::{EndingShape, LineDirection};
|
||||
|
|
|
@ -513,29 +513,28 @@ impl ClippingRegion {
|
|||
/// This is a quick, not a precise, test; it can yield false positives.
|
||||
#[inline]
|
||||
pub fn might_intersect_point(&self, point: &LayoutPoint) -> bool {
|
||||
self.main.contains(point) && self
|
||||
.complex
|
||||
.iter()
|
||||
.all(|complex| complex.rect.contains(point))
|
||||
self.main.contains(point) &&
|
||||
self.complex
|
||||
.iter()
|
||||
.all(|complex| complex.rect.contains(point))
|
||||
}
|
||||
|
||||
/// Returns true if this clipping region might intersect the given rectangle and false
|
||||
/// otherwise. This is a quick, not a precise, test; it can yield false positives.
|
||||
#[inline]
|
||||
pub fn might_intersect_rect(&self, rect: &LayoutRect) -> bool {
|
||||
self.main.intersects(rect) && self
|
||||
.complex
|
||||
.iter()
|
||||
.all(|complex| complex.rect.intersects(rect))
|
||||
self.main.intersects(rect) &&
|
||||
self.complex
|
||||
.iter()
|
||||
.all(|complex| complex.rect.intersects(rect))
|
||||
}
|
||||
|
||||
/// Returns true if this clipping region completely surrounds the given rect.
|
||||
#[inline]
|
||||
pub fn does_not_clip_rect(&self, rect: &LayoutRect) -> bool {
|
||||
self.main.contains(&rect.origin) && self.main.contains(&rect.bottom_right()) && self
|
||||
.complex
|
||||
.iter()
|
||||
.all(|complex| {
|
||||
self.main.contains(&rect.origin) &&
|
||||
self.main.contains(&rect.bottom_right()) &&
|
||||
self.complex.iter().all(|complex| {
|
||||
complex.rect.contains(&rect.origin) && complex.rect.contains(&rect.bottom_right())
|
||||
})
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
//! Layout for elements with a CSS `display` property of `flex`.
|
||||
|
||||
use app_units::{Au, MAX_AU};
|
||||
use crate::block::{AbsoluteAssignBSizesTraversal, BlockFlow, MarginsMayCollapseFlag};
|
||||
use crate::context::LayoutContext;
|
||||
use crate::display_list::StackingContextCollectionState;
|
||||
|
@ -16,6 +15,7 @@ use crate::layout_debug;
|
|||
use crate::model::{AdjoiningMargins, CollapsibleMargins};
|
||||
use crate::model::{IntrinsicISizes, MaybeAuto, SizeConstraint};
|
||||
use crate::traversal::PreorderFlowTraversal;
|
||||
use app_units::{Au, MAX_AU};
|
||||
use euclid::Point2D;
|
||||
use std::cmp::{max, min};
|
||||
use std::ops::Range;
|
||||
|
@ -846,13 +846,14 @@ impl FlexFlow {
|
|||
// as if it has a fixed cross size, all child blocks should resolve against it.
|
||||
// block.assign_block_size(layout_context);
|
||||
}
|
||||
block.base.position.start.b = margin_block_start + if !self.cross_reverse {
|
||||
cur_b
|
||||
} else {
|
||||
self.block_flow.fragment.border_padding.block_start * 2 + total_cross_size -
|
||||
cur_b -
|
||||
line.cross_size
|
||||
};
|
||||
block.base.position.start.b = margin_block_start +
|
||||
if !self.cross_reverse {
|
||||
cur_b
|
||||
} else {
|
||||
self.block_flow.fragment.border_padding.block_start * 2 + total_cross_size -
|
||||
cur_b -
|
||||
line.cross_size
|
||||
};
|
||||
// TODO(stshine): support baseline alignment.
|
||||
if free_space != Au(0) {
|
||||
let flex_cross = match self_align {
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use app_units::{Au, MAX_AU};
|
||||
use crate::block::FormattingContextType;
|
||||
use crate::flow::{Flow, FlowFlags, GetBaseFlow, ImmutableFlowUtils};
|
||||
use crate::persistent_list::PersistentList;
|
||||
use app_units::{Au, MAX_AU};
|
||||
use std::cmp::{max, min};
|
||||
use std::fmt;
|
||||
use style::computed_values::float::T as StyleFloat;
|
||||
|
@ -353,7 +353,7 @@ impl Floats {
|
|||
info.ceiling,
|
||||
info.max_inline_size,
|
||||
MAX_AU,
|
||||
)
|
||||
);
|
||||
},
|
||||
FloatKind::Right => {
|
||||
return LogicalRect::new(
|
||||
|
@ -362,7 +362,7 @@ impl Floats {
|
|||
info.ceiling,
|
||||
info.max_inline_size,
|
||||
MAX_AU,
|
||||
)
|
||||
);
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -395,7 +395,7 @@ impl Floats {
|
|||
info.max_inline_size,
|
||||
MAX_AU,
|
||||
),
|
||||
}
|
||||
};
|
||||
},
|
||||
Some(rect) => {
|
||||
assert_ne!(
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
//! line breaks and mapping to CSS boxes, for the purpose of handling `getClientRects()` and
|
||||
//! similar methods.
|
||||
|
||||
use app_units::Au;
|
||||
use crate::block::{BlockFlow, FormattingContextType};
|
||||
use crate::context::LayoutContext;
|
||||
use crate::display_list::items::ClippingAndScrolling;
|
||||
|
@ -46,6 +45,7 @@ use crate::table_colgroup::TableColGroupFlow;
|
|||
use crate::table_row::TableRowFlow;
|
||||
use crate::table_rowgroup::TableRowGroupFlow;
|
||||
use crate::table_wrapper::TableWrapperFlow;
|
||||
use app_units::Au;
|
||||
use euclid::{Point2D, Rect, Size2D, Vector2D};
|
||||
use gfx_traits::print_tree::PrintTree;
|
||||
use gfx_traits::StackingContextId;
|
||||
|
@ -342,14 +342,14 @@ pub trait Flow: HasBaseFlow + fmt::Debug + Sync + Send + 'static {
|
|||
overflow.scroll.size.height = border_box.size.height;
|
||||
}
|
||||
|
||||
if !self.as_block().fragment.establishes_stacking_context() || self
|
||||
.as_block()
|
||||
.fragment
|
||||
.style
|
||||
.get_box()
|
||||
.transform
|
||||
.0
|
||||
.is_empty()
|
||||
if !self.as_block().fragment.establishes_stacking_context() ||
|
||||
self.as_block()
|
||||
.fragment
|
||||
.style
|
||||
.get_box()
|
||||
.transform
|
||||
.0
|
||||
.is_empty()
|
||||
{
|
||||
overflow.translate(&position.origin.to_vector());
|
||||
return overflow;
|
||||
|
@ -466,10 +466,10 @@ pub trait Flow: HasBaseFlow + fmt::Debug + Sync + Send + 'static {
|
|||
}
|
||||
|
||||
fn contains_positioned_fragments(&self) -> bool {
|
||||
self.contains_relatively_positioned_fragments() || self
|
||||
.base()
|
||||
.flags
|
||||
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
|
||||
self.contains_relatively_positioned_fragments() ||
|
||||
self.base()
|
||||
.flags
|
||||
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
|
||||
}
|
||||
|
||||
fn contains_relatively_positioned_fragments(&self) -> bool {
|
||||
|
@ -1406,10 +1406,10 @@ impl<'a> ImmutableFlowUtils for &'a dyn Flow {
|
|||
return Some(kid.base().position.start.b + baseline_offset);
|
||||
}
|
||||
}
|
||||
if kid.is_block_like() && !kid
|
||||
.base()
|
||||
.flags
|
||||
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
|
||||
if kid.is_block_like() &&
|
||||
!kid.base()
|
||||
.flags
|
||||
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
|
||||
{
|
||||
if let Some(baseline_offset) = kid.baseline_offset_of_last_line_box_in_flow() {
|
||||
return Some(kid.base().position.start.b + baseline_offset);
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
//! The `Fragment` type, which represents the leaves of the layout tree.
|
||||
|
||||
use app_units::Au;
|
||||
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;
|
||||
|
@ -22,6 +20,8 @@ use crate::text;
|
|||
use crate::text::TextRunScanner;
|
||||
use crate::wrapper::ThreadSafeLayoutNodeHelpers;
|
||||
use crate::ServoArc;
|
||||
use app_units::Au;
|
||||
use canvas_traits::canvas::{CanvasId, CanvasMsg};
|
||||
use euclid::{Point2D, Rect, Size2D, Vector2D};
|
||||
use gfx::text::glyph::ByteIndex;
|
||||
use gfx::text::text_run::{TextRun, TextRunSlice};
|
||||
|
@ -849,10 +849,10 @@ impl Fragment {
|
|||
}
|
||||
|
||||
pub fn contains_node(&self, node_address: OpaqueNode) -> bool {
|
||||
node_address == self.node || self
|
||||
.inline_context
|
||||
.as_ref()
|
||||
.map_or(false, |ctx| ctx.contains_node(node_address))
|
||||
node_address == self.node ||
|
||||
self.inline_context
|
||||
.as_ref()
|
||||
.map_or(false, |ctx| ctx.contains_node(node_address))
|
||||
}
|
||||
|
||||
/// Adds a style to the inline context for this fragment. If the inline context doesn't exist
|
||||
|
@ -1939,9 +1939,9 @@ impl Fragment {
|
|||
// The advance is more than the remaining inline-size, so split here. First, check to
|
||||
// see if we're going to overflow the line. If so, perform a best-effort split.
|
||||
let mut remaining_range = slice.text_run_range();
|
||||
let split_is_empty = inline_start_range.is_empty() && !(self
|
||||
.requires_line_break_afterward_if_wrapping_on_newlines() &&
|
||||
!self.white_space().allow_wrap());
|
||||
let split_is_empty = inline_start_range.is_empty() &&
|
||||
!(self.requires_line_break_afterward_if_wrapping_on_newlines() &&
|
||||
!self.white_space().allow_wrap());
|
||||
if split_is_empty {
|
||||
// We're going to overflow the line.
|
||||
overflowing = true;
|
||||
|
@ -2416,9 +2416,9 @@ impl Fragment {
|
|||
minimum_line_metrics.space_above_baseline
|
||||
},
|
||||
VerticalAlign::TextBottom => {
|
||||
offset = minimum_line_metrics.space_below_baseline - self
|
||||
.content_inline_metrics(layout_context)
|
||||
.space_below_baseline
|
||||
offset = minimum_line_metrics.space_below_baseline -
|
||||
self.content_inline_metrics(layout_context)
|
||||
.space_below_baseline
|
||||
},
|
||||
VerticalAlign::Top => {
|
||||
if let Some(actual_line_metrics) = actual_line_metrics {
|
||||
|
|
|
@ -62,17 +62,18 @@ impl<'a> LayoutDamageComputation for &'a mut dyn Flow {
|
|||
.damage_for_parent(child_is_absolutely_positioned),
|
||||
);
|
||||
|
||||
has_counter_affecting_children =
|
||||
has_counter_affecting_children || kid.base().flags.intersects(
|
||||
has_counter_affecting_children = has_counter_affecting_children ||
|
||||
kid.base().flags.intersects(
|
||||
FlowFlags::AFFECTS_COUNTERS | FlowFlags::HAS_COUNTER_AFFECTING_CHILDREN,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let self_base = self.mut_base();
|
||||
if self_base.flags.float_kind() != Float::None && self_base
|
||||
.restyle_damage
|
||||
.intersects(ServoRestyleDamage::REFLOW)
|
||||
if self_base.flags.float_kind() != Float::None &&
|
||||
self_base
|
||||
.restyle_damage
|
||||
.intersects(ServoRestyleDamage::REFLOW)
|
||||
{
|
||||
special_damage.insert(SpecialRestyleDamage::REFLOW_ENTIRE_DOCUMENT);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use app_units::{Au, MIN_AU};
|
||||
use crate::block::AbsoluteAssignBSizesTraversal;
|
||||
use crate::context::{LayoutContext, LayoutFontContext};
|
||||
use crate::display_list::items::OpaqueNode;
|
||||
|
@ -20,6 +19,7 @@ use crate::model::IntrinsicISizesContribution;
|
|||
use crate::text;
|
||||
use crate::traversal::PreorderFlowTraversal;
|
||||
use crate::ServoArc;
|
||||
use app_units::{Au, MIN_AU};
|
||||
use euclid::{Point2D, Size2D};
|
||||
use gfx::font::FontMetrics;
|
||||
use gfx_traits::print_tree::PrintTree;
|
||||
|
@ -1363,9 +1363,9 @@ impl InlineFlow {
|
|||
fragment_index: FragmentIndex,
|
||||
) -> Range<FragmentIndex> {
|
||||
let mut start_index = fragment_index;
|
||||
while start_index > FragmentIndex(0) && self.fragments.fragments
|
||||
[(start_index - FragmentIndex(1)).get() as usize]
|
||||
.is_positioned()
|
||||
while start_index > FragmentIndex(0) &&
|
||||
self.fragments.fragments[(start_index - FragmentIndex(1)).get() as usize]
|
||||
.is_positioned()
|
||||
{
|
||||
start_index = start_index - FragmentIndex(1)
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
//! Layout for elements with a CSS `display` property of `list-item`. These elements consist of a
|
||||
//! block and an extra inline fragment for the marker.
|
||||
|
||||
use app_units::Au;
|
||||
use crate::block::BlockFlow;
|
||||
use crate::context::{with_thread_local_font_context, LayoutContext};
|
||||
use crate::display_list::StackingContextCollectionState;
|
||||
|
@ -18,6 +17,7 @@ use crate::fragment::{
|
|||
};
|
||||
use crate::generated_content;
|
||||
use crate::inline::InlineFlow;
|
||||
use app_units::Au;
|
||||
use euclid::Point2D;
|
||||
use style::computed_values::list_style_type::T as ListStyleType;
|
||||
use style::computed_values::position::T as Position;
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
//! Borders, padding, and margins.
|
||||
|
||||
use app_units::Au;
|
||||
use crate::fragment::Fragment;
|
||||
use app_units::Au;
|
||||
use euclid::SideOffsets2D;
|
||||
use std::cmp::{max, min};
|
||||
use std::fmt;
|
||||
|
@ -133,8 +133,8 @@ impl MarginCollapseInfo {
|
|||
) -> (CollapsibleMargins, Au) {
|
||||
let state = match self.state {
|
||||
MarginCollapseState::AccumulatingCollapsibleTopMargin => {
|
||||
may_collapse_through =
|
||||
may_collapse_through && match fragment.style().content_block_size() {
|
||||
may_collapse_through = may_collapse_through &&
|
||||
match fragment.style().content_block_size() {
|
||||
LengthOrPercentageOrAuto::Auto => true,
|
||||
LengthOrPercentageOrAuto::Length(l) => l.px() == 0.,
|
||||
LengthOrPercentageOrAuto::Percentage(v) => {
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
//! CSS Multi-column layout http://dev.w3.org/csswg/css-multicol/
|
||||
|
||||
use app_units::Au;
|
||||
use crate::block::BlockFlow;
|
||||
use crate::context::LayoutContext;
|
||||
use crate::display_list::{DisplayListBuildState, StackingContextCollectionState};
|
||||
|
@ -12,6 +11,7 @@ use crate::floats::FloatKind;
|
|||
use crate::flow::{Flow, FlowClass, FragmentationContext, GetBaseFlow, OpaqueFlow};
|
||||
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||
use crate::ServoArc;
|
||||
use app_units::Au;
|
||||
use euclid::{Point2D, Vector2D};
|
||||
use gfx_traits::print_tree::PrintTree;
|
||||
use std::cmp::{max, min};
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
//! Utilities for querying the layout, as needed by the layout thread.
|
||||
|
||||
use app_units::Au;
|
||||
use crate::construct::ConstructionResult;
|
||||
use crate::context::LayoutContext;
|
||||
use crate::display_list::items::{DisplayList, OpaqueNode, ScrollOffsetMap};
|
||||
|
@ -15,6 +14,7 @@ use crate::inline::InlineFragmentNodeFlags;
|
|||
use crate::opaque_node::OpaqueNodeMethods;
|
||||
use crate::sequential;
|
||||
use crate::wrapper::LayoutNodeLayoutData;
|
||||
use app_units::Au;
|
||||
use euclid::{Point2D, Rect, Size2D, Vector2D};
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use msg::constellation_msg::PipelineId;
|
||||
|
@ -777,7 +777,7 @@ where
|
|||
// so this should be web-compatible.
|
||||
PropertyId::ShorthandAlias(..) | PropertyId::Shorthand(_) => return String::new(),
|
||||
PropertyId::Custom(ref name) => {
|
||||
return style.computed_value_to_string(PropertyDeclarationId::Custom(name))
|
||||
return style.computed_value_to_string(PropertyDeclarationId::Custom(name));
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -825,7 +825,7 @@ where
|
|||
// so this should be web-compatible.
|
||||
PropertyId::ShorthandAlias(..) | PropertyId::Shorthand(_) => return String::new(),
|
||||
PropertyId::Custom(ref name) => {
|
||||
return style.computed_value_to_string(PropertyDeclarationId::Custom(name))
|
||||
return style.computed_value_to_string(PropertyDeclarationId::Custom(name));
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
//! Implements sequential traversals over the DOM and flow trees.
|
||||
|
||||
use app_units::Au;
|
||||
use crate::context::LayoutContext;
|
||||
use crate::display_list::{DisplayListBuildState, StackingContextCollectionState};
|
||||
use crate::floats::SpeculatedFloatPlacement;
|
||||
|
@ -14,6 +13,7 @@ use crate::generated_content::ResolveGeneratedContent;
|
|||
use crate::incremental::RelayoutMode;
|
||||
use crate::traversal::{AssignBSizes, AssignISizes, BubbleISizes, BuildDisplayList};
|
||||
use crate::traversal::{InorderFlowTraversal, PostorderFlowTraversal, PreorderFlowTraversal};
|
||||
use app_units::Au;
|
||||
use euclid::{Point2D, Vector2D};
|
||||
use servo_config::opts;
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
|
@ -106,10 +106,11 @@ pub fn iterate_through_flow_tree_fragment_border_boxes(
|
|||
.stacking_relative_border_box(CoordinateSystem::Own);
|
||||
if let Some(matrix) = kid.as_block().fragment.transform_matrix(&relative_position) {
|
||||
let transform_matrix = matrix.transform_point2d(&LayoutPoint::zero()).unwrap();
|
||||
stacking_context_position = stacking_context_position + Vector2D::new(
|
||||
Au::from_f32_px(transform_matrix.x),
|
||||
Au::from_f32_px(transform_matrix.y),
|
||||
)
|
||||
stacking_context_position = stacking_context_position +
|
||||
Vector2D::new(
|
||||
Au::from_f32_px(transform_matrix.x),
|
||||
Au::from_f32_px(transform_matrix.y),
|
||||
)
|
||||
}
|
||||
}
|
||||
doit(kid, level + 1, iterator, &stacking_context_position);
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
//! CSS table formatting contexts.
|
||||
|
||||
use app_units::Au;
|
||||
use crate::block::{BlockFlow, CandidateBSizeIterator, ISizeAndMarginsComputer};
|
||||
use crate::block::{ISizeConstraintInput, ISizeConstraintSolution};
|
||||
use crate::context::LayoutContext;
|
||||
|
@ -24,6 +23,7 @@ use crate::table_cell::TableCellFlow;
|
|||
use crate::table_row::{self, CellIntrinsicInlineSize, CollapsedBorder, CollapsedBorderProvenance};
|
||||
use crate::table_row::{TableRowFlow, TableRowSizeData};
|
||||
use crate::table_wrapper::TableLayout;
|
||||
use app_units::Au;
|
||||
use euclid::Point2D;
|
||||
use gfx_traits::print_tree::PrintTree;
|
||||
use std::{cmp, fmt};
|
||||
|
@ -952,9 +952,8 @@ impl TableLikeFlow for BlockFlow {
|
|||
row.mut_base().restyle_damage.remove(
|
||||
ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW,
|
||||
);
|
||||
current_block_offset =
|
||||
current_block_offset +
|
||||
border_spacing_for_row(&self.fragment, row, block_direction_spacing);
|
||||
current_block_offset = current_block_offset +
|
||||
border_spacing_for_row(&self.fragment, row, block_direction_spacing);
|
||||
i += 1;
|
||||
}
|
||||
|
||||
|
@ -990,11 +989,12 @@ impl TableLikeFlow for BlockFlow {
|
|||
current_block_offset = current_block_offset + delta;
|
||||
|
||||
// Take border, padding, and spacing into account.
|
||||
let block_end_offset = self.fragment.border_padding.block_end + if has_rows {
|
||||
block_direction_spacing
|
||||
} else {
|
||||
Au(0)
|
||||
};
|
||||
let block_end_offset = self.fragment.border_padding.block_end +
|
||||
if has_rows {
|
||||
block_direction_spacing
|
||||
} else {
|
||||
Au(0)
|
||||
};
|
||||
current_block_offset = current_block_offset + block_end_offset;
|
||||
|
||||
// Now that `current_block_offset` is at the block-end of the border box, compute the
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
|
||||
//! CSS table formatting contexts.
|
||||
|
||||
use app_units::Au;
|
||||
use crate::block::BlockFlow;
|
||||
use crate::context::LayoutContext;
|
||||
use crate::display_list::{BlockFlowDisplayListBuilding, DisplayListBuildState};
|
||||
use crate::display_list::{StackingContextCollectionFlags, StackingContextCollectionState};
|
||||
use crate::flow::{Flow, FlowClass, OpaqueFlow};
|
||||
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||
use app_units::Au;
|
||||
use euclid::Point2D;
|
||||
use gfx_traits::print_tree::PrintTree;
|
||||
use std::fmt;
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
//! CSS table formatting contexts.
|
||||
|
||||
use app_units::Au;
|
||||
use crate::block::{BlockFlow, ISizeAndMarginsComputer, MarginsMayCollapseFlag};
|
||||
use crate::context::LayoutContext;
|
||||
use crate::display_list::{BlockFlowDisplayListBuilding, DisplayListBuildState};
|
||||
|
@ -15,6 +14,7 @@ use crate::layout_debug;
|
|||
use crate::model::MaybeAuto;
|
||||
use crate::table::InternalTable;
|
||||
use crate::table_row::{CollapsedBorder, CollapsedBorderProvenance};
|
||||
use app_units::Au;
|
||||
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
|
||||
use gfx_traits::print_tree::PrintTree;
|
||||
use script_layout_interface::wrapper_traits::ThreadSafeLayoutNode;
|
||||
|
@ -106,12 +106,15 @@ impl TableCellFlow {
|
|||
if kid_base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
continue;
|
||||
}
|
||||
let start = kid_base.position.start.b - kid_base
|
||||
.collapsible_margins
|
||||
.block_start_margin_for_noncollapsible_context();
|
||||
let end = kid_base.position.start.b + kid_base.position.size.block + kid_base
|
||||
.collapsible_margins
|
||||
.block_end_margin_for_noncollapsible_context();
|
||||
let start = kid_base.position.start.b -
|
||||
kid_base
|
||||
.collapsible_margins
|
||||
.block_start_margin_for_noncollapsible_context();
|
||||
let end = kid_base.position.start.b +
|
||||
kid_base.position.size.block +
|
||||
kid_base
|
||||
.collapsible_margins
|
||||
.block_end_margin_for_noncollapsible_context();
|
||||
match extents {
|
||||
Some((ref mut first_start, ref mut last_end)) => {
|
||||
if start < *first_start {
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
|
||||
//! CSS table formatting contexts.
|
||||
|
||||
use app_units::Au;
|
||||
use crate::context::LayoutContext;
|
||||
use crate::display_list::{DisplayListBuildState, StackingContextCollectionState};
|
||||
use crate::flow::{BaseFlow, Flow, FlowClass, ForceNonfloatedFlag, OpaqueFlow};
|
||||
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||
use crate::layout_debug;
|
||||
use app_units::Au;
|
||||
use euclid::Point2D;
|
||||
use std::fmt;
|
||||
use style::logical_geometry::LogicalSize;
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
//! CSS table formatting contexts.
|
||||
|
||||
use app_units::Au;
|
||||
use crate::block::{BlockFlow, ISizeAndMarginsComputer};
|
||||
use crate::context::LayoutContext;
|
||||
use crate::display_list::{BlockFlowDisplayListBuilding, DisplayListBuildState};
|
||||
|
@ -18,6 +17,7 @@ use crate::layout_debug;
|
|||
use crate::model::MaybeAuto;
|
||||
use crate::table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, VecExt};
|
||||
use crate::table_cell::{CollapsedBordersForCell, TableCellFlow};
|
||||
use app_units::Au;
|
||||
use euclid::Point2D;
|
||||
use gfx_traits::print_tree::PrintTree;
|
||||
use serde::{Serialize, Serializer};
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
//! CSS table formatting contexts.
|
||||
|
||||
use app_units::Au;
|
||||
use crate::block::{BlockFlow, ISizeAndMarginsComputer};
|
||||
use crate::context::LayoutContext;
|
||||
use crate::display_list::{BlockFlowDisplayListBuilding, DisplayListBuildState};
|
||||
|
@ -13,6 +12,7 @@ use crate::flow::{Flow, FlowClass, OpaqueFlow};
|
|||
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||
use crate::layout_debug;
|
||||
use crate::table::{ColumnIntrinsicInlineSize, InternalTable, TableLikeFlow};
|
||||
use app_units::Au;
|
||||
use euclid::Point2D;
|
||||
use gfx_traits::print_tree::PrintTree;
|
||||
use serde::{Serialize, Serializer};
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
//!
|
||||
//! Hereafter this document is referred to as INTRINSIC.
|
||||
|
||||
use app_units::Au;
|
||||
use crate::block::{
|
||||
AbsoluteNonReplaced, BlockFlow, FloatNonReplaced, ISizeAndMarginsComputer, ISizeConstraintInput,
|
||||
};
|
||||
|
@ -26,6 +25,7 @@ use crate::flow::{Flow, FlowClass, FlowFlags, ImmutableFlowUtils, OpaqueFlow};
|
|||
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||
use crate::model::MaybeAuto;
|
||||
use crate::table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize};
|
||||
use app_units::Au;
|
||||
use euclid::Point2D;
|
||||
use gfx_traits::print_tree::PrintTree;
|
||||
use std::cmp::{max, min};
|
||||
|
@ -795,18 +795,18 @@ impl ExcessInlineSizeDistributionInfo {
|
|||
if !column_intrinsic_inline_size.constrained &&
|
||||
column_intrinsic_inline_size.percentage == 0.0
|
||||
{
|
||||
column_intrinsic_inline_size.preferred.to_f32_px() / self
|
||||
.preferred_inline_size_of_nonconstrained_columns_with_no_percentage
|
||||
.to_f32_px()
|
||||
column_intrinsic_inline_size.preferred.to_f32_px() /
|
||||
self.preferred_inline_size_of_nonconstrained_columns_with_no_percentage
|
||||
.to_f32_px()
|
||||
} else {
|
||||
0.0
|
||||
}
|
||||
} else if self.count_of_nonconstrained_columns_with_no_percentage > 0 {
|
||||
1.0 / (self.count_of_nonconstrained_columns_with_no_percentage as CSSFloat)
|
||||
} else if self.preferred_inline_size_of_constrained_columns_with_no_percentage > Au(0) {
|
||||
column_intrinsic_inline_size.preferred.to_f32_px() / self
|
||||
.preferred_inline_size_of_constrained_columns_with_no_percentage
|
||||
.to_f32_px()
|
||||
column_intrinsic_inline_size.preferred.to_f32_px() /
|
||||
self.preferred_inline_size_of_constrained_columns_with_no_percentage
|
||||
.to_f32_px()
|
||||
} else if self.total_percentage > 0.0 {
|
||||
column_intrinsic_inline_size.percentage / self.total_percentage
|
||||
} else {
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
|
||||
//! Text layout.
|
||||
|
||||
use app_units::Au;
|
||||
use crate::context::LayoutFontContext;
|
||||
use crate::fragment::{Fragment, ScannedTextFlags};
|
||||
use crate::fragment::{ScannedTextFragmentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo};
|
||||
use crate::inline::{InlineFragmentNodeFlags, InlineFragments};
|
||||
use crate::linked_list::split_off_head;
|
||||
use app_units::Au;
|
||||
use gfx::font::{FontMetrics, FontRef, RunMetrics, ShapingFlags, ShapingOptions};
|
||||
use gfx::text::glyph::ByteIndex;
|
||||
use gfx::text::text_run::TextRun;
|
||||
|
@ -112,11 +112,11 @@ impl TextRunScanner {
|
|||
// Create a clump.
|
||||
split_first_fragment_at_newline_if_necessary(&mut fragments);
|
||||
self.clump.append(&mut split_off_head(&mut fragments));
|
||||
while !fragments.is_empty() && self
|
||||
.clump
|
||||
.back()
|
||||
.unwrap()
|
||||
.can_merge_with_fragment(fragments.front().unwrap())
|
||||
while !fragments.is_empty() &&
|
||||
self.clump
|
||||
.back()
|
||||
.unwrap()
|
||||
.can_merge_with_fragment(fragments.front().unwrap())
|
||||
{
|
||||
split_first_fragment_at_newline_if_necessary(&mut fragments);
|
||||
self.clump.append(&mut split_off_head(&mut fragments));
|
||||
|
|
|
@ -201,9 +201,10 @@ where
|
|||
|
||||
// Always reconstruct if incremental layout is turned off.
|
||||
let nonincremental_layout = opts::get().nonincremental_layout;
|
||||
if nonincremental_layout || tnode.restyle_damage() != RestyleDamage::empty() || node
|
||||
.as_element()
|
||||
.map_or(false, |el| el.has_dirty_descendants())
|
||||
if nonincremental_layout ||
|
||||
tnode.restyle_damage() != RestyleDamage::empty() ||
|
||||
node.as_element()
|
||||
.map_or(false, |el| el.has_dirty_descendants())
|
||||
{
|
||||
let mut flow_constructor = FlowConstructor::new(context);
|
||||
if nonincremental_layout || !flow_constructor.repair_if_possible(&tnode) {
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
|
||||
#![allow(unsafe_code)]
|
||||
|
||||
use atomic_refcell::{AtomicRef, AtomicRefMut};
|
||||
use crate::data::{LayoutData, LayoutDataFlags, StyleAndLayoutData};
|
||||
use atomic_refcell::{AtomicRef, AtomicRefMut};
|
||||
use script_layout_interface::wrapper_traits::GetLayoutData;
|
||||
use script_layout_interface::wrapper_traits::{ThreadSafeLayoutElement, ThreadSafeLayoutNode};
|
||||
use style::dom::{NodeInfo, TNode};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue