Dirty elements whose selectors are affected by sibling changes

This fixes incremental layout of nodes that match pseudo-class selectors such
as :first-child, :nth-child, :last-child, :first-of-type, etc.

* Fixes #8191
* Fixes #9063
* Fixes #9303
* Fixes #9448

This code is based on the following flags from Gecko:
https://hg.mozilla.org/mozilla-central/file/e1cf617a1f28/dom/base/nsINode.h#l134
This commit is contained in:
Matt Brubeck 2016-02-19 17:05:38 -08:00
parent d85ee09bc7
commit 973918967f
14 changed files with 145 additions and 47 deletions

View file

@ -53,7 +53,7 @@ use script::dom::node::{CAN_BE_FRAGMENTED, HAS_CHANGED, HAS_DIRTY_DESCENDANTS, I
use script::dom::node::{LayoutNodeHelpers, Node, OpaqueStyleAndLayoutData};
use script::dom::text::Text;
use script::layout_interface::TrustedNodeAddress;
use selectors::matching::DeclarationBlock;
use selectors::matching::{DeclarationBlock, ElementFlags};
use selectors::parser::{AttrSelector, NamespaceConstraint};
use smallvec::VecLike;
use std::borrow::ToOwned;
@ -604,6 +604,10 @@ impl<'le> ::selectors::Element for ServoLayoutElement<'le> {
self.element.html_element_in_html_document_for_layout()
}
}
fn insert_flags(&self, flags: ElementFlags) {
self.element.insert_atomic_flags(flags);
}
}
#[derive(Copy, PartialEq, Clone)]