mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01: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
|
@ -9,19 +9,21 @@ use context::{SharedStyleContext, StyleContext, ThreadLocalStyleContext};
|
|||
use data::ElementData;
|
||||
use dom::{NodeInfo, TNode};
|
||||
use gecko::wrapper::{GeckoElement, GeckoNode};
|
||||
use traversal::{DomTraversal, PerLevelTraversalData, recalc_style_at};
|
||||
use traversal::{DomTraversal, PerLevelTraversalData, TraversalDriver, recalc_style_at};
|
||||
|
||||
/// This is the simple struct that Gecko uses to encapsulate a DOM traversal for
|
||||
/// styling.
|
||||
pub struct RecalcStyleOnly {
|
||||
shared: SharedStyleContext,
|
||||
driver: TraversalDriver,
|
||||
}
|
||||
|
||||
impl RecalcStyleOnly {
|
||||
/// Create a `RecalcStyleOnly` traversal from a `SharedStyleContext`.
|
||||
pub fn new(shared: SharedStyleContext) -> Self {
|
||||
pub fn new(shared: SharedStyleContext, driver: TraversalDriver) -> Self {
|
||||
RecalcStyleOnly {
|
||||
shared: shared,
|
||||
driver: driver,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -66,4 +68,8 @@ impl<'le> DomTraversal<GeckoElement<'le>> for RecalcStyleOnly {
|
|||
fn create_thread_local_context(&self) -> Self::ThreadLocalContext {
|
||||
ThreadLocalStyleContext::new(&self.shared)
|
||||
}
|
||||
|
||||
fn is_parallel(&self) -> bool {
|
||||
self.driver.is_parallel()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue