Remove servo_config dependency for geckolib

This commit is contained in:
Xidorn Quan 2017-04-07 17:12:01 +10:00
parent 3150a92651
commit c857878ce9
6 changed files with 53 additions and 12 deletions

View file

@ -13,7 +13,7 @@ use dom::{DirtyDescendants, NodeInfo, TElement, TNode};
use matching::{MatchMethods, StyleSharingBehavior};
use restyle_hints::{RESTYLE_DESCENDANTS, RESTYLE_SELF};
use selector_parser::RestyleDamage;
use servo_config::opts;
#[cfg(feature = "servo")] use servo_config::opts;
use std::borrow::BorrowMut;
use stylist::Stylist;
@ -100,6 +100,16 @@ impl TraversalDriver {
}
}
#[cfg(feature = "servo")]
fn is_servo_nonincremental_layout() -> bool {
opts::get().nonincremental_layout
}
#[cfg(not(feature = "servo"))]
fn is_servo_nonincremental_layout() -> bool {
false
}
/// A DOM Traversal trait, that is used to generically implement styling for
/// Gecko and Servo.
pub trait DomTraversal<E: TElement> : Sync {
@ -175,7 +185,7 @@ pub trait DomTraversal<E: TElement> : Sync {
/// Returns true if traversal is needed for the given node and subtree.
fn node_needs_traversal(node: E::ConcreteNode, animation_only: bool) -> bool {
// Non-incremental layout visits every node.
if cfg!(feature = "servo") && opts::get().nonincremental_layout {
if is_servo_nonincremental_layout() {
return true;
}