aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_thread/lib.rs
Commit message (Collapse)AuthorAgeFilesLines
* Layout-2020: Serialize access to stylo thread pool.Mukilan Thiyagarajan2023-05-261-11/+5
| | | | | | | | | | | | | | | | | | | | When rendering a page containing an iframe, layout 2020 creates parallel 'Layout' threads which share workers in the stylo thread pool. Because of the way the 'StyleSharingCache' is designed using TLS for storage of the LRU cache, this leads to a double borrow of the cache when both layout threads run concurrently. More details about the issue can be found here: https://gist.github.com/mukilan/ed57eb61b83237a05fbf6360ec5e33b0 This PR is a workaround until we find a more elegant/optimal design that also can work for gecko. The fix for now is simply to not allow multiple layouts in parallel. Signed-off-by: Mukilan Thiyagarajan <me@mukilan.in>
* Clean up and document the `send_display_list` interfaceMartin Robinson2023-05-241-10/+6
| | | | | | This moves more members to the CompositorDisplayListInfo struct, which now holds all miscellaneous, non-WebRender data when sending display lists. It also documents what each things sent with a display list does.
* Auto merge of #29745 - mrobinson:compositor-side-scroll-tree, r=mukilanbors-servo2023-05-231-7/+5
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a compositor-side scroll tree This will allow the compositor to properly chain scrolling requests up when a node has reached the extent of the scroll area. In addition, it removes the use of the deprecated WebRender `scroll()` API. This fixes scrolling on servo.org. --- <!-- 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 - [x] These changes: - Fix #29402. - Fix #27996. - Fix #27624. - Fix #24028. - Fix #23918. - Fix #21165. - [x] There are tests for these changes
| * Add a compositor-side scroll treeMartin Robinson2023-05-191-7/+5
| | | | | | | | | | | | This will allow the compositor to properly chain scrolling requests up when a node has reached the extent of the scroll area. This fixes scrolling on servo.org.
* | Further changes required by ServoOriol Brufau2023-05-161-6/+2
|/
* Eliminate duplicate Layout DOM wrappersMartin Robinson2023-05-051-20/+20
| | | | | | | | | | There are duplicate sets of Layout DOM wrappers: one for Layout 2013 and one for Layout 2020. As part of cleaning up and simplifying the wrappers, this change parameterizes them on the specific layout data they contain. This allows them to be shared again. In addition, various small cleanups are included. Fixes #29691.
* Clean up arguments passed to and stored in LayoutThreadMartin Robinson2023-05-011-91/+26
|
* Scroll from script should trigger a reflowMartin Robinson2023-04-251-17/+19
| | | | | | | | | Scrolling from script should flow layout and send a display list to WebRender. This allows all of the scroll nodes to exist in WebRender before asking it to move the node. See https://gist.github.com/paulirish/5d52fb081b3570c81e3a. Fixes #29659.
* Add support for <iframe> elements for Layout 2020Martin Robinson2023-04-041-43/+48
| | | | | | This change adds support for the <iframe> element to Layout 2020. In addition, certain aspects of the implementation are made the same between both layout systems.
* Fix some build warningsMartin Robinson2023-03-271-1/+0
|
* Move hit testing information out of WebRenderMartin Robinson2023-03-151-8/+10
| | | | | | | | | Store hit testing information in a data structure that sits alongside the display list in the compositor. This will allow the compositor to store more information per-node. The data structure also takes care of de-duplicating information between successive display list entries. In the future, the data structure can be even more aggressive in producing smaller side hit testing lists, if necessary.
* Actually check if root is absolute positionedWu Yu Wei2022-04-191-6/+15
|
* feat: shorten thread namesyvt2021-07-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Linux kernel imposes a 15-byte limit on thread names[1]. This means information that does not fit in this limit, e.g., the pipeline ID of layout and script threads, is lost in a debugger and profiler (see the first column of the table below). This commit shortens the thread names used in Servo to maximize the amount of information conveyed. It also rectifies some inconsistencies in the names. | Before | After | |-------------------|-------------------| | `BluetoothThread` | `Bluetooth` | | `CanvasThread` | `Canvas` | | `display alert d` | `AlertDialog` | | `FontCacheThread` | `FontCache` | | `GLPlayerThread` | `GLPlayer` | | `HTML Parser` | `Parse:www.examp` | | `LayoutThread Pi` | `Layout(1,1)` | | `Memory profiler` | `MemoryProfiler` | | `Memory profiler` | `MemoryProfTimer` | | `OfflineAudioCon` | `OfflineACResolv` | | `PullTimelineMar` | `PullTimelineDat` | | `ScriptThread Pi` | `Script(1,1)` | | `WebWorker for h` | `WW:www.example.` | | `ServiceWorker f` | `SW:www.example.` | | `ServiceWorkerMa` | `SvcWorkerManage` | | `Time profiler t` | `TimeProfTimer` | | `Time profiler` | `TimeProfiler` | | `WebGL thread` | `WebGL` | | `Choose a device` | `DevicePicker` | | `Pick a file` | `FilePicker` | | `Pick files` | `FilePicker` | [1]: https://stackoverflow.com/questions/5026531/thread-name-longer-than-15-chars
* Miscellaneous build / tidy fixes.Emilio Cobos Álvarez2021-02-261-1/+7
|
* Fix warnings introduced in newer Rust NightlySimon Sapin2021-02-251-5/+0
| | | | | | | | | | | | This does not (yet) upgrade ./rust-toolchain The warnings: * dead_code "field is never read" * redundant_semicolons "unnecessary trailing semicolon" * non_fmt_panic "panic message is not a string literal, this is no longer accepted in Rust 2021" * unstable_name_collisions "a method with this name may be added to the standard library in the future" * legacy_derive_helpers "derive helper attribute is used before it is introduced" https://github.com/rust-lang/rust/issues/79202
* Fix num_threads to avoid divide by zero error when running without a thread poolteymour-aldridge2020-12-281-1/+1
| | | | Signed-off-by: teymour-aldridge <teymour.aldridge@icloud.com>
* ensure clean shutdown of all threads running JSGregory Terzian2020-06-301-15/+10
|
* Add animation and transition support for pseudo-elementsMartin Robinson2020-06-161-2/+14
| | | | | | | | | | This change extends the DocumentAnimationSet to hold animations for pseudo-elements. Since pseudo-elements in Servo are not in the DOM like in Gecko, they need to be handled a bit carefully in stylo. When a pseudo-element has an animation, recascade the style. Finally, this change passes the pseudo-element string properly to animation events. Fixes: #10316
* Add DocumentAnimationSet and AnimationSetKeyMartin Robinson2020-06-151-11/+13
| | | | | | | This will be used in order to hold animations for pseudo elements in the DocumentAnimationSet. Also no longer store the OpaqueNode in the animation and transition data structures. This is already part of the DocumentAnimationSet key.
* Store resolved font style in canvas context stateUtsav Oza2020-06-101-7/+8
|
* Query layout to resolve canvas font property valueUtsav Oza2020-06-101-4/+22
|
* Remove unecessary webrender document from layout.Josh Matthews2020-06-091-17/+3
|
* Cache animation computed values when animations changeMartin Robinson2020-06-051-1/+8
| | | | | | | | Instead of recalculating the animation style every tick of an animation, cache the computed values when animations change. In addition to being more efficient, this will allow us to return animation rules as property declarations because we don't need to consult the final style to produce them.
* Remove support for energy profilingSimon Sapin2020-06-041-2/+0
|
* Implement concept of dirty rootAnthony Ramine2020-05-191-15/+27
|
* Move most animation processing to scriptMartin Robinson2020-05-121-34/+41
| | | | | | | 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.
* Split animations and transitions into separate listsMartin Robinson2020-05-061-3/+3
| | | | | | | | | | | This change splits the list of animations and transitions, which are almost always handled differently. It also renames `ElementAnimationState` to `ElementAnimationSet` and establishes an `AnimationState` for every transition and animation. This allows us to stop continually reallocating lists every time a transition or animation needs to be canceled. Fixes #14419.
* Start having animations conform to the HTML specMartin Robinson2020-05-051-19/+4
| | | | | | | | | | | | | | This is a small step toward fixing #19242. The main idea is that the clock for animations should advance as the event loop ticks. We accomplish this by moving the clock from layout and naming it the "animation timeline" which is the spec language. This should fix flakiness with animations and transitions tests where a reflow could move animations forward while script was running. This change also starts to break out transition and animation events into their own data structure, because it's quite likely that the next step in fixing #19242 is to no longer send these events through a channel.
* Use a restyle for animation ticksMartin Robinson2020-05-051-128/+21
| | | | | | | | | | | | | | 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-14/+8
| | | | | | | | | | 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.
* Add support for transitionrun eventsMartin Robinson2020-04-241-4/+9
| | | | | | These events are triggered as soon as a transition is added to the list of running transitions. This will allow better test coverage while reworking the transitions and animations processing model.
* Add ElementAnimationState and PossibleElementAnimationStateMartin Robinson2020-04-241-41/+18
| | | | | | | | | | | | This refactor is preparation for implementing a specification compliant transitions and animations processing model. These data structures hold all the animation information about a single node. Since adding, updating, and modifying animations for a single node are all interdependent, it makes sense to start encapsulating animation data and functionality into a single data structure. This also opens up the possibility for easier concurrency in the future by more easily allowing per-node mutexes.
* Auto merge of #26244 - mrobinson:animation-cancel, r=jdmbors-servo2020-04-221-0/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for canceling CSS transitions This change adds support for canceling CSS transitions when a property is no longer transitionable. Support for canceling and replacing CSS transitions when the end value changes is still pending. This change also takes advantage of updating the constellation message to fix a bug where transition events could be sent for closed pipelines. Fixes #15079. <!-- Please describe your changes on the following line: --> --- <!-- 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 - [x] These changes fix #15079. <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
| * Add support for canceling CSS transitionsMartin Robinson2020-04-221-0/+6
| | | | | | | | | | | | | | | | | | | | | | This change adds support for canceling CSS transitions when a property is no longer transitionable or when an element becomes styled with display:none. Support for canceling and replacing CSS transitions when the end value changes is still pending. This change also takes advantage of updating the constellation message to fix a bug where transition events could be sent for closed pipelines. Fixes #15079.
* | Make the rule tree actually threadsafeAnthony Ramine2020-04-201-3/+1
|/ | | | | | RuleTree::gc is now a safe method that any thread can call at any time, and StrongRuleNode values can all be dropped whenever their owner want to, on any thread.
* Don't go through the layout thread to retrieve a node's primary styleAnthony Ramine2020-04-071-12/+4
|
* Auto merge of #26110 - servo:layout-2020-rm-note-dirty-descendant, r=emiliobors-servo2020-04-041-8/+0
|\ | | | | | | Kill ServoLayoutElement::note_dirty_descendant
| * Kill ServoLayoutElement::note_dirty_descendantAnthony Ramine2020-04-041-8/+0
| | | | | | | | | | | | There is no need to set the dirty descendants flag unsafely from the layout side for elements with pending restyles, we can do that on the DOM side when draining the restyles from the Document.
* | Make DOM own the style and layout data, in an UnsafeCellAnthony Ramine2020-04-041-8/+0
| | | | | | | | The previous Cell was a lie.
* | Don't expose any AtomicRefCell directly from style traitsAnthony Ramine2020-04-041-3/+1
|/ | | | This lets us experiment with how we store this data on the DOM side.
* Pass pending restyles instead of draining them from layoutAnthony Ramine2020-03-281-2/+4
|
* Add a 'dom lifetime to GetLayoutDataAnthony Ramine2020-03-261-1/+1
|
* Remove unnecessary .clone() callsIulian Gabriel Radu2020-03-041-5/+5
|
* Make Background Hang Monitor OptionalKunal Mohan2020-02-231-9/+15
| | | | | | This is done by wrapping all channels of communication and related objects inside Option which are configured using flag inside servo_config.
* remove option for origin and mirror changes to layout_thread_2020Kunal Mohan2020-02-181-19/+21
|
* Take origin from window instead of creating a new one in case of reflowKunal Mohan2020-02-151-4/+12
| | | | | | | | | | 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.
* Improve the name the NodeGeometryQueryMartin Robinson2020-02-051-4/+4
| | | | | | | This query is used to get the clientTop, clientWidth, clientHeight, clientLeft properties of DOM objects. "NodeGeometry" doesn't really capture what these properties do as they often are returning the width of element border.
* Use non-IPC webrender API over explicit IPC channels.Josh Matthews2019-11-271-30/+13
|
* layout: Inform webrender about new pipeline as early as possible.Josh Matthews2019-11-131-2/+16
|
* Ensure layout/script always have a correct viewport size when a new pipeline ↵Josh Matthews2019-11-061-23/+8
| | | | is created.