servo: Merge #17386 - :-moz-locale-dir shouldn't be a revalidation selector (from bzbarsky:locale-dir-not-revalidation); r=emilio

Fixes Gecko bug 1374019 <https://bugzilla.mozilla.org/show_bug.cgi?id=1374019>

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix https://bugzilla.mozilla.org/show_bug.cgi?id=1374019

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

Source-Repo: https://github.com/servo/servo
Source-Revision: 4c5f7bfaa3bfa57b92b1a30f86e4d5e4031d78db

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 0b72e43e6db84e8db0d34410dd0273f9c7590ff3
This commit is contained in:
Boris Zbarsky 2017-06-18 02:14:22 -07:00
Родитель ea0f1a2acc
Коммит 2d205eed24
1 изменённых файлов: 18 добавлений и 5 удалений

Просмотреть файл

@ -176,16 +176,29 @@ impl NonTSPseudoClass {
/// Returns true if the given pseudoclass should trigger style sharing cache revalidation. /// Returns true if the given pseudoclass should trigger style sharing cache revalidation.
pub fn needs_cache_revalidation(&self) -> bool { pub fn needs_cache_revalidation(&self) -> bool {
// :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.
self.state_flag().is_empty() && self.state_flag().is_empty() &&
!matches!(*self, !matches!(*self,
// :-moz-any is handled by the revalidation visitor walking
// the things inside it; it does not need to cause
// revalidation on its own.
NonTSPseudoClass::MozAny(_) | NonTSPseudoClass::MozAny(_) |
// :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.
NonTSPseudoClass::Dir(_) | NonTSPseudoClass::Dir(_) |
// :-moz-is-html only depends on the state of the document and
// the namespace of the element; the former is invariant
// across all the elements involved and the latter is already
// checked for by our caching precondtions.
NonTSPseudoClass::MozIsHTML | NonTSPseudoClass::MozIsHTML |
NonTSPseudoClass::MozPlaceholder) // :-moz-placeholder is parsed but never matches.
NonTSPseudoClass::MozPlaceholder |
// :-moz-locale-dir depends only on the state of the document,
// which is invariant across all the elements involved in a
// given style cache.
NonTSPseudoClass::MozLocaleDir(_)
)
} }
/// Convert NonTSPseudoClass to Gecko's CSSPseudoClassType. /// Convert NonTSPseudoClass to Gecko's CSSPseudoClassType.