Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement :required/:optional support for stylo. #16090

Merged
merged 1 commit into from Mar 23, 2017
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -57,7 +57,11 @@ bitflags! {
const IN_HANDLER_DISABLED_STATE = 1 << 18,
#[doc = "Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-handler-crashed"]
const IN_HANDLER_CRASHED_STATE = 1 << 19,
#[doc = "https://html.spec.whatwg.org/multipage/#selector-required"]
const IN_REQUIRED_STATE = 1 << 20,
#[doc = "https://html.spec.whatwg.org/multipage/#selector-optional"]
const IN_OPTIONAL_STATE = 1 << 21,
#[doc = "https://html.spec.whatwg.org/multipage/#selector-read-write"]
const IN_READ_WRITE_STATE = 1 << 20,
const IN_READ_WRITE_STATE = 1 << 22,
}
}
@@ -59,6 +59,8 @@ macro_rules! apply_non_ts_list {
PSEUDO_CLASS_INTERNAL),
("-moz-handler-crashed", MozHandlerCrashed, mozHandlerCrashed, IN_HANDLER_CRASHED_STATE,
PSEUDO_CLASS_INTERNAL),
("required", Required, required, IN_REQUIRED_STATE, _),
("optional", Optional, optional, IN_OPTIONAL_STATE, _),
("read-write", ReadWrite, _, IN_READ_WRITE_STATE, _),
("read-only", ReadOnly, _, IN_READ_WRITE_STATE, _),

@@ -707,7 +707,9 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
NonTSPseudoClass::MozLoading |
NonTSPseudoClass::MozHandlerBlocked |
NonTSPseudoClass::MozHandlerDisabled |
NonTSPseudoClass::MozHandlerCrashed => {
NonTSPseudoClass::MozHandlerCrashed |
NonTSPseudoClass::Required |
NonTSPseudoClass::Optional => {
self.get_state().contains(pseudo_class.state_flag())
},
NonTSPseudoClass::ReadOnly => {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.