aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/context.rs
Commit message (Collapse)AuthorAgeFilesLines
* Strict import formatting (grouping and granularity) (#30325)Samson2023-09-111-8/+9
| | | | | * strict imports formatting * Reformat all imports
* Combine DOM-related concepts in Layout 2020 into dom.rsMartin Robinson2023-05-131-3/+2
|
* Move most animation processing to scriptMartin Robinson2020-05-121-4/+0
| | | | | | | This is preparation for sharing this code with layout_2020 and implementing selective off-the-main-thread animations. We still look for nodes not in the flow tree in the layout thread.
* Don't send a load event when a loaded image is actually the placeholderBastien Orivel2020-05-081-1/+1
| | | | | | | | | | | | The image cache returns an `ImageCacheResult::ImageAvailable `the second time you try getting the placeholder. This means that in some cases, the loading of an image would fail, then the same image would get fetched from the cache, the placeholder would be loaded from that but would be seen as a normal image, firing a load event. This made the tests in `fetch/cross-origin-resource-policy/image-loads.html` fail depending on their order.
* Use a restyle for animation ticksMartin Robinson2020-05-051-37/+14
| | | | | | | | | | | | | | This change corrects synchronization issues with animations, by reworking the animation processing model to do a quick restyle and incremental layout when ticking animations. While this change adds overhead to animation ticks, the idea is that this will be the fallback when synchronous behavior is required to fulfill specification requirements. In the optimistic case, many animations could be updated and applied off-the-main-thread and then resynchronized when style information is queried by script. Fixes #13865.
* Add support for animationend eventMartin Robinson2020-05-011-2/+2
| | | | | | | | | | This is triggered when an animation finishes. This is a high priority because it allows us to start rooting nodes with animations in the script thread. This doesn't yet cause a lot of tests to pass because they rely on the existence of `Document.getAnimations()` and the presence of `animationstart` and animationiteration` events.
* Refactor ImageCache::find_image_or_metadata API.Julien Tregoat2020-04-171-25/+26
|
* Take origin from window instead of creating a new one in case of reflowKunal Mohan2020-02-151-0/+2
| | | | | | | | | | Everytime a new LayoutContext was created, it created a new origin which caused endless stream of image loads to occur in case of reflow. The reason for this was that the existing image, although cached successfully, was not used because the entry in hashmap did not match because of different(new) origin. This is solved by storing the origin of a window in enum ScriptReflow and used in creating new LayoutContext in case of reflow.
* Support CORS attributes for image elements.Josh Matthews2019-10-041-0/+1
|
* Double key image cache by requesting origin, and store CORS status with ↵Josh Matthews2019-10-041-4/+10
| | | | cached images.
* Update MPL license to https (part 4)Jan Andre Ikenmeyer2018-11-191-1/+1
|
* `cargo fix --edition-idioms`Simon Sapin2018-11-081-3/+3
|
* Reorder importsPyfisch2018-11-061-1/+1
|
* Sort `use` statementsSimon Sapin2018-11-061-1/+1
|
* `cargo fix --edition`Simon Sapin2018-11-061-2/+2
|
* Rustfmt layout cratePyfisch2018-09-011-27/+38
|
* Move DL items from gfx to layoutPyfisch2018-04-221-1/+1
| | | | | | | | | Implement corner clipping. Remove PixelFormat from WebrenderImageInfo. Use WebRender text shadow. Remove MallocSizeOf and Deserialize for DL items. Closes #19649, #19680, #19802
* Add test for FontContext/FontGroup functionalityJon Leighton2018-02-221-2/+4
| | | | | | | | | | | | | | | | | | | | | | Unfortunately, this required quite a bit of changes to the non-test code. That's because FontContext depends on a FontCacheThread, which in turn depends on a CoreResourceThread and therefore lots of other data structures. It seemed like it would be very difficult to instantiate a FontContext as it was, and even if we could it seems like overkill to have all these data structures present for a relatively focused test. Therefore, I created a FontSource trait which represents the interface which FontContext uses to talk to FontCacheThread. FontCacheThread then implements FontSource. Then, in the test, we can create a dummy implementation of FontSource rather than using FontCacheThread. This actually has the advantage that we can make our dummy implementation behave in certain specific way which are useful for testing, for example it can count the number of times find_font_template() is called, which helps us verify that caching/lazy-loading is working as intended.
* Replace all uses of the `heapsize` crate with `malloc_size_of`.Nicholas Nethercote2017-10-181-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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`.
* Speculatively evaluate paint functions during style.Alan Jeffrey2017-07-311-8/+9
|
* Implemented paint worklet properties.Alan Jeffrey2017-07-111-3/+13
|
* Rip out the generic abstractions around ThreadLocalStyleContext.Bobby Holley2017-07-051-28/+1
| | | | MozReview-Commit-ID: 5WTLuk323Ac
* Implemented the plumbing for paint worklets.Alan Jeffrey2017-06-071-0/+4
|
* Use the origin of the actual image response when determining if a canvas is ↵SendilKumar N2017-05-191-1/+1
| | | | origin clean.
* Accumulate transitioning nodes inside the layout context.Josh Matthews2017-05-151-1/+6
|
* Eliminate ScrollRootIdMartin Robinson2017-04-201-0/+4
| | | | | | | Just use WebRender's ClipId directly. This will allow us to create and use ReferenceFrames in the future, if we need to do that. It will also make it easier to have Servo responsible for creating the root scrolling area, which will allow removing some old hacks in the future.
* Make image cache per-document rather than globalFernando Jiménez Moreno2017-03-271-8/+7
|
* Replace RwLock<StyleRule> with Locked<StyleRule>Simon Sapin2017-03-191-4/+4
|
* Avoid dropping image requests on the ground from non-script-initiated reflow.Josh Matthews2017-02-221-11/+28
|
* Make script thread initiate requests for images needed by layout.Josh Matthews2017-02-221-58/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In support of this goal, the layout thread collects information about CSS images that are missing image data and hands it off to the script thread after layout completes. The script thread stores a list of nodes that will need to be reflowed after the associated network request is complete. The script thread ensures that the nodes are not GCed while a request is ongoing, which the layout thread is incapable of guaranteeing. The image cache's API has also been redesigned in support of this work. No network requests are made by the new image cache, since it does not possess the document-specific information necessary to initiate them. Instead, there is now a single, synchronous query operation that optionally reserves a slot when a cache entry for a URL cannot be found. This reserved slot is then the responsibility of the queryer to populate with the contents of the network response for the URL once it is complete. Any subsequent queries for the same URL will be informed that the response is pending until that occurs. The changes to layout also remove the synchronous image loading code path, which means that reftests now test the same code that non-test binaries execute. The decision to take a screenshot now considers whether there are any outstanding image requests for layout in order to avoid intermittent failures in reftests that use CSS images.
* Remove cached thread local context from LayoutContextPu Xingyu2017-02-081-64/+21
| | | | | Remove cached thread local context from LayoutContext, use LayoutContext for assign_inline_sizes(), and simplify the parallel flow traversal code.
* Remove redundant style_context() method of LayoutContextPu Xingyu2017-02-061-8/+0
|
* Bug 1325734 - Pass the thread-local context into should_traverse_children. ↵Bobby Holley2017-01-091-0/+13
| | | | r=emilio
* Stop allowing unsafe code around thread_local.Ms2ger2016-12-301-3/+0
|
* Stop using UnsafeNode in the StyleSharingCandidateCache.Bobby Holley2016-12-211-3/+4
|
* Introduce and use Scoped TLS.Bobby Holley2016-12-211-37/+34
| | | | | | | | | | | | | | | | It turns out that it's problematic to embed ThreadLocalStyleContext within LayoutContext, because parameterizing the former on TElement (which we do in the next patch) infects all the traversal stuff with the trait parameters, which we don't really want. In general, it probably makes sense to use separate scoped TLS types for the separate DOM and Flow tree passes, so we can add a different ScopedTLS type for the Flow pass if we ever need it. We also reorder the |scope| and |shared| parameters in parallel.rs, because it aligns more with the order in style/parallel.rs. I did this when I was adding a TLS parameter to all these functions, which I realized we don't need for now.
* Make the DomTraversalContext own the SharedStyleContext and share it ↵Bobby Holley2016-12-161-31/+42
| | | | | | | | | | immutably across the traversal. This allows us to get rid of a bunch of lifetimes and simplify a lot of code. It also lets us get rid of that nasty lifetime transmute, which is awesome. The situation with thread-local contexts is still suboptimal, but we fix that in subsequent patches.
* Removed util.Alan Jeffrey2016-12-141-1/+1
|
* Make Restyle tracking more granular.Bobby Holley2016-12-091-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | The primary idea of this patch is to ditch the rigid enum of Previous/Current styles, and replace it with a series of indicators for the various types of work that needs to be performed (expanding snapshots, rematching, recascading, and damage processing). This loses us a little bit of sanity checking (since the up-to-date-ness of our style is no longer baked into the type system), but gives us a lot more flexibility that we'll need going forward (especially when we separate matching from cascading). We also eliminate get_styling_mode in favor of a method on the traversal. This patch does a few other things as ridealongs: * Temporarily eliminates the handling for transfering ownership of styles to the frame. We'll need this again at some point, but for now it's causing too much complexity for a half-implemented feature. * Ditches TRestyleDamage, which is no longer necessary post-crate-merge, and is a constant source of compilation failures from either needing to be imported or being unnecessarily imported (which varies between gecko and servo). * Expands Snapshots for the traversal root, which was missing before. * Fixes up the skip_root stuff to avoid visiting the skipped root. * Unifies parallel traversal and avoids spawning for a single work item. * Adds an explicit pre_traverse step do any pre-processing and determine whether we need to traverse at all. MozReview-Commit-ID: IKhLAkAigXE
* Urlmageddon: Use refcounted urls more often.Emilio Cobos Álvarez2016-11-171-8/+8
|
* Concurrent rule tree, v1Emilio Cobos Álvarez2016-11-051-3/+0
| | | | | | | | | | | | This patch introduces infrastructure for the rule tree, and constructs it. We don't use it yet, nor have good heuristics for GC'ing it, but this should not happen anymore once we store the rule node reference in the node. I haven't messed up with memory orders because I want to do a try run with it, then mess with them. Take down the ApplicableDeclarationsCache, use the rule tree for doing the cascade.
* Auto merge of #14048 - antrik:nosync-ipc_sender, r=mbrubeckbors-servo2016-11-031-5/+8
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | layout/context: Wrap `image_cache_thread` in a `Mutex<>` as well `SharedLayoutContext.image_cache_thread` didn't get the `Mutex<>` treatment along with all the other channels in there, because `ipc-channel::Sender` is presently inherently `Sync`. I believe this to be an implementation accident though, that should be rectified in the future -- not something users should actually rely on... Note that sharing senders (be it `mpsc` or `ipc-channel`) in is probably not a good idea anyway: just cloning them -- and letting them handle the sharing internally -- should be both simpler and cheaper. But right now that's how things are handled here; so let's go with the flow... <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14048) <!-- Reviewable:end -->
| * layout/context: Wrap `image_cache_thread` in a `Mutex<>` as wellOlaf Buddenhagen2016-11-031-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | `SharedLayoutContext.image_cache_thread` didn't get the `Mutex<>` treatment along with all the other channels in there, because `ipc-channel::Sender` is presently inherently `Sync`. I believe this to be an implementation accident though, that should be rectified in the future -- not something users should actually rely on... Note that sharing senders (be it `mpsc` or `ipc-channel`) in is probably not a good idea anyway: just cloning them -- and letting them handle the sharing internally -- should be both simpler and cheaper. But right now that's how things are handled here; so let's go with the flow...
* | Make style context use parking_lot::RwLockXidorn Quan2016-11-021-5/+3
|/
* Remove concept of Layers from ServoMartin Robinson2016-10-211-6/+0
| | | | | | | | Layers were a feature of the legacy drawing path. If we re-add them at some point, it probably makes more sense to make them a product of display list inspection. This change also remove a bunch of dead painting code.
* Remove old rendering backend.Glenn Watson2016-10-181-20/+11
| | | | | | | | | | | | | | This removes paint threads, rust-layers dependency, and changes optional webrender types to be required. The use_webrender option has been removed, however I've left the "-w" command line option in place so that wpt runner can continue to pass that. Once it's removed from there we can also remove the -w option. Once this stage is complete, it should be fine to change the display list building code to generate webrender display lists directly and avoid the conversion step.
* Move image fetching methods to SharedLayoutContext.Ms2ger2016-08-231-9/+10
|
* Remove some type aliases that are now just re-exports.Simon Sapin2016-07-201-2/+1
|
* Have a concrete SelectorImpl type everywhere in the style crate.Simon Sapin2016-07-201-2/+1
| | | | | It is conditionally compiled to one implementation or the other (Gecko or Servo) with `#[cfg(…)]`.
* Remove the ComputedValue traits and style_struct_traitsSimon Sapin2016-07-201-2/+2
|