mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
style: Expose the traversal kind to the style system.
This way we'll be able to take different paths for the sequential and parallel traversals in some concrete cases. This is a preliminar patch to fix bug 1332525.
This commit is contained in:
parent
7e2329ea4e
commit
f00b628c3a
7 changed files with 64 additions and 13 deletions
|
@ -17,13 +17,14 @@ use style::data::ElementData;
|
|||
use style::dom::{NodeInfo, TElement, TNode};
|
||||
use style::selector_parser::RestyleDamage;
|
||||
use style::servo::restyle_damage::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW, REPAINT};
|
||||
use style::traversal::{DomTraversal, recalc_style_at};
|
||||
use style::traversal::{DomTraversal, TraversalDriver, recalc_style_at};
|
||||
use style::traversal::PerLevelTraversalData;
|
||||
use wrapper::{GetRawData, LayoutNodeHelpers, LayoutNodeLayoutData};
|
||||
use wrapper::ThreadSafeLayoutNodeHelpers;
|
||||
|
||||
pub struct RecalcStyleAndConstructFlows {
|
||||
shared: SharedLayoutContext,
|
||||
driver: TraversalDriver,
|
||||
}
|
||||
|
||||
impl RecalcStyleAndConstructFlows {
|
||||
|
@ -34,9 +35,10 @@ impl RecalcStyleAndConstructFlows {
|
|||
|
||||
impl RecalcStyleAndConstructFlows {
|
||||
/// Creates a traversal context, taking ownership of the shared layout context.
|
||||
pub fn new(shared: SharedLayoutContext) -> Self {
|
||||
pub fn new(shared: SharedLayoutContext, driver: TraversalDriver) -> Self {
|
||||
RecalcStyleAndConstructFlows {
|
||||
shared: shared,
|
||||
driver: driver,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,6 +103,10 @@ impl<E> DomTraversal<E> for RecalcStyleAndConstructFlows
|
|||
fn create_thread_local_context(&self) -> Self::ThreadLocalContext {
|
||||
ScopedThreadLocalLayoutContext::new(&self.shared)
|
||||
}
|
||||
|
||||
fn is_parallel(&self) -> bool {
|
||||
self.driver.is_parallel()
|
||||
}
|
||||
}
|
||||
|
||||
/// A bottom-up, parallelizable traversal.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue