Bug 1322945 - Remove the requirement that the parent styles must be current to style a subtree. r=heycam

Sometimes Gecko eagerly styles things without processing pending restyles first. In
general we'd like to avoid this, but there can be good reasons (for example, needing
to construct a frame for some small piece of newly-added content in order to do something
specific with that frame, but not wanting to flush all of layout). Just handle it.

MozReview-Commit-ID: EjXs0M4855Q
This commit is contained in:
Bobby Holley 2016-12-11 15:42:48 -10:00
parent 851568f59e
commit 75e4c16bc7
2 changed files with 2 additions and 3 deletions

View file

@ -163,10 +163,10 @@ pub trait TElement : PartialEq + Debug + Sized + Copy + Clone + ElementExt + Pre
/// traversal. Returns the number of children left to process. /// traversal. Returns the number of children left to process.
fn did_process_child(&self) -> isize; fn did_process_child(&self) -> isize;
/// Returns true if this element's style is display:none. /// Returns true if this element's style is display:none. Panics if
/// the element has no style.
fn is_display_none(&self) -> bool { fn is_display_none(&self) -> bool {
let data = self.borrow_data().unwrap(); let data = self.borrow_data().unwrap();
debug_assert!(data.has_current_styles());
data.styles().is_display_none() data.styles().is_display_none()
} }

View file

@ -733,7 +733,6 @@ pub trait MatchMethods : TElement {
// Get our parent's style. // Get our parent's style.
let parent_data = parent.as_ref().map(|x| x.borrow_data().unwrap()); let parent_data = parent.as_ref().map(|x| x.borrow_data().unwrap());
let parent_style = parent_data.as_ref().map(|d| { let parent_style = parent_data.as_ref().map(|d| {
debug_assert!(d.has_current_styles());
&d.styles().primary.values &d.styles().primary.values
}); });