mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
layout: Make sure anonymous table flows are statically positioned.
The failing `float-applies-to-*` CSS 2.1 tests never really should have been passing in the first place; they depend on floats inside fixed-layout tables working properly, which they don't. Closes #6078. Closes #6709. Closes #6858.
This commit is contained in:
parent
da06c2dda0
commit
ed4172b2c6
21 changed files with 142 additions and 114 deletions
|
@ -45,7 +45,6 @@ use layout_debug;
|
||||||
use layout_task::DISPLAY_PORT_SIZE_FACTOR;
|
use layout_task::DISPLAY_PORT_SIZE_FACTOR;
|
||||||
use model::{IntrinsicISizes, MarginCollapseInfo};
|
use model::{IntrinsicISizes, MarginCollapseInfo};
|
||||||
use model::{MaybeAuto, CollapsibleMargins, specified, specified_or_none};
|
use model::{MaybeAuto, CollapsibleMargins, specified, specified_or_none};
|
||||||
use wrapper::ThreadSafeLayoutNode;
|
|
||||||
|
|
||||||
use euclid::{Point2D, Rect, Size2D};
|
use euclid::{Point2D, Rect, Size2D};
|
||||||
use gfx::display_list::{ClippingRegion, DisplayList};
|
use gfx::display_list::{ClippingRegion, DisplayList};
|
||||||
|
@ -572,13 +571,10 @@ impl Encodable for BlockFlowFlags {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BlockFlow {
|
impl BlockFlow {
|
||||||
pub fn from_node_and_fragment(node: &ThreadSafeLayoutNode,
|
pub fn from_fragment(fragment: Fragment, float_kind: Option<FloatKind>) -> BlockFlow {
|
||||||
fragment: Fragment,
|
let writing_mode = fragment.style().writing_mode;
|
||||||
float_kind: Option<FloatKind>)
|
|
||||||
-> BlockFlow {
|
|
||||||
let writing_mode = node.style().writing_mode;
|
|
||||||
BlockFlow {
|
BlockFlow {
|
||||||
base: BaseFlow::new(Some((*node).clone()), writing_mode, match float_kind {
|
base: BaseFlow::new(Some(fragment.style()), writing_mode, match float_kind {
|
||||||
Some(_) => ForceNonfloatedFlag::FloatIfNecessary,
|
Some(_) => ForceNonfloatedFlag::FloatIfNecessary,
|
||||||
None => ForceNonfloatedFlag::ForceNonfloated,
|
None => ForceNonfloatedFlag::ForceNonfloated,
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -363,27 +363,41 @@ impl<'a> FlowConstructor<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if child.is_table_cell() {
|
if child.is_table_cell() {
|
||||||
let fragment = Fragment::new(child_node, SpecificFragmentInfo::TableRow);
|
let mut style = child_node.style().clone();
|
||||||
let mut new_child = FlowRef::new(box TableRowFlow::from_node_and_fragment(child_node,
|
properties::modify_style_for_anonymous_table_object(&mut style, display::T::table_row);
|
||||||
fragment));
|
let fragment = Fragment::from_opaque_node_and_style(child_node.opaque(),
|
||||||
|
PseudoElementType::Normal,
|
||||||
|
style,
|
||||||
|
child_node.restyle_damage(),
|
||||||
|
SpecificFragmentInfo::TableRow);
|
||||||
|
let mut new_child = FlowRef::new(box TableRowFlow::from_fragment(fragment));
|
||||||
new_child.add_new_child(child.clone());
|
new_child.add_new_child(child.clone());
|
||||||
child.finish();
|
child.finish();
|
||||||
*child = new_child
|
*child = new_child
|
||||||
}
|
}
|
||||||
if child.is_table_row() || child.is_table_rowgroup() {
|
if child.is_table_row() || child.is_table_rowgroup() {
|
||||||
let fragment = Fragment::new(child_node, SpecificFragmentInfo::Table);
|
let mut style = child_node.style().clone();
|
||||||
let mut new_child = FlowRef::new(box TableFlow::from_node_and_fragment(child_node,
|
properties::modify_style_for_anonymous_table_object(&mut style, display::T::table);
|
||||||
fragment));
|
let fragment = Fragment::from_opaque_node_and_style(child_node.opaque(),
|
||||||
|
PseudoElementType::Normal,
|
||||||
|
style,
|
||||||
|
child_node.restyle_damage(),
|
||||||
|
SpecificFragmentInfo::Table);
|
||||||
|
let mut new_child = FlowRef::new(box TableFlow::from_fragment(fragment));
|
||||||
new_child.add_new_child(child.clone());
|
new_child.add_new_child(child.clone());
|
||||||
child.finish();
|
child.finish();
|
||||||
*child = new_child
|
*child = new_child
|
||||||
}
|
}
|
||||||
if child.is_table() {
|
if child.is_table() {
|
||||||
let fragment = Fragment::new(child_node, SpecificFragmentInfo::TableWrapper);
|
let mut style = child_node.style().clone();
|
||||||
let mut new_child =
|
properties::modify_style_for_anonymous_table_object(&mut style, display::T::table);
|
||||||
FlowRef::new(box TableWrapperFlow::from_node_and_fragment(child_node,
|
let fragment =
|
||||||
fragment,
|
Fragment::from_opaque_node_and_style(child_node.opaque(),
|
||||||
None));
|
PseudoElementType::Normal,
|
||||||
|
style,
|
||||||
|
child_node.restyle_damage(),
|
||||||
|
SpecificFragmentInfo::TableWrapper);
|
||||||
|
let mut new_child = FlowRef::new(box TableWrapperFlow::from_fragment(fragment, None));
|
||||||
new_child.add_new_child(child.clone());
|
new_child.add_new_child(child.clone());
|
||||||
child.finish();
|
child.finish();
|
||||||
*child = new_child
|
*child = new_child
|
||||||
|
@ -467,7 +481,8 @@ impl<'a> FlowConstructor<'a> {
|
||||||
|
|
||||||
|
|
||||||
let (ascent, descent) =
|
let (ascent, descent) =
|
||||||
inline_flow.compute_minimum_ascent_and_descent(&mut self.layout_context.font_context(),
|
inline_flow.compute_minimum_ascent_and_descent(&mut self.layout_context
|
||||||
|
.font_context(),
|
||||||
&**node.style());
|
&**node.style());
|
||||||
inline_flow.minimum_block_size_above_baseline = ascent;
|
inline_flow.minimum_block_size_above_baseline = ascent;
|
||||||
inline_flow.minimum_depth_below_baseline = descent;
|
inline_flow.minimum_depth_below_baseline = descent;
|
||||||
|
@ -482,15 +497,15 @@ impl<'a> FlowConstructor<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_block_flow_using_construction_result_of_child(&mut self,
|
fn build_block_flow_using_construction_result_of_child(
|
||||||
flow: &mut FlowRef,
|
&mut self,
|
||||||
consecutive_siblings: &mut Vec<FlowRef>,
|
flow: &mut FlowRef,
|
||||||
node: &ThreadSafeLayoutNode,
|
consecutive_siblings: &mut Vec<FlowRef>,
|
||||||
kid: ThreadSafeLayoutNode,
|
node: &ThreadSafeLayoutNode,
|
||||||
inline_fragment_accumulator:
|
kid: ThreadSafeLayoutNode,
|
||||||
&mut InlineFragmentsAccumulator,
|
inline_fragment_accumulator: &mut InlineFragmentsAccumulator,
|
||||||
abs_descendants: &mut Descendants,
|
abs_descendants: &mut Descendants,
|
||||||
first_fragment: &mut bool) {
|
first_fragment: &mut bool) {
|
||||||
match kid.swap_out_construction_result() {
|
match kid.swap_out_construction_result() {
|
||||||
ConstructionResult::None => {}
|
ConstructionResult::None => {}
|
||||||
ConstructionResult::Flow(mut kid_flow, kid_abs_descendants) => {
|
ConstructionResult::Flow(mut kid_flow, kid_abs_descendants) => {
|
||||||
|
@ -731,9 +746,9 @@ impl<'a> FlowConstructor<'a> {
|
||||||
-> ConstructionResult {
|
-> ConstructionResult {
|
||||||
let fragment = self.build_fragment_for_block(node);
|
let fragment = self.build_fragment_for_block(node);
|
||||||
let flow = if node.style().is_multicol() {
|
let flow = if node.style().is_multicol() {
|
||||||
box MulticolFlow::from_node_and_fragment(node, fragment, float_kind) as Box<Flow>
|
box MulticolFlow::from_fragment(fragment, float_kind) as Box<Flow>
|
||||||
} else {
|
} else {
|
||||||
box BlockFlow::from_node_and_fragment(node, fragment, float_kind) as Box<Flow>
|
box BlockFlow::from_fragment(fragment, float_kind) as Box<Flow>
|
||||||
};
|
};
|
||||||
self.build_flow_for_block_like(FlowRef::new(flow), node)
|
self.build_flow_for_block_like(FlowRef::new(flow), node)
|
||||||
}
|
}
|
||||||
|
@ -1039,12 +1054,12 @@ impl<'a> FlowConstructor<'a> {
|
||||||
fn build_flow_for_table_wrapper(&mut self, node: &ThreadSafeLayoutNode, float_value: float::T)
|
fn build_flow_for_table_wrapper(&mut self, node: &ThreadSafeLayoutNode, float_value: float::T)
|
||||||
-> ConstructionResult {
|
-> ConstructionResult {
|
||||||
let fragment = Fragment::new(node, SpecificFragmentInfo::TableWrapper);
|
let fragment = Fragment::new(node, SpecificFragmentInfo::TableWrapper);
|
||||||
let wrapper_flow = box TableWrapperFlow::from_node_and_fragment(
|
let wrapper_flow =
|
||||||
node, fragment, FloatKind::from_property(float_value));
|
box TableWrapperFlow::from_fragment(fragment, FloatKind::from_property(float_value));
|
||||||
let mut wrapper_flow = FlowRef::new(wrapper_flow as Box<Flow>);
|
let mut wrapper_flow = FlowRef::new(wrapper_flow as Box<Flow>);
|
||||||
|
|
||||||
let table_fragment = Fragment::new(node, SpecificFragmentInfo::Table);
|
let table_fragment = Fragment::new(node, SpecificFragmentInfo::Table);
|
||||||
let table_flow = box TableFlow::from_node_and_fragment(node, table_fragment);
|
let table_flow = box TableFlow::from_fragment(table_fragment);
|
||||||
let table_flow = FlowRef::new(table_flow as Box<Flow>);
|
let table_flow = FlowRef::new(table_flow as Box<Flow>);
|
||||||
|
|
||||||
// First populate the table flow with its children.
|
// First populate the table flow with its children.
|
||||||
|
@ -1102,7 +1117,7 @@ impl<'a> FlowConstructor<'a> {
|
||||||
/// with possibly other `BlockFlow`s or `InlineFlow`s underneath it.
|
/// with possibly other `BlockFlow`s or `InlineFlow`s underneath it.
|
||||||
fn build_flow_for_table_caption(&mut self, node: &ThreadSafeLayoutNode) -> ConstructionResult {
|
fn build_flow_for_table_caption(&mut self, node: &ThreadSafeLayoutNode) -> ConstructionResult {
|
||||||
let fragment = self.build_fragment_for_block(node);
|
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_fragment(fragment) as Box<Flow>;
|
||||||
self.build_flow_for_block_like(FlowRef::new(flow), node)
|
self.build_flow_for_block_like(FlowRef::new(flow), node)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1111,8 +1126,7 @@ impl<'a> FlowConstructor<'a> {
|
||||||
fn build_flow_for_table_rowgroup(&mut self, node: &ThreadSafeLayoutNode)
|
fn build_flow_for_table_rowgroup(&mut self, node: &ThreadSafeLayoutNode)
|
||||||
-> ConstructionResult {
|
-> ConstructionResult {
|
||||||
let fragment = Fragment::new(node, SpecificFragmentInfo::TableRow);
|
let fragment = Fragment::new(node, SpecificFragmentInfo::TableRow);
|
||||||
let flow = box TableRowGroupFlow::from_node_and_fragment(node, fragment);
|
let flow = box TableRowGroupFlow::from_fragment(fragment) as Box<Flow>;
|
||||||
let flow = flow as Box<Flow>;
|
|
||||||
self.build_flow_for_block_like(FlowRef::new(flow), node)
|
self.build_flow_for_block_like(FlowRef::new(flow), node)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1120,7 +1134,7 @@ impl<'a> FlowConstructor<'a> {
|
||||||
/// possibly other `TableCellFlow`s underneath it.
|
/// possibly other `TableCellFlow`s underneath it.
|
||||||
fn build_flow_for_table_row(&mut self, node: &ThreadSafeLayoutNode) -> ConstructionResult {
|
fn build_flow_for_table_row(&mut self, node: &ThreadSafeLayoutNode) -> ConstructionResult {
|
||||||
let fragment = Fragment::new(node, SpecificFragmentInfo::TableRow);
|
let fragment = Fragment::new(node, SpecificFragmentInfo::TableRow);
|
||||||
let flow = box TableRowFlow::from_node_and_fragment(node, fragment) as Box<Flow>;
|
let flow = box TableRowFlow::from_fragment(fragment) as Box<Flow>;
|
||||||
self.build_flow_for_block_like(FlowRef::new(flow), node)
|
self.build_flow_for_block_like(FlowRef::new(flow), node)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1191,19 +1205,15 @@ impl<'a> FlowConstructor<'a> {
|
||||||
let main_fragment = self.build_fragment_for_block(node);
|
let main_fragment = self.build_fragment_for_block(node);
|
||||||
let flow = match node.style().get_list().list_style_position {
|
let flow = match node.style().get_list().list_style_position {
|
||||||
list_style_position::T::outside => {
|
list_style_position::T::outside => {
|
||||||
box ListItemFlow::from_node_fragments_and_flotation(node,
|
box ListItemFlow::from_fragments_and_flotation(main_fragment,
|
||||||
main_fragment,
|
marker_fragment,
|
||||||
marker_fragment,
|
flotation)
|
||||||
flotation)
|
|
||||||
}
|
}
|
||||||
list_style_position::T::inside => {
|
list_style_position::T::inside => {
|
||||||
if let Some(marker_fragment) = marker_fragment {
|
if let Some(marker_fragment) = marker_fragment {
|
||||||
initial_fragments.fragments.push_back(marker_fragment)
|
initial_fragments.fragments.push_back(marker_fragment)
|
||||||
}
|
}
|
||||||
box ListItemFlow::from_node_fragments_and_flotation(node,
|
box ListItemFlow::from_fragments_and_flotation(main_fragment, None, flotation)
|
||||||
main_fragment,
|
|
||||||
None,
|
|
||||||
flotation)
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1250,7 +1260,7 @@ impl<'a> FlowConstructor<'a> {
|
||||||
let specific = SpecificFragmentInfo::TableColumn(TableColumnFragmentInfo::new(node));
|
let specific = SpecificFragmentInfo::TableColumn(TableColumnFragmentInfo::new(node));
|
||||||
col_fragments.push(Fragment::new(node, specific));
|
col_fragments.push(Fragment::new(node, specific));
|
||||||
}
|
}
|
||||||
let flow = box TableColGroupFlow::from_node_and_fragments(node, fragment, col_fragments);
|
let flow = box TableColGroupFlow::from_fragments(fragment, col_fragments);
|
||||||
let mut flow = FlowRef::new(flow as Box<Flow>);
|
let mut flow = FlowRef::new(flow as Box<Flow>);
|
||||||
flow.finish();
|
flow.finish();
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ use table_row::TableRowFlow;
|
||||||
use table_rowgroup::TableRowGroupFlow;
|
use table_rowgroup::TableRowGroupFlow;
|
||||||
use table_wrapper::TableWrapperFlow;
|
use table_wrapper::TableWrapperFlow;
|
||||||
use multicol::MulticolFlow;
|
use multicol::MulticolFlow;
|
||||||
use wrapper::ThreadSafeLayoutNode;
|
use wrapper::{PseudoElementType, ThreadSafeLayoutNode};
|
||||||
|
|
||||||
use euclid::{Point2D, Rect, Size2D};
|
use euclid::{Point2D, Rect, Size2D};
|
||||||
use gfx::display_list::ClippingRegion;
|
use gfx::display_list::ClippingRegion;
|
||||||
|
@ -58,8 +58,8 @@ use std::raw;
|
||||||
use std::slice::IterMut;
|
use std::slice::IterMut;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||||
use style::computed_values::{clear, empty_cells, float, position, text_align};
|
use style::computed_values::{clear, display, empty_cells, float, position, text_align};
|
||||||
use style::properties::ComputedValues;
|
use style::properties::{self, ComputedValues};
|
||||||
use style::values::computed::LengthOrPercentageOrAuto;
|
use style::values::computed::LengthOrPercentageOrAuto;
|
||||||
use util::geometry::{Au, ZERO_RECT};
|
use util::geometry::{Au, ZERO_RECT};
|
||||||
use util::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
|
use util::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
|
||||||
|
@ -968,19 +968,18 @@ pub enum ForceNonfloatedFlag {
|
||||||
|
|
||||||
impl BaseFlow {
|
impl BaseFlow {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new(node: Option<ThreadSafeLayoutNode>,
|
pub fn new(style: Option<&ComputedValues>,
|
||||||
writing_mode: WritingMode,
|
writing_mode: WritingMode,
|
||||||
force_nonfloated: ForceNonfloatedFlag)
|
force_nonfloated: ForceNonfloatedFlag)
|
||||||
-> BaseFlow {
|
-> BaseFlow {
|
||||||
let mut flags = FlowFlags::empty();
|
let mut flags = FlowFlags::empty();
|
||||||
match node {
|
match style {
|
||||||
Some(node) => {
|
Some(style) => {
|
||||||
let node_style = node.style();
|
match style.get_box().position {
|
||||||
match node_style.get_box().position {
|
|
||||||
position::T::absolute | position::T::fixed => {
|
position::T::absolute | position::T::fixed => {
|
||||||
flags.insert(IS_ABSOLUTELY_POSITIONED);
|
flags.insert(IS_ABSOLUTELY_POSITIONED);
|
||||||
|
|
||||||
let logical_position = node_style.logical_position();
|
let logical_position = style.logical_position();
|
||||||
if logical_position.inline_start == LengthOrPercentageOrAuto::Auto &&
|
if logical_position.inline_start == LengthOrPercentageOrAuto::Auto &&
|
||||||
logical_position.inline_end == LengthOrPercentageOrAuto::Auto {
|
logical_position.inline_end == LengthOrPercentageOrAuto::Auto {
|
||||||
flags.insert(INLINE_POSITION_IS_STATIC);
|
flags.insert(INLINE_POSITION_IS_STATIC);
|
||||||
|
@ -994,14 +993,14 @@ impl BaseFlow {
|
||||||
}
|
}
|
||||||
|
|
||||||
if force_nonfloated == ForceNonfloatedFlag::FloatIfNecessary {
|
if force_nonfloated == ForceNonfloatedFlag::FloatIfNecessary {
|
||||||
match node_style.get_box().float {
|
match style.get_box().float {
|
||||||
float::T::none => {}
|
float::T::none => {}
|
||||||
float::T::left => flags.insert(FLOATS_LEFT),
|
float::T::left => flags.insert(FLOATS_LEFT),
|
||||||
float::T::right => flags.insert(FLOATS_RIGHT),
|
float::T::right => flags.insert(FLOATS_RIGHT),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
match node_style.get_box().clear {
|
match style.get_box().clear {
|
||||||
clear::T::none => {}
|
clear::T::none => {}
|
||||||
clear::T::left => flags.insert(CLEARS_LEFT),
|
clear::T::left => flags.insert(CLEARS_LEFT),
|
||||||
clear::T::right => flags.insert(CLEARS_RIGHT),
|
clear::T::right => flags.insert(CLEARS_RIGHT),
|
||||||
|
@ -1011,8 +1010,8 @@ impl BaseFlow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !node_style.get_counters().counter_reset.0.is_empty() ||
|
if !style.get_counters().counter_reset.0.is_empty() ||
|
||||||
!node_style.get_counters().counter_increment.0.is_empty() {
|
!style.get_counters().counter_increment.0.is_empty() {
|
||||||
flags.insert(AFFECTS_COUNTERS)
|
flags.insert(AFFECTS_COUNTERS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1192,18 +1191,35 @@ impl<'a> ImmutableFlowUtils for &'a (Flow + 'a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generates missing child flow of this flow.
|
/// Generates missing child flow of this flow.
|
||||||
|
///
|
||||||
|
/// FIXME(pcwalton): This duplicates some logic in
|
||||||
|
/// `generate_anonymous_table_flows_if_necessary()`. We should remove this function eventually,
|
||||||
|
/// as it's harder to understand.
|
||||||
fn generate_missing_child_flow(self, node: &ThreadSafeLayoutNode) -> FlowRef {
|
fn generate_missing_child_flow(self, node: &ThreadSafeLayoutNode) -> FlowRef {
|
||||||
|
let mut style = node.style().clone();
|
||||||
let flow = match self.class() {
|
let flow = match self.class() {
|
||||||
FlowClass::Table | FlowClass::TableRowGroup => {
|
FlowClass::Table | FlowClass::TableRowGroup => {
|
||||||
let fragment =
|
properties::modify_style_for_anonymous_table_object(
|
||||||
Fragment::new_anonymous_from_specific_info(node,
|
&mut style,
|
||||||
SpecificFragmentInfo::TableRow);
|
display::T::table_row);
|
||||||
box TableRowFlow::from_node_and_fragment(node, fragment) as Box<Flow>
|
let fragment = Fragment::from_opaque_node_and_style(
|
||||||
|
node.opaque(),
|
||||||
|
PseudoElementType::Normal,
|
||||||
|
style,
|
||||||
|
node.restyle_damage(),
|
||||||
|
SpecificFragmentInfo::TableRow);
|
||||||
|
box TableRowFlow::from_fragment(fragment) as Box<Flow>
|
||||||
},
|
},
|
||||||
FlowClass::TableRow => {
|
FlowClass::TableRow => {
|
||||||
let fragment =
|
properties::modify_style_for_anonymous_table_object(
|
||||||
Fragment::new_anonymous_from_specific_info(node,
|
&mut style,
|
||||||
SpecificFragmentInfo::TableCell);
|
display::T::table_cell);
|
||||||
|
let fragment = Fragment::from_opaque_node_and_style(
|
||||||
|
node.opaque(),
|
||||||
|
PseudoElementType::Normal,
|
||||||
|
style,
|
||||||
|
node.restyle_damage(),
|
||||||
|
SpecificFragmentInfo::TableCell);
|
||||||
let hide = node.style().get_inheritedtable().empty_cells == empty_cells::T::hide;
|
let hide = node.style().get_inheritedtable().empty_cells == empty_cells::T::hide;
|
||||||
box TableCellFlow::from_node_fragment_and_visibility_flag(node, fragment, !hide) as
|
box TableCellFlow::from_node_fragment_and_visibility_flag(node, fragment, !hide) as
|
||||||
Box<Flow>
|
Box<Flow>
|
||||||
|
|
|
@ -17,7 +17,6 @@ use generated_content;
|
||||||
use incremental::RESOLVE_GENERATED_CONTENT;
|
use incremental::RESOLVE_GENERATED_CONTENT;
|
||||||
use inline::InlineMetrics;
|
use inline::InlineMetrics;
|
||||||
use text;
|
use text;
|
||||||
use wrapper::ThreadSafeLayoutNode;
|
|
||||||
|
|
||||||
use euclid::{Point2D, Rect};
|
use euclid::{Point2D, Rect};
|
||||||
use gfx::display_list::DisplayList;
|
use gfx::display_list::DisplayList;
|
||||||
|
@ -39,13 +38,12 @@ pub struct ListItemFlow {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ListItemFlow {
|
impl ListItemFlow {
|
||||||
pub fn from_node_fragments_and_flotation(node: &ThreadSafeLayoutNode,
|
pub fn from_fragments_and_flotation(main_fragment: Fragment,
|
||||||
main_fragment: Fragment,
|
marker_fragment: Option<Fragment>,
|
||||||
marker_fragment: Option<Fragment>,
|
flotation: Option<FloatKind>)
|
||||||
flotation: Option<FloatKind>)
|
-> ListItemFlow {
|
||||||
-> ListItemFlow {
|
|
||||||
let mut this = ListItemFlow {
|
let mut this = ListItemFlow {
|
||||||
block_flow: BlockFlow::from_node_and_fragment(node, main_fragment, flotation),
|
block_flow: BlockFlow::from_fragment(main_fragment, flotation),
|
||||||
marker: marker_fragment,
|
marker: marker_fragment,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ use context::LayoutContext;
|
||||||
use floats::FloatKind;
|
use floats::FloatKind;
|
||||||
use flow::{FlowClass, Flow, OpaqueFlow};
|
use flow::{FlowClass, Flow, OpaqueFlow};
|
||||||
use fragment::{Fragment, FragmentBorderBoxIterator};
|
use fragment::{Fragment, FragmentBorderBoxIterator};
|
||||||
use wrapper::ThreadSafeLayoutNode;
|
|
||||||
|
|
||||||
use euclid::{Point2D, Rect};
|
use euclid::{Point2D, Rect};
|
||||||
use util::geometry::Au;
|
use util::geometry::Au;
|
||||||
|
@ -25,12 +24,9 @@ pub struct MulticolFlow {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MulticolFlow {
|
impl MulticolFlow {
|
||||||
pub fn from_node_and_fragment(node: &ThreadSafeLayoutNode,
|
pub fn from_fragment(fragment: Fragment, float_kind: Option<FloatKind>) -> MulticolFlow {
|
||||||
fragment: Fragment,
|
|
||||||
float_kind: Option<FloatKind>)
|
|
||||||
-> MulticolFlow {
|
|
||||||
MulticolFlow {
|
MulticolFlow {
|
||||||
block_flow: BlockFlow::from_node_and_fragment(node, fragment, float_kind)
|
block_flow: BlockFlow::from_fragment(fragment, float_kind)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@ use model::{IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto};
|
||||||
use table_row::{self, CellIntrinsicInlineSize, CollapsedBorder, CollapsedBorderProvenance};
|
use table_row::{self, CellIntrinsicInlineSize, CollapsedBorder, CollapsedBorderProvenance};
|
||||||
use table_row::{TableRowFlow};
|
use table_row::{TableRowFlow};
|
||||||
use table_wrapper::TableLayout;
|
use table_wrapper::TableLayout;
|
||||||
use wrapper::ThreadSafeLayoutNode;
|
|
||||||
|
|
||||||
use euclid::{Point2D, Rect};
|
use euclid::{Point2D, Rect};
|
||||||
use gfx::display_list::DisplayList;
|
use gfx::display_list::DisplayList;
|
||||||
|
@ -61,10 +60,8 @@ pub struct TableFlow {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TableFlow {
|
impl TableFlow {
|
||||||
pub fn from_node_and_fragment(node: &ThreadSafeLayoutNode,
|
pub fn from_fragment(fragment: Fragment) -> TableFlow {
|
||||||
fragment: Fragment)
|
let mut block_flow = BlockFlow::from_fragment(fragment, None);
|
||||||
-> TableFlow {
|
|
||||||
let mut block_flow = BlockFlow::from_node_and_fragment(node, fragment, None);
|
|
||||||
let table_layout =
|
let table_layout =
|
||||||
if block_flow.fragment().style().get_table().table_layout == table_layout::T::fixed {
|
if block_flow.fragment().style().get_table().table_layout == table_layout::T::fixed {
|
||||||
TableLayout::Fixed
|
TableLayout::Fixed
|
||||||
|
|
|
@ -10,7 +10,6 @@ use block::BlockFlow;
|
||||||
use context::LayoutContext;
|
use context::LayoutContext;
|
||||||
use flow::{FlowClass, Flow, OpaqueFlow};
|
use flow::{FlowClass, Flow, OpaqueFlow};
|
||||||
use fragment::{Fragment, FragmentBorderBoxIterator};
|
use fragment::{Fragment, FragmentBorderBoxIterator};
|
||||||
use wrapper::ThreadSafeLayoutNode;
|
|
||||||
|
|
||||||
use euclid::{Point2D, Rect};
|
use euclid::{Point2D, Rect};
|
||||||
use util::geometry::Au;
|
use util::geometry::Au;
|
||||||
|
@ -25,10 +24,9 @@ pub struct TableCaptionFlow {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TableCaptionFlow {
|
impl TableCaptionFlow {
|
||||||
pub fn from_node_and_fragment(node: &ThreadSafeLayoutNode, fragment: Fragment)
|
pub fn from_fragment(fragment: Fragment) -> TableCaptionFlow {
|
||||||
-> TableCaptionFlow {
|
|
||||||
TableCaptionFlow {
|
TableCaptionFlow {
|
||||||
block_flow: BlockFlow::from_node_and_fragment(node, fragment, None)
|
block_flow: BlockFlow::from_fragment(fragment, None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ impl TableCellFlow {
|
||||||
visible: bool)
|
visible: bool)
|
||||||
-> TableCellFlow {
|
-> TableCellFlow {
|
||||||
TableCellFlow {
|
TableCellFlow {
|
||||||
block_flow: BlockFlow::from_node_and_fragment(node, fragment, None),
|
block_flow: BlockFlow::from_fragment(fragment, None),
|
||||||
collapsed_borders: CollapsedBordersForCell::new(),
|
collapsed_borders: CollapsedBordersForCell::new(),
|
||||||
column_span: node.get_unsigned_integer_attribute(UnsignedIntegerAttribute::ColSpan)
|
column_span: node.get_unsigned_integer_attribute(UnsignedIntegerAttribute::ColSpan)
|
||||||
.unwrap_or(1),
|
.unwrap_or(1),
|
||||||
|
|
|
@ -10,7 +10,6 @@ use context::LayoutContext;
|
||||||
use flow::{BaseFlow, FlowClass, Flow, ForceNonfloatedFlag, OpaqueFlow};
|
use flow::{BaseFlow, FlowClass, Flow, ForceNonfloatedFlag, OpaqueFlow};
|
||||||
use fragment::{Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo};
|
use fragment::{Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo};
|
||||||
use layout_debug;
|
use layout_debug;
|
||||||
use wrapper::ThreadSafeLayoutNode;
|
|
||||||
|
|
||||||
use euclid::{Point2D, Rect};
|
use euclid::{Point2D, Rect};
|
||||||
use util::geometry::{Au, ZERO_RECT};
|
use util::geometry::{Au, ZERO_RECT};
|
||||||
|
@ -39,13 +38,12 @@ pub struct TableColGroupFlow {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TableColGroupFlow {
|
impl TableColGroupFlow {
|
||||||
pub fn from_node_and_fragments(node: &ThreadSafeLayoutNode,
|
pub fn from_fragments(fragment: Fragment, fragments: Vec<Fragment>) -> TableColGroupFlow {
|
||||||
fragment: Fragment,
|
let writing_mode = fragment.style().writing_mode;
|
||||||
fragments: Vec<Fragment>)
|
|
||||||
-> TableColGroupFlow {
|
|
||||||
let writing_mode = node.style().writing_mode;
|
|
||||||
TableColGroupFlow {
|
TableColGroupFlow {
|
||||||
base: BaseFlow::new(Some((*node).clone()), writing_mode, ForceNonfloatedFlag::ForceNonfloated),
|
base: BaseFlow::new(Some(fragment.style()),
|
||||||
|
writing_mode,
|
||||||
|
ForceNonfloatedFlag::ForceNonfloated),
|
||||||
fragment: Some(fragment),
|
fragment: Some(fragment),
|
||||||
cols: fragments,
|
cols: fragments,
|
||||||
inline_sizes: vec!(),
|
inline_sizes: vec!(),
|
||||||
|
|
|
@ -16,7 +16,6 @@ use layout_debug;
|
||||||
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, VecExt};
|
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, VecExt};
|
||||||
use table_cell::{CollapsedBordersForCell, TableCellFlow};
|
use table_cell::{CollapsedBordersForCell, TableCellFlow};
|
||||||
use model::MaybeAuto;
|
use model::MaybeAuto;
|
||||||
use wrapper::ThreadSafeLayoutNode;
|
|
||||||
|
|
||||||
use cssparser::{Color, RGBA};
|
use cssparser::{Color, RGBA};
|
||||||
use euclid::{Point2D, Rect};
|
use euclid::{Point2D, Rect};
|
||||||
|
@ -80,11 +79,10 @@ pub struct CellIntrinsicInlineSize {
|
||||||
|
|
||||||
|
|
||||||
impl TableRowFlow {
|
impl TableRowFlow {
|
||||||
pub fn from_node_and_fragment(node: &ThreadSafeLayoutNode, fragment: Fragment)
|
pub fn from_fragment(fragment: Fragment) -> TableRowFlow {
|
||||||
-> TableRowFlow {
|
|
||||||
let writing_mode = fragment.style().writing_mode;
|
let writing_mode = fragment.style().writing_mode;
|
||||||
TableRowFlow {
|
TableRowFlow {
|
||||||
block_flow: BlockFlow::from_node_and_fragment(node, fragment, None),
|
block_flow: BlockFlow::from_fragment(fragment, None),
|
||||||
cell_intrinsic_inline_sizes: Vec::new(),
|
cell_intrinsic_inline_sizes: Vec::new(),
|
||||||
column_computed_inline_sizes: Vec::new(),
|
column_computed_inline_sizes: Vec::new(),
|
||||||
spacing: border_spacing::T {
|
spacing: border_spacing::T {
|
||||||
|
|
|
@ -14,7 +14,6 @@ use layout_debug;
|
||||||
use style::computed_values::{border_collapse, border_spacing};
|
use style::computed_values::{border_collapse, border_spacing};
|
||||||
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, TableLikeFlow};
|
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, TableLikeFlow};
|
||||||
use table_row::{self, CollapsedBordersForRow};
|
use table_row::{self, CollapsedBordersForRow};
|
||||||
use wrapper::ThreadSafeLayoutNode;
|
|
||||||
|
|
||||||
use euclid::{Point2D, Rect};
|
use euclid::{Point2D, Rect};
|
||||||
use rustc_serialize::{Encoder, Encodable};
|
use rustc_serialize::{Encoder, Encodable};
|
||||||
|
@ -63,11 +62,10 @@ impl Encodable for TableRowGroupFlow {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TableRowGroupFlow {
|
impl TableRowGroupFlow {
|
||||||
pub fn from_node_and_fragment(node: &ThreadSafeLayoutNode, fragment: Fragment)
|
pub fn from_fragment(fragment: Fragment) -> TableRowGroupFlow {
|
||||||
-> TableRowGroupFlow {
|
|
||||||
let writing_mode = fragment.style().writing_mode;
|
let writing_mode = fragment.style().writing_mode;
|
||||||
TableRowGroupFlow {
|
TableRowGroupFlow {
|
||||||
block_flow: BlockFlow::from_node_and_fragment(node, fragment, None),
|
block_flow: BlockFlow::from_fragment(fragment, None),
|
||||||
column_intrinsic_inline_sizes: Vec::new(),
|
column_intrinsic_inline_sizes: Vec::new(),
|
||||||
column_computed_inline_sizes: Vec::new(),
|
column_computed_inline_sizes: Vec::new(),
|
||||||
spacing: border_spacing::T {
|
spacing: border_spacing::T {
|
||||||
|
|
|
@ -23,7 +23,6 @@ use fragment::{Fragment, FragmentBorderBoxIterator};
|
||||||
use model::MaybeAuto;
|
use model::MaybeAuto;
|
||||||
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize};
|
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize};
|
||||||
use table_row;
|
use table_row;
|
||||||
use wrapper::ThreadSafeLayoutNode;
|
|
||||||
|
|
||||||
use euclid::{Point2D, Rect};
|
use euclid::{Point2D, Rect};
|
||||||
use util::geometry::Au;
|
use util::geometry::Au;
|
||||||
|
@ -56,11 +55,8 @@ pub struct TableWrapperFlow {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TableWrapperFlow {
|
impl TableWrapperFlow {
|
||||||
pub fn from_node_and_fragment(node: &ThreadSafeLayoutNode,
|
pub fn from_fragment(fragment: Fragment, float_kind: Option<FloatKind>) -> TableWrapperFlow {
|
||||||
fragment: Fragment,
|
let mut block_flow = BlockFlow::from_fragment(fragment, float_kind);
|
||||||
float_kind: Option<FloatKind>)
|
|
||||||
-> TableWrapperFlow {
|
|
||||||
let mut block_flow = BlockFlow::from_node_and_fragment(node, fragment, float_kind);
|
|
||||||
let table_layout = if block_flow.fragment().style().get_table().table_layout ==
|
let table_layout = if block_flow.fragment().style().get_table().table_layout ==
|
||||||
table_layout::T::fixed {
|
table_layout::T::fixed {
|
||||||
TableLayout::Fixed
|
TableLayout::Fixed
|
||||||
|
|
|
@ -6517,6 +6517,17 @@ pub fn modify_style_for_inline_sides(style: &mut Arc<ComputedValues>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Adjusts the display and position properties as appropriate for an anonymous table object.
|
||||||
|
#[inline]
|
||||||
|
pub fn modify_style_for_anonymous_table_object(
|
||||||
|
style: &mut Arc<ComputedValues>,
|
||||||
|
new_display_value: longhands::display::computed_value::T) {
|
||||||
|
let mut style = Arc::make_unique(style);
|
||||||
|
let box_style = Arc::make_unique(&mut style.box_);
|
||||||
|
box_style.display = new_display_value;
|
||||||
|
box_style.position = longhands::position::computed_value::T::static_;
|
||||||
|
}
|
||||||
|
|
||||||
pub fn is_supported_property(property: &str) -> bool {
|
pub fn is_supported_property(property: &str) -> bool {
|
||||||
match_ignore_ascii_case! { property,
|
match_ignore_ascii_case! { property,
|
||||||
% for property in SHORTHANDS + LONGHANDS[:-1]:
|
% for property in SHORTHANDS + LONGHANDS[:-1]:
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
[abspos-containing-block-initial-004c.htm]
|
[abspos-containing-block-initial-004c.htm]
|
||||||
type: reftest
|
type: reftest
|
||||||
expected: TIMEOUT
|
expected: FAIL
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
[abspos-containing-block-initial-004d.htm]
|
[abspos-containing-block-initial-004d.htm]
|
||||||
type: reftest
|
type: reftest
|
||||||
expected: TIMEOUT
|
expected: FAIL
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
[abspos-containing-block-initial-005b.htm]
|
[abspos-containing-block-initial-005b.htm]
|
||||||
type: reftest
|
type: reftest
|
||||||
expected: TIMEOUT
|
expected: FAIL
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
[abspos-containing-block-initial-005d.htm]
|
[abspos-containing-block-initial-005d.htm]
|
||||||
type: reftest
|
type: reftest
|
||||||
expected: TIMEOUT
|
expected: FAIL
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
[float-applies-to-001a.htm]
|
||||||
|
type: reftest
|
||||||
|
expected: FAIL
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
[float-applies-to-004a.htm]
|
||||||
|
type: reftest
|
||||||
|
expected: FAIL
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
[float-applies-to-005.htm]
|
||||||
|
type: reftest
|
||||||
|
expected: FAIL
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
[float-applies-to-006.htm]
|
||||||
|
type: reftest
|
||||||
|
expected: FAIL
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue