Auto merge of #10834 - yoava333:master, r=SimonSapin

added support for :read-only and :read-write pseudo-classes

partial fix for https://github.com/servo/servo/issues/10732

It's not a full fix because:
1. there's a bug in wpt-test https://github.com/w3c/web-platform-tests/issues/2889#issuecomment-214144420
2. we don't fully support all input types (namely image, color, hidden and range), which are defaulted to input text. this means that :read-write which is applicable to input text is mis-handled in those cases.
3. we don't support contenteditable, which is also possibly :read-write

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10834)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-04-29 08:12:18 -07:00
commit ac8406f4ae
9 changed files with 82 additions and 31 deletions

View file

@ -27,5 +27,7 @@ bitflags! {
const IN_CHECKED_STATE = 0x20,
#[doc = "https://html.spec.whatwg.org/multipage/#selector-indeterminate"]
const IN_INDETERMINATE_STATE = 0x40,
#[doc = "https://html.spec.whatwg.org/multipage/#selector-read-write"]
const IN_READ_WRITE_STATE = 0x80,
}
}

View file

@ -44,6 +44,8 @@ pub enum NonTSPseudoClass {
Checked,
Indeterminate,
ServoNonZeroBorder,
ReadWrite,
ReadOnly
}
impl NonTSPseudoClass {
@ -58,6 +60,7 @@ impl NonTSPseudoClass {
Disabled => IN_DISABLED_STATE,
Checked => IN_CHECKED_STATE,
Indeterminate => IN_INDETERMINATE_STATE,
ReadOnly | ReadWrite => IN_READ_WRITE_STATE,
AnyLink |
Link |
@ -88,6 +91,8 @@ impl SelectorImpl for ServoSelectorImpl {
"disabled" => Disabled,
"checked" => Checked,
"indeterminate" => Indeterminate,
"read-write" => ReadWrite,
"read-only" => ReadOnly,
"-servo-nonzero-border" => {
if !context.in_user_agent_stylesheet {
return Err(());