| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* fonts: Add `MallocSizeOf` implementation for `FontContext`
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* android: remove unused imports in font_list.rs
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
---------
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
This allows sharing font templates, fonts, and platform fonts across
layout threads. It's the first step toward storing web fonts in the
layout versus the shared `FontCacheThread`. Now fonts and font groups
have some locking (especially on FreeType), which will probably affect
performance. On the other hand, we measured memory usage and this saves
roughly 40 megabytes of memory when loading servo.org based on data from
the memory profiler.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* feat: Support font-relative `ch` and `ic` units
After #31966, which made it possible for the first time to resolve
font-relative CSS units, this change adds support for the `ch` and
`ic` units.
One difference with the `ex` unit that was added in that PR is that
these units must reflect the advance width of a character (the zero
digit in the case of `ch`, and the CJK water radical for `ic`) as it
would be rendered by the current font group. This means that the size
of these units don't only depend on the first available font, in the
case where that font does not contain a glyph for that character.
This is implemented by adding the advance width for these two
characters as optional fields of `FontMetrics`, so the advance width
computation happens in advance. Then, when the font metrics are
queried as part of unit resolution, the font group is searched for the
first font containing that character.
This change only implements support for these units in upright
typesetting modes, since Servo does not yet have support for vertical
writing modes. This means that many of the WPT tests that test for the
behavior of these units with vertical writing modes do not pass.
This change also makes a number of WPT tests pass, which relied on the
`ch` and `ic` units. It, however, also makes the test
`/css/css-text/white-space/text-wrap-balance-overflow-002.html` fail,
since it tests `text-wrap: balance`, which Servo does not yet
implement, and it was only previously passing by chance due to the
previous behavior of these units.
* Revert Python 3.10-related changes to wss
* Fix formatting
* Remove test expectation
|
|
|
| |
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of communicating with layout via messages, script can simply
call methods on the layout trait. This simplifies the way that script
communicates with layout and opens the path to sharing more data
structures between the two systems. This is part of a continuing
series of cleanups after removing the layout thread.
<!-- 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 do not require tests because they should not change
behavior.
<!-- 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. -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As seems #31500 still remain opened here's the next partial fix.
Fixed list: `unused_mut`, `clippy::needless_borrow`,
`clippy::match_ref_pats`, `clippy::borrow_deref_ref`, `clippy::ptr_eq`,
`clippy::unnecessary_cast`, `clippy::derivable_impls`,
`clippy::collapsible_match`, `clippy::extra_unused_lifetimes`,
`clippy::map_clone`, `clippy::manual_filter`.
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes are part of #31500.
- [x] These changes do not require tests because are only cosmetic.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change contains three semi-related clean ups:
1. the `to_webrender()` and `from_webrender()` functions on Pipeline are
turned into more-idiomatic `From` and `Into` implementations.
2. `combine_id_with_fragment_type` now returns a `u64` as that is what is
expected for all callers and not a `usize`.
3. The `query_scroll_id` query is removed entirely. The
`ExternalScrollId` that this queries is easily generated directly
from the node's opaque id. Querying into layout isn't necessary at
all.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The only font relative unit that Servo knows how to resolve currently is
`rem` (relative to the root font size). This is because Stylo cannot do
any font queries. This adds a mechanism to allow this, exposing the
ability to properly render `ex` units in Servo.
This change only allows resolving some font size relative units thoug,
as Servo doesn't collect all the FontMetrics it needs to resolve them
all. This capability will be added in followup changes.
Some new tests fail:
- ex-unit-001.html: This test fails because Servo does not yet have
support for setting the weight using @font-face rules on web fonts.
- ex-unit-004.html: This test fails because Servo does not yet have
support for setting the Unicode range of a web font using @font-face
rules.
- first-available-font-001.html: This test fails because the above
two feature are missing.
|
|
|
|
|
|
|
|
|
| |
Remove the type parameter from the layout DOM wrappers. This is possible
now that style and layout data are separate and the `Any` nature of the
layout data is exposed in the wrappers.
Removing the phantom data member of the wrappers also allows using the
default `derive` implementations for things like `Clone`, `Copy`, and
`PartialEq`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of the tricky `LayoutRPC` interface, query layout using the
`Layout` trait. This means that now queries will requires calling layout
and then running the query. During layout an enum is used to indicate
what kind of layout is necessary.
This change also removes the mutex-locked `rw_data` from both layout
threads. It's no longer necessary since layout runs synchronously. The
one downside here is that for resolved style queries, we now have to
create two StyleContexts. One for layout and one for the query itself.
The creation of this context should not be very expensive though.
`LayoutRPC` used to be necessary because layout used to run
asynchronously from script, but that no longer happens. With this
change, it becomes possible to safely pass nodes to layout from script
-- a cleanup that can happen in a followup change.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change also makes two fixes that are necessary to get WOFF2 fonts
working:
1. It adds support for loading web fonts from stylesheets included via
@import rules.
2. It ensure that when web fonts are loaded synchronusly they invalidate
the font cache. This led to incorrect font rendering when running
tests before.
Fixes #31598.
|
|
|
|
|
|
|
|
|
| |
Instead of replacing Stylist's device on every reflow, only replace it
when the viewport changes. In addition, preserve the root font size from
the previous reflow fixing an issue where `rem` units were not properly
computed between reflows.
This fixes a bug where fonts that are sized using `rem` units change
size on reload.
|
|
|
|
|
|
| |
This adds basic support for `getClientRects()` by sharing code with the
implementation of `getBoundingClientRect()`. In addition to sharing
code, it also shares all of the bugs. Primarily, scrolilng positions are
not taken into account when return boundary rectangles.
|
|
|
|
|
|
|
|
|
| |
This brings the version of WebRender used in Servo up-to-date with Gecko
upstream. The big change here is that HiDPI is no longer handled via
WebRender. Instead this happens via a scale applied to the root layer in
the compositor. In addition to this change, various changes are made to
Servo to adapt to the new WebRender API.
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
|
|
|
|
|
|
|
| |
The specification gives instructions for how these values should be
propagated. The other big changs here is that they aren't applied to the
`<body>`.
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of letting Stylo filter `@font-face` rules, handle this
filtering in Servo. It doesn't make sense that Stylo knows about what
fonts Servo supports. This also cleans up a bit the way that this is
handled, giving an entire stylesheet of rules to the font cache to
process instead of letting each layout thread walk the rules. This
brings more of the font-related code into the FontCacheThread itself.
This is the first step toward adding WOFF2 support and fixing various
web font related bugs.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Layout 2020 (#31436)
* layout: support setting canvas font
Signed-off-by: syvb <me@iter.ca>
* Update 2d.reset.state.font.html test
Signed-off-by: syvb <me@iter.ca>
---------
Signed-off-by: syvb <me@iter.ca>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* script: Do not run layout in a thread
Instead of spawning a thread for layout that almost always runs
synchronously with script, simply run layout in the script thread.
This is a resurrection of #28708, taking just the bits that remove the
layout thread. It's a complex change and thus is just a first step
toward cleaning up the interface between script and layout. Messages are
still passed from script to layout via a `process()` method and script
proxies some messages to layout from other threads as well.
Big changes:
1. Layout is created in the script thread on Document load, thus every
live document is guaranteed to have a layout. This isn't completely
hidden in the interface, but we can safely `unwrap()` on a Document's
layout.
2. Layout configuration is abstracted away into a LayoutConfig struct
and the LayoutFactory is a struct passed around by the Constellation.
This is to avoid having to monomorphize the entire script thread
for each layout.
3. Instead of having the Constellation block on the layout thread to
figure out the current epoch and whether there are pending web fonts
loading, updates are sent synchronously to the Constellation when
rendering to a screenshot. This practically only used by the WPT.
A couple tests start to fail, which is probably inevitable since removing
the layout thread has introduced timing changes in "exit after load" and
screenshot behavior.
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
* Update test expectations
* Fix some issues found during review
* Clarify some comments
* Address review comments
---------
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
|
|
|
|
|
| |
In order for stylo to be a separate crate, it needs to depend on less
things from Servo. This change makes it so that stylo no longer depends
on servo_url.
|
|
|
| |
These were identified with `cargo-marchete`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This completes the transition to compiling Servo with rust stable. Some
nightly-only features are still used when compiling the `script` and
`crown` crates, as well as for some style unit tests. These will likely
break with newer compiler versions, but `crown` can be disabled for them
conditionally. This is just the first step.
This has some caveats:
1. We need to disable setting up the special linker on Linux. The -Z
option isn't supported with stable rust so using this is out --
meanwhile we can't be sure that lld is installed on most systems.
2. `cargo fmt` still uses some unstable options, so we need to rely on
the unstable toolchain just for running `fmt`. The idea is to fix this
gradually.
|
|
|
|
|
|
|
|
|
|
| |
* Add initial support for sticky positioning for non-legacy layout
Many tests still fail for a variety of reasons. One of the primary ones
is that CSSOM currently does not return correct values for elements
positioned by sticky nodes. This requires changes to WebRender to work
properly.
* Fix an assertion failure in the legacy layout sticky code
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is the start of the organization of types that are in their own
crates in order to break dependency cycles between other crates. The
idea here is that putting these packages into their own directory is the
first step toward cleaning them up. They have grown organically and it
is difficult to explain to new folks where to put new shared types. Many
of these crates contain more than traits or don't contain traits at all.
Notably, `script_traits` isn't touched because it is vendored from
Gecko. Eventually this will move to `third_party`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Sort stacking contexts and stacking containers by painting order
* fix stealing of stacking containers; fix interleaving with fragments
* actually positioned stacking containers should be stolen too
* update expectations and clean up panic changes
* rework naming and docs
* rename s_c_a_p_s_c to real_s_c_a_p_s_c; fix docs
* rename InlineStackingContainer to AtomicInlineStackingContainer
* rework debug logging to use PrintTree
* clean up docs and PrintTree output
* don't panic unless cfg!(debug_assertions) is true
* update expectations
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Refactor the scrolling and scrollable area calculation on the window
object, to make it better match the specification. This has some mild
changes to behavior, but in general things work the same as they did
before. This is mainly preparation for properly handling viewport
propagation of the `overflow` property but seems to fix a few issues as
well.
There is one new failure in Layout 2020 regarding `position: sticky`,
but this isn't a big deal because there is no support for `position:
sticky` in Layout 2020 yet.
Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
|
|
|
|
|
| |
* strict imports formatting
* Reformat all imports
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Upgrade vendored version of WebRender
* Patch WebRender: upgrade version of gleam
* Restore hit testing implementation
* Fix WebRender warnings
* Adapt Servo to new WebRender
* Update results
* Add a workaround for #30313
This slightly expands text boundaries in order to take into account the
fact that layout isn't measuring glyph boundaries.
|
|
|
|
|
|
|
|
|
|
|
| |
* remove extern crate
* Update components/script_plugins/lib.rs
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
---------
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* build(deps): bump parking_lot from 0.11.2 to 0.12.0
Bumps [parking_lot](https://github.com/Amanieu/parking_lot) from 0.11.2 to 0.12.0.
- [Changelog](https://github.com/Amanieu/parking_lot/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Amanieu/parking_lot/compare/0.11.2...0.12.0)
---
updated-dependencies:
- dependency-name: parking_lot
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Upgrade parking-log in style and layout_thread* as well
---------
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
|
|
|
|
|
| |
The newer versions of WebRender move types around between `webrender` and
`webrender_api` and this will reduce the churn during the upgrade.
|
|
|
|
| |
Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com>
|
|
|
|
|
|
|
|
| |
This is a step toward upgrading WebRender, which will be upgraded and
patched in the `third_party` directory. This change vendors the current
private branch of WebRender that we use and adds a `patches` directory
which tracks the changes on top of the upstream WebRender commit
described by third_party/webrender/patches/head.
|
|
|
|
| |
Just a remnant from #29850, it was causing a build warning.
|
|
|
|
| |
This also removes the meta viewport support (which was implemented on top), but that also had a single test and is disabled everywhere, so I'm not too concerned, it can be implemented again if / when needed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
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.
|