mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Simplify :dir() implementation
This I noticed while working on the following patches. Shouldn't have any behavior change: the behavior does in fact match the element state flag semantics correctly if we do this. We did split the dir flags into two element bits a while ago. :not(:dir()) still behaves correctly of course, and we have tests for that. Differential Revision: https://phabricator.services.mozilla.com/D130734
This commit is contained in:
parent
327812e3eb
commit
5b68241958
4 changed files with 6 additions and 34 deletions
|
@ -162,7 +162,7 @@ impl NonTSPseudoClass {
|
|||
([$(($css:expr, $name:ident, $state:tt, $flags:tt),)*]) => {
|
||||
match *self {
|
||||
$(NonTSPseudoClass::$name => flag!($state),)*
|
||||
NonTSPseudoClass::Dir(..) |
|
||||
NonTSPseudoClass::Dir(ref dir) => dir.element_state(),
|
||||
NonTSPseudoClass::MozLocaleDir(..) |
|
||||
NonTSPseudoClass::Lang(..) => ElementState::empty(),
|
||||
}
|
||||
|
@ -186,10 +186,8 @@ impl NonTSPseudoClass {
|
|||
self.state_flag().is_empty() &&
|
||||
!matches!(
|
||||
*self,
|
||||
// :dir() depends on state only, but doesn't use state_flag
|
||||
// because its semantics don't quite match. Nevertheless, it
|
||||
// doesn't need cache revalidation, because we already compare
|
||||
// states for elements and candidates.
|
||||
// :dir() depends on state only, but may have an empty
|
||||
// state_flag for invalid arguments.
|
||||
NonTSPseudoClass::Dir(_) |
|
||||
// :-moz-is-html only depends on the state of the document and
|
||||
// the namespace of the element; the former is invariant
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue