aboutsummaryrefslogtreecommitdiffstats
path: root/components/servo_arc/lib.rs
Commit message (Collapse)AuthorAgeFilesLines
* Move Stylo to its own repo (#31350)Delan Azabani2024-02-271-1370/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove packages that were moved to external repo * Add workspace dependencies pointing to 2023-06-14 branch * Fix servo-tidy.toml errors * Update commit to include #31346 * Update commit to include servo/stylo#2 * Move css-properties.json lookup to target/doc/stylo * Remove dependency on vendored mako in favour of pypi dependency This also removes etc/ci/generate_workflow.py, which has been unused since at least 9e71bd6a7010d6e5723831696ae0ebe26b47682f. * Add temporary code to debug Windows test failures * Fix failures on Windows due to custom target dir * Update commit to include servo/stylo#3 * Fix license in tests/unit/style/build.rs * Document how to build with local Stylo in Cargo.toml
* Revert changes to servo_arc, style_derive, and style_traits (#31387)Martin Robinson2024-02-221-21/+18
| | | | | | | This reverts the Rust edition updates to these three traits as well as incorporates https://phabricator.services.mozilla.com/D117887. The purpose of this change is to reduce the diff with upstream stylo. Finally, formatting is disabled for these crates as well.
* style: Rustfmt servo/. r=zrhoffmanEmilio Cobos Álvarez2023-11-241-2/+8
| | | | | | | | $ find servo -name '*.rs' | xargs rustup run nightly rustfmt Depends on D179380 Differential Revision: https://phabricator.services.mozilla.com/D179381
* style: Remove some magic from the bindingsEmilio Cobos Álvarez2023-11-241-167/+1
| | | | | | | | | | | | | | | | | | | This simplifies a tiny bit our bindings in some places, and complicates it in others, but over all I think it's better. It requires a bit more manual code in the rust side to drop and cast the relevant pointers (which was done implicitly before), but it's a lot less magic than it used to be, and that's all autogenerated so consumers don't need to care about it. The set up is still not ideal. I don't like that we rely on destructors running in both sides of the FFI boundary, but that's for another day. This is the last usage of RawOffsetArc, so remove that. We now support proper Arc<> in structs (GridTemplateAreas uses it), so I don't think we'll need it any time soon. Differential Revision: https://phabricator.services.mozilla.com/D177905
* style: Remove HasArcFFI for some typesEmilio Cobos Álvarez2023-11-241-4/+2
| | | | | | | | | | See blocked bug. For non-Locked types we can just use the same underlying type at the FFI boundary. Port StylesheetContents and CssUrlData to this set-up. CssUrlData is already generated by cbindgen anyways. Differential Revision: https://phabricator.services.mozilla.com/D177559
* style: [css-nesting] Process nested rules at cascade data rebuildEmilio Cobos Álvarez2023-11-211-17/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | More nesting plumbing. Still does nothing because we don't parse the nested rules. Should be trivial to prove this patch doesn't change any behavior so far, but I want to land it on its own because it can have performance implications. This follows the pattern of what we do with other rules like layers and container conditions, that is, keep the ancestor selectors in a stack, and poke at the last one in order to replace the ancestor. This changes the behavior of replace_parent_selector as with the newer version of the spec, stuff like: div { .foo { stuff } } Should work as `div .foo`. A test is added for this case. Differential Revision: https://phabricator.services.mozilla.com/D176560
* style: Fix clippy warningsSylvestre Ledru2023-11-211-3/+3
| | | | | | Depends on D96634 Differential Revision: https://phabricator.services.mozilla.com/D96636
* style: [css-nesting] Parse parent selectorEmilio Cobos Álvarez2023-11-061-0/+26
| | | | | | | | | | | | | This parses the ampersand as a parent selector behind an (off-by-default) selectors feature. The plan is to call replace_parent_selector while we're doing the CascadeData rebuilds, which is where we can have all the ancestor nesting information. No behavior change. Differential Revision: https://phabricator.services.mozilla.com/D167237
* Strict import formatting (grouping and granularity) (#30325)Samson2023-09-111-11/+8
| | | | | * strict imports formatting * Reformat all imports
* style: Refactor the author sheet cache to keep alive the relevant ↵Emilio Cobos Álvarez2023-05-241-0/+8
| | | | | | | | | | | | | | | StylesheetContents This prevents incorrectly reusing cached results when the contents go away and new contents are allocated with the same address. Note that these keep alive transitively everything else under them, so all other medialist keys don't need this. By making this a proper hashmap it should also improve cache lookup times if the cache grows too big. Differential Revision: https://phabricator.services.mozilla.com/D115202
* Upgrade remaining components to edition 2018sagudev2023-02-181-5/+0
|
* Fix some Clippy lints.Teymour Aldridge2022-08-041-8/+3
|
* style: Simplify code for keeping alive shared memory until all sheets go away.Emilio Cobos Álvarez2019-11-301-4/+9
| | | | | | | | | | | | | | | | | | The existing code wasn't sound, as CSSOM objects also needed to go away before the shared memory goes away (as they keep references to them). This is sound assuming no presence of reference cycles introduced by CSSOM. We may want to live with this and rely on chrome code not writing cycles like this with UA stylesheet DOM objects. We could explicitly drop all potentially-static objects... That seems pretty error prone though. Or we could also just leak the shared memory buffer, is there any reason why we may not want to do that? Differential Revision: https://phabricator.services.mozilla.com/D51870
* style: Properly refcount-log UniqueArcs created with new_uninitialized().Emilio Cobos Álvarez2019-07-241-0/+6
|
* Don't insta-free in UniqueArc::assume_init.Emilio Cobos Álvarez2019-07-241-1/+1
|
* Stylo: replace uses of mem::uninitialized with MaybeUninitSimon Sapin2019-07-161-20/+9
| | | | MozReview-Commit-ID: KGhYL6DJRaR
* Add UniqueArc::new_uninit, UniqueArc::assume_initSimon Sapin2019-07-161-1/+29
| | | | MozReview-Commit-ID: DoNcSsKpRn
* style: Rustfmt recent changes.Emilio Cobos Álvarez2019-07-081-5/+1
|
* style: Generate top-level function and constant declarations for the style ↵Emilio Cobos Álvarez2019-07-081-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | crate. This needs https://github.com/eqrion/cbindgen/pull/362, but I expect it to be uncontroversial. I'll add a patch to this bug when it's merged to update it. cbindgen historically didn't include these, but it turns out to be pretty useful to generate constants for the style crate (since the binding crate is `servo/ports/geckolib`). An alternative is to get a completely different cbindgen-generated header for these, but that seems a bit wasteful. This generates the constants with the Style prefix (so we'll get `StyleMAX_GRID_LINE` for example), which is very ugly. But we probably want to eventually stop using the Style prefix and use a namespace instead, plus it's trivial to do `auto kMaxLine = StyleMAX_GRID_LINE`, for example, so it's probably not a huge deal. Another alternative would be to use associated consts, which _are_ generated by cbindgen. Something like: ``` struct GridConstants([u8; 0]); impl GridConstants { const MAX_GRID_LINE: i32 = 10000; } ``` Which would yield something like: ``` static const int32 StyleGridConstants_MAX_GRID_LINE = 10000; ``` I'm not sure if you find it preferrable, but I'm also happy to change it in a follow-up to use this. We need to fix a few manual C++ function signature definitions to match the C++ declaration. Differential Revision: https://phabricator.services.mozilla.com/D35197
* style: Rustfmt recent changes.Emilio Cobos Álvarez2019-06-041-3/+15
|
* style: Use a RwLock'd HashMap instead of a lock-free linked list for rule ↵Emilio Cobos Álvarez2019-06-041-0/+7
| | | | | | | | | | | | | | node children. I need to profile this a bit more, but talos was pretty happy about this, and it solves the known performance issues here such as the test-case from bug 1483963 for example. This also gets rid of a bunch of unsafe code which is nice. This still keeps the same GC scheme, removing the key from the hashmap when needed. I kept those as release assertions, but should probably be turned into debug-only assertions. Differential Revision: https://phabricator.services.mozilla.com/D6801
* style: Rejigger a bit rust features so that rusttests still link.Emilio Cobos Álvarez2019-06-041-4/+4
| | | | | | | | | | | We cannot compile with just feature(gecko + debug_assertions), since that's how debug rusttests get compiled and they don't have the refcount logging stuff. We were getting away with it for the pre-existing usage of the style crate, because it wasn't used during any test and presumably the linker didn't complain. But servo_arc is definitely used in tests. Differential Revision: https://phabricator.services.mozilla.com/D32691
* style: Add refcount logging to servo_arc.Emilio Cobos Álvarez2019-06-041-7/+61
| | | | Differential Revision: https://phabricator.services.mozilla.com/D32173
* style: Use cbindgen for URIs.Emilio Cobos Álvarez2019-06-041-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This doesn't clean up as much as a whole, but it's a step in the right direction. In particular, it allows us to start using simple bindings for: * Filters * Shapes and images, almost. Need to: * Get rid of the complex -moz- gradient parsing (let layout.css.simple-moz-gradient.enabled get to release). * Counters, almost. Need to: * Share the Attr representation with Gecko, by not using Option<>. * Just another variant should be enough (ContentItem::{Attr,Prefixedattr}, maybe). Which in turn allows us to remove a whole lot of bindings in followups to this. The setup changes a bit. This also removes the double pointer I complained about while reviewing the shared UA sheet patches. The old setup is: ``` SpecifiedUrl * CssUrl * Arc<CssUrlData> * String * UrlExtraData * UrlValueSource * Arc<CssUrlData> * load id * resolved uri * CORS mode. * ... ``` The new one removes the double reference to the url data via URLValue, and looks like: ``` SpecifiedUrl * CssUrl * Arc<CssUrlData> * String * UrlExtraData * CorsMode * LoadData * load id * resolved URI ``` The LoadData is the only mutable bit that C++ can change, and is not used from Rust. Ideally, in the future, we could just use rust-url to resolve the URL after parsing or something, and make it all immutable. Maybe. I've verified that this approach still works with the UA sheet patches (via the LoadDataSource::Lazy). The reordering of mWillChange is to avoid nsStyleDisplay from going over the size limit. We want to split it up anyway in bug 1552587, but mBinding gains a tag member, which means that we were having a bit of extra padding. One thing I want to explore is to see if we can abuse rustc's non-zero optimizations to predict the layout from C++, but that's something to explore at some other point in time and with a lot of care and help from Michael (who sits next to me and works on rustc ;)). Differential Revision: https://phabricator.services.mozilla.com/D31742
* style: Implement ArcSlice::default().Emilio Cobos Álvarez2019-05-291-12/+11
| | | | | | Share a singleton to avoid allocating for empty lists. Differential Revision: https://phabricator.services.mozilla.com/D30543
* style: Rustfmt + build fix.Emilio Cobos Álvarez2019-05-101-4/+11
|
* style: Add bindings for ArcSlice and ThinArc, and use them to reduce copies ↵Emilio Cobos Álvarez2019-05-101-0/+8
| | | | | | | | | | | of SVG path data. As I said over bug 1549593, the eventual goal is to use ArcSlice in all inherited properties. But this seemed like a good first candidate that doesn't require me to move around a lot more code, since we were already using cbindgen for the path commands. Differential Revision: https://phabricator.services.mozilla.com/D30134
* style: Introduce ArcSlice, a small wrapper over ThinArc but without an ↵Emilio Cobos Álvarez2019-05-101-3/+14
| | | | | | | | | | explicit header. We could make the header PhantomData or something, but then we wouldn't be able to bind to C++, since C++ doesn't have ZSTs. So add a canary instead to add a runtime check of stuff being sane. Differential Revision: https://phabricator.services.mozilla.com/D30133
* style: Fix an assertion that doesn't account for alignment padding.Emilio Cobos Álvarez2019-05-101-3/+21
| | | | | | | I'm hitting this when trying to add bindings for box shadows, which are 32-bit aligned. Differential Revision: https://phabricator.services.mozilla.com/D30353
* style: Don't panic when creating empty ThinArcs.Emilio Cobos Álvarez2019-05-101-17/+31
| | | | | | | | | The change from [T; 1] to [T; 0] shouldn't change behavior since they have the right alignment and we never poke at that particular array, but feels more correct to avoid creating types that point to uninitialized data or outside of their allocation, now that we allow empty slices. Differential Revision: https://phabricator.services.mozilla.com/D30352
* style: Use PhantomData<T> in servo_arc.Emilio Cobos Álvarez2019-05-101-1/+14
| | | | | | See https://github.com/rust-lang/rust/pull/60594#issuecomment-489966933 Differential Revision: https://phabricator.services.mozilla.com/D30169
* style: ThinArc should use NonNull.Emilio Cobos Álvarez2019-05-101-7/+9
| | | | | | If only for parallelism with Arc<>. Differential Revision: https://phabricator.services.mozilla.com/D30131
* style: Add support for static references to servo_arc::Arc. r=emilioCameron McCormack2019-04-121-38/+156
| | | | Differential Revision: https://phabricator.services.mozilla.com/D17186
* `cargo fix --edition`Simon Sapin2018-11-101-1/+1
|
* Reorder importsPyfisch2018-11-061-2/+2
|
* Fix tidy issues.Emilio Cobos Álvarez2018-09-181-13/+10
|
* servo_arc cleanups for publishing.Manish Goregaokar2018-09-181-140/+202
| | | | Differential Revision: https://phabricator.services.mozilla.com/D6034
* style: Use an acquire load for is_unique in servo_arc.Bobby Holley2018-07-241-8/+3
| | | | | | | | Fixes #21186 Bug: 1476445 Reviewed-by: Manishearth Differential Revision: https://phabricator.services.mozilla.com/D2205
* style: Fix tidy issues and Servo build.Emilio Cobos Álvarez2018-04-291-1/+1
|
* servo_arc: ArcUnion.Bobby Holley2018-04-291-2/+134
| | | | | | Bug: 1455784 Reviewed-by: Manishearth MozReview-Commit-ID: Jxp2A7cj6CV
* Run rustfmt on selectors, servo_arc, and style.Bobby Holley2018-04-101-38/+65
| | | | | | | | | | This was generated with: ./mach cargo fmt --package selectors && ./mach cargo fmt --package servo_arc && ./mach cargo fmt --package style Using rustfmt 0.4.1-nightly (a4462d1 2018-03-26)
* Change debug assertions to specific onesjanczer2018-02-071-1/+1
|
* Use specific negative assertion for ServoArcCYBAI2018-01-261-1/+1
|
* Use specific assertion for ServoArcCYBAI2018-01-261-2/+2
|
* Add some FIXME comments about using ptr::NonNullSimon Sapin2018-01-221-0/+1
|
* Prepare servo_arc for publication on crates.ioSimon Sapin2018-01-121-1/+1
|
* servo_arc: Add some #[inline] and repr(C) annotations.Emilio Cobos Álvarez2017-12-011-3/+30
| | | | | inline is probably unnecessary, but anyway... We rely on those being repr(C), so they rather have some.
* Replace all uses of the `heapsize` crate with `malloc_size_of`.Nicholas Nethercote2017-10-181-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Servo currently uses `heapsize`, but Stylo/Gecko use `malloc_size_of`. `malloc_size_of` is better -- it handles various cases that `heapsize` does not -- so this patch changes Servo to use `malloc_size_of`. This patch makes the following changes to the `malloc_size_of` crate. - Adds `MallocSizeOf` trait implementations for numerous types, some built-in (e.g. `VecDeque`), some external and Servo-only (e.g. `string_cache`). - Makes `enclosing_size_of_op` optional, because vanilla jemalloc doesn't support that operation. - For `HashSet`/`HashMap`, falls back to a computed estimate when `enclosing_size_of_op` isn't available. - Adds an extern "C" `malloc_size_of` function that does the actual heap measurement; this is based on the same functions from the `heapsize` crate. This patch makes the following changes elsewhere. - Converts all the uses of `heapsize` to instead use `malloc_size_of`. - Disables the "heapsize"/"heap_size" feature for the external crates that provide it. - Removes the `HeapSizeOf` implementation from `hashglobe`. - Adds `ignore` annotations to a few `Rc`/`Arc`, because `malloc_size_of` doesn't derive those types, unlike `heapsize`.
* Fix commonmark Markdown warnings in docs, part 1Matt Brubeck2017-10-171-2/+3
| | | | | | | | Fixes warnings from rust-lang/rust#44229 when `--enable-commonmark` is passed to rustdoc. This is mostly a global find-and-replace for bare URIs on lines by themselves in doc comments.
* servo_arc: Make Arc do a pointer equality check in eq and ne first.Cameron McCormack2017-10-111-2/+2
|