Commit graph

50 commits

Author SHA1 Message Date
valadaptive
60e65c175d
Implement the aspect-ratio property for replaced elements (#32800)
* Add WPT tests for box-sizing with aspect-ratio

Signed-off-by: valadaptive <valadaptive@protonmail.com>

* Implement `aspect-ratio` for replaced elements

There are two regressions because we don't implement `object-fit`, and
one because we don't properly represent non-available <img>s with `alt`
attributes.

Signed-off-by: valadaptive <valadaptive@protonmail.com>

---------

Signed-off-by: valadaptive <valadaptive@protonmail.com>
2024-07-24 11:40:23 +00:00
rachaelspooky
8b3c9b744a
Fix 5 clippy warnings (#32808)
Signed-off-by: Rachael Gentry <rachael.l.gentry@gmail.com>
2024-07-19 04:04:42 +00:00
valadaptive
f6c9714286
Fix sizing of replaced elements with min/max sizes (#32777)
If a (min/max)-(height/width) property is set, we still need to respect
the intrinsic ratio of the element if it exists. The previous code was
simply clamping the element size after doing the sizing calculations
once, but this leads to an incorrect aspect ratio.

Signed-off-by: valadaptive <valadaptive@protonmail.com>
2024-07-18 07:07:13 +00:00
Martin Robinson
4b63043c6a
clippy: Fix warnings in shared and config, fonts, layout, and layout_2020 components (#32674) 2024-07-04 14:18:58 +00:00
Oriol Brufau
f055964792
Switch replaced layout to app units (#32625) 2024-06-26 16:19:24 +00:00
atbrakhi
26c585a0c5
use app unit in box_fragement (#32349) 2024-06-21 14:54:21 +00:00
Mukilan Thiyagarajan
2af6fe0b30
compositor: Move WebRender-ish messages and types to webrender_traits (#32315)
* 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>
2024-05-20 10:35:18 +00:00
Martin Robinson
3398fc017b
Move non-gfx things out of gfx_traits and create a base crate (#32296)
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`.
2024-05-17 12:28:58 +00:00
Martin Robinson
f379041597
layout: Add support for <object> with image data URLs (#32069)
This is enough support for `<object>` to get Acid2 working.

Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2024-04-15 20:20:55 +00:00
Josh Matthews
41a41b3d8f
Treat video elements as replaced content and render the current frame. (#31412)
* Treat video elements as replaced content and render the current frame.

* Update test results.
2024-02-23 17:34:08 +00:00
Martin Robinson
9a6973d629
style: Remove dependency on servo_url (#31358)
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.
2024-02-16 11:56:35 +00:00
atbrakhi
091653417a
use app unit in replaced elements (#31178)
* use app unit in replaced elements

* more app unit usage

* Avoid unnecessary into()

* Run ./mach fmt

* use scaleby

* update

---------

Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2024-01-29 09:21:52 +00:00
Oriol Brufau
50f56affe3
Lint layout_2020 with clippy (#31169)
cargo clippy --fix -p layout_2020 --allow-dirty --broken-code
2024-01-25 09:03:31 +00:00
atbrakhi
45af1198aa
Layout: use Au in ContentSizes (#31135)
* use app_units

* resolve errors in table layout

* fmt

* add back current_line.min_content

* update expectation

* review fix
2024-01-23 10:18:39 +00:00
Martin Robinson
5c1723c983
rustdoc: Fix many rustdoc errors (#31147)
This fixes many rustdoc errors that occur due to raw URLs in rustdoc
comments as well as unescaped Rust code that should be in backticks.
2024-01-22 13:13:48 +00:00
atbrakhi
a315bec4ed
Use app units in replaced elements (#30825)
* use app_units in replaced elements

* fmt

* remove from_f32_px

* fix typo
2023-12-11 11:30:37 +00:00
Martin Robinson
8299868bd5
Layout 2020: Rename flow_relative types to Logical... (#30324)
This makes the names of flow relative geometry consistent with what is
used in the style crate and removes them from a module. With this change
it's more obvious what makes these types different from the ones in
`euclid`.
2023-09-12 07:31:30 +00:00
Samson
aad2dccc9c
Strict import formatting (grouping and granularity) (#30325)
* strict imports formatting

* Reformat all imports
2023-09-11 19:16:54 +00:00
Samson
711dbbd4af
remove extern crate (#30311)
* 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>
2023-09-08 12:11:31 +00:00
Martin Robinson
f25ab59406
Properly handle degenerate aspect ratios (#30245)
When a replaced element has a degenerate aspect ratio, it should be
handled as if that element did not have an aspect ratio according to
https://drafts.csswg.org/css-images/#natural-aspect-ratio.
2023-08-30 09:00:18 +00:00
Martin Robinson
e563927718 Layout 2020: Move all Fragment code to the fragment_tree directory
This is a simple code organization change with no behavior change with
the idea of making Layout 2020 easier to understand by new folks to the
project. The idea is that we will have a cleaner separation between the
different parts of layout ie one directory for the fragment tree and one
(currently multiple) directory for the box tree.
2023-06-04 18:12:11 +02:00
bors-servo
0f8824da6d
Auto merge of #29755 - stshine:automatic-min-size, r=Loirooriol
layout_2020: Implement automatic minimum size of flex items

Implement the algorithm described in
https://drafts.csswg.org/css-flexbox/#min-size-auto.

<!-- 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

<!-- Either: -->
- [x] There are tests for these changes OR

<!-- 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. -->
2023-06-03 10:43:48 +02:00
Pu Xingyu
4b73436684 layout_2020: Implement automatic minimum size of flex items
Implement the algorithm described in
https://drafts.csswg.org/css-flexbox/#min-size-auto.
2023-06-02 08:15:10 +08:00
Pu Xingyu
1dbd74f389 layout_2020: Add an optional box size parameter to ReplacedContent::used_size_as_if_inline_element
This allow us to specify the used size when calculating size of
replaced content.
2023-05-27 09:03:40 +08:00
Oriol Brufau
108c50c6df Further changes required by Servo 2023-05-16 12:54:55 +02:00
Martin Robinson
72b5fcd0b6 Combine DOM-related concepts in Layout 2020 into dom.rs 2023-05-13 11:52:59 +02:00
Martin Robinson
72302e2dae Detect body elements during layout
During layout it is often useful, for various specification reasons, to
know if an element is the `<body>` element of an `<html>` element root. There
are a couple places where a brittle heuristic is used to detect `<body>`
elements. This information is going to be even more important to
properly handle `<html>` elements that inherit their overflow property from
their `<body>` children.

Implementing this properly requires updating the DOM wrapper interface.
This check does reach up to the parent of thread-safe nodes, but this is
essentially the same kind of operation that `parent_style()` does, so is
ostensibly safe.

This change should not change any behavior and is just a preparation
step for properly handle `<body>` overflow.
2023-05-04 10:46:27 +02:00
Martin Robinson
9e0b41ebc4 Add support for <iframe> elements for Layout 2020
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.
2023-04-04 17:49:24 +02:00
Dirk Stolle
f2260e7c18 Fix some typos
Signed-off-by: Dirk Stolle <striezel-dev@web.de>
2022-12-17 03:22:34 +01:00
Kunal Mohan
2c95df73a4 Add WebGPU to Layout-2020 2020-06-14 11:05:36 +05:30
Bastien Orivel
8249be38c9 Implement cross origin resource policy check
I removed the window getter usage from those tests as servo does not
support that yet.
2020-05-08 19:15:24 +02:00
Daniel Alley
61fb84d6a0 Don't send empty canvases to WebRender
If any dimension of a canvas is 0, don't try to render it as it causes
problems inside webrender.
2020-04-03 11:34:04 -04:00
Simon Sapin
c377d9c48e Implement the box-sizing property 2020-03-31 23:43:58 +02:00
Fernando Jiménez Moreno
f0e30f5b0c Canvas rendering for layout 2020
Update test expectations with layout 2020 canvas support
2020-03-06 13:23:07 +01:00
Fernando Jiménez Moreno
dc9a33f3a9 Generate ::before and ::after content from url() for layout2020 2020-02-28 15:00:07 +01:00
Fernando Jiménez Moreno
c4276aa27e Fix rebase issues and run Prettier on layout viewer code 2020-02-21 11:11:00 +01:00
Fernando Jiménez Moreno
a042f85083 Dump box tree state into json files and display it on layout 2020 viewer 2020-02-21 11:11:00 +01:00
Fernando Jiménez Moreno
67706f9c0b Add fragment debug id 2020-02-21 11:11:00 +01:00
Martin Robinson
02deb99a05 Use euclid data types for physical structs in layout_2020
This removes a bit of duplication and allows layout_2020 to benefit from
a much richer set of utilities.
2020-01-23 15:39:32 +01:00
Simon Sapin
b1dcd5ecb6 Add background-size 2020-01-13 21:59:46 +01:00
Simon Sapin
14ddf39215 Rename ReplacedContent::used_size to used_size_as_if_inline_element 2019-12-10 15:11:53 +01:00
Simon Sapin
80b2b5fb5e Fix min/max-content of replaced boxes 2019-12-10 15:11:53 +01:00
Simon Sapin
8996be3c5e Don’t assume replaced elements have an intrinsic size 2019-12-10 15:11:53 +01:00
Simon Sapin
c40583b644 Move replaced box used size computation to a method of ReplacedContents 2019-12-10 12:36:43 +01:00
Simon Sapin
6d91d77fba Rename content_rect to rect in TextFragment and ImageFragment
Since they don’t have padding etc.
2019-12-07 14:25:16 +01:00
Simon Sapin
34e8cda801 Rename ReplacedContent::layout to make_fragments and simplify its API 2019-12-03 15:11:35 +01:00
Simon Sapin
aa925a5984 Un-allow and fix warnings in components/layout_2020 2019-12-02 16:32:34 +01:00
Anthony Ramine
5a360ac63d Start supporting images in layout 2020 2019-12-01 10:56:33 +01:00
Anthony Ramine
4444c5a2ad Import victor's layout system 🍷 2019-09-11 10:36:30 +02:00
Simon Sapin
86904757e6 Import files from Victor
fdb11f3e87
2019-09-11 10:06:35 +02:00