aboutsummaryrefslogtreecommitdiffstats
path: root/components
Commit message (Collapse)AuthorAgeFilesLines
...
* gfx: font_list: Fix OpenHarmony build (#32466)Jonathan Schwender2024-06-101-8/+4
| | | | Adapt changes from 1c9120c293cc16c11637feb6003117d4093642b5 to the OpenHarmony font_list.rs.
* Fix missing alpha value when using CompositeTarget::Fbo (#32453)Ngo Iok Ui (Wu Yu Wei)2024-06-101-2/+2
|
* webgpu: Enable gles support (#32452)Hieu Do2024-06-092-1/+9
|
* Don't shrink table columns when handling cells with greater spanning (#32458)Oriol Brufau2024-06-071-2/+2
| | | | | | | | | | | | | For example: ```html <table border="1"> <tr> <td></td> <td></td> </tr> <tr> <td colspan="2"></td> </tr> </table> ``` We should initially size the columns according to the cells in the first row since they have a span of 1. Then we handle the cell in the second row with a span of 2, this should be able to increase the size of the columns, but never decrease them.
* layout: Properly size absolutely positioned tables (#32447)Martin Robinson2024-06-071-1/+13
| | | Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* layout: Don't default to fallback fonts for spaces (#32442)Martin Robinson2024-06-051-1/+1
| | | | | | | | | | | | Previously, when deciding the font for a space, preference was given to the previous used font. This could means that the font chosen was a fallback font instead of the first font that supporting the space character in the font preference list. This caused an issue rendering emojis surrounded by spaces with "Noto Color Emoji" which has a space character the same size as the emoji, leading to too much spacing between them. Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
* Remove unused items in gfx (#32423)Ngo Iok Ui (Wu Yu Wei)2024-06-052-7/+0
|
* Fix getComputedStyle for width and height (#32437)Oriol Brufau2024-06-041-2/+32
| | | | | It was providing a length whenever the element generates a box. However, these properties don't apply to non-replaced inlines, so the computed value should be provided instead.
* base: Remove `ucd` dependency (#32424)Martin Robinson2024-06-0316-85/+824
| | | | | | | | | | | | | | Remove the `ucd` dependency which has not been updated in 8 years. In addition, replace it with a generated UnicodeBlock enum which reflects the modern Unicode standard. This is generated via a Python script which is included in the repository. The generation is not part of the build process, because the Unicode database is hosted on the web and it does not change the frequently. This is done instead of bringing in the more up-to-date `unicode_blocks` dependency. `unicode_blocks` defines each block as constant, which means that they cannot be used in match statements -- which we do in Servo. Co-authored-by: Lauryn Menard <lauryn.menard@gmail.com>
* layout: Add a `InlineFormattingContextBuilder` (#32415)Martin Robinson2024-06-0310-798/+961
| | | | | | | | | | | | | | | | The main change here is that collapsed and `text-transform`'d text is computed as it's processed by DOM traversal. This single transformed text is stored in the root of the `InlineFormattingContext`. This will eventually allow performing linebreaking and shaping of the entire inline formatting context at once. Allowing for intelligent processing of linebreaking and also shaping across elements. This matches more closely what LayoutNG does. This shouldn't have any (or negligable) behavioral changes, but will allow us to prevent linebreaking inside of clusters in a followup change. Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
* Update to Rust 1.78 (#32217)Samson2024-06-011-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Update to rust 1.78 * Update crown for rust 1.78 * rust 1.78 is now stable * Update for nix * Update comment Co-authored-by: Martin Robinson <mrobinson@igalia.com> * Update support/crown/src/common.rs * Update support/crown/Cargo.toml * Update support/crown/src/common.rs * Fix ipc problem * Update ipc-channel to 0.18.1 * fixed fixme --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* webgpu: Parse and forward backend prefs to wgpu (#32410)Hieu Do2024-05-312-2/+16
| | | Signed-off-by: Hieu Do <hieudn.uh@gmail.com>
* clippy: Fix warnings in `components/layout_2020/flow/text_run.rs` (#32393)Farid2024-05-311-1/+1
| | | | | | | | | | | | | * clippy: Fix warnings in `components/layout_2020/flow/text_run.rs` Signed-off-by: Jujumba <far77578@gmail.com> * clippy: Fix warnings in `components/layout_2020/flow/text_run.rs` Signed-off-by: Jujumba <far77578@gmail.com> --------- Signed-off-by: Jujumba <far77578@gmail.com>
* clippy: Fix warnings in `components/webgpu/wgpu_thread.rs` (#32392)Farid2024-05-311-30/+25
| | | | | | | | | | | | | * clippy: Fix warnings in `components/webgpu/wgpu_thread.rs` Signed-off-by: Jujumba <far77578@gmail.com> * clippy: `test-tidy` failure in `components/webgpu/wgpu_thread.rs` Signed-off-by: Jujumba <far77578@gmail.com> --------- Signed-off-by: Jujumba <far77578@gmail.com>
* font_template.rs: apply clippy lints (#32391)Farid2024-05-301-7/+7
| | | Signed-off-by: Jujumba <far77578@gmail.com>
* layout: Add support for `white-space-collapse: break-spaces` (#32388)Martin Robinson2024-05-3014-262/+394
| | | | | | | | | | | | | | This change adds support for `white-space-collapse: break-spaces` and adds initial parsing support for `overflow-wrap` and `word-break`. The later two properties are not fully supported, only in their interaction with `break-spaces`. This is a preliminary change preparing to implement them. In addition, `break_and_shape` is now forked and added to Layout 2020. This function is going to change a lot soon and forking is preparation for this. More code that is only used by Layout 2013 is moved from `gfx` to that crate. Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
* Move `RenderingContext` to `webrender_traits` (#32386)Martin Robinson2024-05-289-10/+12
| | | | | | The `gfx_traits` crate is gradually become just about text and fonts and this is one of the few things there that is standing in the way of this. Eventually `webrender_traits` will be the general cross-process compositor API, so this sort of makes sense as well.
* Upgrade stylo to 2024-05-15 (#32334)Oriol Brufau2024-05-274-4/+4
| | | | | | | | | | | | | * Upgrade stylo to 2024-05-15 * Fixup for https://phabricator.services.mozilla.com/D208599 * Fixup for https://phabricator.services.mozilla.com/D208569 * Fixup for https://phabricator.services.mozilla.com/D207796 * Fixup for https://phabricator.services.mozilla.com/D209690 * hashbrown and indexmap are no longer duplicated
* fonts: Improve font fallback (#32286)Martin Robinson2024-05-2712-327/+645
| | | | | | | | | | | | | | | | | | - Better detect situations where emoji is necessary by looking ahead one character while laying out. This allow processing Unicode presentation selectors. When detecting emoji, put emoji fonts at the front of fallback lists for all platforms. This enables monochrome emoji on Windows. Full-color emoji on Windows probably needs full support for processing the COLR table and drawing separate glyph color layers. - Improve the font fallback list on FreeType platforms. Ideally, Servo would be able to look through the entire font list to find the best font for a certain character, but until that time we can make sure the font list contains the "Noto Sans" fonts which cover most situations. Fixes #31664. Fixes #12944.
* Remove more IPC messages between script and layout (#32377)Martin Robinson2024-05-276-165/+103
| | | | | | Instead of bouncing messages from the compositor to script and then to layout, just have script call methods on Layout. Additionally, we do not need to send any followup messages to script for these messages. Instead just execute code after calling the method on Layout.
* fonts: Add support for the CSS font matching algorithm (#32366)Martin Robinson2024-05-242-41/+443
| | | | | | | | | | | | | | | | | | | | | | * fonts: Add support for the CSS font matching algorithm This is a port from Gecko of the CSS font matching algorithm distance functions as well as the "simple family" concept for optimizing matching when dealing with simple fonts. Fixes #189. Fixes #190. Fixes #20686. Fixes #20684. Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com> * Ensure that simple faces are removed for removed stylesheets --------- Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* Move webgl_channel into base crate (#32339)Ngo Iok Ui (Wu Yu Wei)2024-05-249-244/+162
| | | | | | | | | * Move webgl_channel into a shared crate * Add license header * Rename channle types and simplify module * Move module to base
* fonts: Remove web fonts when their stylsheet is removed (#32346)Martin Robinson2024-05-237-55/+194
| | | | | | | | | | | | | This is the first part of ensuring that unused fonts do not leak. This change makes it so that when a stylesheet is removed, the corresponding web fonts are removed from the `FontContext`. Note: WebRender assets are still leaked, which was the situation before for all fonts. A followup change will fix this issue. Fixes #15139. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* webgpu: Move errorscopes to WGPU thread (#32304)Samson2024-05-2236-715/+789
| | | | | | | | | | | | | | | | | | | | | * Prepare errorscopes logic in wgpu_thread * remove scope_id from ipc * new GPUErrors per spec * remove cotent timeline error_scope * fixup poperrorscope types * device_scope -> gpu_error and nice errors * Handle errors detection more elegantly * good expectations * new expectations * Make error_scope.errors Vec as per spec
* fonts: Clean up messaging during web fonts loads (#32332)Martin Robinson2024-05-229-204/+148
| | | | | | | | | | | | Instead of sending a message to the script thread via IPC when a web font loads and then sending another, just give the `FontContext` a callback that send a single message to the script thread. This moves all the cache invalidation internally into `FontContext` as well. Additionally, the unused LayoutControlMessage::ExitNow enum variant is removed. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* Implement 'visibility: collapse' on table parts (#32333)Oriol Brufau2024-05-211-19/+64
| | | | | https://drafts.csswg.org/css2/#dynamic-effects Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Implement 'empty-cells' for layout 2020 (#32331)Oriol Brufau2024-05-213-2/+33
| | | | | https://drafts.csswg.org/css-tables/#empty-cell-rendering Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* fonts: Depend directly on `freetype-sys` (#32318)Martin Robinson2024-05-213-46/+38
| | | | | | Instead of depending on `rust-freetype`, depend directly on `freetype-sys` which is a transitive dependency. This provides almost everything we need (apart from one function call). This will help us eliminate one crate in the dependency chain.
* fonts: Store web fonts in the per-Layout `FontContext` (#32303)Martin Robinson2024-05-2023-557/+920
| | | | | | | | | This moves mangement of web fonts to the per-Layout `FontContext`, preventing web fonts from being available in different Documents. Fixes #12920. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* script: Have `Document` own `Layout` (#32316)Martin Robinson2024-05-207-133/+88
| | | | | | Have `Document` own `Layout`. This makes it impossible to have a `Document` without `Layout`, which was true, but now the compiler checks it. In addition, `Layout` is now released when the `Document` is, avoiding leaking the entire `Layout`.
* compositor: Move WebRender-ish messages and types to `webrender_traits` (#32315)Mukilan Thiyagarajan2024-05-2051-615/+639
| | | | | | | | | | | | | | | | | | | | * Move WebRender related types to `webrender_traits` This refactor moves several WebRender related types from `compositing_traits`, `script_traits` and `net_traits` crates to the `webrender_traits` crate. This change also moves the `Image` type and associated function out of `net_traits` and into the `pixels` crate. Co-authored-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * Move `script_traits::WebrenderIpcSender` to `webrender_traits::WebRenderScriptApi` --------- Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Add unit test to EmbedderCoordinates (#32314)Ngo Iok Ui (Wu Yu Wei)2024-05-201-0/+62
| | | | | * Add unit test to EmbedderCoordinates * Fix typo
* clippy: Fix warnings in `components/gfx` (#32311)aBit192024-05-181-5/+5
| | | Co-authored-by: antreas <andreas.bitzilis@redpill-linpro.com>
* tables: Add a naive implementation of `border-collapse` (#32309)Martin Robinson2024-05-182-28/+111
| | | | | | | | | This change adds a very simple implementation of `border-collapse` for tables. No harmonization or merging is done at all for borders. Instead, the largest border for every continuous border sets the size. Instead of merging different border styles, they are squashed to half size -- which isn't great, but ensures appropriate positioning. Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* Move non-gfx things out of `gfx_traits` and create a `base` crate (#32296)Martin Robinson2024-05-17155-586/+640
| | | | | | | | | | | | | | | | | | | | | | | For a long time, `gfx_traits` has held a lot of things unrelated to graphics and also unrelated to the `gfx` crate (which is mostly about fonts). This is a cleanup which does a few things: 1. Move non `gfx` crate things out of `gfx_traits`. This is important in order to prevent dependency cycles with a different integration between layout, script, and fonts. 2. Rename the `msg` crate to `base`. It didn't really contain anything to do with messages and instead mostly holds ids, which are used across many different crates in Servo. This new crate will hold the *rare* data types that are widely used. Details: - All BackgroundHangMonitor-related things from base to a new `background_hang_monitor_api` crate. - Moved `TraversalDirection` to `script_traits` - Moved `Epoch`-related things from `gfx_traits` to `base`. - Moved `PrintTree` to base. This should be widely useful in Servo. - Moved `WebrenderApi` from `base` to `webrender_traits` and renamed it to `WebRenderFontApi`.
* fonts: Add color emoji support for FreeType (#32278)Martin Robinson2024-05-173-128/+286
| | | | | | | | | | | Color emoji support with "Noto Color Emoji" requires two things: 1. Support for bitmap fonts in the FreeType backend. This requires specially handling bitmap fonts which have different characteristics in the FreeType API (such as requiring metrics scaling). This support is generally ported from Gecko's implementation. 2. When a character is an emoji it "Noto Color Emoji" needs to be in the fallback list. Ensure that this is high on the list -- this will be improved in a later PR.
* android: Trim whitespace around font filenames. (#32298)Mukilan Thiyagarajan2024-05-171-1/+1
| | | | | | | | | This is a speculative fix for #32161. A similar failure is reproducible on the Android x86_64 emulator with API 35 system image. The fix has not been validated on the actual device so potentially there might be other issues that need to be fixed to complete #32161. Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* use au in HoistedSharedFragment (#32288)atbrakhi2024-05-163-11/+11
|
* Rename NavigationType to NavigationTimingType (#32299)shanehandley2024-05-162-16/+16
| | | | | | | | | This was renamed in the spec: https://github.com/w3c/navigation-timing/pull/172 The NavigationType enum name is now part of the navigation history apis: https://html.spec.whatwg.org/multipage/nav-history-apis.html\#navigationtype
* webgpu: Use WGPU poller thread for poll_all_devices (#32266)Samson2024-05-153-22/+149
| | | | | | | | | | | * Use special WGPU poller thread for poll_all_devices * Switch to latest wgpu This is required to fix some deadlocks. * non-blocking poll unconditionally * small fixes
* Fix RefCell borrows (#32276)Samson2024-05-131-3/+2
| | | | | | | * Fix RefCell borrows * Update document.rs fmt
* android: use `jemalloc` on Android (#32273)Mukilan Thiyagarajan2024-05-134-22/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | This is a fix for the crash issue in 64-bit ARM [#32175][1]. When targeting Android 11 and above, 64-bit ARM platforms have the 'Tagged Pointer' feature enabled by default which causes memory allocated using the system allocator to have a non-zero 'tag' set in the highest byte of heap addresses. This is incompatible with SpiderMonkey which assumes that only the bottom 48 bits are set and asserts this at various points. Both Servo and Gecko have a similar architecture where the pointer to a heap allocated DOM struct is encoded as a JS::Value and stored in the DOM_OBJECT_SLOT (reserved slot) of the JSObject which reflects the native DOM struct. As observed in #32175, even Gecko crashes with `jemalloc` disabled which suggests that support for using the native system allocator with tagged pointers enabled by default is not present at the moment. [1]: https://github.com/servo/servo/issues/32175 Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* script: Start rework to better match the specification HTML event loop (#31505)Gregory Terzian2024-05-139-280/+519
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix the HTML event-loop: add a update the rendering task add rendering task source sketch structure to update the rendering resize steps composition events fix warnings in rendering task source refactor handling of composition events: put window and doc for pipeline on top set script as user interacting in update the rendering task fmt add todos for other steps, put all compositor handling logic in one place update the rendering: evaluate media queries and report changes update the rendering: update animations and send events update the rendering: run animation frames update the rendering: order docs put rendering related info on documents map tidy update the rendering: add issue numbers to todos update the rendering: reflow as last step update the rendering: add todo for top layer removals note rendering opportunity when ticking animations for testing fix double borrow crash in css/basic-transition fix faster reversing of transitions test undo ordering of docs bypass not fully-active pipeline task throttling for rendering tasks ensure tasks are dequed from task queue prioritize update the rendering task remove servo media stuff from set activity tidy debug update the rendering: perform microtask checkpoint after task tidy-up only run evaluate media queries if resized re-add evaluation of media queries for each rendering task, re-prioritize rendering tasks, re-add microtask checkpoint for all sequential messages re-structure resize steps, and their interaction with evaluating media queries and reacting to environment changes update the rendering: remove reflow call at the end update webmessaging expectations update to FAIL /html/browsers/browsing-the-web/navigating-across-documents/initial-empty-document/load-pageshow-events-iframe-contentWindow.html update to FAIL load-pageshow-events-window-open.html add issue number for ordering of docs nits move batching of mouse move event to document info nits add doc for mouse move event index reset mouse move event index when taking pending compositor events fix replacing mouse move event nits * move update the rendering related data to document * move re-taking of tasks to try_recv * address nits * change task queue try_recv into take_tasks_and_recv, with nits * refactor process_pending_compositor_events * when updating the rendering, return early if script cannot continue running * use an instant for the last render opportunity time * nits * remove handle_tick_all_animations * use a vec for pending resize and compositor events * fix spec links * Fix a few other nits before landing --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* layout: When line-height is not `Normal` use metrics of first font not ↵Martin Robinson2024-05-131-4/+16
| | | | | fallback (#32165) This fixes an issue revealed by more consistent font fallback.
* fix: Implement additional logic in ↵shanehandley2024-05-134-14/+67
| | | | DOMString::set_best_representation_of_the_floating_point_number in order to correct some failing tests related to -0 values. (#32272)
* clippy: Fix last few warnings (#32270)Pi-Cla2024-05-126-58/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix clippy in components/script warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do (components/script/dom/htmlformelement.rs:896:20) warning: `Box::new(_)` of default value (components/script/dom/paintworkletglobalscope.rs:291:29) warning: this creates an owned instance just for comparison (components/script/dom/radionodelist.rs:105:50) * Fix clippy in layout_thread (2013 and 2020) warning: this `if` statement can be collapsed (components/layout_thread/lib.rs:876:17) warning: the following explicit lifetimes could be elided: 'a (components/layout_thread/lib.rs:239 and 2020 same line) warning: deref which would be done by auto-deref (components/layout_thread/lib.rs:500 and 1289) warning: dereferencing a tuple pattern where every element takes a reference (components/layout_thread/lib.rs:503,1562 and 2020 line 1153) warning: useless conversion to the same type: `style::invalidation::element::restyle_hints::RestyleHint` (components/layout_thread_2020/lib.rs:742:36) * Fix clippy in components/servo warning: constants have by default a `'static` lifetime (components/servo/lib.rs:1238:31) warning: creating a `let` binding to a value of unit type, which usually can't be used afterwards (5 occurances in components/servo/lib.rs) * FIx clippy in ports/servoshell warning: this expression creates a reference which is immediately dereferenced by the compiler (ports/servoshell/app.rs:251:89) warning: using `clone` on type `Option<TopLevelBrowsingContextId>` which implements the `Copy` trait (ports/servoshell/webview.rs:122:9)
* Implement attributes for the `<meter>` element (#32230)shanehandley2024-05-112-13/+139
| | | | | * Implement attributes for the meter element * Remove checks for min < max before clamping
* clippy: Fix vtable_address_comparisons error (#32262)sergiitomusiak2024-05-091-1/+5
| | | | | | | | | | | | * clippy: Fix vtable_address_comparisons error * Update components/script/dom/bindings/root.rs Co-authored-by: Mukilan Thiyagarajan <mukilanthiagarajan@gmail.com> --------- Co-authored-by: Sergii Tomusiak <sergiitomusiak@github.com> Co-authored-by: Mukilan Thiyagarajan <mukilanthiagarajan@gmail.com>
* webgpu: Refactor webgpu crate (#32255)Samson2024-05-0821-1413/+1475
| | | | | | | * wgpu(_core) -> wgc * Refactor webgpu crate split lib.rs into multiple modules
* webgpu: Update to wgpu 0.20 (#32173)Samson2024-05-089-42/+72
| | | | | | | | | | | * Update wgpu to 0.20 * good expectations * Throw TypeError in configure on unsupported format instead of panic * Expect * `into_command_buffer_id`,`into_command_encoder_id`