Auto merge of #17318 - aethanyc:fix-pseudo-xbl-stylesheet, r=emilio

stylo: Fix pseudo element matching for XBL stylesheets (Bug 1371577)

This change is reviewed in https://bugzilla.mozilla.org/show_bug.cgi?id=1371577#c9

<!-- 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/17318)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-06-14 05:11:31 -07:00 committed by GitHub
commit 5dce166266
3 changed files with 58 additions and 26 deletions

View file

@ -382,17 +382,19 @@ impl<'lb> GeckoXBLBinding<'lb> {
// Implements Gecko's nsXBLBinding::WalkRules().
fn get_declarations_for<E, V>(&self,
element: &E,
pseudo_element: Option<&PseudoElement>,
applicable_declarations: &mut V)
where E: TElement,
V: Push<ApplicableDeclarationBlock> + VecLike<ApplicableDeclarationBlock> {
if let Some(base_binding) = self.base_binding() {
base_binding.get_declarations_for(element, applicable_declarations);
base_binding.get_declarations_for(element, pseudo_element, applicable_declarations);
}
let raw_data = unsafe { bindings::Gecko_XBLBinding_GetRawServoStyleSet(self.0) };
if let Some(raw_data) = raw_data {
let data = PerDocumentStyleData::from_ffi(&*raw_data).borrow();
data.stylist.push_applicable_declarations_as_xbl_only_stylist(element,
pseudo_element,
applicable_declarations);
}
}
@ -942,6 +944,7 @@ impl<'le> TElement for GeckoElement<'le> {
// Implements Gecko's nsBindingManager::WalkRules(). Returns whether to cut off the
// inheritance.
fn get_declarations_from_xbl_bindings<V>(&self,
pseudo_element: Option<&PseudoElement>,
applicable_declarations: &mut V)
-> bool
where V: Push<ApplicableDeclarationBlock> + VecLike<ApplicableDeclarationBlock> {
@ -951,7 +954,9 @@ impl<'le> TElement for GeckoElement<'le> {
while let Some(element) = current {
if let Some(binding) = element.get_xbl_binding() {
binding.get_declarations_for(self, applicable_declarations);
binding.get_declarations_for(self,
pseudo_element,
applicable_declarations);
// If we're not looking at our original element, allow the binding to cut off
// style inheritance.