Auto merge of #18893 - emilio:bye-can-be-fragmented, r=SimonSapin

style: Remove TNode::set_can_be_fragmented and TNode::can_be_fragmented.

Replace them instead by a computed value flag, the same way as the
IS_IN_DISPLAY_NONE_SUBTREE flag works.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18893)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-01-05 05:11:00 -06:00 committed by GitHub
commit 83a8891bd4
14 changed files with 60 additions and 84 deletions

View file

@ -1353,13 +1353,14 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
return false
}
if node.can_be_fragmented() || node.style(self.style_context()).is_multicol() {
return false
}
let mut set_has_newly_constructed_flow_flag = false;
let result = {
let style = node.style(self.style_context());
if style.can_be_fragmented() || style.is_multicol() {
return false
}
let damage = node.restyle_damage();
let mut data = node.mutate_layout_data().unwrap();
@ -1657,16 +1658,9 @@ impl<ConcreteThreadSafeLayoutNode> NodeUtils for ConcreteThreadSafeLayoutNode
}
#[inline(always)]
fn set_flow_construction_result(self, mut result: ConstructionResult) {
if self.can_be_fragmented() {
if let ConstructionResult::Flow(ref mut flow, _) = result {
FlowRef::deref_mut(flow).mut_base().flags.insert(FlowFlags::CAN_BE_FRAGMENTED);
}
}
fn set_flow_construction_result(self, result: ConstructionResult) {
let mut layout_data = self.mutate_layout_data().unwrap();
let dst = self.construction_result_mut(&mut *layout_data);
*dst = result;
}

View file

@ -992,6 +992,10 @@ impl BaseFlow {
let mut flags = FlowFlags::empty();
match style {
Some(style) => {
if style.can_be_fragmented() {
flags.insert(FlowFlags::CAN_BE_FRAGMENTED);
}
match style.get_box().position {
Position::Absolute | Position::Fixed => {
flags.insert(FlowFlags::IS_ABSOLUTELY_POSITIONED);

View file

@ -280,7 +280,8 @@ impl<'a> PostorderFlowTraversal for AssignBSizes<'a> {
fn should_process(&self, flow: &mut Flow) -> bool {
let base = flow.base();
base.restyle_damage.intersects(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW) &&
// The fragmentation countainer is responsible for calling Flow::fragment recursively
// The fragmentation countainer is responsible for calling
// Flow::fragment recursively
!base.flags.contains(FlowFlags::CAN_BE_FRAGMENTED)
}
}