зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset d44f633899ce (bug 1351535)
This commit is contained in:
Родитель
f9e4178cd2
Коммит
5ca82fe2ef
|
@ -523,7 +523,7 @@ impl LayoutThread {
|
||||||
local_context_creation_data: Mutex::new(thread_local_style_context_creation_data),
|
local_context_creation_data: Mutex::new(thread_local_style_context_creation_data),
|
||||||
timer: self.timer.clone(),
|
timer: self.timer.clone(),
|
||||||
quirks_mode: self.quirks_mode.unwrap(),
|
quirks_mode: self.quirks_mode.unwrap(),
|
||||||
traversal_flags: TraversalFlags::empty(),
|
animation_only_restyle: false,
|
||||||
},
|
},
|
||||||
image_cache: self.image_cache.clone(),
|
image_cache: self.image_cache.clone(),
|
||||||
font_cache_thread: Mutex::new(self.font_cache_thread.clone()),
|
font_cache_thread: Mutex::new(self.font_cache_thread.clone()),
|
||||||
|
|
|
@ -29,7 +29,7 @@ use stylist::Stylist;
|
||||||
use thread_state;
|
use thread_state;
|
||||||
use time;
|
use time;
|
||||||
use timer::Timer;
|
use timer::Timer;
|
||||||
use traversal::{DomTraversal, TraversalFlags};
|
use traversal::DomTraversal;
|
||||||
|
|
||||||
/// This structure is used to create a local style context from a shared one.
|
/// This structure is used to create a local style context from a shared one.
|
||||||
pub struct ThreadLocalStyleContextCreationInfo {
|
pub struct ThreadLocalStyleContextCreationInfo {
|
||||||
|
@ -89,8 +89,8 @@ pub struct SharedStyleContext<'a> {
|
||||||
/// The QuirksMode state which the document needs to be rendered with
|
/// The QuirksMode state which the document needs to be rendered with
|
||||||
pub quirks_mode: QuirksMode,
|
pub quirks_mode: QuirksMode,
|
||||||
|
|
||||||
/// Flags controlling how we traverse the tree.
|
/// True if the traversal is processing only animation restyles.
|
||||||
pub traversal_flags: TraversalFlags,
|
pub animation_only_restyle: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> SharedStyleContext<'a> {
|
impl<'a> SharedStyleContext<'a> {
|
||||||
|
|
|
@ -1038,7 +1038,7 @@ pub trait MatchMethods : TElement {
|
||||||
// in the name of animation-only traversal. Rest of restyle hints
|
// in the name of animation-only traversal. Rest of restyle hints
|
||||||
// will be processed in a subsequent normal traversal.
|
// will be processed in a subsequent normal traversal.
|
||||||
if hint.contains(RESTYLE_CSS_ANIMATIONS) {
|
if hint.contains(RESTYLE_CSS_ANIMATIONS) {
|
||||||
debug_assert!(context.shared.traversal_flags.for_animation_only());
|
debug_assert!(context.shared.animation_only_restyle);
|
||||||
|
|
||||||
let animation_rule = self.get_animation_rule(None);
|
let animation_rule = self.get_animation_rule(None);
|
||||||
replace_rule_node(CascadeLevel::Animations,
|
replace_rule_node(CascadeLevel::Animations,
|
||||||
|
|
|
@ -175,7 +175,7 @@ pub trait DomTraversal<E: TElement> : Sync {
|
||||||
}
|
}
|
||||||
|
|
||||||
PreTraverseToken {
|
PreTraverseToken {
|
||||||
traverse: Self::node_needs_traversal(root.as_node(), traversal_flags),
|
traverse: Self::node_needs_traversal(root.as_node(), traversal_flags.for_animation_only()),
|
||||||
unstyled_children_only: false,
|
unstyled_children_only: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ pub trait DomTraversal<E: TElement> : Sync {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if traversal is needed for the given node and subtree.
|
/// Returns true if traversal is needed for the given node and subtree.
|
||||||
fn node_needs_traversal(node: E::ConcreteNode, traversal_flags: TraversalFlags) -> bool {
|
fn node_needs_traversal(node: E::ConcreteNode, animation_only: bool) -> bool {
|
||||||
// Non-incremental layout visits every node.
|
// Non-incremental layout visits every node.
|
||||||
if is_servo_nonincremental_layout() {
|
if is_servo_nonincremental_layout() {
|
||||||
return true;
|
return true;
|
||||||
|
@ -216,7 +216,7 @@ pub trait DomTraversal<E: TElement> : Sync {
|
||||||
// In case of animation-only traversal we need to traverse
|
// In case of animation-only traversal we need to traverse
|
||||||
// the element if the element has animation only dirty
|
// the element if the element has animation only dirty
|
||||||
// descendants bit, animation-only restyle hint or recascade.
|
// descendants bit, animation-only restyle hint or recascade.
|
||||||
if traversal_flags.for_animation_only() {
|
if animation_only {
|
||||||
if el.has_animation_only_dirty_descendants() {
|
if el.has_animation_only_dirty_descendants() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -341,7 +341,7 @@ pub trait DomTraversal<E: TElement> : Sync {
|
||||||
}
|
}
|
||||||
|
|
||||||
for kid in parent.as_node().children() {
|
for kid in parent.as_node().children() {
|
||||||
if Self::node_needs_traversal(kid, self.shared_context().traversal_flags) {
|
if Self::node_needs_traversal(kid, self.shared_context().animation_only_restyle) {
|
||||||
let el = kid.as_element();
|
let el = kid.as_element();
|
||||||
if el.as_ref().and_then(|el| el.borrow_data())
|
if el.as_ref().and_then(|el| el.borrow_data())
|
||||||
.map_or(false, |d| d.has_styles())
|
.map_or(false, |d| d.has_styles())
|
||||||
|
@ -517,7 +517,7 @@ pub fn recalc_style_at<E, D>(traversal: &D,
|
||||||
let propagated_hint = match data.get_restyle_mut() {
|
let propagated_hint = match data.get_restyle_mut() {
|
||||||
None => StoredRestyleHint::empty(),
|
None => StoredRestyleHint::empty(),
|
||||||
Some(r) => {
|
Some(r) => {
|
||||||
debug_assert!(context.shared.traversal_flags.for_animation_only() ||
|
debug_assert!(context.shared.animation_only_restyle ||
|
||||||
!r.hint.has_animation_hint(),
|
!r.hint.has_animation_hint(),
|
||||||
"animation restyle hint should be handled during \
|
"animation restyle hint should be handled during \
|
||||||
animation-only restyles");
|
animation-only restyles");
|
||||||
|
@ -525,14 +525,13 @@ pub fn recalc_style_at<E, D>(traversal: &D,
|
||||||
r.hint.propagate()
|
r.hint.propagate()
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
debug_assert!(data.has_current_styles() ||
|
debug_assert!(data.has_current_styles() || context.shared.animation_only_restyle,
|
||||||
context.shared.traversal_flags.for_animation_only(),
|
|
||||||
"Should have computed style or haven't yet valid computed style in case of animation-only restyle");
|
"Should have computed style or haven't yet valid computed style in case of animation-only restyle");
|
||||||
trace!("propagated_hint={:?}, inherited_style_changed={:?}",
|
trace!("propagated_hint={:?}, inherited_style_changed={:?}",
|
||||||
propagated_hint, inherited_style_changed);
|
propagated_hint, inherited_style_changed);
|
||||||
|
|
||||||
let has_dirty_descendants_for_this_restyle =
|
let has_dirty_descendants_for_this_restyle =
|
||||||
if context.shared.traversal_flags.for_animation_only() {
|
if context.shared.animation_only_restyle {
|
||||||
element.has_animation_only_dirty_descendants()
|
element.has_animation_only_dirty_descendants()
|
||||||
} else {
|
} else {
|
||||||
element.has_dirty_descendants()
|
element.has_dirty_descendants()
|
||||||
|
@ -557,7 +556,7 @@ pub fn recalc_style_at<E, D>(traversal: &D,
|
||||||
inherited_style_changed);
|
inherited_style_changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
if context.shared.traversal_flags.for_animation_only() {
|
if context.shared.animation_only_restyle {
|
||||||
unsafe { element.unset_animation_only_dirty_descendants(); }
|
unsafe { element.unset_animation_only_dirty_descendants(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ unsafe fn dummy_url_data() -> &'static RefPtr<URLExtraData> {
|
||||||
|
|
||||||
fn create_shared_context<'a>(guard: &'a SharedRwLockReadGuard,
|
fn create_shared_context<'a>(guard: &'a SharedRwLockReadGuard,
|
||||||
per_doc_data: &PerDocumentStyleDataImpl,
|
per_doc_data: &PerDocumentStyleDataImpl,
|
||||||
traversal_flags: TraversalFlags) -> SharedStyleContext<'a> {
|
animation_only: bool) -> SharedStyleContext<'a> {
|
||||||
let local_context_data =
|
let local_context_data =
|
||||||
ThreadLocalStyleContextCreationInfo::new(per_doc_data.new_animations_sender.clone());
|
ThreadLocalStyleContextCreationInfo::new(per_doc_data.new_animations_sender.clone());
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ fn create_shared_context<'a>(guard: &'a SharedRwLockReadGuard,
|
||||||
timer: Timer::new(),
|
timer: Timer::new(),
|
||||||
// FIXME Find the real QuirksMode information for this document
|
// FIXME Find the real QuirksMode information for this document
|
||||||
quirks_mode: QuirksMode::NoQuirks,
|
quirks_mode: QuirksMode::NoQuirks,
|
||||||
traversal_flags: traversal_flags,
|
animation_only_restyle: animation_only,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +183,8 @@ fn traverse_subtree(element: GeckoElement, raw_data: RawServoStyleSetBorrowed,
|
||||||
|
|
||||||
let global_style_data = &*GLOBAL_STYLE_DATA;
|
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||||
let guard = global_style_data.shared_lock.read();
|
let guard = global_style_data.shared_lock.read();
|
||||||
let shared_style_context = create_shared_context(&guard, &per_doc_data, traversal_flags);
|
let shared_style_context = create_shared_context(&guard, &per_doc_data,
|
||||||
|
traversal_flags.for_animation_only());
|
||||||
|
|
||||||
let traversal_driver = if global_style_data.style_thread_pool.is_none() {
|
let traversal_driver = if global_style_data.style_thread_pool.is_none() {
|
||||||
TraversalDriver::Sequential
|
TraversalDriver::Sequential
|
||||||
|
@ -397,7 +398,7 @@ pub extern "C" fn Servo_StyleSet_GetBaseComputedValuesForElement(raw_data: RawSe
|
||||||
let doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow();
|
let doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow();
|
||||||
let global_style_data = &*GLOBAL_STYLE_DATA;
|
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||||
let guard = global_style_data.shared_lock.read();
|
let guard = global_style_data.shared_lock.read();
|
||||||
let shared_context = &create_shared_context(&guard, &doc_data, TraversalFlags::empty());
|
let shared_context = &create_shared_context(&guard, &doc_data, false);
|
||||||
|
|
||||||
let element = GeckoElement(element);
|
let element = GeckoElement(element);
|
||||||
let element_data = element.borrow_data().unwrap();
|
let element_data = element.borrow_data().unwrap();
|
||||||
|
@ -1630,7 +1631,7 @@ pub extern "C" fn Servo_ResolveStyleLazily(element: RawGeckoElementBorrowed,
|
||||||
}
|
}
|
||||||
|
|
||||||
// We don't have the style ready. Go ahead and compute it as necessary.
|
// We don't have the style ready. Go ahead and compute it as necessary.
|
||||||
let shared = create_shared_context(&guard, &mut doc_data.borrow_mut(), TraversalFlags::empty());
|
let shared = create_shared_context(&guard, &mut doc_data.borrow_mut(), false);
|
||||||
let mut tlc = ThreadLocalStyleContext::new(&shared);
|
let mut tlc = ThreadLocalStyleContext::new(&shared);
|
||||||
let mut context = StyleContext {
|
let mut context = StyleContext {
|
||||||
shared: &shared,
|
shared: &shared,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче