mirror of
https://github.com/servo/servo.git
synced 2025-10-05 02:59:19 +01:00
Revert "layout: Implement ordered lists, CSS counters, and quotes
per CSS 2.1"
This reverts commit 30fd28d107
.
This commit is contained in:
parent
7a218b3f08
commit
4c1d778ced
36 changed files with 496 additions and 1735 deletions
|
@ -13,27 +13,33 @@
|
|||
|
||||
#![deny(unsafe_blocks)]
|
||||
|
||||
use css::node_style::StyledNode;
|
||||
use block::BlockFlow;
|
||||
use context::LayoutContext;
|
||||
use css::node_style::StyledNode;
|
||||
use floats::FloatKind;
|
||||
use flow::{self, AbsDescendants, Descendants, Flow, IS_ABSOLUTELY_POSITIONED, ImmutableFlowUtils};
|
||||
use flow::{MutableOwnedFlowUtils};
|
||||
use flow::{Flow, ImmutableFlowUtils, MutableOwnedFlowUtils};
|
||||
use flow::{Descendants, AbsDescendants};
|
||||
use flow::{IS_ABSOLUTELY_POSITIONED};
|
||||
use flow;
|
||||
use flow_ref::FlowRef;
|
||||
use fragment::{CanvasFragmentInfo, Fragment, GeneratedContentInfo, IframeFragmentInfo};
|
||||
use fragment::{ImageFragmentInfo, InlineAbsoluteHypotheticalFragmentInfo, InlineBlockFragmentInfo};
|
||||
use fragment::{SpecificFragmentInfo, TableColumnFragmentInfo, UnscannedTextFragmentInfo};
|
||||
use fragment::{Fragment, IframeFragmentInfo};
|
||||
use fragment::ImageFragmentInfo;
|
||||
use fragment::CanvasFragmentInfo;
|
||||
use fragment::InlineAbsoluteHypotheticalFragmentInfo;
|
||||
use fragment::{InlineBlockFragmentInfo, SpecificFragmentInfo};
|
||||
use fragment::TableColumnFragmentInfo;
|
||||
use fragment::UnscannedTextFragmentInfo;
|
||||
use incremental::{RECONSTRUCT_FLOW, RestyleDamage};
|
||||
use inline::InlineFlow;
|
||||
use list_item::{ListItemFlow, ListStyleTypeContent};
|
||||
use list_item::{self, ListItemFlow};
|
||||
use parallel;
|
||||
use table_wrapper::TableWrapperFlow;
|
||||
use table::TableFlow;
|
||||
use table_caption::TableCaptionFlow;
|
||||
use table_cell::TableCellFlow;
|
||||
use table_colgroup::TableColGroupFlow;
|
||||
use table_row::TableRowFlow;
|
||||
use table_rowgroup::TableRowGroupFlow;
|
||||
use table_wrapper::TableWrapperFlow;
|
||||
use table_row::TableRowFlow;
|
||||
use table_cell::TableCellFlow;
|
||||
use text::TextRunScanner;
|
||||
use util::{HAS_NEWLY_CONSTRUCTED_FLOW, LayoutDataAccess, OpaqueNodeMethods, LayoutDataWrapper};
|
||||
use wrapper::{PostorderNodeMutTraversal, PseudoElementType, TLayoutNode, ThreadSafeLayoutNode};
|
||||
|
@ -48,10 +54,9 @@ use std::borrow::ToOwned;
|
|||
use std::collections::DList;
|
||||
use std::mem;
|
||||
use std::sync::atomic::Ordering;
|
||||
use style::computed_values::content::ContentItem;
|
||||
use style::computed_values::{caption_side, display, empty_cells, float, list_style_position};
|
||||
use style::computed_values::{position};
|
||||
use style::properties::{self, ComputedValues};
|
||||
use style::properties::{ComputedValues, make_inline};
|
||||
use std::sync::Arc;
|
||||
use url::Url;
|
||||
|
||||
|
@ -245,51 +250,41 @@ impl<'a> FlowConstructor<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Builds the fragment for the given block or subclass thereof.
|
||||
fn build_fragment_for_block(&mut self, node: &ThreadSafeLayoutNode) -> Fragment {
|
||||
let specific_fragment_info = match node.type_id() {
|
||||
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||
HTMLElementTypeId::HTMLIFrameElement))) => {
|
||||
/// Builds specific `Fragment` info for the given node.
|
||||
///
|
||||
/// This does *not* construct the text for generated content (but, for generated content with
|
||||
/// `display: block`, it does construct the generic fragment corresponding to the block).
|
||||
/// Construction of the text fragment is done specially by `build_flow_using_children()` and
|
||||
/// `build_fragments_for_replaced_inline_content()`.
|
||||
pub fn build_specific_fragment_info_for_node(&mut self, node: &ThreadSafeLayoutNode)
|
||||
-> SpecificFragmentInfo {
|
||||
match node.type_id() {
|
||||
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLIFrameElement))) => {
|
||||
SpecificFragmentInfo::Iframe(box IframeFragmentInfo::new(node))
|
||||
}
|
||||
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||
HTMLElementTypeId::HTMLImageElement))) => {
|
||||
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLImageElement))) => {
|
||||
self.build_fragment_info_for_image(node, node.image_url())
|
||||
}
|
||||
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||
HTMLElementTypeId::HTMLObjectElement))) => {
|
||||
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLObjectElement))) => {
|
||||
let data = node.get_object_data();
|
||||
self.build_fragment_info_for_image(node, data)
|
||||
}
|
||||
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||
HTMLElementTypeId::HTMLTableElement))) => {
|
||||
SpecificFragmentInfo::TableWrapper
|
||||
}
|
||||
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||
HTMLElementTypeId::HTMLTableColElement))) => {
|
||||
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableElement))) => SpecificFragmentInfo::TableWrapper,
|
||||
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableColElement))) => {
|
||||
SpecificFragmentInfo::TableColumn(TableColumnFragmentInfo::new(node))
|
||||
}
|
||||
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||
HTMLElementTypeId::HTMLTableCellElement(_)))) => {
|
||||
SpecificFragmentInfo::TableCell
|
||||
}
|
||||
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||
HTMLElementTypeId::HTMLTableRowElement))) |
|
||||
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||
HTMLElementTypeId::HTMLTableSectionElement))) => {
|
||||
SpecificFragmentInfo::TableRow
|
||||
}
|
||||
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||
HTMLElementTypeId::HTMLCanvasElement))) => {
|
||||
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableCellElement(_)))) => SpecificFragmentInfo::TableCell,
|
||||
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableRowElement))) |
|
||||
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableSectionElement))) => SpecificFragmentInfo::TableRow,
|
||||
Some(NodeTypeId::Text) => SpecificFragmentInfo::UnscannedText(UnscannedTextFragmentInfo::new(node)),
|
||||
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLCanvasElement))) => {
|
||||
SpecificFragmentInfo::Canvas(box CanvasFragmentInfo::new(node))
|
||||
}
|
||||
_ => {
|
||||
// This includes pseudo-elements.
|
||||
SpecificFragmentInfo::Generic
|
||||
}
|
||||
};
|
||||
|
||||
Fragment::new(node, specific_fragment_info)
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates an inline flow from a set of inline fragments, then adds it as a child of the given
|
||||
|
@ -329,9 +324,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
let mut inline_block_flows = vec!();
|
||||
for f in fragments.iter() {
|
||||
match f.specific {
|
||||
SpecificFragmentInfo::InlineBlock(ref info) => {
|
||||
inline_block_flows.push(info.flow_ref.clone())
|
||||
}
|
||||
SpecificFragmentInfo::InlineBlock(ref info) => inline_block_flows.push(info.flow_ref.clone()),
|
||||
SpecificFragmentInfo::InlineAbsoluteHypothetical(ref info) => {
|
||||
inline_block_flows.push(info.flow_ref.clone())
|
||||
}
|
||||
|
@ -465,8 +458,8 @@ impl<'a> FlowConstructor<'a> {
|
|||
whitespace_damage)) => {
|
||||
// Add whitespace results. They will be stripped out later on when
|
||||
// between block elements, and retained when between inline elements.
|
||||
let fragment_info = SpecificFragmentInfo::UnscannedText(
|
||||
UnscannedTextFragmentInfo::from_text(" ".to_owned()));
|
||||
let fragment_info =
|
||||
SpecificFragmentInfo::UnscannedText(UnscannedTextFragmentInfo::from_text(" ".to_owned()));
|
||||
let fragment = Fragment::from_opaque_node_and_style(whitespace_node,
|
||||
whitespace_style,
|
||||
whitespace_damage,
|
||||
|
@ -562,22 +555,18 @@ impl<'a> FlowConstructor<'a> {
|
|||
fn build_flow_for_block(&mut self, flow: FlowRef, node: &ThreadSafeLayoutNode)
|
||||
-> ConstructionResult {
|
||||
let initial_fragment = if node.get_pseudo_element_type() != PseudoElementType::Normal ||
|
||||
node.type_id() == Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||
HTMLElementTypeId::HTMLInputElement))) ||
|
||||
node.type_id() == Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||
HTMLElementTypeId::HTMLTextAreaElement))) {
|
||||
node.type_id() == Some(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement))) ||
|
||||
node.type_id() == Some(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement))) {
|
||||
// A TextArea's text contents are displayed through the input text
|
||||
// box, so don't construct them.
|
||||
if node.type_id() == Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||
HTMLElementTypeId::HTMLTextAreaElement))) {
|
||||
if node.type_id() == Some(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement))) {
|
||||
for kid in node.children() {
|
||||
kid.set_flow_construction_result(ConstructionResult::None)
|
||||
}
|
||||
}
|
||||
|
||||
let mut fragments = DList::new();
|
||||
self.create_fragments_for_node_text_content(&mut fragments, node, node.style());
|
||||
fragments.into_iter().next()
|
||||
Some(Fragment::new_from_specific_info(
|
||||
node,
|
||||
SpecificFragmentInfo::UnscannedText(UnscannedTextFragmentInfo::new(node))))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
@ -585,39 +574,12 @@ impl<'a> FlowConstructor<'a> {
|
|||
self.build_flow_for_block_starting_with_fragment(flow, node, initial_fragment)
|
||||
}
|
||||
|
||||
/// Pushes fragments appropriate for the content of the given node onto the given list.
|
||||
fn create_fragments_for_node_text_content(&self,
|
||||
fragments: &mut DList<Fragment>,
|
||||
node: &ThreadSafeLayoutNode,
|
||||
style: &Arc<ComputedValues>) {
|
||||
for content_item in node.text_content().into_iter() {
|
||||
let specific = match content_item {
|
||||
ContentItem::String(string) => {
|
||||
let info = UnscannedTextFragmentInfo::from_text(string);
|
||||
SpecificFragmentInfo::UnscannedText(info)
|
||||
}
|
||||
content_item => {
|
||||
let content_item = box GeneratedContentInfo::ContentItem(content_item);
|
||||
SpecificFragmentInfo::GeneratedContent(content_item)
|
||||
}
|
||||
};
|
||||
|
||||
let opaque_node = OpaqueNodeMethods::from_thread_safe_layout_node(node);
|
||||
fragments.push_back(Fragment::from_opaque_node_and_style(opaque_node,
|
||||
style.clone(),
|
||||
node.restyle_damage(),
|
||||
specific))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Builds a flow for a node with `display: block`. This yields a `BlockFlow` with possibly
|
||||
/// other `BlockFlow`s or `InlineFlow`s underneath it, depending on whether {ib} splits needed
|
||||
/// to happen.
|
||||
fn build_flow_for_nonfloated_block(&mut self, node: &ThreadSafeLayoutNode)
|
||||
-> ConstructionResult {
|
||||
let flow = box BlockFlow::from_node_and_fragment(node, self.build_fragment_for_block(node))
|
||||
as Box<Flow>;
|
||||
let flow = box BlockFlow::from_node(self, node) as Box<Flow>;
|
||||
self.build_flow_for_block(FlowRef::new(flow), node)
|
||||
}
|
||||
|
||||
|
@ -625,9 +587,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
/// a `BlockFlow` underneath it.
|
||||
fn build_flow_for_floated_block(&mut self, node: &ThreadSafeLayoutNode, float_kind: FloatKind)
|
||||
-> ConstructionResult {
|
||||
let fragment = self.build_fragment_for_block(node);
|
||||
let flow = box BlockFlow::float_from_node_and_fragment(node, fragment, float_kind) as
|
||||
Box<Flow>;
|
||||
let flow = box BlockFlow::float_from_node(self, node, float_kind) as Box<Flow>;
|
||||
self.build_flow_for_block(FlowRef::new(flow), node)
|
||||
}
|
||||
|
||||
|
@ -695,8 +655,8 @@ impl<'a> FlowConstructor<'a> {
|
|||
whitespace_style,
|
||||
whitespace_damage)) => {
|
||||
// Instantiate the whitespace fragment.
|
||||
let fragment_info = SpecificFragmentInfo::UnscannedText(
|
||||
UnscannedTextFragmentInfo::from_text(" ".to_owned()));
|
||||
let fragment_info = SpecificFragmentInfo::UnscannedText(UnscannedTextFragmentInfo::from_text(
|
||||
" ".to_owned()));
|
||||
let fragment = Fragment::from_opaque_node_and_style(whitespace_node,
|
||||
whitespace_style,
|
||||
whitespace_damage,
|
||||
|
@ -750,22 +710,30 @@ impl<'a> FlowConstructor<'a> {
|
|||
// `baz` had better not be absolutely positioned!
|
||||
let mut style = (*node.style()).clone();
|
||||
if style.get_box().display != display::T::inline {
|
||||
style = Arc::new(properties::make_inline(&*style))
|
||||
style = Arc::new(make_inline(&*style))
|
||||
}
|
||||
|
||||
// If this is generated content, then we need to initialize the accumulator with the
|
||||
// fragment corresponding to that content. Otherwise, just initialize with the ordinary
|
||||
// fragment that needs to be generated for this inline node.
|
||||
let fragment = if node.get_pseudo_element_type() != PseudoElementType::Normal {
|
||||
let fragment_info =
|
||||
SpecificFragmentInfo::UnscannedText(UnscannedTextFragmentInfo::new(node));
|
||||
Fragment::from_opaque_node_and_style(
|
||||
OpaqueNodeMethods::from_thread_safe_layout_node(node),
|
||||
style,
|
||||
node.restyle_damage(),
|
||||
fragment_info)
|
||||
} else {
|
||||
Fragment::from_opaque_node_and_style(
|
||||
OpaqueNodeMethods::from_thread_safe_layout_node(node),
|
||||
style,
|
||||
node.restyle_damage(),
|
||||
self.build_specific_fragment_info_for_node(node))
|
||||
};
|
||||
|
||||
let mut fragments = DList::new();
|
||||
match (node.get_pseudo_element_type(), node.type_id()) {
|
||||
(_, Some(NodeTypeId::Text)) => {
|
||||
self.create_fragments_for_node_text_content(&mut fragments, node, &style)
|
||||
}
|
||||
(PseudoElementType::Normal, _) => {
|
||||
fragments.push_back(self.build_fragment_for_block(node));
|
||||
}
|
||||
(_, _) => self.create_fragments_for_node_text_content(&mut fragments, node, &style),
|
||||
}
|
||||
fragments.push_back(fragment);
|
||||
|
||||
let construction_item =
|
||||
ConstructionItem::InlineFragments(InlineFragmentsConstructionResult {
|
||||
|
@ -786,7 +754,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
|
||||
let fragment_info = SpecificFragmentInfo::InlineBlock(InlineBlockFragmentInfo::new(
|
||||
block_flow));
|
||||
let fragment = Fragment::new(node, fragment_info);
|
||||
let fragment = Fragment::new_from_specific_info(node, fragment_info);
|
||||
|
||||
let mut fragment_accumulator = InlineFragmentsAccumulator::from_inline_node(node);
|
||||
fragment_accumulator.fragments.push_back(fragment);
|
||||
|
@ -812,7 +780,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
|
||||
let fragment_info = SpecificFragmentInfo::InlineAbsoluteHypothetical(
|
||||
InlineAbsoluteHypotheticalFragmentInfo::new(block_flow));
|
||||
let fragment = Fragment::new(node, fragment_info);
|
||||
let fragment = Fragment::new_from_specific_info(node, fragment_info);
|
||||
|
||||
let mut fragment_accumulator = InlineFragmentsAccumulator::from_inline_node(node);
|
||||
fragment_accumulator.fragments.push_back(fragment);
|
||||
|
@ -897,7 +865,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
/// possibly other `TableCaptionFlow`s or `TableFlow`s underneath it.
|
||||
fn build_flow_for_table_wrapper(&mut self, node: &ThreadSafeLayoutNode, float_value: float::T)
|
||||
-> ConstructionResult {
|
||||
let fragment = Fragment::new(node, SpecificFragmentInfo::TableWrapper);
|
||||
let fragment = Fragment::new_from_specific_info(node, SpecificFragmentInfo::TableWrapper);
|
||||
let wrapper_flow = match float_value {
|
||||
float::T::none => box TableWrapperFlow::from_node_and_fragment(node, fragment),
|
||||
_ => {
|
||||
|
@ -907,7 +875,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
};
|
||||
let mut wrapper_flow = FlowRef::new(wrapper_flow as Box<Flow>);
|
||||
|
||||
let table_fragment = Fragment::new(node, SpecificFragmentInfo::Table);
|
||||
let table_fragment = Fragment::new_from_specific_info(node, SpecificFragmentInfo::Table);
|
||||
let table_flow = box TableFlow::from_node_and_fragment(node, table_fragment);
|
||||
let table_flow = FlowRef::new(table_flow as Box<Flow>);
|
||||
|
||||
|
@ -941,8 +909,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
wrapper_flow.finish();
|
||||
let is_positioned = wrapper_flow.as_block().is_positioned();
|
||||
let is_fixed_positioned = wrapper_flow.as_block().is_fixed();
|
||||
let is_absolutely_positioned =
|
||||
flow::base(&*wrapper_flow).flags.contains(IS_ABSOLUTELY_POSITIONED);
|
||||
let is_absolutely_positioned = flow::base(&*wrapper_flow).flags.contains(IS_ABSOLUTELY_POSITIONED);
|
||||
if is_positioned {
|
||||
// This is the containing block for all the absolute descendants.
|
||||
wrapper_flow.set_absolute_descendants(abs_descendants);
|
||||
|
@ -965,8 +932,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
/// Builds a flow for a node with `display: table-caption`. This yields a `TableCaptionFlow`
|
||||
/// with possibly other `BlockFlow`s or `InlineFlow`s underneath it.
|
||||
fn build_flow_for_table_caption(&mut self, node: &ThreadSafeLayoutNode) -> ConstructionResult {
|
||||
let fragment = self.build_fragment_for_block(node);
|
||||
let flow = box TableCaptionFlow::from_node_and_fragment(node, fragment) as Box<Flow>;
|
||||
let flow = box TableCaptionFlow::from_node(self, node) as Box<Flow>;
|
||||
self.build_flow_for_block(FlowRef::new(flow), node)
|
||||
}
|
||||
|
||||
|
@ -974,7 +940,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
/// with possibly other `TableRowFlow`s underneath it.
|
||||
fn build_flow_for_table_rowgroup(&mut self, node: &ThreadSafeLayoutNode)
|
||||
-> ConstructionResult {
|
||||
let fragment = Fragment::new(node, SpecificFragmentInfo::TableRow);
|
||||
let fragment = Fragment::new_from_specific_info(node, SpecificFragmentInfo::TableRow);
|
||||
let flow = box TableRowGroupFlow::from_node_and_fragment(node, fragment);
|
||||
let flow = flow as Box<Flow>;
|
||||
self.build_flow_for_block(FlowRef::new(flow), node)
|
||||
|
@ -983,7 +949,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
/// Builds a flow for a node with `display: table-row`. This yields a `TableRowFlow` with
|
||||
/// possibly other `TableCellFlow`s underneath it.
|
||||
fn build_flow_for_table_row(&mut self, node: &ThreadSafeLayoutNode) -> ConstructionResult {
|
||||
let fragment = Fragment::new(node, SpecificFragmentInfo::TableRow);
|
||||
let fragment = Fragment::new_from_specific_info(node, SpecificFragmentInfo::TableRow);
|
||||
let flow = box TableRowFlow::from_node_and_fragment(node, fragment) as Box<Flow>;
|
||||
self.build_flow_for_block(FlowRef::new(flow), node)
|
||||
}
|
||||
|
@ -991,7 +957,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
/// Builds a flow for a node with `display: table-cell`. This yields a `TableCellFlow` with
|
||||
/// possibly other `BlockFlow`s or `InlineFlow`s underneath it.
|
||||
fn build_flow_for_table_cell(&mut self, node: &ThreadSafeLayoutNode) -> ConstructionResult {
|
||||
let fragment = Fragment::new(node, SpecificFragmentInfo::TableCell);
|
||||
let fragment = Fragment::new_from_specific_info(node, SpecificFragmentInfo::TableCell);
|
||||
|
||||
// Determine if the table cell should be hidden. Per CSS 2.1 § 17.6.1.1, this will be true
|
||||
// if the cell has any in-flow elements (even empty ones!) and has `empty-cells` set to
|
||||
|
@ -1019,18 +985,19 @@ impl<'a> FlowConstructor<'a> {
|
|||
};
|
||||
let marker_fragment = match node.style().get_list().list_style_image {
|
||||
Some(ref url) => {
|
||||
Some(Fragment::new(node,
|
||||
self.build_fragment_info_for_image(node, Some((*url).clone()))))
|
||||
Some(Fragment::new_from_specific_info(
|
||||
node,
|
||||
self.build_fragment_info_for_image(node, Some((*url).clone()))))
|
||||
}
|
||||
None => {
|
||||
match ListStyleTypeContent::from_list_style_type(node.style()
|
||||
match list_item::static_text_for_list_style_type(node.style()
|
||||
.get_list()
|
||||
.list_style_type) {
|
||||
ListStyleTypeContent::None => None,
|
||||
ListStyleTypeContent::StaticText(text) => {
|
||||
None => None,
|
||||
Some(text) => {
|
||||
let text = text.to_owned();
|
||||
let mut unscanned_marker_fragments = DList::new();
|
||||
unscanned_marker_fragments.push_back(Fragment::new(
|
||||
unscanned_marker_fragments.push_back(Fragment::new_from_specific_info(
|
||||
node,
|
||||
SpecificFragmentInfo::UnscannedText(
|
||||
UnscannedTextFragmentInfo::from_text(text))));
|
||||
|
@ -1040,9 +1007,6 @@ impl<'a> FlowConstructor<'a> {
|
|||
debug_assert!(marker_fragments.len() == 1);
|
||||
marker_fragments.fragments.into_iter().next()
|
||||
}
|
||||
ListStyleTypeContent::GeneratedContent(info) => {
|
||||
Some(Fragment::new(node, SpecificFragmentInfo::GeneratedContent(info)))
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1054,20 +1018,19 @@ impl<'a> FlowConstructor<'a> {
|
|||
// there.
|
||||
let flow;
|
||||
let initial_fragment;
|
||||
let main_fragment = self.build_fragment_for_block(node);
|
||||
match node.style().get_list().list_style_position {
|
||||
list_style_position::T::outside => {
|
||||
flow = box ListItemFlow::from_node_fragments_and_flotation(node,
|
||||
main_fragment,
|
||||
marker_fragment,
|
||||
flotation);
|
||||
flow = box ListItemFlow::from_node_marker_and_flotation(self,
|
||||
node,
|
||||
marker_fragment,
|
||||
flotation);
|
||||
initial_fragment = None;
|
||||
}
|
||||
list_style_position::T::inside => {
|
||||
flow = box ListItemFlow::from_node_fragments_and_flotation(node,
|
||||
main_fragment,
|
||||
None,
|
||||
flotation);
|
||||
flow = box ListItemFlow::from_node_marker_and_flotation(self,
|
||||
node,
|
||||
None,
|
||||
flotation);
|
||||
initial_fragment = marker_fragment;
|
||||
}
|
||||
}
|
||||
|
@ -1086,8 +1049,9 @@ impl<'a> FlowConstructor<'a> {
|
|||
}
|
||||
|
||||
let specific = SpecificFragmentInfo::TableColumn(TableColumnFragmentInfo::new(node));
|
||||
let construction_item = ConstructionItem::TableColumnFragment(Fragment::new(node,
|
||||
specific));
|
||||
let construction_item = ConstructionItem::TableColumnFragment(
|
||||
Fragment::new_from_specific_info(node, specific)
|
||||
);
|
||||
ConstructionResult::ConstructionItem(construction_item)
|
||||
}
|
||||
|
||||
|
@ -1095,9 +1059,9 @@ impl<'a> FlowConstructor<'a> {
|
|||
/// This yields a `TableColGroupFlow`.
|
||||
fn build_flow_for_table_colgroup(&mut self, node: &ThreadSafeLayoutNode)
|
||||
-> ConstructionResult {
|
||||
let fragment =
|
||||
Fragment::new(node,
|
||||
SpecificFragmentInfo::TableColumn(TableColumnFragmentInfo::new(node)));
|
||||
let fragment = Fragment::new_from_specific_info(
|
||||
node,
|
||||
SpecificFragmentInfo::TableColumn(TableColumnFragmentInfo::new(node)));
|
||||
let mut col_fragments = vec!();
|
||||
for kid in node.children() {
|
||||
// CSS 2.1 § 17.2.1. Treat all non-column child fragments of `table-column-group`
|
||||
|
@ -1113,7 +1077,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
if col_fragments.is_empty() {
|
||||
debug!("add SpecificFragmentInfo::TableColumn for empty colgroup");
|
||||
let specific = SpecificFragmentInfo::TableColumn(TableColumnFragmentInfo::new(node));
|
||||
col_fragments.push(Fragment::new(node, specific));
|
||||
col_fragments.push(Fragment::new_from_specific_info(node, specific));
|
||||
}
|
||||
let flow = box TableColGroupFlow::from_node_and_fragments(node, fragment, col_fragments);
|
||||
let mut flow = FlowRef::new(flow as Box<Flow>);
|
||||
|
@ -1329,29 +1293,25 @@ trait NodeUtils {
|
|||
/// Sets the construction result of a flow.
|
||||
fn set_flow_construction_result(self, result: ConstructionResult);
|
||||
|
||||
/// Replaces the flow construction result in a node with `ConstructionResult::None` and returns
|
||||
/// the old value.
|
||||
/// Replaces the flow construction result in a node with `ConstructionResult::None` and returns the
|
||||
/// old value.
|
||||
fn swap_out_construction_result(self) -> ConstructionResult;
|
||||
}
|
||||
|
||||
impl<'ln> NodeUtils for ThreadSafeLayoutNode<'ln> {
|
||||
fn is_replaced_content(&self) -> bool {
|
||||
match self.type_id() {
|
||||
None |
|
||||
Some(NodeTypeId::Text) |
|
||||
Some(NodeTypeId::ProcessingInstruction) |
|
||||
Some(NodeTypeId::Comment) |
|
||||
Some(NodeTypeId::DocumentType) |
|
||||
Some(NodeTypeId::DocumentFragment) |
|
||||
Some(NodeTypeId::Document) |
|
||||
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||
HTMLElementTypeId::HTMLImageElement))) |
|
||||
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||
HTMLElementTypeId::HTMLIFrameElement))) |
|
||||
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||
HTMLElementTypeId::HTMLCanvasElement))) => true,
|
||||
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||
HTMLElementTypeId::HTMLObjectElement))) => self.has_object_data(),
|
||||
None |
|
||||
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLImageElement))) => true,
|
||||
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLObjectElement))) => self.has_object_data(),
|
||||
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLIFrameElement))) => true,
|
||||
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLCanvasElement))) => true,
|
||||
Some(NodeTypeId::Element(_)) => false,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue