mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Force reflow in the sequential fallback of block format context
When reflowing a block format context during the inorder traversal, propagate restyle damage manually to its children since they were already reflowed.
This commit is contained in:
parent
56435db820
commit
68f74d5cbe
6 changed files with 25 additions and 14 deletions
|
@ -43,6 +43,7 @@ use flow_list::FlowList;
|
||||||
use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow};
|
use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow};
|
||||||
use fragment::{IS_INLINE_FLEX_ITEM, IS_BLOCK_FLEX_ITEM};
|
use fragment::{IS_INLINE_FLEX_ITEM, IS_BLOCK_FLEX_ITEM};
|
||||||
use gfx_traits::print_tree::PrintTree;
|
use gfx_traits::print_tree::PrintTree;
|
||||||
|
use incremental::RelayoutMode;
|
||||||
use layout_debug;
|
use layout_debug;
|
||||||
use model::{AdjoiningMargins, CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo, MaybeAuto};
|
use model::{AdjoiningMargins, CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo, MaybeAuto};
|
||||||
use model::{specified, specified_or_none};
|
use model::{specified, specified_or_none};
|
||||||
|
@ -1549,7 +1550,7 @@ impl BlockFlow {
|
||||||
self.assign_inline_sizes(layout_context);
|
self.assign_inline_sizes(layout_context);
|
||||||
// Re-run layout on our children.
|
// Re-run layout on our children.
|
||||||
for child in flow::mut_base(self).children.iter_mut() {
|
for child in flow::mut_base(self).children.iter_mut() {
|
||||||
sequential::traverse_flow_tree_preorder(child, layout_context);
|
sequential::traverse_flow_tree_preorder(child, layout_context, RelayoutMode::Force);
|
||||||
}
|
}
|
||||||
// Assign our final-final block size.
|
// Assign our final-final block size.
|
||||||
self.assign_block_size(layout_context);
|
self.assign_block_size(layout_context);
|
||||||
|
|
|
@ -7,6 +7,13 @@ use style::computed_values::float;
|
||||||
use style::selector_parser::RestyleDamage;
|
use style::selector_parser::RestyleDamage;
|
||||||
use style::servo::restyle_damage::{REFLOW, RECONSTRUCT_FLOW};
|
use style::servo::restyle_damage::{REFLOW, RECONSTRUCT_FLOW};
|
||||||
|
|
||||||
|
/// Used in a flow traversal to indicate whether this re-layout should be incremental or not.
|
||||||
|
#[derive(Clone, Copy, PartialEq)]
|
||||||
|
pub enum RelayoutMode {
|
||||||
|
Incremental,
|
||||||
|
Force
|
||||||
|
}
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
pub flags SpecialRestyleDamage: u8 {
|
pub flags SpecialRestyleDamage: u8 {
|
||||||
#[doc = "If this flag is set, we need to reflow the entire document. This is more or less a \
|
#[doc = "If this flag is set, we need to reflow the entire document. This is more or less a \
|
||||||
|
|
|
@ -14,8 +14,9 @@ use flow::{PostorderFlowTraversal, PreorderFlowTraversal};
|
||||||
use flow::IS_ABSOLUTELY_POSITIONED;
|
use flow::IS_ABSOLUTELY_POSITIONED;
|
||||||
use fragment::FragmentBorderBoxIterator;
|
use fragment::FragmentBorderBoxIterator;
|
||||||
use generated_content::ResolveGeneratedContent;
|
use generated_content::ResolveGeneratedContent;
|
||||||
|
use incremental::RelayoutMode;
|
||||||
use servo_config::opts;
|
use servo_config::opts;
|
||||||
use style::servo::restyle_damage::{REFLOW, STORE_OVERFLOW};
|
use style::servo::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW, STORE_OVERFLOW};
|
||||||
use traversal::{AssignBSizes, AssignISizes, BubbleISizes, BuildDisplayList};
|
use traversal::{AssignBSizes, AssignISizes, BubbleISizes, BuildDisplayList};
|
||||||
|
|
||||||
pub use style::sequential::traverse_dom;
|
pub use style::sequential::traverse_dom;
|
||||||
|
@ -38,16 +39,24 @@ pub fn resolve_generated_content(root: &mut Flow, layout_context: &LayoutContext
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn traverse_flow_tree_preorder(root: &mut Flow,
|
pub fn traverse_flow_tree_preorder(root: &mut Flow,
|
||||||
layout_context: &LayoutContext) {
|
layout_context: &LayoutContext,
|
||||||
|
relayout_mode: RelayoutMode) {
|
||||||
fn doit(flow: &mut Flow,
|
fn doit(flow: &mut Flow,
|
||||||
assign_inline_sizes: AssignISizes,
|
assign_inline_sizes: AssignISizes,
|
||||||
assign_block_sizes: AssignBSizes) {
|
assign_block_sizes: AssignBSizes,
|
||||||
|
relayout_mode: RelayoutMode) {
|
||||||
|
// Force reflow children during this traversal. This is needed when we failed
|
||||||
|
// the float speculation of a block formatting context and need to fix it.
|
||||||
|
if relayout_mode == RelayoutMode::Force {
|
||||||
|
flow::mut_base(flow).restyle_damage.insert(REFLOW_OUT_OF_FLOW | REFLOW);
|
||||||
|
}
|
||||||
|
|
||||||
if assign_inline_sizes.should_process(flow) {
|
if assign_inline_sizes.should_process(flow) {
|
||||||
assign_inline_sizes.process(flow);
|
assign_inline_sizes.process(flow);
|
||||||
}
|
}
|
||||||
|
|
||||||
for kid in flow::child_iter_mut(flow) {
|
for kid in flow::child_iter_mut(flow) {
|
||||||
doit(kid, assign_inline_sizes, assign_block_sizes);
|
doit(kid, assign_inline_sizes, assign_block_sizes, relayout_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if assign_block_sizes.should_process(flow) {
|
if assign_block_sizes.should_process(flow) {
|
||||||
|
@ -66,7 +75,7 @@ pub fn traverse_flow_tree_preorder(root: &mut Flow,
|
||||||
let assign_inline_sizes = AssignISizes { layout_context: &layout_context };
|
let assign_inline_sizes = AssignISizes { layout_context: &layout_context };
|
||||||
let assign_block_sizes = AssignBSizes { layout_context: &layout_context };
|
let assign_block_sizes = AssignBSizes { layout_context: &layout_context };
|
||||||
|
|
||||||
doit(root, assign_inline_sizes, assign_block_sizes);
|
doit(root, assign_inline_sizes, assign_block_sizes, relayout_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_display_list_for_subtree<'a>(flow_root: &mut Flow,
|
pub fn build_display_list_for_subtree<'a>(flow_root: &mut Flow,
|
||||||
|
|
|
@ -60,7 +60,7 @@ use layout::context::heap_size_of_persistent_local_context;
|
||||||
use layout::display_list_builder::ToGfxColor;
|
use layout::display_list_builder::ToGfxColor;
|
||||||
use layout::flow::{self, Flow, ImmutableFlowUtils, MutableFlowUtils, MutableOwnedFlowUtils};
|
use layout::flow::{self, Flow, ImmutableFlowUtils, MutableFlowUtils, MutableOwnedFlowUtils};
|
||||||
use layout::flow_ref::FlowRef;
|
use layout::flow_ref::FlowRef;
|
||||||
use layout::incremental::{LayoutDamageComputation, REFLOW_ENTIRE_DOCUMENT};
|
use layout::incremental::{LayoutDamageComputation, REFLOW_ENTIRE_DOCUMENT, RelayoutMode};
|
||||||
use layout::layout_debug;
|
use layout::layout_debug;
|
||||||
use layout::opaque_node::OpaqueNodeMethods;
|
use layout::opaque_node::OpaqueNodeMethods;
|
||||||
use layout::parallel;
|
use layout::parallel;
|
||||||
|
@ -810,7 +810,7 @@ impl LayoutThread {
|
||||||
fn solve_constraints(layout_root: &mut Flow,
|
fn solve_constraints(layout_root: &mut Flow,
|
||||||
layout_context: &LayoutContext) {
|
layout_context: &LayoutContext) {
|
||||||
let _scope = layout_debug_scope!("solve_constraints");
|
let _scope = layout_debug_scope!("solve_constraints");
|
||||||
sequential::traverse_flow_tree_preorder(layout_root, layout_context);
|
sequential::traverse_flow_tree_preorder(layout_root, layout_context, RelayoutMode::Incremental);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Performs layout constraint solving in parallel.
|
/// Performs layout constraint solving in parallel.
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
[floats-038.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[floats-wrap-bfc-002-left-table.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
Loading…
Add table
Add a link
Reference in a new issue