mirror of
https://github.com/servo/servo.git
synced 2025-08-14 09:55:35 +01:00
parent
b4e30da3db
commit
4e8d2b0e38
3 changed files with 21 additions and 20 deletions
|
@ -34,20 +34,20 @@ pub struct ListItemFlow {
|
|||
pub block_flow: BlockFlow,
|
||||
/// The marker, if outside. (Markers that are inside are instead just fragments on the interior
|
||||
/// `InlineFlow`.)
|
||||
pub marker: Option<Fragment>,
|
||||
pub marker_fragments: Vec<Fragment>,
|
||||
}
|
||||
|
||||
impl ListItemFlow {
|
||||
pub fn from_fragments_and_flotation(main_fragment: Fragment,
|
||||
marker_fragment: Option<Fragment>,
|
||||
marker_fragments: Vec<Fragment>,
|
||||
flotation: Option<FloatKind>)
|
||||
-> ListItemFlow {
|
||||
let mut this = ListItemFlow {
|
||||
block_flow: BlockFlow::from_fragment(main_fragment, flotation),
|
||||
marker: marker_fragment,
|
||||
marker_fragments: marker_fragments,
|
||||
};
|
||||
|
||||
if let Some(ref marker) = this.marker {
|
||||
if let Some(ref marker) = this.marker_fragments.first() {
|
||||
match marker.style().get_list().list_style_type {
|
||||
list_style_type::T::disc |
|
||||
list_style_type::T::none |
|
||||
|
@ -84,7 +84,9 @@ impl Flow for ListItemFlow {
|
|||
fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) {
|
||||
self.block_flow.assign_inline_sizes(layout_context);
|
||||
|
||||
if let Some(ref mut marker) = self.marker {
|
||||
let mut marker_inline_start = self.block_flow.fragment.border_box.start.i;
|
||||
|
||||
for marker in self.marker_fragments.iter_mut().rev() {
|
||||
let containing_block_inline_size = self.block_flow.base.block_container_inline_size;
|
||||
marker.assign_replaced_inline_size_if_necessary(containing_block_inline_size);
|
||||
|
||||
|
@ -94,15 +96,15 @@ impl Flow for ListItemFlow {
|
|||
|
||||
marker.border_box.size.inline =
|
||||
intrinsic_inline_sizes.content_intrinsic_sizes.preferred_inline_size;
|
||||
marker.border_box.start.i = self.block_flow.fragment.border_box.start.i -
|
||||
marker.border_box.size.inline;
|
||||
marker_inline_start = marker_inline_start - marker.border_box.size.inline;
|
||||
marker.border_box.start.i = marker_inline_start;
|
||||
}
|
||||
}
|
||||
|
||||
fn assign_block_size<'a>(&mut self, layout_context: &'a LayoutContext<'a>) {
|
||||
self.block_flow.assign_block_size(layout_context);
|
||||
|
||||
if let Some(ref mut marker) = self.marker {
|
||||
for marker in &mut self.marker_fragments {
|
||||
let containing_block_block_size =
|
||||
self.block_flow.base.block_container_explicit_block_size;
|
||||
marker.assign_replaced_block_size_if_necessary(containing_block_block_size);
|
||||
|
@ -161,7 +163,7 @@ impl Flow for ListItemFlow {
|
|||
stacking_context_position: &Point2D<Au>) {
|
||||
self.block_flow.iterate_through_fragment_border_boxes(iterator, level, stacking_context_position);
|
||||
|
||||
if let Some(ref marker) = self.marker {
|
||||
for marker in &self.marker_fragments {
|
||||
if iterator.should_process(marker) {
|
||||
iterator.process(
|
||||
marker,
|
||||
|
@ -186,7 +188,7 @@ impl Flow for ListItemFlow {
|
|||
fn mutate_fragments(&mut self, mutator: &mut FnMut(&mut Fragment)) {
|
||||
self.block_flow.mutate_fragments(mutator);
|
||||
|
||||
if let Some(ref mut marker) = self.marker {
|
||||
for marker in &mut self.marker_fragments {
|
||||
(*mutator)(marker)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue