Build Fragments without the RECONSTRUCT_FLOW bit

The RECONSTRUCT_FLOW restyle damage bit shouldn't apply to newly
constructed flow tree elements. It is explicitly removed for Flows, but
not for Fragments. This causes RECONSTRUCT_FLOW to bubble up to Flows
that contain any Fragments at all. Instead explicitly remove the
RECONSTRUCT_FLOW bit when creating a new Fragment.

There isn't a good way to test this currently, but all tests should
continue to pass.
This commit is contained in:
Martin Robinson 2015-11-27 22:27:21 +01:00
parent a515fe320b
commit 12db4594dd

View file

@ -17,7 +17,7 @@ use gfx;
use gfx::display_list::{BLUR_INFLATION_FACTOR, OpaqueNode}; use gfx::display_list::{BLUR_INFLATION_FACTOR, OpaqueNode};
use gfx::text::glyph::CharIndex; use gfx::text::glyph::CharIndex;
use gfx::text::text_run::{TextRun, TextRunSlice}; use gfx::text::text_run::{TextRun, TextRunSlice};
use incremental::{self, RestyleDamage}; use incremental::{self, RECONSTRUCT_FLOW, RestyleDamage};
use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFragmentContext, InlineFragmentNodeInfo}; use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFragmentContext, InlineFragmentNodeInfo};
use inline::{InlineMetrics, LAST_FRAGMENT_OF_ELEMENT}; use inline::{InlineMetrics, LAST_FRAGMENT_OF_ELEMENT};
use ipc_channel::ipc::IpcSender; use ipc_channel::ipc::IpcSender;
@ -774,10 +774,14 @@ impl Fragment {
pub fn new(node: &ServoThreadSafeLayoutNode, specific: SpecificFragmentInfo) -> Fragment { pub fn new(node: &ServoThreadSafeLayoutNode, specific: SpecificFragmentInfo) -> Fragment {
let style = node.style().clone(); let style = node.style().clone();
let writing_mode = style.writing_mode; let writing_mode = style.writing_mode;
let mut restyle_damage = node.restyle_damage();
restyle_damage.remove(RECONSTRUCT_FLOW);
Fragment { Fragment {
node: node.opaque(), node: node.opaque(),
style: style, style: style,
restyle_damage: node.restyle_damage(), restyle_damage: restyle_damage,
border_box: LogicalRect::zero(writing_mode), border_box: LogicalRect::zero(writing_mode),
border_padding: LogicalMargin::zero(writing_mode), border_padding: LogicalMargin::zero(writing_mode),
margin: LogicalMargin::zero(writing_mode), margin: LogicalMargin::zero(writing_mode),
@ -793,10 +797,13 @@ impl Fragment {
pub fn from_opaque_node_and_style(node: OpaqueNode, pub fn from_opaque_node_and_style(node: OpaqueNode,
pseudo: PseudoElementType<()>, pseudo: PseudoElementType<()>,
style: Arc<ComputedValues>, style: Arc<ComputedValues>,
restyle_damage: RestyleDamage, mut restyle_damage: RestyleDamage,
specific: SpecificFragmentInfo) specific: SpecificFragmentInfo)
-> Fragment { -> Fragment {
let writing_mode = style.writing_mode; let writing_mode = style.writing_mode;
restyle_damage.remove(RECONSTRUCT_FLOW);
Fragment { Fragment {
node: node, node: node,
style: style, style: style,
@ -826,10 +833,13 @@ impl Fragment {
self.border_box.start, self.border_box.start,
size); size);
let mut restyle_damage = incremental::rebuild_and_reflow();
restyle_damage.remove(RECONSTRUCT_FLOW);
Fragment { Fragment {
node: self.node, node: self.node,
style: self.style.clone(), style: self.style.clone(),
restyle_damage: incremental::rebuild_and_reflow(), restyle_damage: restyle_damage,
border_box: new_border_box, border_box: new_border_box,
border_padding: self.border_padding, border_padding: self.border_padding,
margin: self.margin, margin: self.margin,