On 03/11/16 21:02, Boris Zbarsky wrote:
On 11/3/16 3:17 PM, Simon Sapin wrote:
An important aspect is that atoms with different static sets are
different Rust types.
Just to check that I understand correctly...
Are element names atoms? Which static set do they come from?
Presumably the html5ever one?
Yes. Previously Servo had a single Atom type that was used, among other
things, for element names.
Now there is html5ever_atoms::LocalName (which is a type alias for
string_cache::Atom<html5ever_atoms::LocalNameStaticSet>), used for
element and content attribute names.
When parsing CSS selectors, are tag name selectors atomized? Which
static set is used for that?
Yes. Types from the selectors crate are generic, with a trait that has
associated types for the string types of various components.
Servo defines:
type AttrValue = std::string::String;
type Identifier = servo_atoms::Atom;
type ClassName = servo_atoms::Atom;
type LocalName = html5ever_atoms::LocalName;
type NamespacePrefix = html5ever_atoms::Prefix;
Stylo defines:
type AttrValue = gecko_string_cache::Atom;
type Identifier = gecko_string_cache::Atom;
type ClassName = gecko_string_cache::Atom;
type LocalName = gecko_string_cache::Atom;
type NamespacePrefix = gecko_string_cache::Atom;
gecko_string_cache::Atom wraps *mut nsIAtom.
(I don’t know if there’s a reason for the discrepancy: interning
attribute values in selectors in Stylo but not Servo. We can change it.)
--
Simon Sapin
_______________________________________________
dev-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo