Commit Graph

16 Commits

Author SHA1 Message Date
Matthew Olsson
31341b280a LibWeb: Add calls to JS_{DECLARE,DEFINE}_ALLOCATOR() 2024-04-09 09:13:06 +02:00
Andreas Kling
268b9c5d90 LibWeb: Make the layout tree GC-allocated
This removes a set of complex reference cycles between DOM, layout tree
and browsing context.

It also makes lifetimes much easier to reason about, as the DOM and
layout trees are now free to keep each other alive.
2022-10-20 15:16:23 +02:00
Lenny Maiorani
c37820b898 Libraries: Use default constructors/destructors in LibWeb
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules

"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
2022-03-17 17:23:49 +00:00
Sam Atkins
7bb721bea2 LibWeb: Make display: foo box constructors take the Element by pointer
This means we can instantiate them for pseudo-elements, which don't have
an associated Element. They all pass it to their parent as a
`Layout::Node*` and handle a lack of `layout_node()` already so this
won't affect any functionality.
2022-02-25 19:35:34 +01:00
Andreas Kling
92266d2247 LibWeb: Create list-item markers during layout tree construction
Previously, these were added during layout. This didn't fit into the new
world where layout doesn't mutate the tree incrementally, so this patch
adds logic to Layout::TreeBuilder for adding a marker to each list-item
box after its children have been constructed.
2022-02-21 18:35:12 +01:00
Andreas Kling
0608de8c12 LibWeb: Rename Layout::Box::size() to content_size()
This property represents the CSS content size, so let's reduce ambiguity
by using the spec terminology.

We also bring a bunch of related functions along for the ride.
2022-02-06 01:07:47 +01:00
Timothy Flynn
ef62118c8b LibWeb: Render any specified list-style-image for list items 2021-10-29 22:06:49 +02:00
Andreas Kling
c4826eae4f LibWeb: Rename Layout::BlockBox => BlockContainer
There's a subtle difference here. A "block box" in the spec is a
block-level box, while a "block container" is a box whose children are
either all inline-level boxes in an IFC, or all block-level boxes
participating in a BFC.

Notably, an "inline-block" box is a "block container" but not a "block
box" since it is itself inline-level.
2021-10-06 20:10:36 +02:00
Andreas Kling
c5b4928f4a LibWeb: Make ListItemMarkerBox inherit style from ListItemBox 2021-09-24 15:01:49 +02:00
Tobias Christiansen
2a77abf85e Everywhere: Use tobyase@serenityos.org for my copyright headers 2021-08-09 21:43:05 +02:00
Tobias Christiansen
e7498bb918 LibWeb: Position the ListItemMarkers according to their width
Previously they were positioned with a fixed offset. However this lead
to wider markers with more than one character to collide with the
element itself.
Now the ListItemMarkerBox generates and stores the appropriate String
in its constructor and sets its own width according to that.
The ListItemBox then lays out the Marker taking this width into
account.
This also made the painting a lot easier since we don't generate the
needed Strings every time we repaint, just once.
2021-05-12 08:53:18 +01:00
Andreas Kling
b91c49364d AK: Rename adopt() to adopt_ref()
This makes it more symmetrical with adopt_own() (which is used to
create a NonnullOwnPtr from the result of a naked new.)
2021-04-23 16:46:57 +02:00
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Tobias Christiansen
bfcfe84240 LibWeb: Make the ListItemMarkerBox index-aware.
In the ListItemBox we get the index of the current <li> element in the
parent and pass it to the ListItemMarkerBox.

This patch is work towards #2059
2021-04-20 18:29:19 +02:00
Tobias Christiansen
7744048d0f LibWeb: Fix misplaced bullet points on list items
The bullet point should not be centered in the height of the list item,
but rather stay in front of the first line.
So, instead of giving the marker the full height of the ListItemBox,
it gets the height of a single line.

This closes #6384
2021-04-17 00:28:55 +02:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00