layout: Add a REPOSITION restyle damage type.

Separating out `REPOSITION` from `REPAINT` allows us to compute
stacking-context-relative positions without rebuilding the display list.
This saves a lot of time when responding to script-to-layout queries.
This commit is contained in:
Patrick Walton 2016-09-20 16:14:54 -07:00
parent 1235f4bff6
commit 65e3db1c0d
6 changed files with 52 additions and 35 deletions

View file

@ -42,7 +42,8 @@ use model::{CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo};
use multicol::MulticolFlow;
use parallel::FlowParallelInfo;
use rustc_serialize::{Encodable, Encoder};
use script_layout_interface::restyle_damage::{RECONSTRUCT_FLOW, REFLOW, REFLOW_OUT_OF_FLOW, REPAINT, RestyleDamage};
use script_layout_interface::restyle_damage::{RECONSTRUCT_FLOW, REFLOW, REFLOW_OUT_OF_FLOW};
use script_layout_interface::restyle_damage::{REPAINT, REPOSITION, RestyleDamage};
use script_layout_interface::wrapper_traits::{PseudoElementType, ThreadSafeLayoutNode};
use std::{fmt, mem, raw};
use std::iter::Zip;
@ -320,6 +321,7 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static {
/// Phase 4 of reflow: computes absolute positions.
fn compute_absolute_position(&mut self, _: &SharedLayoutContext) {
// The default implementation is a no-op.
mut_base(self).restyle_damage.remove(REPOSITION)
}
/// Phase 5 of reflow: builds display lists.