mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
set HAS_NEWLY_CONSTRUCTED_FLOW flag for reconstructed flow'less inline element
This commit is contained in:
parent
fc549fcd2f
commit
3e73475d5b
1 changed files with 81 additions and 71 deletions
|
@ -1408,88 +1408,98 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut style = node.style(self.style_context()).clone();
|
let mut set_has_newly_constructed_flow_flag = false;
|
||||||
let mut data = node.mutate_layout_data().unwrap();
|
let result = {
|
||||||
let damage = data.restyle_damage;
|
let mut style = node.style(self.style_context()).clone();
|
||||||
match *node.construction_result_mut(&mut *data) {
|
let mut data = node.mutate_layout_data().unwrap();
|
||||||
ConstructionResult::None => true,
|
let damage = data.restyle_damage;
|
||||||
ConstructionResult::Flow(ref mut flow, _) => {
|
|
||||||
// The node's flow is of the same type and has the same set of children and can
|
|
||||||
// therefore be repaired by simply propagating damage and style to the flow.
|
|
||||||
if !flow.is_block_flow() {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
let flow = flow_ref::deref_mut(flow);
|
|
||||||
flow::mut_base(flow).restyle_damage.insert(damage);
|
|
||||||
flow.repair_style_and_bubble_inline_sizes(&style);
|
|
||||||
true
|
|
||||||
}
|
|
||||||
ConstructionResult::ConstructionItem(ConstructionItem::InlineFragments(
|
|
||||||
ref mut inline_fragments_construction_result)) => {
|
|
||||||
if !inline_fragments_construction_result.splits.is_empty() {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
for fragment in inline_fragments_construction_result.fragments
|
match *node.construction_result_mut(&mut *data) {
|
||||||
.fragments
|
ConstructionResult::None => true,
|
||||||
.iter_mut() {
|
ConstructionResult::Flow(ref mut flow, _) => {
|
||||||
// Only mutate the styles of fragments that represent the dirty node (including
|
// The node's flow is of the same type and has the same set of children and can
|
||||||
// pseudo-element).
|
// therefore be repaired by simply propagating damage and style to the flow.
|
||||||
if fragment.node != node.opaque() {
|
if !flow.is_block_flow() {
|
||||||
continue
|
return false
|
||||||
}
|
|
||||||
if fragment.pseudo != node.get_pseudo_element_type().strip() {
|
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
|
|
||||||
match fragment.specific {
|
let flow = flow_ref::deref_mut(flow);
|
||||||
SpecificFragmentInfo::InlineBlock(ref mut inline_block_fragment) => {
|
flow::mut_base(flow).restyle_damage.insert(damage);
|
||||||
let flow_ref = flow_ref::deref_mut(&mut inline_block_fragment.flow_ref);
|
flow.repair_style_and_bubble_inline_sizes(&style);
|
||||||
flow::mut_base(flow_ref).restyle_damage.insert(damage);
|
true
|
||||||
// FIXME(pcwalton): Fragment restyle damage too?
|
}
|
||||||
flow_ref.repair_style_and_bubble_inline_sizes(&style);
|
ConstructionResult::ConstructionItem(ConstructionItem::InlineFragments(
|
||||||
|
ref mut inline_fragments_construction_result)) => {
|
||||||
|
if !inline_fragments_construction_result.splits.is_empty() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
for fragment in inline_fragments_construction_result.fragments
|
||||||
|
.fragments
|
||||||
|
.iter_mut() {
|
||||||
|
// Only mutate the styles of fragments that represent the dirty node (including
|
||||||
|
// pseudo-element).
|
||||||
|
if fragment.node != node.opaque() {
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
SpecificFragmentInfo::InlineAbsoluteHypothetical(
|
if fragment.pseudo != node.get_pseudo_element_type().strip() {
|
||||||
ref mut inline_absolute_hypothetical_fragment) => {
|
continue
|
||||||
let flow_ref = flow_ref::deref_mut(
|
|
||||||
&mut inline_absolute_hypothetical_fragment.flow_ref);
|
|
||||||
flow::mut_base(flow_ref).restyle_damage.insert(damage);
|
|
||||||
// FIXME(pcwalton): Fragment restyle damage too?
|
|
||||||
flow_ref.repair_style_and_bubble_inline_sizes(&style);
|
|
||||||
}
|
}
|
||||||
SpecificFragmentInfo::InlineAbsolute(ref mut inline_absolute_fragment) => {
|
|
||||||
let flow_ref = flow_ref::deref_mut(
|
match fragment.specific {
|
||||||
&mut inline_absolute_fragment.flow_ref);
|
SpecificFragmentInfo::InlineBlock(ref mut inline_block_fragment) => {
|
||||||
flow::mut_base(flow_ref).restyle_damage.insert(damage);
|
let flow_ref = flow_ref::deref_mut(&mut inline_block_fragment.flow_ref);
|
||||||
// FIXME(pcwalton): Fragment restyle damage too?
|
flow::mut_base(flow_ref).restyle_damage.insert(damage);
|
||||||
flow_ref.repair_style_and_bubble_inline_sizes(&style);
|
// FIXME(pcwalton): Fragment restyle damage too?
|
||||||
}
|
flow_ref.repair_style_and_bubble_inline_sizes(&style);
|
||||||
SpecificFragmentInfo::ScannedText(_) => {
|
}
|
||||||
// Text fragments in ConstructionResult haven't been scanned yet
|
SpecificFragmentInfo::InlineAbsoluteHypothetical(
|
||||||
unreachable!()
|
ref mut inline_absolute_hypothetical_fragment) => {
|
||||||
}
|
let flow_ref = flow_ref::deref_mut(
|
||||||
SpecificFragmentInfo::GeneratedContent(_) |
|
&mut inline_absolute_hypothetical_fragment.flow_ref);
|
||||||
SpecificFragmentInfo::UnscannedText(_) => {
|
flow::mut_base(flow_ref).restyle_damage.insert(damage);
|
||||||
// We can't repair this unscanned text; we need to update the
|
// FIXME(pcwalton): Fragment restyle damage too?
|
||||||
// scanned text fragments.
|
flow_ref.repair_style_and_bubble_inline_sizes(&style);
|
||||||
//
|
}
|
||||||
// TODO: Add code to find and repair the ScannedText fragments?
|
SpecificFragmentInfo::InlineAbsolute(ref mut inline_absolute_fragment) => {
|
||||||
return false
|
let flow_ref = flow_ref::deref_mut(
|
||||||
}
|
&mut inline_absolute_fragment.flow_ref);
|
||||||
_ => {
|
flow::mut_base(flow_ref).restyle_damage.insert(damage);
|
||||||
if node.is_replaced_content() {
|
// FIXME(pcwalton): Fragment restyle damage too?
|
||||||
properties::modify_style_for_replaced_content(&mut style);
|
flow_ref.repair_style_and_bubble_inline_sizes(&style);
|
||||||
|
}
|
||||||
|
SpecificFragmentInfo::ScannedText(_) => {
|
||||||
|
// Text fragments in ConstructionResult haven't been scanned yet
|
||||||
|
unreachable!()
|
||||||
|
}
|
||||||
|
SpecificFragmentInfo::GeneratedContent(_) |
|
||||||
|
SpecificFragmentInfo::UnscannedText(_) => {
|
||||||
|
// We can't repair this unscanned text; we need to update the
|
||||||
|
// scanned text fragments.
|
||||||
|
//
|
||||||
|
// TODO: Add code to find and repair the ScannedText fragments?
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
if node.is_replaced_content() {
|
||||||
|
properties::modify_style_for_replaced_content(&mut style);
|
||||||
|
}
|
||||||
|
fragment.repair_style(&style);
|
||||||
|
set_has_newly_constructed_flow_flag = true;
|
||||||
}
|
}
|
||||||
fragment.repair_style(&style);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
true
|
||||||
|
}
|
||||||
|
ConstructionResult::ConstructionItem(_) => {
|
||||||
|
false
|
||||||
}
|
}
|
||||||
true
|
|
||||||
}
|
|
||||||
ConstructionResult::ConstructionItem(_) => {
|
|
||||||
false
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
if set_has_newly_constructed_flow_flag {
|
||||||
|
node.insert_flags(HAS_NEWLY_CONSTRUCTED_FLOW);
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue