mirror of
https://github.com/servo/servo.git
synced 2025-08-09 23:45:35 +01:00
Incremental Style Recalc
This patch puts in the initial framework for incremental reflow. Nodes' styles are no longer recalculated unless the node has changed. I've been hacking on the general problem of incremental reflow for the past couple weeks, and I've yet to get a full implementation that actually passes all the reftests + wikipedia + cnn. Therefore, I'm going to try to land the different parts of it one by one. This patch only does incremental style recalc, without incremental flow construction, inline-size bubbling, reflow, or display lists. Those will be coming in that order as I finish them. At least with this strategy, I can land a working version of incremental reflow, even if not yet complete. r? @pcwalton
This commit is contained in:
parent
510f8a817f
commit
d12c6e7383
31 changed files with 641 additions and 424 deletions
|
@ -11,6 +11,7 @@ use flow::{BaseFlow, FlowClass, Flow, InlineFlowClass, MutableFlowUtils};
|
|||
use flow;
|
||||
use fragment::{Fragment, InlineBlockFragment, ScannedTextFragment, ScannedTextFragmentInfo};
|
||||
use fragment::{SplitInfo};
|
||||
use incremental;
|
||||
use layout_debug;
|
||||
use model::IntrinsicISizes;
|
||||
use text;
|
||||
|
@ -494,7 +495,7 @@ impl LineBreaker {
|
|||
self.push_fragment_to_line(in_fragment);
|
||||
true
|
||||
} else {
|
||||
debug!("LineBreaker: Found a new-line character, so splitting theline.");
|
||||
debug!("LineBreaker: Found a new-line character, so splitting the line.");
|
||||
|
||||
let (inline_start, inline_end, run) = in_fragment.find_split_info_by_new_line()
|
||||
.expect("LineBreaker: This split case makes no sense!");
|
||||
|
@ -621,7 +622,7 @@ impl LineBreaker {
|
|||
true
|
||||
},
|
||||
Some((None, None)) => {
|
||||
error!("LineBreaker: This split case makes no sense!");
|
||||
debug!("LineBreaker: Nothing to do.");
|
||||
true
|
||||
},
|
||||
}
|
||||
|
@ -763,13 +764,22 @@ pub struct InlineFlow {
|
|||
|
||||
impl InlineFlow {
|
||||
pub fn from_fragments(node: ThreadSafeLayoutNode, fragments: InlineFragments) -> InlineFlow {
|
||||
InlineFlow {
|
||||
let fragment_damage =
|
||||
fragments.fragments.iter().fold(
|
||||
incremental::RestyleDamage::empty(),
|
||||
|dmg, frag| dmg | frag.restyle_damage);
|
||||
|
||||
let mut ret = InlineFlow {
|
||||
base: BaseFlow::new(node),
|
||||
fragments: fragments,
|
||||
lines: Vec::new(),
|
||||
minimum_block_size_above_baseline: Au(0),
|
||||
minimum_depth_below_baseline: Au(0),
|
||||
}
|
||||
};
|
||||
|
||||
ret.base.restyle_damage.insert(fragment_damage);
|
||||
|
||||
ret
|
||||
}
|
||||
|
||||
pub fn build_display_list_inline(&mut self, layout_context: &LayoutContext) {
|
||||
|
@ -1273,4 +1283,3 @@ impl InlineMetrics {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue