Auto merge of #8162 - bholley:centralize_event_states, r=pcwalton

Centralize event states in rust-selectors

This still needs a rev bump on rust-selectors once https://github.com/servo/rust-selectors/pull/55 gets merged.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8162)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-10-31 10:05:45 +05:30
commit 521a87180a
20 changed files with 123 additions and 169 deletions

View file

@ -1180,11 +1180,11 @@ impl LayoutTask {
} }
} }
let event_state_changes = document.drain_event_state_changes(); let state_changes = document.drain_element_state_changes();
if !needs_dirtying { if !needs_dirtying {
for &(el, state) in event_state_changes.iter() { for &(el, state) in state_changes.iter() {
assert!(!state.is_empty()); assert!(!state.is_empty());
el.note_event_state_change(); el.note_state_change();
} }
} }

View file

@ -47,7 +47,7 @@ extern crate net_traits;
extern crate rustc_serialize; extern crate rustc_serialize;
extern crate script; extern crate script;
extern crate script_traits; extern crate script_traits;
extern crate selectors; #[macro_use(state_pseudo_classes)] extern crate selectors;
extern crate serde; extern crate serde;
extern crate serde_json; extern crate serde_json;
extern crate smallvec; extern crate smallvec;

View file

@ -43,8 +43,7 @@ use script::dom::bindings::conversions::Castable;
use script::dom::bindings::js::LayoutJS; use script::dom::bindings::js::LayoutJS;
use script::dom::characterdata::LayoutCharacterDataHelpers; use script::dom::characterdata::LayoutCharacterDataHelpers;
use script::dom::document::{Document, LayoutDocumentHelpers}; use script::dom::document::{Document, LayoutDocumentHelpers};
use script::dom::element; use script::dom::element::{Element, LayoutElementHelpers, RawLayoutElementHelpers};
use script::dom::element::{Element, EventState, LayoutElementHelpers, RawLayoutElementHelpers};
use script::dom::htmlcanvaselement::{LayoutHTMLCanvasElementHelpers, HTMLCanvasData}; use script::dom::htmlcanvaselement::{LayoutHTMLCanvasElementHelpers, HTMLCanvasData};
use script::dom::htmliframeelement::HTMLIFrameElement; use script::dom::htmliframeelement::HTMLIFrameElement;
use script::dom::htmlimageelement::LayoutHTMLImageElementHelpers; use script::dom::htmlimageelement::LayoutHTMLImageElementHelpers;
@ -56,6 +55,7 @@ use script::dom::text::Text;
use script::layout_interface::TrustedNodeAddress; use script::layout_interface::TrustedNodeAddress;
use selectors::matching::DeclarationBlock; use selectors::matching::DeclarationBlock;
use selectors::parser::{AttrSelector, NamespaceConstraint}; use selectors::parser::{AttrSelector, NamespaceConstraint};
use selectors::states::*;
use smallvec::VecLike; use smallvec::VecLike;
use std::borrow::ToOwned; use std::borrow::ToOwned;
use std::cell::{Ref, RefMut}; use std::cell::{Ref, RefMut};
@ -375,9 +375,9 @@ impl<'le> LayoutDocument<'le> {
self.as_node().children().find(LayoutNode::is_element) self.as_node().children().find(LayoutNode::is_element)
} }
pub fn drain_event_state_changes(&self) -> Vec<(LayoutElement, EventState)> { pub fn drain_element_state_changes(&self) -> Vec<(LayoutElement, ElementState)> {
unsafe { unsafe {
let changes = self.document.drain_event_state_changes(); let changes = self.document.drain_element_state_changes();
Vec::from_iter(changes.iter().map(|&(el, state)| Vec::from_iter(changes.iter().map(|&(el, state)|
(LayoutElement { (LayoutElement {
element: el, element: el,
@ -408,11 +408,11 @@ impl<'le> LayoutElement<'le> {
} }
} }
/// Properly marks nodes as dirty in response to event state changes. /// Properly marks nodes as dirty in response to state changes.
/// ///
/// Currently this implementation is very conservative, and basically mirrors node::dirty_impl. /// Currently this implementation is very conservative, and basically mirrors node::dirty_impl.
/// With restyle hints, we can do less work here. /// With restyle hints, we can do less work here.
pub fn note_event_state_change(&self) { pub fn note_state_change(&self) {
let node = self.as_node(); let node = self.as_node();
// Bail out if we're already dirty. This won't be valid when we start doing more targeted // Bail out if we're already dirty. This won't be valid when we start doing more targeted
@ -453,6 +453,15 @@ fn as_element<'le>(node: LayoutJS<Node>) -> Option<LayoutElement<'le>> {
}) })
} }
macro_rules! state_getter {
($(
$(#[$Flag_attr: meta])*
state $css: expr => $variant: ident / $method: ident /
$flag: ident = $value: expr,
)+) => {
$( fn $method(&self) -> bool { self.element.get_state_for_layout().contains($flag) } )+
}
}
impl<'le> ::selectors::Element for LayoutElement<'le> { impl<'le> ::selectors::Element for LayoutElement<'le> {
fn parent_element(&self) -> Option<LayoutElement<'le>> { fn parent_element(&self) -> Option<LayoutElement<'le>> {
@ -544,20 +553,7 @@ impl<'le> ::selectors::Element for LayoutElement<'le> {
false false
} }
#[inline] state_pseudo_classes!(state_getter);
fn get_hover_state(&self) -> bool {
self.element.get_event_state_for_layout().contains(element::IN_HOVER_STATE)
}
#[inline]
fn get_focus_state(&self) -> bool {
self.element.get_event_state_for_layout().contains(element::IN_FOCUS_STATE)
}
#[inline]
fn get_active_state(&self) -> bool {
self.element.get_event_state_for_layout().contains(element::IN_ACTIVE_STATE)
}
#[inline] #[inline]
fn get_id(&self) -> Option<Atom> { fn get_id(&self) -> Option<Atom> {
@ -566,26 +562,6 @@ impl<'le> ::selectors::Element for LayoutElement<'le> {
} }
} }
#[inline]
fn get_disabled_state(&self) -> bool {
self.element.get_event_state_for_layout().contains(element::IN_DISABLED_STATE)
}
#[inline]
fn get_enabled_state(&self) -> bool {
self.element.get_event_state_for_layout().contains(element::IN_ENABLED_STATE)
}
#[inline]
fn get_checked_state(&self) -> bool {
self.element.get_checked_state_for_layout()
}
#[inline]
fn get_indeterminate_state(&self) -> bool {
self.element.get_indeterminate_state_for_layout()
}
#[inline] #[inline]
fn has_class(&self, name: &Atom) -> bool { fn has_class(&self, name: &Atom) -> bool {
unsafe { unsafe {

View file

@ -62,6 +62,7 @@ use profile_traits::time::ProfilerChan as TimeProfilerChan;
use script_task::ScriptChan; use script_task::ScriptChan;
use script_traits::{TimerEventChan, TimerEventId, TimerSource, UntrustedNodeAddress}; use script_traits::{TimerEventChan, TimerEventId, TimerSource, UntrustedNodeAddress};
use selectors::parser::PseudoElement; use selectors::parser::PseudoElement;
use selectors::states::*;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use smallvec::SmallVec; use smallvec::SmallVec;
use std::boxed::FnBox; use std::boxed::FnBox;
@ -308,6 +309,7 @@ no_jsmanaged_fields!(TimeProfilerChan);
no_jsmanaged_fields!(MemProfilerChan); no_jsmanaged_fields!(MemProfilerChan);
no_jsmanaged_fields!(PseudoElement); no_jsmanaged_fields!(PseudoElement);
no_jsmanaged_fields!(Length); no_jsmanaged_fields!(Length);
no_jsmanaged_fields!(ElementState);
impl JSTraceable for Box<ScriptChan + Send> { impl JSTraceable for Box<ScriptChan + Send> {
#[inline] #[inline]

View file

@ -32,7 +32,7 @@ use dom::customevent::CustomEvent;
use dom::documentfragment::DocumentFragment; use dom::documentfragment::DocumentFragment;
use dom::documenttype::DocumentType; use dom::documenttype::DocumentType;
use dom::domimplementation::DOMImplementation; use dom::domimplementation::DOMImplementation;
use dom::element::{Element, ElementCreator, EventState}; use dom::element::{Element, ElementCreator};
use dom::event::{Event, EventBubbles, EventCancelable}; use dom::event::{Event, EventBubbles, EventCancelable};
use dom::eventtarget::{EventTarget}; use dom::eventtarget::{EventTarget};
use dom::htmlanchorelement::HTMLAnchorElement; use dom::htmlanchorelement::HTMLAnchorElement;
@ -85,6 +85,7 @@ use net_traits::{AsyncResponseTarget, PendingAsyncLoad};
use num::ToPrimitive; use num::ToPrimitive;
use script_task::{MainThreadScriptMsg, Runnable}; use script_task::{MainThreadScriptMsg, Runnable};
use script_traits::{MouseButton, UntrustedNodeAddress}; use script_traits::{MouseButton, UntrustedNodeAddress};
use selectors::states::*;
use std::ascii::AsciiExt; use std::ascii::AsciiExt;
use std::borrow::ToOwned; use std::borrow::ToOwned;
use std::boxed::FnBox; use std::boxed::FnBox;
@ -174,8 +175,8 @@ pub struct Document {
/// This field is set to the document itself for inert documents. /// This field is set to the document itself for inert documents.
/// https://html.spec.whatwg.org/multipage/#appropriate-template-contents-owner-document /// https://html.spec.whatwg.org/multipage/#appropriate-template-contents-owner-document
appropriate_template_contents_owner_document: MutNullableHeap<JS<Document>>, appropriate_template_contents_owner_document: MutNullableHeap<JS<Document>>,
// The collection of EventStates that have been changed since the last restyle. // The collection of ElementStates that have been changed since the last restyle.
event_state_changes: DOMRefCell<HashMap<JS<Element>, EventState>>, element_state_changes: DOMRefCell<HashMap<JS<Element>, ElementState>>,
} }
impl PartialEq for Document { impl PartialEq for Document {
@ -305,7 +306,7 @@ impl Document {
pub fn needs_reflow(&self) -> bool { pub fn needs_reflow(&self) -> bool {
self.GetDocumentElement().is_some() && self.GetDocumentElement().is_some() &&
(self.upcast::<Node>().get_has_dirty_descendants() || !self.event_state_changes.borrow().is_empty()) (self.upcast::<Node>().get_has_dirty_descendants() || !self.element_state_changes.borrow().is_empty())
} }
/// Returns the first `base` element in the DOM that has an `href` attribute. /// Returns the first `base` element in the DOM that has an `href` attribute.
@ -1185,7 +1186,7 @@ pub enum DocumentSource {
#[allow(unsafe_code)] #[allow(unsafe_code)]
pub trait LayoutDocumentHelpers { pub trait LayoutDocumentHelpers {
unsafe fn is_html_document_for_layout(&self) -> bool; unsafe fn is_html_document_for_layout(&self) -> bool;
unsafe fn drain_event_state_changes(&self) -> Vec<(LayoutJS<Element>, EventState)>; unsafe fn drain_element_state_changes(&self) -> Vec<(LayoutJS<Element>, ElementState)>;
} }
#[allow(unsafe_code)] #[allow(unsafe_code)]
@ -1197,8 +1198,8 @@ impl LayoutDocumentHelpers for LayoutJS<Document> {
#[inline] #[inline]
#[allow(unrooted_must_root)] #[allow(unrooted_must_root)]
unsafe fn drain_event_state_changes(&self) -> Vec<(LayoutJS<Element>, EventState)> { unsafe fn drain_element_state_changes(&self) -> Vec<(LayoutJS<Element>, ElementState)> {
let mut changes = (*self.unsafe_get()).event_state_changes.borrow_mut_for_layout(); let mut changes = (*self.unsafe_get()).element_state_changes.borrow_mut_for_layout();
let drain = changes.drain(); let drain = changes.drain();
let layout_drain = drain.map(|(k, v)| (k.to_layout(), v)); let layout_drain = drain.map(|(k, v)| (k.to_layout(), v));
Vec::from_iter(layout_drain) Vec::from_iter(layout_drain)
@ -1268,7 +1269,7 @@ impl Document {
reflow_timeout: Cell::new(None), reflow_timeout: Cell::new(None),
base_element: Default::default(), base_element: Default::default(),
appropriate_template_contents_owner_document: Default::default(), appropriate_template_contents_owner_document: Default::default(),
event_state_changes: DOMRefCell::new(HashMap::new()), element_state_changes: DOMRefCell::new(HashMap::new()),
} }
} }
@ -1334,12 +1335,12 @@ impl Document {
self.idmap.borrow().get(&id).map(|ref elements| (*elements)[0].root()) self.idmap.borrow().get(&id).map(|ref elements| (*elements)[0].root())
} }
pub fn record_event_state_change(&self, el: &Element, which: EventState) { pub fn record_element_state_change(&self, el: &Element, which: ElementState) {
let mut map = self.event_state_changes.borrow_mut(); let mut map = self.element_state_changes.borrow_mut();
let empty; let empty;
{ {
let states = map.entry(JS::from_ref(el)) let states = map.entry(JS::from_ref(el))
.or_insert(EventState::empty()); .or_insert(ElementState::empty());
states.toggle(which); states.toggle(which);
empty = states.is_empty(); empty = states.is_empty();
} }

View file

@ -26,6 +26,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::global::GlobalRef; use dom::bindings::global::GlobalRef;
use dom::bindings::js::{JS, LayoutJS, MutNullableHeap}; use dom::bindings::js::{JS, LayoutJS, MutNullableHeap};
use dom::bindings::js::{Root, RootedReference}; use dom::bindings::js::{Root, RootedReference};
use dom::bindings::trace::JSTraceable;
use dom::bindings::utils::XMLName::InvalidXMLName; use dom::bindings::utils::XMLName::InvalidXMLName;
use dom::bindings::utils::{namespace_from_domstring, validate_and_extract, xml_name_type}; use dom::bindings::utils::{namespace_from_domstring, validate_and_extract, xml_name_type};
use dom::characterdata::CharacterData; use dom::characterdata::CharacterData;
@ -63,8 +64,8 @@ use html5ever::serialize::TraversalScope;
use html5ever::serialize::TraversalScope::{ChildrenOnly, IncludeNode}; use html5ever::serialize::TraversalScope::{ChildrenOnly, IncludeNode};
use html5ever::tree_builder::{LimitedQuirks, NoQuirks, Quirks}; use html5ever::tree_builder::{LimitedQuirks, NoQuirks, Quirks};
use selectors::matching::{DeclarationBlock, matches}; use selectors::matching::{DeclarationBlock, matches};
use selectors::parser::parse_author_origin_selector_list_from_str; use selectors::parser::{AttrSelector, NamespaceConstraint, parse_author_origin_selector_list_from_str};
use selectors::parser::{AttrSelector, NamespaceConstraint}; use selectors::states::*;
use smallvec::VecLike; use smallvec::VecLike;
use std::ascii::AsciiExt; use std::ascii::AsciiExt;
use std::borrow::{Cow, ToOwned}; use std::borrow::{Cow, ToOwned};
@ -80,26 +81,12 @@ use style::properties::{PropertyDeclaration, PropertyDeclarationBlock, parse_sty
use style::values::CSSFloat; use style::values::CSSFloat;
use style::values::specified::{self, CSSColor, CSSRGBA}; use style::values::specified::{self, CSSColor, CSSRGBA};
use url::UrlParser; use url::UrlParser;
use util::mem::HeapSizeOf;
use util::str::{DOMString, LengthOrPercentageOrAuto}; use util::str::{DOMString, LengthOrPercentageOrAuto};
bitflags! { // TODO: Update focus state when the top-level browsing context gains or loses system focus,
#[doc = "Element Event States."] // and when the element enters or leaves a browsing context container.
#[derive(JSTraceable, HeapSizeOf)] // https://html.spec.whatwg.org/multipage/#selector-focus
flags EventState: u8 {
#[doc = "The mouse is down on this element. \
(https://html.spec.whatwg.org/multipage/#selector-active). \
FIXME(#7333): set/unset this when appropriate"]
const IN_ACTIVE_STATE = 0x01,
#[doc = "This element has focus."]
const IN_FOCUS_STATE = 0x02,
#[doc = "The mouse is hovering over this element."]
const IN_HOVER_STATE = 0x04,
#[doc = "Content is enabled (and can be disabled)."]
const IN_ENABLED_STATE = 0x08,
#[doc = "Content is disabled."]
const IN_DISABLED_STATE = 0x10,
}
}
#[dom_struct] #[dom_struct]
pub struct Element { pub struct Element {
@ -112,7 +99,7 @@ pub struct Element {
style_attribute: DOMRefCell<Option<PropertyDeclarationBlock>>, style_attribute: DOMRefCell<Option<PropertyDeclarationBlock>>,
attr_list: MutNullableHeap<JS<NamedNodeMap>>, attr_list: MutNullableHeap<JS<NamedNodeMap>>,
class_list: MutNullableHeap<JS<DOMTokenList>>, class_list: MutNullableHeap<JS<DOMTokenList>>,
event_state: Cell<EventState>, state: Cell<ElementState>,
} }
impl PartialEq for Element { impl PartialEq for Element {
@ -141,11 +128,11 @@ impl Element {
pub fn new_inherited(local_name: DOMString, pub fn new_inherited(local_name: DOMString,
namespace: Namespace, prefix: Option<DOMString>, namespace: Namespace, prefix: Option<DOMString>,
document: &Document) -> Element { document: &Document) -> Element {
Element::new_inherited_with_state(EventState::empty(), local_name, Element::new_inherited_with_state(ElementState::empty(), local_name,
namespace, prefix, document) namespace, prefix, document)
} }
pub fn new_inherited_with_state(state: EventState, local_name: DOMString, pub fn new_inherited_with_state(state: ElementState, local_name: DOMString,
namespace: Namespace, prefix: Option<DOMString>, namespace: Namespace, prefix: Option<DOMString>,
document: &Document) document: &Document)
-> Element { -> Element {
@ -159,7 +146,7 @@ impl Element {
style_attribute: DOMRefCell::new(None), style_attribute: DOMRefCell::new(None),
attr_list: Default::default(), attr_list: Default::default(),
class_list: Default::default(), class_list: Default::default(),
event_state: Cell::new(state), state: Cell::new(state),
} }
} }
@ -252,7 +239,7 @@ pub trait LayoutElementHelpers {
fn get_checked_state_for_layout(&self) -> bool; fn get_checked_state_for_layout(&self) -> bool;
fn get_indeterminate_state_for_layout(&self) -> bool; fn get_indeterminate_state_for_layout(&self) -> bool;
fn get_event_state_for_layout(&self) -> EventState; fn get_state_for_layout(&self) -> ElementState;
} }
impl LayoutElementHelpers for LayoutJS<Element> { impl LayoutElementHelpers for LayoutJS<Element> {
@ -605,9 +592,9 @@ impl LayoutElementHelpers for LayoutJS<Element> {
#[inline] #[inline]
#[allow(unsafe_code)] #[allow(unsafe_code)]
fn get_event_state_for_layout(&self) -> EventState { fn get_state_for_layout(&self) -> ElementState {
unsafe { unsafe {
(*self.unsafe_get()).event_state.get() (*self.unsafe_get()).state.get()
} }
} }
} }
@ -1583,6 +1570,16 @@ impl VirtualMethods for Element {
} }
} }
macro_rules! state_getter {
($(
$(#[$Flag_attr: meta])*
state $css: expr => $variant: ident / $method: ident /
$flag: ident = $value: expr,
)+) => {
$( fn $method(&self) -> bool { Element::get_state(self).contains($flag) } )+
}
}
impl<'a> ::selectors::Element for Root<Element> { impl<'a> ::selectors::Element for Root<Element> {
fn parent_element(&self) -> Option<Root<Element>> { fn parent_element(&self) -> Option<Root<Element>> {
self.upcast::<Node>().GetParentElement() self.upcast::<Node>().GetParentElement()
@ -1649,42 +1646,11 @@ impl<'a> ::selectors::Element for Root<Element> {
self.namespace() self.namespace()
} }
fn get_hover_state(&self) -> bool { state_pseudo_classes!(state_getter);
Element::get_hover_state(self)
}
fn get_active_state(&self) -> bool {
Element::get_active_state(self)
}
fn get_focus_state(&self) -> bool {
// TODO: Also check whether the top-level browsing context has the system focus,
// and whether this element is a browsing context container.
// https://html.spec.whatwg.org/multipage/#selector-focus
Element::get_focus_state(self)
}
fn get_id(&self) -> Option<Atom> { fn get_id(&self) -> Option<Atom> {
self.id_attribute.borrow().clone() self.id_attribute.borrow().clone()
} }
fn get_disabled_state(&self) -> bool {
Element::get_disabled_state(self)
}
fn get_enabled_state(&self) -> bool {
Element::get_enabled_state(self)
}
fn get_checked_state(&self) -> bool {
match self.downcast::<HTMLInputElement>() {
Some(input) => input.Checked(),
None => false,
}
}
fn get_indeterminate_state(&self) -> bool {
match self.downcast::<HTMLInputElement>() {
Some(input) => input.get_indeterminate_state(),
None => false,
}
}
fn has_class(&self, name: &Atom) -> bool { fn has_class(&self, name: &Atom) -> bool {
Element::has_class(&**self, name) Element::has_class(&**self, name)
} }
@ -1834,8 +1800,12 @@ impl Element {
self.set_click_in_progress(false); self.set_click_in_progress(false);
} }
fn set_state(&self, which: EventState, value: bool) { pub fn get_state(&self) -> ElementState {
let mut state = self.event_state.get(); self.state.get()
}
pub fn set_state(&self, which: ElementState, value: bool) {
let mut state = self.state.get();
if state.contains(which) == value { if state.contains(which) == value {
return return
} }
@ -1843,14 +1813,14 @@ impl Element {
true => state.insert(which), true => state.insert(which),
false => state.remove(which), false => state.remove(which),
}; };
self.event_state.set(state); self.state.set(state);
let node = self.upcast::<Node>(); let node = self.upcast::<Node>();
node.owner_doc().record_event_state_change(self, which); node.owner_doc().record_element_state_change(self, which);
} }
pub fn get_active_state(&self) -> bool { pub fn get_active_state(&self) -> bool {
self.event_state.get().contains(IN_ACTIVE_STATE) self.state.get().contains(IN_ACTIVE_STATE)
} }
pub fn set_active_state(&self, value: bool) { pub fn set_active_state(&self, value: bool) {
@ -1858,7 +1828,7 @@ impl Element {
} }
pub fn get_focus_state(&self) -> bool { pub fn get_focus_state(&self) -> bool {
self.event_state.get().contains(IN_FOCUS_STATE) self.state.get().contains(IN_FOCUS_STATE)
} }
pub fn set_focus_state(&self, value: bool) { pub fn set_focus_state(&self, value: bool) {
@ -1866,7 +1836,7 @@ impl Element {
} }
pub fn get_hover_state(&self) -> bool { pub fn get_hover_state(&self) -> bool {
self.event_state.get().contains(IN_HOVER_STATE) self.state.get().contains(IN_HOVER_STATE)
} }
pub fn set_hover_state(&self, value: bool) { pub fn set_hover_state(&self, value: bool) {
@ -1874,7 +1844,7 @@ impl Element {
} }
pub fn get_enabled_state(&self) -> bool { pub fn get_enabled_state(&self) -> bool {
self.event_state.get().contains(IN_ENABLED_STATE) self.state.get().contains(IN_ENABLED_STATE)
} }
pub fn set_enabled_state(&self, value: bool) { pub fn set_enabled_state(&self, value: bool) {
@ -1882,7 +1852,7 @@ impl Element {
} }
pub fn get_disabled_state(&self) -> bool { pub fn get_disabled_state(&self) -> bool {
self.event_state.get().contains(IN_DISABLED_STATE) self.state.get().contains(IN_DISABLED_STATE)
} }
pub fn set_disabled_state(&self, value: bool) { pub fn set_disabled_state(&self, value: bool) {

View file

@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::HTMLButtonElementBinding::HTMLButtonElemen
use dom::bindings::conversions::Castable; use dom::bindings::conversions::Castable;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::element::{AttributeMutation, Element, IN_ENABLED_STATE}; use dom::element::{AttributeMutation, Element};
use dom::event::Event; use dom::event::Event;
use dom::eventtarget::EventTarget; use dom::eventtarget::EventTarget;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -19,6 +19,7 @@ use dom::htmlformelement::{SubmittedFrom, HTMLFormElement};
use dom::node::{Node, document_from_node, window_from_node}; use dom::node::{Node, document_from_node, window_from_node};
use dom::validitystate::ValidityState; use dom::validitystate::ValidityState;
use dom::virtualmethods::VirtualMethods; use dom::virtualmethods::VirtualMethods;
use selectors::states::*;
use std::ascii::AsciiExt; use std::ascii::AsciiExt;
use std::borrow::ToOwned; use std::borrow::ToOwned;
use std::cell::Cell; use std::cell::Cell;

View file

@ -17,7 +17,7 @@ use dom::bindings::utils::Reflectable;
use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration}; use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration};
use dom::document::Document; use dom::document::Document;
use dom::domstringmap::DOMStringMap; use dom::domstringmap::DOMStringMap;
use dom::element::{AttributeMutation, Element, EventState}; use dom::element::{AttributeMutation, Element};
use dom::eventtarget::EventTarget; use dom::eventtarget::EventTarget;
use dom::htmlbodyelement::HTMLBodyElement; use dom::htmlbodyelement::HTMLBodyElement;
use dom::htmlframesetelement::HTMLFrameSetElement; use dom::htmlframesetelement::HTMLFrameSetElement;
@ -27,6 +27,7 @@ use dom::node::{Node, SEQUENTIALLY_FOCUSABLE};
use dom::node::{document_from_node, window_from_node}; use dom::node::{document_from_node, window_from_node};
use dom::virtualmethods::VirtualMethods; use dom::virtualmethods::VirtualMethods;
use msg::constellation_msg::FocusType; use msg::constellation_msg::FocusType;
use selectors::states::*;
use std::ascii::AsciiExt; use std::ascii::AsciiExt;
use std::borrow::ToOwned; use std::borrow::ToOwned;
use std::default::Default; use std::default::Default;
@ -51,10 +52,10 @@ impl PartialEq for HTMLElement {
impl HTMLElement { impl HTMLElement {
pub fn new_inherited(tag_name: DOMString, prefix: Option<DOMString>, pub fn new_inherited(tag_name: DOMString, prefix: Option<DOMString>,
document: &Document) -> HTMLElement { document: &Document) -> HTMLElement {
HTMLElement::new_inherited_with_state(EventState::empty(), tag_name, prefix, document) HTMLElement::new_inherited_with_state(ElementState::empty(), tag_name, prefix, document)
} }
pub fn new_inherited_with_state(state: EventState, tag_name: DOMString, pub fn new_inherited_with_state(state: ElementState, tag_name: DOMString,
prefix: Option<DOMString>, document: &Document) prefix: Option<DOMString>, document: &Document)
-> HTMLElement { -> HTMLElement {
HTMLElement { HTMLElement {

View file

@ -9,7 +9,7 @@ use dom::bindings::codegen::InheritTypes::{ElementTypeId, HTMLElementTypeId, Nod
use dom::bindings::conversions::Castable; use dom::bindings::conversions::Castable;
use dom::bindings::js::{Root, RootedReference}; use dom::bindings::js::{Root, RootedReference};
use dom::document::Document; use dom::document::Document;
use dom::element::{AttributeMutation, Element, IN_ENABLED_STATE}; use dom::element::{AttributeMutation, Element};
use dom::htmlcollection::{CollectionFilter, HTMLCollection}; use dom::htmlcollection::{CollectionFilter, HTMLCollection};
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
use dom::htmlformelement::{FormControl, HTMLFormElement}; use dom::htmlformelement::{FormControl, HTMLFormElement};
@ -17,6 +17,7 @@ use dom::htmllegendelement::HTMLLegendElement;
use dom::node::{Node, window_from_node}; use dom::node::{Node, window_from_node};
use dom::validitystate::ValidityState; use dom::validitystate::ValidityState;
use dom::virtualmethods::VirtualMethods; use dom::virtualmethods::VirtualMethods;
use selectors::states::*;
use util::str::{DOMString, StaticStringVec}; use util::str::{DOMString, StaticStringVec};
#[dom_struct] #[dom_struct]

View file

@ -15,7 +15,7 @@ use dom::bindings::conversions::Castable;
use dom::bindings::global::GlobalRef; use dom::bindings::global::GlobalRef;
use dom::bindings::js::{JS, LayoutJS, Root, RootedReference}; use dom::bindings::js::{JS, LayoutJS, Root, RootedReference};
use dom::document::Document; use dom::document::Document;
use dom::element::{AttributeMutation, Element, IN_ENABLED_STATE, RawLayoutElementHelpers}; use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers};
use dom::event::{Event, EventBubbles, EventCancelable}; use dom::event::{Event, EventBubbles, EventCancelable};
use dom::eventtarget::EventTarget; use dom::eventtarget::EventTarget;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -27,6 +27,7 @@ use dom::node::{Node, NodeDamage};
use dom::node::{document_from_node, window_from_node}; use dom::node::{document_from_node, window_from_node};
use dom::virtualmethods::VirtualMethods; use dom::virtualmethods::VirtualMethods;
use msg::constellation_msg::ConstellationChan; use msg::constellation_msg::ConstellationChan;
use selectors::states::*;
use std::borrow::ToOwned; use std::borrow::ToOwned;
use std::cell::Cell; use std::cell::Cell;
use string_cache::Atom; use string_cache::Atom;
@ -57,10 +58,8 @@ enum InputType {
pub struct HTMLInputElement { pub struct HTMLInputElement {
htmlelement: HTMLElement, htmlelement: HTMLElement,
input_type: Cell<InputType>, input_type: Cell<InputType>,
checked: Cell<bool>,
checked_changed: Cell<bool>, checked_changed: Cell<bool>,
placeholder: DOMRefCell<DOMString>, placeholder: DOMRefCell<DOMString>,
indeterminate: Cell<bool>,
value_changed: Cell<bool>, value_changed: Cell<bool>,
size: Cell<u32>, size: Cell<u32>,
#[ignore_heap_size_of = "#7193"] #[ignore_heap_size_of = "#7193"]
@ -111,9 +110,7 @@ impl HTMLInputElement {
HTMLElement::new_inherited_with_state(IN_ENABLED_STATE, HTMLElement::new_inherited_with_state(IN_ENABLED_STATE,
localName, prefix, document), localName, prefix, document),
input_type: Cell::new(InputType::InputText), input_type: Cell::new(InputType::InputText),
checked: Cell::new(false),
placeholder: DOMRefCell::new("".to_owned()), placeholder: DOMRefCell::new("".to_owned()),
indeterminate: Cell::new(false),
checked_changed: Cell::new(false), checked_changed: Cell::new(false),
value_changed: Cell::new(false), value_changed: Cell::new(false),
size: Cell::new(DEFAULT_INPUT_SIZE), size: Cell::new(DEFAULT_INPUT_SIZE),
@ -204,13 +201,13 @@ impl RawLayoutHTMLInputElementHelpers for HTMLInputElement {
#[allow(unrooted_must_root)] #[allow(unrooted_must_root)]
#[allow(unsafe_code)] #[allow(unsafe_code)]
unsafe fn get_checked_state_for_layout(&self) -> bool { unsafe fn get_checked_state_for_layout(&self) -> bool {
self.checked.get() self.Checked()
} }
#[allow(unrooted_must_root)] #[allow(unrooted_must_root)]
#[allow(unsafe_code)] #[allow(unsafe_code)]
unsafe fn get_indeterminate_state_for_layout(&self) -> bool { unsafe fn get_indeterminate_state_for_layout(&self) -> bool {
self.indeterminate.get() self.Indeterminate()
} }
#[allow(unrooted_must_root)] #[allow(unrooted_must_root)]
@ -240,7 +237,7 @@ impl HTMLInputElementMethods for HTMLInputElement {
// https://html.spec.whatwg.org/multipage/#dom-input-checked // https://html.spec.whatwg.org/multipage/#dom-input-checked
fn Checked(&self) -> bool { fn Checked(&self) -> bool {
self.checked.get() self.upcast::<Element>().get_state().contains(IN_CHECKED_STATE)
} }
// https://html.spec.whatwg.org/multipage/#dom-input-checked // https://html.spec.whatwg.org/multipage/#dom-input-checked
@ -329,12 +326,12 @@ impl HTMLInputElementMethods for HTMLInputElement {
// https://html.spec.whatwg.org/multipage/#dom-input-indeterminate // https://html.spec.whatwg.org/multipage/#dom-input-indeterminate
fn Indeterminate(&self) -> bool { fn Indeterminate(&self) -> bool {
self.indeterminate.get() self.upcast::<Element>().get_state().contains(IN_INDETERMINATE_STATE)
} }
// https://html.spec.whatwg.org/multipage/#dom-input-indeterminate // https://html.spec.whatwg.org/multipage/#dom-input-indeterminate
fn SetIndeterminate(&self, val: bool) { fn SetIndeterminate(&self, val: bool) {
self.indeterminate.set(val) self.upcast::<Element>().set_state(IN_INDETERMINATE_STATE, val)
} }
} }
@ -443,7 +440,7 @@ impl HTMLInputElement {
} }
fn update_checked_state(&self, checked: bool, dirty: bool) { fn update_checked_state(&self, checked: bool, dirty: bool) {
self.checked.set(checked); self.upcast::<Element>().set_state(IN_CHECKED_STATE, checked);
if dirty { if dirty {
self.checked_changed.set(true); self.checked_changed.set(true);
@ -459,7 +456,7 @@ impl HTMLInputElement {
} }
pub fn get_indeterminate_state(&self) -> bool { pub fn get_indeterminate_state(&self) -> bool {
self.indeterminate.get() self.Indeterminate()
} }
// https://html.spec.whatwg.org/multipage/#concept-fe-mutable // https://html.spec.whatwg.org/multipage/#concept-fe-mutable

View file

@ -8,11 +8,12 @@ use dom::bindings::codegen::Bindings::HTMLOptGroupElementBinding::HTMLOptGroupEl
use dom::bindings::conversions::Castable; use dom::bindings::conversions::Castable;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::element::{AttributeMutation, Element, IN_ENABLED_STATE}; use dom::element::{AttributeMutation, Element};
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
use dom::htmloptionelement::HTMLOptionElement; use dom::htmloptionelement::HTMLOptionElement;
use dom::node::Node; use dom::node::Node;
use dom::virtualmethods::VirtualMethods; use dom::virtualmethods::VirtualMethods;
use selectors::states::*;
use util::str::DOMString; use util::str::DOMString;
#[dom_struct] #[dom_struct]

View file

@ -11,13 +11,14 @@ use dom::bindings::conversions::Castable;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::characterdata::CharacterData; use dom::characterdata::CharacterData;
use dom::document::Document; use dom::document::Document;
use dom::element::{AttributeMutation, Element, IN_ENABLED_STATE}; use dom::element::{AttributeMutation, Element};
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
use dom::htmlscriptelement::HTMLScriptElement; use dom::htmlscriptelement::HTMLScriptElement;
use dom::htmlselectelement::HTMLSelectElement; use dom::htmlselectelement::HTMLSelectElement;
use dom::node::Node; use dom::node::Node;
use dom::text::Text; use dom::text::Text;
use dom::virtualmethods::VirtualMethods; use dom::virtualmethods::VirtualMethods;
use selectors::states::*;
use std::cell::Cell; use std::cell::Cell;
use util::str::{DOMString, split_html_space_chars, str_join}; use util::str::{DOMString, split_html_space_chars, str_join};

View file

@ -11,7 +11,7 @@ use dom::bindings::codegen::UnionTypes::HTMLOptionElementOrHTMLOptGroupElement;
use dom::bindings::conversions::Castable; use dom::bindings::conversions::Castable;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::element::{AttributeMutation, Element, IN_ENABLED_STATE}; use dom::element::{AttributeMutation, Element};
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
use dom::htmlfieldsetelement::HTMLFieldSetElement; use dom::htmlfieldsetelement::HTMLFieldSetElement;
use dom::htmlformelement::{FormControl, HTMLFormElement}; use dom::htmlformelement::{FormControl, HTMLFormElement};
@ -19,6 +19,7 @@ use dom::htmloptionelement::HTMLOptionElement;
use dom::node::{Node, window_from_node}; use dom::node::{Node, window_from_node};
use dom::validitystate::ValidityState; use dom::validitystate::ValidityState;
use dom::virtualmethods::VirtualMethods; use dom::virtualmethods::VirtualMethods;
use selectors::states::*;
use std::borrow::ToOwned; use std::borrow::ToOwned;
use string_cache::Atom; use string_cache::Atom;
use util::str::DOMString; use util::str::DOMString;

View file

@ -13,7 +13,7 @@ use dom::bindings::global::GlobalRef;
use dom::bindings::js::{LayoutJS, Root}; use dom::bindings::js::{LayoutJS, Root};
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::document::Document; use dom::document::Document;
use dom::element::{AttributeMutation, IN_ENABLED_STATE, Element}; use dom::element::{AttributeMutation, Element};
use dom::event::{Event, EventBubbles, EventCancelable}; use dom::event::{Event, EventBubbles, EventCancelable};
use dom::eventtarget::EventTarget; use dom::eventtarget::EventTarget;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -26,6 +26,7 @@ use dom::virtualmethods::VirtualMethods;
use msg::constellation_msg::ConstellationChan; use msg::constellation_msg::ConstellationChan;
use script_task::ScriptTaskEventCategory::InputEvent; use script_task::ScriptTaskEventCategory::InputEvent;
use script_task::{CommonScriptMsg, Runnable}; use script_task::{CommonScriptMsg, Runnable};
use selectors::states::*;
use std::borrow::ToOwned; use std::borrow::ToOwned;
use std::cell::Cell; use std::cell::Cell;
use string_cache::Atom; use string_cache::Atom;

View file

@ -70,7 +70,7 @@ extern crate rand;
extern crate rustc_serialize; extern crate rustc_serialize;
extern crate rustc_unicode; extern crate rustc_unicode;
extern crate script_traits; extern crate script_traits;
extern crate selectors; #[macro_use(state_pseudo_classes)] extern crate selectors;
extern crate serde; extern crate serde;
extern crate smallvec; extern crate smallvec;
extern crate string_cache; extern crate string_cache;

View file

@ -1039,7 +1039,7 @@ dependencies = [
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"script 0.0.1", "script 0.0.1",
"script_traits 0.0.1", "script_traits 0.0.1",
"selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", "selectors 0.2.0 (git+https://github.com/servo/rust-selectors)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1548,7 +1548,7 @@ dependencies = [
"rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"script_traits 0.0.1", "script_traits 0.0.1",
"selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", "selectors 0.2.0 (git+https://github.com/servo/rust-selectors)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1593,8 +1593,8 @@ dependencies = [
[[package]] [[package]]
name = "selectors" name = "selectors"
version = "0.1.0" version = "0.2.0"
source = "git+https://github.com/servo/rust-selectors#1e1e44c2f4090e8beb95a8d27f184aefcf91a362" source = "git+https://github.com/servo/rust-selectors#d3bd9b7c665c838f703ef0bbc7fd67b89847550d"
dependencies = [ dependencies = [
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1751,7 +1751,7 @@ dependencies = [
"num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1", "plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", "selectors 0.2.0 (git+https://github.com/servo/rust-selectors)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1769,7 +1769,7 @@ dependencies = [
"app_units 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "app_units 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", "selectors 0.2.0 (git+https://github.com/servo/rust-selectors)",
"string_cache 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
@ -1789,7 +1789,7 @@ dependencies = [
"num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1", "plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", "selectors 0.2.0 (git+https://github.com/servo/rust-selectors)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1934,7 +1934,7 @@ dependencies = [
"plugins 0.0.1", "plugins 0.0.1",
"rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", "selectors 0.2.0 (git+https://github.com/servo/rust-selectors)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -27,6 +27,7 @@ use logical_geometry::WritingMode;
use rand::OsRng; use rand::OsRng;
use range::Range; use range::Range;
use selectors::parser::{Combinator, CompoundSelector, PseudoElement, Selector, SimpleSelector}; use selectors::parser::{Combinator, CompoundSelector, PseudoElement, Selector, SimpleSelector};
use selectors::states::ElementState;
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
use std::collections::{HashMap, LinkedList, hash_state}; use std::collections::{HashMap, LinkedList, hash_state};
use std::hash::Hash; use std::hash::Hash;
@ -417,4 +418,4 @@ known_heap_size!(0, Au, WritingMode, CSSParserColor, Color, RGBA, Cursor, Matrix
known_heap_size!(0, JSVal, PagePx, ViewportPx, DevicePixel, QuirksMode, OsRng, RawStatus); known_heap_size!(0, JSVal, PagePx, ViewportPx, DevicePixel, QuirksMode, OsRng, RawStatus);
known_heap_size!(0, TokenSerializationType, LengthOrPercentageOrAuto); known_heap_size!(0, TokenSerializationType, LengthOrPercentageOrAuto);
known_heap_size!(0, PseudoElement, Combinator, str); known_heap_size!(0, ElementState, Combinator, PseudoElement, str);

14
ports/cef/Cargo.lock generated
View file

@ -989,7 +989,7 @@ dependencies = [
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"script 0.0.1", "script 0.0.1",
"script_traits 0.0.1", "script_traits 0.0.1",
"selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", "selectors 0.2.0 (git+https://github.com/servo/rust-selectors)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1480,7 +1480,7 @@ dependencies = [
"rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"script_traits 0.0.1", "script_traits 0.0.1",
"selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", "selectors 0.2.0 (git+https://github.com/servo/rust-selectors)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1517,8 +1517,8 @@ dependencies = [
[[package]] [[package]]
name = "selectors" name = "selectors"
version = "0.1.0" version = "0.2.0"
source = "git+https://github.com/servo/rust-selectors#1e1e44c2f4090e8beb95a8d27f184aefcf91a362" source = "git+https://github.com/servo/rust-selectors#d3bd9b7c665c838f703ef0bbc7fd67b89847550d"
dependencies = [ dependencies = [
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1708,7 +1708,7 @@ dependencies = [
"num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1", "plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", "selectors 0.2.0 (git+https://github.com/servo/rust-selectors)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1730,7 +1730,7 @@ dependencies = [
"num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1", "plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", "selectors 0.2.0 (git+https://github.com/servo/rust-selectors)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1875,7 +1875,7 @@ dependencies = [
"plugins 0.0.1", "plugins 0.0.1",
"rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", "selectors 0.2.0 (git+https://github.com/servo/rust-selectors)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",

14
ports/gonk/Cargo.lock generated
View file

@ -938,7 +938,7 @@ dependencies = [
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"script 0.0.1", "script 0.0.1",
"script_traits 0.0.1", "script_traits 0.0.1",
"selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", "selectors 0.2.0 (git+https://github.com/servo/rust-selectors)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1429,7 +1429,7 @@ dependencies = [
"rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"script_traits 0.0.1", "script_traits 0.0.1",
"selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", "selectors 0.2.0 (git+https://github.com/servo/rust-selectors)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1466,8 +1466,8 @@ dependencies = [
[[package]] [[package]]
name = "selectors" name = "selectors"
version = "0.1.0" version = "0.2.0"
source = "git+https://github.com/servo/rust-selectors#1e1e44c2f4090e8beb95a8d27f184aefcf91a362" source = "git+https://github.com/servo/rust-selectors#d3bd9b7c665c838f703ef0bbc7fd67b89847550d"
dependencies = [ dependencies = [
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1655,7 +1655,7 @@ dependencies = [
"num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1", "plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", "selectors 0.2.0 (git+https://github.com/servo/rust-selectors)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1677,7 +1677,7 @@ dependencies = [
"num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1", "plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", "selectors 0.2.0 (git+https://github.com/servo/rust-selectors)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1822,7 +1822,7 @@ dependencies = [
"plugins 0.0.1", "plugins 0.0.1",
"rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.1.0 (git+https://github.com/servo/rust-selectors)", "selectors 0.2.0 (git+https://github.com/servo/rust-selectors)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -103,7 +103,7 @@ fn test_parse_stylesheet() {
simple_selectors: vec![ simple_selectors: vec![
SimpleSelector::Class(Atom::from_slice("ok")), SimpleSelector::Class(Atom::from_slice("ok")),
], ],
next: Some((Box::new(CompoundSelector { next: Some((Arc::new(CompoundSelector {
simple_selectors: vec![ simple_selectors: vec![
SimpleSelector::ID(Atom::from_slice("d1")), SimpleSelector::ID(Atom::from_slice("d1")),
], ],