mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
style: Fix various issues with XBL rule matching.
We were using the wrong MatchingMode and flags setter just because we didn't bother threading them down. This patch fixes the issue seen with the video controls. MozReview-Commit-ID: Il1WOzRDxI1 Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
parent
d82e6926fc
commit
19d34b96e5
2 changed files with 21 additions and 61 deletions
|
@ -26,7 +26,6 @@ use selectors::matching::{ElementSelectorFlags, VisitedHandlingMode};
|
||||||
use selectors::sink::Push;
|
use selectors::sink::Push;
|
||||||
use servo_arc::{Arc, ArcBorrow};
|
use servo_arc::{Arc, ArcBorrow};
|
||||||
use shared_lock::Locked;
|
use shared_lock::Locked;
|
||||||
use smallvec::VecLike;
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
#[cfg(feature = "gecko")] use hash::HashMap;
|
#[cfg(feature = "gecko")] use hash::HashMap;
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
@ -648,24 +647,6 @@ pub trait TElement : Eq + PartialEq + Debug + Hash + Sized + Copy + Clone +
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets declarations from XBL bindings from the element.
|
|
||||||
fn get_declarations_from_xbl_bindings<V>(
|
|
||||||
&self,
|
|
||||||
pseudo_element: Option<&PseudoElement>,
|
|
||||||
applicable_declarations: &mut V
|
|
||||||
) -> bool
|
|
||||||
where
|
|
||||||
V: Push<ApplicableDeclarationBlock> + VecLike<ApplicableDeclarationBlock>
|
|
||||||
{
|
|
||||||
self.each_xbl_stylist(|stylist| {
|
|
||||||
stylist.push_applicable_declarations_as_xbl_only_stylist(
|
|
||||||
self,
|
|
||||||
pseudo_element,
|
|
||||||
applicable_declarations
|
|
||||||
);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Gets the current existing CSS transitions, by |property, end value| pairs in a HashMap.
|
/// Gets the current existing CSS transitions, by |property, end value| pairs in a HashMap.
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
fn get_css_transitions_info(&self)
|
fn get_css_transitions_info(&self)
|
||||||
|
|
|
@ -1015,10 +1015,12 @@ impl Stylist {
|
||||||
let mut inputs = CascadeInputs::default();
|
let mut inputs = CascadeInputs::default();
|
||||||
let mut declarations = ApplicableDeclarationList::new();
|
let mut declarations = ApplicableDeclarationList::new();
|
||||||
let mut matching_context =
|
let mut matching_context =
|
||||||
MatchingContext::new(MatchingMode::ForStatelessPseudoElement,
|
MatchingContext::new(
|
||||||
None,
|
MatchingMode::ForStatelessPseudoElement,
|
||||||
None,
|
None,
|
||||||
self.quirks_mode);
|
None,
|
||||||
|
self.quirks_mode,
|
||||||
|
);
|
||||||
|
|
||||||
self.push_applicable_declarations(
|
self.push_applicable_declarations(
|
||||||
element,
|
element,
|
||||||
|
@ -1181,39 +1183,6 @@ impl Stylist {
|
||||||
self.quirks_mode = quirks_mode;
|
self.quirks_mode = quirks_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the applicable CSS declarations for the given element by
|
|
||||||
/// treating us as an XBL stylesheet-only stylist.
|
|
||||||
pub fn push_applicable_declarations_as_xbl_only_stylist<E, V>(
|
|
||||||
&self,
|
|
||||||
element: &E,
|
|
||||||
pseudo_element: Option<&PseudoElement>,
|
|
||||||
applicable_declarations: &mut V
|
|
||||||
)
|
|
||||||
where
|
|
||||||
E: TElement,
|
|
||||||
V: Push<ApplicableDeclarationBlock> + VecLike<ApplicableDeclarationBlock>,
|
|
||||||
{
|
|
||||||
let mut matching_context =
|
|
||||||
MatchingContext::new(MatchingMode::Normal, None, None, self.quirks_mode);
|
|
||||||
let mut dummy_flag_setter = |_: &E, _: ElementSelectorFlags| {};
|
|
||||||
|
|
||||||
let rule_hash_target = element.rule_hash_target();
|
|
||||||
|
|
||||||
// nsXBLPrototypeResources::LoadResources() loads Chrome XBL style
|
|
||||||
// sheets under eAuthorSheetFeatures level.
|
|
||||||
if let Some(map) = self.cascade_data.author.borrow_for_pseudo(pseudo_element) {
|
|
||||||
map.get_all_matching_rules(
|
|
||||||
element,
|
|
||||||
&rule_hash_target,
|
|
||||||
applicable_declarations,
|
|
||||||
&mut matching_context,
|
|
||||||
self.quirks_mode,
|
|
||||||
&mut dummy_flag_setter,
|
|
||||||
CascadeLevel::XBL,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the applicable CSS declarations for the given element.
|
/// Returns the applicable CSS declarations for the given element.
|
||||||
///
|
///
|
||||||
/// This corresponds to `ElementRuleCollector` in WebKit.
|
/// This corresponds to `ElementRuleCollector` in WebKit.
|
||||||
|
@ -1303,11 +1272,21 @@ impl Stylist {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 3b: XBL rules.
|
// Step 3b: XBL rules.
|
||||||
let cut_off_inheritance =
|
let cut_off_inheritance = element.each_xbl_stylist(|stylist| {
|
||||||
element.get_declarations_from_xbl_bindings(
|
// ServoStyleSet::CreateXBLServoStyleSet() loads XBL style sheets
|
||||||
pseudo_element,
|
// under eAuthorSheetFeatures level.
|
||||||
applicable_declarations,
|
if let Some(map) = stylist.cascade_data.author.borrow_for_pseudo(pseudo_element) {
|
||||||
);
|
map.get_all_matching_rules(
|
||||||
|
element,
|
||||||
|
&rule_hash_target,
|
||||||
|
applicable_declarations,
|
||||||
|
context,
|
||||||
|
self.quirks_mode,
|
||||||
|
flags_setter,
|
||||||
|
CascadeLevel::XBL,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if rule_hash_target.matches_user_and_author_rules() && !only_default_rules {
|
if rule_hash_target.matches_user_and_author_rules() && !only_default_rules {
|
||||||
// Gecko skips author normal rules if cutting off inheritance.
|
// Gecko skips author normal rules if cutting off inheritance.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue