gecko-dev/servo/tests/unit/style
Simon Sapin 7cb2f9a2dc servo: Merge #14043 - Update to string-cache 0.3 (from servo:string-cache-up); r=nox
Previously, `string-cache` defined:
*  An string-like `Atom` type,
* An `atom!("foo")` macro that expands to a value of that type, for a set of strings known at compile-time,
* A `struct Namespace(Atom);` type
* A `ns!(html)` macro that maps known prefixed to `Namespace` values with the corresponding namespace URL.

Adding a string to the static set required making a change to the `string-cache` crate.

With 0.3, the `Atom` type is now generic, with a type parameter that provides a set of static strings. We can have multiple such sets, defined in different crates. The `string_cache_codegen` crate, to be used in build scripts, generates code that defines such a set, a new atom type (a type alias for `Atom<_>` with the type parameter set), and an `atom!`-like macro.

The html5ever repository has a new `html5ever_atoms` crate that defines three such types: `Prefix`, `Namespace`, and `LocalName` (with respective `namespace_prefix!`, `namespace_url!`, and `local_name!` macros). It also defines the `ns!` macro like before.

This repository has a new `servo_atoms` crate in `components/atoms` that, for now, defines a single `Atom` type (and `atom!`) macro. (`servo_atoms::Atom` is defined as something like `type Atom = string_cache::Atom<ServoStaticStringSet>;`, so overall there’s now two types named `Atom`.)

In this PR, `servo_atoms::Atom` is used for everything else that was `string_cache::Atom` before. But more atom types can be defined as needed. Two reasons to do this are to auto-generate the set of static strings (I’m planning to do this for CSS property names, which is the motivation for this change), or to have the type system help us avoid mix up unrelated things (this is why we had a `Namespace` type ever before this change).

Introducing new types helped me find a bug: when creating a new attribute `dom::Element::set_style_attr`, would pass `Some(atom!("style"))` instead of `None` (now `Option<html5ever_atoms::Prefix>` instead of `Option<string_cache::Atom>`) to the `prefix` argument of `Attr::new`. I suppose the author of that code confused it with the `local_name` argument.

---

Note that Stylo is not affected by any of this. The `gecko_string_cache` module is unchanged, with a single `Atom` type. The `style` crate conditionally compiles `Prefix` and `LocalName` re-exports for that are both `gecko_string_cache::Atom` on stylo.

---
<!-- 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
- [ ] These changes fix #__ (github issue number if applicable).

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

<!-- 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: 5b4cc9568dbd5c15e5d2fbc62719172f11566ffa
2016-11-03 11:19:44 -05:00
..
parsing servo: Merge #13886 - Adds parsing test for linear-gradient (from AVGP:13837-linear-gradient-tests); r=canaltinova 2016-10-30 14:45:09 -05:00
properties servo: Merge #13908 - Use enum BorderWidth as SpecifiedValue (from aethanyc:add-border-width-keyword); r=emilio 2016-10-29 19:48:27 -05:00
atomic_refcell.rs servo: Merge #13797 - Implement AtomicRef{,Mut}::map (from bholley:atomic_refcell_map); r=SimonSapin 2016-11-01 14:54:24 -05:00
attr.rs servo: Merge #12632 - account for sign in double parsing (from bobthekingofegypt:signed_parse_double); r=KiChjang 2016-07-28 16:56:43 -05:00
cache.rs servo: Merge #12311 - Move the cache module out of util (from Ms2ger:cache); r=nox 2016-07-08 07:46:00 -07:00
Cargo.toml servo: Merge #14043 - Update to string-cache 0.3 (from servo:string-cache-up); r=nox 2016-11-03 11:19:44 -05:00
lib.rs servo: Merge #14043 - Update to string-cache 0.3 (from servo:string-cache-up); r=nox 2016-11-03 11:19:44 -05:00
logical_geometry.rs servo: Merge #9686 - Move util::logical_geometry to style (from nox:mv-logical_geometry); r=Ms2ger 2016-02-18 14:22:29 +05:01
media_queries.rs servo: Merge #14043 - Update to string-cache 0.3 (from servo:string-cache-up); r=nox 2016-11-03 11:19:44 -05:00
owning_handle.rs servo: Merge #13759 - Implement OwningHandle in style (from bholley:owning_handle); r=SimonSapin 2016-10-14 10:42:10 -05:00
selector_matching.rs servo: Merge #14043 - Update to string-cache 0.3 (from servo:string-cache-up); r=nox 2016-11-03 11:19:44 -05:00
str.rs servo: Merge #12256 - Move some stuff from util to style (from nox:die-util-die); r=Ms2ger 2016-07-05 02:04:42 -07:00
stylesheets.rs servo: Merge #14043 - Update to string-cache 0.3 (from servo:string-cache-up); r=nox 2016-11-03 11:19:44 -05:00
value.rs servo: Merge #11890 - Bug 10104 - Only restyle nodes that uses viewport percentage units on viewport size change (from shinglyu:viewport-percent-recalc); r=mbrubeck 2016-07-17 20:46:24 -07:00
viewport.rs servo: Merge #13839 - Add RwLock in more Arc’d things in stylesheets (from servo:locked-style); r=mbrubeck 2016-10-20 11:29:27 -05:00