Bug 1364377: Fix inheritance of NAC, and selector-matching of pseudo-implementing NAC. r=bholley

MozReview-Commit-ID: DjSyaWHq1Xj
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
Emilio Cobos Álvarez 2017-05-12 12:14:09 +02:00
parent 58253f545b
commit 2ffffcfdce
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 59 additions and 8 deletions

View file

@ -526,6 +526,32 @@ impl<'le> TElement for GeckoElement<'le> {
type ConcreteNode = GeckoNode<'le>;
type FontMetricsProvider = GeckoFontMetricsProvider;
fn inheritance_parent(&self) -> Option<Self> {
if self.is_native_anonymous() {
return self.closest_non_native_anonymous_ancestor();
}
return self.parent_element();
}
fn closest_non_native_anonymous_ancestor(&self) -> Option<Self> {
debug_assert!(self.is_native_anonymous());
let mut parent = match self.parent_element() {
Some(e) => e,
None => return None,
};
loop {
if !parent.is_native_anonymous() {
return Some(parent);
}
parent = match parent.parent_element() {
Some(p) => p,
None => return None,
};
}
}
fn as_node(&self) -> Self::ConcreteNode {
unsafe { GeckoNode(&*(self.0 as *const _ as *const RawGeckoNode)) }
}