Commit graph

340 commits

Author SHA1 Message Date
Simon Wülker
3d320fa96a
Update rustfmt to the 2024 style edition (#35764)
* Use 2024 style edition

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Reformat all code

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-03-03 11:26:53 +00:00
Martin Robinson
e81951a973
layout: Remove the obsolete layout tracing functionality (#35001)
There were two kinds of layout tracing controlled by the same debugging
option:

 - modern layout: Functionality that dumped a JSON serialization of the
   layout tree before and after layout.
 - legacy layout: A scope based tracing that reported the process of
   layout in a structured way.

I don't think anyone working on layout is using either of these two
features. For modern layout requiring data structure to implement
`serde` serialization is incredibly inconvenient and also generates a
lot of extra code.

We also have a more modern tracing functionality based on perfetto that
we have started to use for layout and IMO it's actually being used and
more robust.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-01-15 13:24:14 +00:00
Martin Robinson
f5ef8aaed3
config: Remove legacy-layout and unused Preferences and Opts (#34994)
There are some preferences and options that are only used by legacy
layout or not used at all. This PR removes them.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-01-14 20:12:14 +00:00
Martin Robinson
621ddd749c
Elide lifetimes where possible after rustup (#34824)
The new version of rust allows us to elide some lifetimes and clippy is
now complaining about this. This change elides them where possible and
removes the clippy exceptions.

Fixes #34804.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-01-03 18:54:44 +00:00
Oriol Brufau
61ca2dde29
Upgrade Stylo to 2024-12-04 (#34501)
* Upgrade Stylo to 2024-12-04

Signed-off-by: Oriol Brufau <obrufau@igalia.com>

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

Signed-off-by: Oriol Brufau <obrufau@igalia.com>

* Update test expectations

Signed-off-by: Oriol Brufau <obrufau@igalia.com>

---------

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2024-12-06 01:05:54 +00:00
Martin Robinson
556bfb7dff
fonts: Make FontContext thread-safe and share it per-Layout (#32205)
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>
2024-05-02 10:34:10 +00:00
Martin Robinson
08ef158d4e
script: Split style and layout data in DOM nodes (#31985)
This change splits the style and layout data in DOM nodes that is
populated by style and layout passes. This makes Servo's data design
more like Gecko's. This allows:

1. Removing the various `StyleAndLayout` data structures used by layout.
2. Removing the `GetStyleAndLayoutData` and
   `GetStyleAndOpaqueLayoutData` traits. Accessing style and layout data
   are now just functions on the `LayoutNode` and `ThreadSafeLayoutNode`
   traits.
3. Styling now doesn't populate layout data. This is is postponed until
   layout itself.
4. Allows the DOM wrappers to no longer have to be generic over the
   layout data. This data was already stored using `std::any::Any` and
   the new code just makes layout responsible for downcasting. Cleaning
   up the generic type parameter in the DOM wrappers can happen in a
   followup change.

The main benefit to all of this is that we should be able to remove
unsafe creation of `ServoLayoutNode` in layout and
`TrustedLayoutNodeAddress` entirely, because `ServoLayoutNode` will be
able to be passed directly from script to layout. In addition, this
removes one more abstraction layer from the layout DOM wrappers, making
the code a lot more understandable.

Note: This increases the measured size of DOM types, but the same data
is stored. It's simply that before that data was stored behind a heap
pointer.
2024-04-04 07:56:51 +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
eri
a6e25d555b
clippy: Fix warnings in components/layout (#31612)
* clippy: fix warnings in components/layout

* fix: formatting
2024-03-11 10:24:36 +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
Oriol Brufau
f7ead9bcb6
Lint layout_2013 with clippy (#31221)
* Lint layout_2013 with clippy

CARGO_BUILD_RUSTC=rustc cargo clippy --fix -p layout_2013 --broken-code

* ./mach fmt

* Cosmetic adjustments
2024-01-30 11:46:35 +00:00
Martin Robinson
81f5157522
Add support for table fixups (#30868)
This adds support for fixing up tables so that internal table elements
that are not properly parented in the DOM have the correct box tree
structure according to the CSS Table specification [1]. Note that this
only comes into play when building the DOM via script, as HTML 5 has its
own table fixups that mean that the box tree construction fixups here
are not necessary.

There are no tests for this change. In general, it's hard to write tests
against the shape of the box tree, because it depends on the DOM. We
plan to test this via WPT tests once layout is complete.

1. https://drafts.csswg.org/css-tables/#table-internal-element

Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2023-12-22 12:11:58 +00:00
Oriol Brufau
0fd2f08da1 Further changes required by Servo 2023-11-24 08:57:14 +01:00
Martin Robinson
fd31da9102
Anonymous boxes that wrap inlines should not inherit overflow (#30579)
In legacy layout, anonymous text wrappers were inheriting the `overflow`
and `text-overflow` properties. This results in the creation of extra
clipping for these anonymous wrappers which could clip away floats. We
will likely implement `text-overflow` differently in non-legacy layout.

This change marks all legacy layout pseudo elements as "legacy" and also
adds a new pseudo element for non-legacy layout that does not inherit
`overflow`.

Fixes #30562.

Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2023-10-19 13:43:55 +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
d4b5fc1f65
Make Layout 2013 style a superset of Layout 2020 style
This is the first step toward removing the compile-time difference in
style between Layout 2020 and Layout 2013.
2023-06-28 16:06:07 +02:00
Martin Robinson
dc192172ad Clean up debug options 2023-05-01 14:09:28 +02:00
Emilio Cobos Álvarez
31e8e418ea Miscellaneous build / tidy fixes. 2021-02-26 17:53:55 +01:00
Anthony Ramine
04af32128c Add a 'dom lifetime to GetLayoutData 2020-03-26 13:17:46 +01:00
Emilio Cobos Álvarez
e227715aee
style: Miscellaneous Servo build fixes. 2020-02-12 02:43:23 +01:00
Fernando Jiménez Moreno
aa0c05574c Make inline elements work in fullscreen mode 2019-09-05 17:45:38 +02:00
Emilio Cobos Álvarez
4752110d53
Fix Servo build and unify display representation. 2019-08-15 17:11:08 +02:00
Fernando Jiménez Moreno
1621076af7 Revert change to render media controls breaking inline layout 2019-07-22 17:40:16 +02:00
Fernando Jiménez Moreno
e344203c11 Only allow UA widgets as children of media elements
Do not allow pseudo-elements for replaced elements
2019-07-22 17:40:15 +02:00
Fernando Jiménez Moreno
a664449681 Media UI basic functionality 2019-07-22 17:40:14 +02:00
Fernando Jiménez Moreno
4f6b86f9f5 Render media controls 2019-07-22 17:40:14 +02:00
Anthony Ramine
887cc62556 Remove ObjectElement 2019-01-14 16:10:27 +01:00
Anthony Ramine
059c9f4f78 Remove ComputedValueUtils 2019-01-14 16:10:27 +01:00
Anthony Ramine
aacaf1bd70 Remove FlowConstructionUtils 2019-01-14 16:10:26 +01:00
Anthony Ramine
ddef6211b3 Move is_image_data to the layout crate
It's only used there.
2019-01-09 13:15:04 +01:00
Simon Sapin
be69f9c3e6 Rustfmt has changed its default style :/ 2018-12-28 13:17:47 +01:00
Jan Andre Ikenmeyer
1d6fe65401
Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
Pyfisch
9e92eb205a Reorder imports 2018-11-06 22:35:07 +01:00
Pyfisch
cb07debcb6 Format remaining files 2018-11-06 22:30:31 +01:00
Simon Sapin
76e59a46d3 Sort use statements 2018-11-06 15:26:02 +01:00
Simon Sapin
45f7199eee cargo fix --edition 2018-11-06 15:26:02 +01:00
Pyfisch
d9b1950d74 Layout: Remove redundant deny unsafe and format
Add license to two files.

Bypass DisplayListBuilder for some items.
2018-10-22 16:15:48 +02:00
Fernando Jiménez Moreno
3fbeb398d4 Revert import style format 2018-10-08 16:12:02 +02:00
Víctor Manuel Jáquez Leal
2d709a283b layout: instantiate SpecificFragmentInfo from node's media data 2018-10-08 16:12:01 +02:00
paavininanda
25027e476c Current-pixel-density tests passing 2018-09-13 00:23:09 +05:30
Pyfisch
349047b096 Rustfmt layout crate 2018-09-01 13:24:57 +02:00
Emilio Cobos Álvarez
895946bb18
layout: script: Fix build. 2018-06-23 20:34:10 +02:00
Emilio Cobos Álvarez
bbb59614fa
Fix Servo build. 2018-05-28 16:02:31 +02:00
Emilio Cobos Álvarez
2a5007926d
Fix Servo build. 2018-05-19 10:15:17 +02:00
bors-servo
0ff6f32d7d
Auto merge of #20420 - pyfisch:corner-clipping, r=emilio
Move DL items from gfx to layout and implement corner clipping

Implement corner clipping.
Remove PixelFormat from WebrenderImageInfo.
Use WebRender text shadow.
Remove MallocSizeOf and Deserialize for DL items.

Closes #19649, closes #19680, closes #19802

<!-- 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 #__ (github issue number if applicable).

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

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20420)
<!-- Reviewable:end -->
2018-04-29 02:30:16 -04:00
Pyfisch
c0be925bed Move DL items from gfx to layout
Implement corner clipping.
Remove PixelFormat from WebrenderImageInfo.
Use WebRender text shadow.
Remove MallocSizeOf and Deserialize for DL items.

Closes #19649, #19680, #19802
2018-04-22 13:13:45 +02:00
Fausto Núñez Alberro
cc838f54e5
Implement a URL-generic type for list-style-image
This should fix the following two "expected to fail" tests:

- getComputedStyle(elem) for url() listStyleImage uses the resolved URL
  and elem.style uses the original URL

- getComputedStyle(elem) for url() listStyle uses the resolved URL
  and elem.style uses the original URL
2018-04-03 22:01:26 +02:00
Igor Gutorov
7a00066477 style: Move content property out of mako. 2018-02-07 00:11:57 +02:00
Emilio Cobos Álvarez
5ac12b5df4
style: Make the TElement type arrive to the cascade function.
Not super-proud of this one, but it's the easiest way I could think of.

The changeset looks bigger than what it is, because while at it I've rewrapped a
fair amount of functions around to use proper block indentation.

Alternatives are parameterizing Stylist by <E>, which is not fun, or moving the
concrete element from layout_thread to layout, but that implies layout depending
on script, which isn't fun either.

Other alternative is implementing an empty enum and making anon boxes work on
it. It has the advantage of removing the annoying type parameter, but the
disadvantage of instantiating `cascade` twice, which isn't great, and having to
maintain all the boilerplate of a `TElement` implementation that just does
nothing.
2018-01-23 00:57:54 +01:00