Auto merge of #16424 - servo:assert-layout, r=bholley

style: relax assertions in dom::element when setting selector flags.

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16424)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-04-13 04:49:30 -05:00 committed by GitHub
commit 3011f76139
2 changed files with 10 additions and 1 deletions

View file

@ -930,8 +930,17 @@ pub trait MatchMethods : TElement {
let self_flags = flags.for_self();
if !self_flags.is_empty() {
if element == self {
// If this is the element we're styling, we have exclusive
// access to the element, and thus it's fine inserting them,
// even from the worker.
unsafe { element.set_selector_flags(self_flags); }
} else {
// Otherwise, this element is an ancestor of the current element
// we're styling, and thus multiple children could write to it
// if we did from here.
//
// Instead, we can read them, and post them if necessary as a
// sequential task in order for them to be processed later.
if !element.has_selector_flags(self_flags) {
let task =
SequentialTask::set_selector_flags(element.clone(),