Commit graph

631 commits

Author SHA1 Message Date
Munish Mummadi
2a517f786b
Implementation of baseline-source (#31904)
Updating Stylo and test expectations.
2024-04-02 10:20:13 +00:00
komuhangi
0da2508e4d
clippy: Allow too_many_arguments for all functions (#31962)
This is the start of preventing this in the future.

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-04-01 14:53:33 +00:00
Oriol Brufau
fff9ef87e6
Update Stylo to 2023-10-16 (#31932)
* Update Stylo to 2023-10-16

* Fixup for https://phabricator.services.mozilla.com/D185154

* Fixup for https://phabricator.services.mozilla.com/D188216

* Fixup for https://phabricator.services.mozilla.com/D185677

* Fixup for https://phabricator.services.mozilla.com/D188566

* Fixup for https://phabricator.services.mozilla.com/D188727

* Fixup for https://phabricator.services.mozilla.com/D189475

* Fixup for https://phabricator.services.mozilla.com/D189521

* Fixup for https://phabricator.services.mozilla.com/D188812

* Fixup for https://phabricator.services.mozilla.com/D189484

* Update test expectations
2024-03-30 13:30:13 +00:00
Martin Robinson
b7d089930e
layout: Remove LayoutRPC and query layout via the Layout trait (#31937)
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.
2024-03-29 16:25:47 +00:00
Oriol Brufau
07391e346b
Obey white-space: pre-wrap when intrinsically sizing an IFC (#31930)
It was being treated like `pre`, but it allows wrapping lines.
2024-03-29 15:02:47 +00:00
Ekta Siwach
5d518ca8dc
layout: Use Au in ResolvedMargins and CollapsedMargin (#31848)
* change ResolvedMargins to use Au instead of length

* made suggested changes

removed whitespace changes

made suggested changes

* Update components/layout_2020/flexbox/layout.rs

Co-authored-by: Oriol Brufau <obrufau@igalia.com>

* Update components/layout_2020/flow/mod.rs

Co-authored-by: Oriol Brufau <obrufau@igalia.com>

* fixed errors

fixed errors

fixed formatting

fixed errors

* modified changes

made suggested changes

* Update components/layout_2020/fragment_tree/fragment.rs

Co-authored-by: Oriol Brufau <obrufau@igalia.com>

updated components/layout_2020/fragment_tree/fragment.rs

* Update components/layout_2020/flow/mod.rs

Co-authored-by: Oriol Brufau <obrufau@igalia.com>

* Update components/layout_2020/flow/mod.rs

Co-authored-by: Oriol Brufau <obrufau@igalia.com>

* updated changes

updated changes

* unified all the suggested changes here

* fixed formatting

* reverted unnecessary changes

* fixed unnecessary warnings

---------

Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2024-03-28 14:20:14 +00:00
Oriol Brufau
b77ec08ab6
Ignore spaces before atomic inline for the min-content size (#31896)
* Ignore spaces before atomic inline for the min-content size

For the min-content size we should wrap lines wherever is possible,
so wrappable spaces shouldn't increase the length of the line,
they will just be removed or hang at the end of the line.

* Add a clarifying comment

Co-authored-by: Martin Robinson <mrobinson@igalia.com>

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-03-27 16:46:54 +00:00
Martin Robinson
b8c82c1ab0
layout: Allow transforming inline replaced elements (#31833)
This requires passing through information about whether or not the
element in question is replaced when checking to see if it's
transformable and transitively all functions that make decisions about
containing blocks. A new FragmentFlag is added to help track this -- it
will be set on both the replaced items BoxFragment container as well as
the Fragment for the replaced item itself.

Fixes #31806.
2024-03-27 11:57:27 +00:00
Oriol Brufau
d16f259e1d
Fix table with rows but no column (#31862)
* Fix table with rows but no column

We weren't generating any fragment for the rows, which meant that JS
APIs like clientWidth would be 0, and also outlines weren't painted.

This aligns Servo with Blink and WebKit. Gecko is broken, it distributes
twice the table height among the rows.

* Feedback

* Avoid conflict with #31874
2024-03-26 12:36:43 +00:00
Oriol Brufau
e77dc36842
Pick the first or last baseline as appropriate (#31705)
The old logic was always picking the last baseline, but this should only
happen for inline-blocks.

Since replaced elements and flex containers aren't currently setting
their baselines, this is only an improvement for inline-tables.
2024-03-25 16:19:06 +00:00
Oriol Brufau
dbe3cb8a3c
Don't update row baseline if cell is empty (#31831)
Gecko, Blink and WebKit agree that the if a row only has empty cells,
its baseline should be at the bottom, not at the top.

There isn't interoperability when the cells are just empty-ish, so this
patch takes the simplest approach, aligning with Blink: any out-of-flow
or in-flow content other than collapsed whitespace counts as not empty.
2024-03-25 09:39:02 +00:00
atbrakhi
3fc157338e
remove unused code (#31826) 2024-03-23 04:25:52 +00:00
atbrakhi
95e69fe4ff
layout: use Au in BoxFragment (#31794)
* use au in BoxFragement

* review fix
2024-03-22 04:30:39 +00:00
Martin Robinson
841bd91784
layout: Take into account text-indent for justification (#31777)
This change makes it so that when calculating the space added between
words for justification, text-indent is taken into account.

Fixes #31775.
2024-03-21 15:58:03 +00:00
Oriol Brufau
ecabdc2583
Don't trim leading whitespace of anonymous table cells (#31803)
A sequence of whitespace shouldn't generate an anonymous table row/cell,
but we can't just throw away the leading whitespace, because afterwards
we may encounter some other content, and then the leading whitespace
should appear in the cell (noticeable with e.g. `white-space: pre`).
2024-03-21 11:48:39 +00:00
Azhar Ismagulova
d0fcbb0898
rustdoc: fix warnings in components/layout_2020/table (#31738)
* fix: fixed rustdoc warnings caused by private intra-doc links

* fix: fixed private link warning by allowing private intra doc links
2024-03-19 14:51:28 +00:00
Martin Robinson
f175679434
gfx: Derive line-through metrics for fonts on MacOS (#31756)
There is now platform-specific way to get metrics for `line-through` on
MacOS and currently striking through simply does not work. The correct
approach here is likely to first search for these metrics in font tables
and then falling back to deriving them. Searching the font tables is a
larger change, so this change adds the fallback mechanism first. This at
least makes sure that strike through renders at all on Mac.

In a followup change we can add support for getting metrics via HarfBuzz
in a platform-independent way, which is what Gecko does.

Fixes #942.
2024-03-19 13:55:12 +00:00
Martin Robinson
2ec995a56f
layout: Enable text-shadow (#31734)
`text-shadow` is enabled for legacy layout, so this just extends support
to the modern layout system.
2024-03-19 10:29:20 +00:00
Aarya Khandelwal
2a02f94d76
rustdoc: Correct unresolved link to `handle_cell. (#31708) 2024-03-19 08:41:18 +00:00
Ekta Siwach
03c11f7907
rustdoc: Fix some typos in components/layout_2020/table/mod.rs (#31644)
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-03-19 08:23:14 +00:00
Oriol Brufau
c07484fcb6
Update Stylo to 2023-09-01 (#31609)
* Update Stylo to 2023-09-01

* Fixup for https://phabricator.services.mozilla.com/D184929

* Fixup for https://phabricator.services.mozilla.com/D184526

* Fixup for https://phabricator.services.mozilla.com/D184525

* Fixup for https://phabricator.services.mozilla.com/D185154

* Fixup for https://phabricator.services.mozilla.com/D184685

* Fixup for https://phabricator.services.mozilla.com/D185916

* Fixup for https://phabricator.services.mozilla.com/D185492

* Fixup for https://phabricator.services.mozilla.com/D186626

* Update test expectations
2024-03-18 13:52:40 +00:00
RustAndMetal
f6a975fc58
clippy: Fix several warnings (#31710)
Signed-off-by: RustAndMetal <111676747+RustAndMetal@users.noreply.github.com>
2024-03-18 08:33:43 +00:00
Rhea-Eve
1ab8fa2895
rustdoc: Fix two warnings in components/layout_2020 (#31712)
* Fix BoxFragment reference.

Signed-off-by: Rhea Karty <rheakarty@gmail.com>

* Fix reference to InlineFormattingContext.

Signed-off-by: Rhea Karty <rheakarty@gmail.com>

* Rewrap lines to avoid long length

* Remove trailing whitesapce

---------

Signed-off-by: Rhea Karty <rheakarty@gmail.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-03-18 08:33:15 +00:00
Oriol Brufau
82128d3838
Don't null out the baselines of anonymous tables (#31704) 2024-03-15 20:46:41 +00:00
Martin Robinson
47a4ce467f
layout: Add basic support for getClientRects() queries (#31696)
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.
2024-03-15 17:20:47 +00:00
Tumuhairwe
4cd3c056e5
rustdoc: Fix errors in components and ports (#31654)
* Fixed warnings in components/gfx/text/shaping/harfbuzz-rs  components/layout_2020/fragment_tree  ports/servoshell/minibrowser.rs

* Fixed warnings in components/gfx/text/shaping/harfbuzz-rs  components/layout_2020/fragment_tree  ports/servoshell/minibrowser.rs.

* Update minibrowser.rs

Returned "if" back to "iff"

* Update minibrowser.rs

Changed ```BrowserManager``` to ```WebViewManager```

* Update fragment.rs

Changed ```[SequentialLayoutState]``` to ```[crate::flow::float::SequentialLayoutState]```

* Update fragment.rs

Balanced the length of paragraph lines in fragment.rs

* Fix tidy errors

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-03-15 16:24:11 +00:00
Oriol Brufau
39f660f520
Allow pre-wrap whitespace to hang at the end of the line (#31681)
* Allow pre-wrap whitespace to hang at the end of the line

* Use bitflags
2024-03-15 16:12:41 +00:00
Oriol Brufau
99c14c83ed
Obey white-space when intrinsically sizing an IFC (#31660)
The old logic was assuming that all whitespace was a break opportunity,
and that no newlines would be preserved.

Note that text shaping considers the advance of a newline to be the same
as a space. This was problematic because if we have a segment with a
preserved space and newline, only the advance of the space should
contrinute to the size of the block container. Therefore, I'm changing
the breaker logic in other to have newline characters in their own
segment.

Then glyph_run_is_whitespace_ending_with_preserved_newline can just be
renamed to glyph_run_is_preserved_newline.

This patch is still not perfect because it doesn't check allow_wrap(),
so `nowrap` is treated like `normal`, and `pre-wrap` like `pre`.
2024-03-15 12:45:23 +00:00
Martin Robinson
ad37a54f59
dependencies: Upgrade to WebRender 0.64 (#31486)
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>
2024-03-14 17:40:54 +00:00
Martin Robinson
78fe461ff2
layout: Properly parent table-row and table-row-group (#31619)
Put table cell content fragments into a hieararchy of fragments that
include their table row and table row group fragments. This ensures that
things like relative positioning and transforms set on rows and row
groups properly affect cells and cell content.

Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2024-03-14 10:33:42 +00:00
Oriol Brufau
0e78c8114b
Allow finishing anonymous inline-table at the end of inline elements (#31650)
This avoids inserting it outside of its parent.
2024-03-14 09:58:00 +00:00
Martin Robinson
871a9bf677
layout: IFCs should not always be marked as containing floats (#31641)
Marking all IFCs as containing floats shouldn't change layout results,
but does prevent parallel layout in some cases. This change fixes an
issue where we were marking all IFCs as containing floats.

Fixes #31540.
2024-03-14 09:55:01 +00:00
Oriol Brufau
f3a73dbed3
End ongoing IFC when inserting anonymous block-level table (#31606)
So that the table appears after preceding inline-level contents.
Fixes #31603.
2024-03-13 21:03:06 +00:00
Aarya Khandelwal
525fc58ed9
rustdoc: Fix warnings in components/layout_2020 (#31647)
* Added a : to make it a clickable link

* changed block_offset_of_parent to parent_offset , to make it a clickable link.
2024-03-13 18:16:31 +00:00
Aarya Khandelwal
f5a1879bac
rustdoc: Fix warnings in components/layout_2020 (#31640)
* Changed LineItems to LineItem to make it a clickable link

* No variant named Anonymous is present in Fragment.
2024-03-13 13:50:26 +00:00
Oriol Brufau
0860deba05
Fix vertical alignment at the root of an IFC (#31636)
At the root of an inline formatting context, we used its vertical-align
in order to compute the strut. That was wrong, since vertical-align
on a block container shouldn't affect the contents, it should only
affect the alignment of the block container (if it's inline-level)
within the parent IFC.

This was only working well if the block container was block-level, since
effective_vertical_align_for_inline_layout returned `baseline` for
block-level boxes.

Instead of the outer display type, this patch changes the logic to check
whether we are at the root of the IFC.
2024-03-13 10:39:01 +00:00
Martin Robinson
716f4a006d
layout: Propagate overflow values from <body> to root element (#31618)
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>
2024-03-13 09:17:09 +00:00
atbrakhi
0fda14263a
layout: make margin in pbm use app unit (#31621)
* make margin in pbm use app unit

* Simplification

* Consistently resolve inline margins as Au, like block margins

---------

Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2024-03-13 03:15:20 +00:00
Oluwatobi Sofela
59d89c8267
rustdoc: Fix StackingContextFragment error (#31625) 2024-03-12 16:25:26 +00:00
eri
b03411f567
clippy: Fix warnings in components/layout_2020 (#31611)
* clippy: fix warnings in components/layout_2020

* fix: review comments
2024-03-11 14:24:33 +00:00
Martin Robinson
1d1f239ecc
layout: Enable rendering of conical-gradient and repeating-conical-gradient (#31597)
This also ignores a clippy warning for a new function (and a similar
existing one), until this code can be refactored to use temporary Rust
strutures to carry display list building state.

There are a few new test failures here:

 - FAIL [expected PASS] /css/css-images/image-set/image-set-conic-gradient-rendering.html
 - FAIL [expected PASS] /css/css-images/image-set/image-set-repeating-conic-gradient-rendering.html

 These fail because Servo does not yet support `image-set()`.

 - FAIL [expected PASS] /css/filter-effects/filter-function/filter-function-conic-gradient.html
 - FAIL [expected PASS] /css/filter-effects/filter-function/filter-function-repeating-conic-gradient.html

 These fail because Servo does not support the very early filter effects
 specification.

 - FAIL [expected PASS] /html/canvas/element/manual/fill-and-stroke-styles/conic-gradient-rotation.html
 - FAIL [expected PASS] /html/canvas/element/manual/fill-and-stroke-styles/conic-gradient.html

 These fail because this change only adds support for CSS conical
 gradients. Another set of changes will be necessary to support this for
 Canvas.
2024-03-11 12:58:44 +00:00
Oriol Brufau
de7b9bed85
Take spaces into account in the max-content size of an IFC (#31613)
They were only considered in min-content sizes.
Also avoid some pointless conversions from Au to Length.

Fixes #31605.
2024-03-11 12:01:53 +00:00
Oriol Brufau
fddc7a1390
Align table cell measures in the block axis to Gecko/Blink/WebKit (#31596) 2024-03-09 12:59:57 +00:00
Martin Robinson
1f23ec2b27
layout: Do not inherit node and fragment flags in anonymous boxes (#31586)
This doesn't really have observable behavior right now, as much as I
tried to trigger some kind of bug. On the other hand, it's just wrong
and is very obvious when you dump the Fragment tree. If you create a
`display: table-cell` that is a child of the `<body>` all parts of the
anonymous table are flagged as if they are the `<body>` element.
2024-03-09 09:13:19 +00:00
Wepngong Maureen
0f4522c360
Fixed unresolved links by appropriately linking to parent (#31588)
Signed-off-by: Wepngong Maureen <maureenwepngong@gmail.com>
2024-03-08 19:53:44 +00:00
Wepngong Maureen
f64409dbfb
Fix rustdoc warnings in components/layout 2020/positioned.rs (#31592)
* fixed typo in PositioningContext

Signed-off-by: Wepngong Maureen <maureenwepngong@gmail.com>

* fixed unresolved link to unresolved link to adjust_static_position_of_hoisted_fragments function

Signed-off-by: Wepngong Maureen <maureenwepngong@gmail.com>

* fixed unresolved link to unresolved link to len() function of PositioningContext

Signed-off-by: Wepngong Maureen <maureenwepngong@gmail.com>

---------

Signed-off-by: Wepngong Maureen <maureenwepngong@gmail.com>
2024-03-08 18:00:45 +00:00
sandeep
81e6bd962b
Fix rustdoc warnings in components/layout_2020 (#31587)
* fix rustdoc warnings in components/layout_2020

Signed-off-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local>

* made suggested changes

Signed-off-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local>

---------

Signed-off-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local>
Co-authored-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local>
2024-03-08 15:51:18 +00:00
Martin Robinson
7e8a1503ba
layout: Add documentation about table layout (#31535)
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2024-03-08 12:57:23 +00:00
Oriol Brufau
6b5a5147f8
Obey table cell's box-sizing (#31536)
Instead of assuming `box-sizing: content-box`.
2024-03-08 12:07:42 +00:00
Martin Robinson
49ae9bb442
layout: Fix the pseudo for anonymous tables (#31578)
Anonymous tables should not use legacy pseudos, as the legacy layout
engine had them inherit lots of random properites that lead to bad
layout in the new layout engine.

Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2024-03-08 10:32:51 +00:00