mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Backed out changeset e64e659c077d: servo PR #18809 and revendor for reftest failures, e.g. in layout/reftests/bugs/392435-1.html. r=backout on a CLOSED TREE
Backs out https://github.com/servo/servo/pull/18809
This commit is contained in:
parent
fe16c1d5c3
commit
11c64178d8
142 changed files with 1635 additions and 1685 deletions
|
@ -16,19 +16,22 @@
|
|||
use ServoArc;
|
||||
use block::BlockFlow;
|
||||
use context::{LayoutContext, with_thread_local_font_context};
|
||||
use data::{LayoutDataFlags, LayoutData};
|
||||
use data::{HAS_NEWLY_CONSTRUCTED_FLOW, LayoutData};
|
||||
use flex::FlexFlow;
|
||||
use floats::FloatKind;
|
||||
use flow::{self, AbsoluteDescendants, Flow, FlowClass, ImmutableFlowUtils};
|
||||
use flow::{FlowFlags, MutableFlowUtils, MutableOwnedFlowUtils};
|
||||
use flow::{CAN_BE_FRAGMENTED, IS_ABSOLUTELY_POSITIONED, MARGINS_CANNOT_COLLAPSE};
|
||||
use flow::{MutableFlowUtils, MutableOwnedFlowUtils};
|
||||
use flow_ref::FlowRef;
|
||||
use fragment::{CanvasFragmentInfo, ImageFragmentInfo, InlineAbsoluteFragmentInfo, SvgFragmentInfo};
|
||||
use fragment::{Fragment, GeneratedContentInfo, IframeFragmentInfo, FragmentFlags};
|
||||
use fragment::{Fragment, GeneratedContentInfo, IframeFragmentInfo};
|
||||
use fragment::{IS_INLINE_FLEX_ITEM, IS_BLOCK_FLEX_ITEM};
|
||||
use fragment::{InlineAbsoluteHypotheticalFragmentInfo, TableColumnFragmentInfo};
|
||||
use fragment::{InlineBlockFragmentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo};
|
||||
use fragment::WhitespaceStrippingResult;
|
||||
use gfx::display_list::OpaqueNode;
|
||||
use inline::{InlineFlow, InlineFragmentNodeInfo, InlineFragmentNodeFlags};
|
||||
use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFlow};
|
||||
use inline::{InlineFragmentNodeInfo, LAST_FRAGMENT_OF_ELEMENT};
|
||||
use linked_list::prepend_from;
|
||||
use list_item::{ListItemFlow, ListStyleTypeContent};
|
||||
use multicol::{MulticolColumnFlow, MulticolFlow};
|
||||
|
@ -51,7 +54,7 @@ use style::logical_geometry::Direction;
|
|||
use style::properties::ComputedValues;
|
||||
use style::properties::longhands::list_style_image;
|
||||
use style::selector_parser::{PseudoElement, RestyleDamage};
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use style::servo::restyle_damage::{BUBBLE_ISIZES, RECONSTRUCT_FLOW};
|
||||
use style::values::Either;
|
||||
use table::TableFlow;
|
||||
use table_caption::TableCaptionFlow;
|
||||
|
@ -170,7 +173,7 @@ impl InlineBlockSplit {
|
|||
-> InlineBlockSplit {
|
||||
fragment_accumulator.enclosing_node.as_mut().expect(
|
||||
"enclosing_node is None; Are {ib} splits being generated outside of an inline node?"
|
||||
).flags.remove(InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT);
|
||||
).flags.remove(LAST_FRAGMENT_OF_ELEMENT);
|
||||
|
||||
let split = InlineBlockSplit {
|
||||
predecessors: mem::replace(
|
||||
|
@ -180,8 +183,7 @@ impl InlineBlockSplit {
|
|||
flow: flow,
|
||||
};
|
||||
|
||||
fragment_accumulator.enclosing_node.as_mut().unwrap().flags.remove(
|
||||
InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT);
|
||||
fragment_accumulator.enclosing_node.as_mut().unwrap().flags.remove(FIRST_FRAGMENT_OF_ELEMENT);
|
||||
|
||||
split
|
||||
}
|
||||
|
@ -256,8 +258,7 @@ impl InlineFragmentsAccumulator {
|
|||
pseudo: node.get_pseudo_element_type().strip(),
|
||||
style: node.style(style_context),
|
||||
selected_style: node.selected_style(),
|
||||
flags: InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT |
|
||||
InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT,
|
||||
flags: FIRST_FRAGMENT_OF_ELEMENT | LAST_FRAGMENT_OF_ELEMENT,
|
||||
}),
|
||||
bidi_control_chars: None,
|
||||
restyle_damage: node.restyle_damage(),
|
||||
|
@ -286,18 +287,17 @@ impl InlineFragmentsAccumulator {
|
|||
for (index, fragment) in fragments.fragments.iter_mut().enumerate() {
|
||||
let mut enclosing_node = enclosing_node.clone();
|
||||
if index != 0 {
|
||||
enclosing_node.flags.remove(InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT)
|
||||
enclosing_node.flags.remove(FIRST_FRAGMENT_OF_ELEMENT)
|
||||
}
|
||||
if index != fragment_count - 1 {
|
||||
enclosing_node.flags.remove(InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT)
|
||||
enclosing_node.flags.remove(LAST_FRAGMENT_OF_ELEMENT)
|
||||
}
|
||||
fragment.add_inline_context_style(enclosing_node);
|
||||
}
|
||||
|
||||
// Control characters are later discarded in transform_text, so they don't affect the
|
||||
// is_first/is_last styles above.
|
||||
enclosing_node.flags.remove(InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT |
|
||||
InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT);
|
||||
enclosing_node.flags.remove(FIRST_FRAGMENT_OF_ELEMENT | LAST_FRAGMENT_OF_ELEMENT);
|
||||
|
||||
if let Some((start, end)) = bidi_control_chars {
|
||||
fragments.fragments.push_front(
|
||||
|
@ -493,7 +493,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
ConstructionResult::Flow(kid_flow, AbsoluteDescendants::new());
|
||||
self.set_flow_construction_result(&kid, construction_result)
|
||||
} else {
|
||||
if !flow::base(&*kid_flow).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
if !flow::base(&*kid_flow).flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
// Flush any inline fragments that we were gathering up. This allows us to
|
||||
// handle {ib} splits.
|
||||
let old_inline_fragment_accumulator =
|
||||
|
@ -621,7 +621,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
flow.set_absolute_descendants(abs_descendants);
|
||||
|
||||
abs_descendants = AbsoluteDescendants::new();
|
||||
if flow::base(&*flow).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
if flow::base(&*flow).flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
// This is now the only absolute flow in the subtree which hasn't yet
|
||||
// reached its CB.
|
||||
abs_descendants.push(flow.clone());
|
||||
|
@ -776,7 +776,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
match kid.get_construction_result() {
|
||||
ConstructionResult::None => {}
|
||||
ConstructionResult::Flow(flow, kid_abs_descendants) => {
|
||||
if !flow::base(&*flow).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
if !flow::base(&*flow).flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
opt_inline_block_splits.push_back(InlineBlockSplit::new(
|
||||
&mut fragment_accumulator, node, self.style_context(), flow));
|
||||
abs_descendants.push_descendants(kid_abs_descendants);
|
||||
|
@ -1066,7 +1066,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
|
||||
abs_descendants = AbsoluteDescendants::new();
|
||||
|
||||
if flow::base(&*flow).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
if flow::base(&*flow).flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
// This is now the only absolute flow in the subtree which hasn't yet
|
||||
// reached its containing block.
|
||||
abs_descendants.push(flow.clone());
|
||||
|
@ -1137,7 +1137,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
|
||||
abs_descendants = AbsoluteDescendants::new();
|
||||
|
||||
if flow::base(&*wrapper_flow).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
if flow::base(&*wrapper_flow).flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
// This is now the only absolute flow in the subtree which hasn't yet
|
||||
// reached its containing block.
|
||||
abs_descendants.push(wrapper_flow.clone());
|
||||
|
@ -1332,8 +1332,8 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
}
|
||||
|
||||
for kid in node.children() {
|
||||
if kid.flags().contains(LayoutDataFlags::HAS_NEWLY_CONSTRUCTED_FLOW) {
|
||||
kid.remove_flags(LayoutDataFlags::HAS_NEWLY_CONSTRUCTED_FLOW);
|
||||
if kid.flags().contains(HAS_NEWLY_CONSTRUCTED_FLOW) {
|
||||
kid.remove_flags(HAS_NEWLY_CONSTRUCTED_FLOW);
|
||||
need_to_reconstruct = true
|
||||
}
|
||||
}
|
||||
|
@ -1342,7 +1342,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
return false
|
||||
}
|
||||
|
||||
if node.restyle_damage().contains(ServoRestyleDamage::RECONSTRUCT_FLOW) {
|
||||
if node.restyle_damage().contains(RECONSTRUCT_FLOW) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -1436,7 +1436,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
}
|
||||
};
|
||||
if set_has_newly_constructed_flow_flag {
|
||||
node.insert_flags(LayoutDataFlags::HAS_NEWLY_CONSTRUCTED_FLOW);
|
||||
node.insert_flags(HAS_NEWLY_CONSTRUCTED_FLOW);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -1452,7 +1452,7 @@ impl<'a, ConcreteThreadSafeLayoutNode> PostorderNodeMutTraversal<ConcreteThreadS
|
|||
// TODO: This should actually consult the table in that section to get the
|
||||
// final computed value for 'display'.
|
||||
fn process(&mut self, node: &ConcreteThreadSafeLayoutNode) {
|
||||
node.insert_flags(LayoutDataFlags::HAS_NEWLY_CONSTRUCTED_FLOW);
|
||||
node.insert_flags(HAS_NEWLY_CONSTRUCTED_FLOW);
|
||||
|
||||
// Bail out if this node has an ancestor with display: none.
|
||||
if node.style(self.style_context()).is_in_display_none_subtree() {
|
||||
|
@ -1654,7 +1654,7 @@ impl<ConcreteThreadSafeLayoutNode> NodeUtils for ConcreteThreadSafeLayoutNode
|
|||
fn set_flow_construction_result(self, mut result: ConstructionResult) {
|
||||
if self.can_be_fragmented() {
|
||||
if let ConstructionResult::Flow(ref mut flow, _) = result {
|
||||
flow::mut_base(FlowRef::deref_mut(flow)).flags.insert(FlowFlags::CAN_BE_FRAGMENTED);
|
||||
flow::mut_base(FlowRef::deref_mut(flow)).flags.insert(CAN_BE_FRAGMENTED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1744,7 +1744,7 @@ impl FlowConstructionUtils for FlowRef {
|
|||
fn finish(&mut self) {
|
||||
if !opts::get().bubble_inline_sizes_separately {
|
||||
FlowRef::deref_mut(self).bubble_inline_sizes();
|
||||
flow::mut_base(FlowRef::deref_mut(self)).restyle_damage.remove(ServoRestyleDamage::BUBBLE_ISIZES);
|
||||
flow::mut_base(FlowRef::deref_mut(self)).restyle_damage.remove(BUBBLE_ISIZES);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1945,7 +1945,7 @@ impl Legalizer {
|
|||
}
|
||||
|
||||
(FlowClass::Flex, FlowClass::Inline) => {
|
||||
flow::mut_base(FlowRef::deref_mut(child)).flags.insert(FlowFlags::MARGINS_CANNOT_COLLAPSE);
|
||||
flow::mut_base(FlowRef::deref_mut(child)).flags.insert(MARGINS_CANNOT_COLLAPSE);
|
||||
let mut block_wrapper =
|
||||
Legalizer::create_anonymous_flow(context,
|
||||
parent,
|
||||
|
@ -1954,12 +1954,12 @@ impl Legalizer {
|
|||
BlockFlow::from_fragment);
|
||||
{
|
||||
let flag = if parent.as_flex().main_mode() == Direction::Inline {
|
||||
FragmentFlags::IS_INLINE_FLEX_ITEM
|
||||
IS_INLINE_FLEX_ITEM
|
||||
} else {
|
||||
FragmentFlags::IS_BLOCK_FLEX_ITEM
|
||||
IS_BLOCK_FLEX_ITEM
|
||||
};
|
||||
let block = FlowRef::deref_mut(&mut block_wrapper).as_mut_block();
|
||||
block.base.flags.insert(FlowFlags::MARGINS_CANNOT_COLLAPSE);
|
||||
block.base.flags.insert(MARGINS_CANNOT_COLLAPSE);
|
||||
block.fragment.flags.insert(flag);
|
||||
}
|
||||
block_wrapper.add_new_child((*child).clone());
|
||||
|
@ -1971,12 +1971,12 @@ impl Legalizer {
|
|||
(FlowClass::Flex, _) => {
|
||||
{
|
||||
let flag = if parent.as_flex().main_mode() == Direction::Inline {
|
||||
FragmentFlags::IS_INLINE_FLEX_ITEM
|
||||
IS_INLINE_FLEX_ITEM
|
||||
} else {
|
||||
FragmentFlags::IS_BLOCK_FLEX_ITEM
|
||||
IS_BLOCK_FLEX_ITEM
|
||||
};
|
||||
let block = FlowRef::deref_mut(child).as_mut_block();
|
||||
block.base.flags.insert(FlowFlags::MARGINS_CANNOT_COLLAPSE);
|
||||
block.base.flags.insert(MARGINS_CANNOT_COLLAPSE);
|
||||
block.fragment.flags.insert(flag);
|
||||
}
|
||||
parent.add_new_child((*child).clone());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue