Commit Graph

18263 Commits

Author SHA1 Message Date
Andreas Kling
b8aa6a4453 LibWeb: Use PercentageOr<T>::contains_percentage() in CSS layout
By asking if the value *contains* a percentage rather than whether it
*is* one, we cover many more cases where e.g `width: calc(100% - 10px)`
should be "treated as auto" etc.
2022-09-14 14:43:17 +02:00
Andreas Kling
c4050fe675 LibWeb: Treat unimplemented grid-track-size syntax as "auto" for now
Note that there's a FIXME just above the previous case. That applies to
this workaround as well.
2022-09-14 14:43:17 +02:00
Andreas Kling
55ad9591df LibWeb: Add a way to ask if a PercentageOr<T> value contains percentages
Values that contain percentages require special treatment in various
parts of layout. Previously we had no way of peeking into calc() values
to see if their expression contains one or more percentages. That's the
bulk of what we're adding here.
2022-09-14 14:43:17 +02:00
electrikmilk
fdd202259d LibWeb: Add partial serialization for CSSFontFaceRule
This partially adds serialization code for
`CSSFontFaceRule::serialized()` to spec. This is only partially
implemented as some parts of the `@font-face` rule are not implemented
yet.
2022-09-14 10:50:33 +01:00
Brian Gianforcaro
d0a1775369 Everywhere: Fix a variety of typos
Spelling fixes found by `codespell`.
2022-09-14 04:46:49 +00:00
Andreas Kling
63c727a4a3 LibWeb: Don't clip to containing block when painting abspos descendants 2022-09-14 00:09:49 +02:00
Andreas Kling
f941b7aefe LibWeb: Create stacking context for flex/grid items with z-index != auto 2022-09-14 00:09:49 +02:00
Andreas Kling
fb5879fdcc LibWeb: Don't include abspos children in containing block's auto width 2022-09-14 00:09:49 +02:00
martinfalisse
df22f38feb LibWeb: Inform the parent context of the grid's size 2022-09-14 00:09:14 +02:00
martinfalisse
214329b81c LibWeb: Layout grid items after calculation
Now that the positions of each grid item have been calculated, and the
sizes of the individual rows and columns ascertained, can actually
layout the different items.
2022-09-14 00:09:14 +02:00
martinfalisse
58078c1f40 LibWeb: Calculate sizes of Auto grid tracks 2022-09-14 00:09:14 +02:00
martinfalisse
f558fd93b7 LibWeb: Calculate sizes of FlexibleLength grid tracks 2022-09-14 00:09:14 +02:00
martinfalisse
fbe703e2bd LibWeb: Follow spec for calculating intrinsic track sizes 2022-09-14 00:09:14 +02:00
martinfalisse
b7d053421e LibWeb: Calculate sizes of known grid track sizes
Calculate the sizes of grid tracks for which there is a clear size
(length or percentage has been specified).
2022-09-14 00:09:14 +02:00
martinfalisse
6b649b6343 LibWeb: Start sizing grid tracks
The second part of formatting the display grid is calculating the sizes
of the columns and rows.
2022-09-14 00:09:14 +02:00
martinfalisse
902bdc8f15 LibWeb: Position remaining grid items 2022-09-14 00:09:14 +02:00
martinfalisse
707b76ed41 LibWeb: Position grid items with fixed row positions 2022-09-14 00:09:14 +02:00
martinfalisse
f143fefca2 LibWeb: Position grid items with fixed position values 2022-09-14 00:09:14 +02:00
martinfalisse
e0cd63f531 LibWeb: Add array to keep track of grid boxes left to place
This structure will be useful to subtract from after placing different
boxes into the grid.
2022-09-14 00:09:14 +02:00
martinfalisse
a2ecb903af LibWeb: New start at layouting out the grid
According to the spec it's necessary to:
1. Layout the cells in the grid
2. Find the sizes of the rows and columns

Since I had started to do this backwards, and as I expand in future
commits, I take here the opportunity to start with a clean state.

The occupation_grid keeps track of which cells in the grid have been
filled out.
2022-09-14 00:09:14 +02:00
martinfalisse
df88e2bd8e LibWeb: Add spec utility function for GridTrackSize
Often in the spec they talk about intrinsic_track_sizes and this way can
have a clearer way of checking if a GridTrackSize is indeed an
"intrinsic track size".
2022-09-14 00:09:14 +02:00
martinfalisse
9681eb89a6 LibWeb: Add helper function for creating auto GridTrackSizes
Makes it more convenient to create auto GridTrackSizes. I think having
an auto GridTrackSize be defined by an auto Length value kind of
confusing, and this at least helps when creating one.
2022-09-14 00:09:14 +02:00
martinfalisse
ad221164d5 LibWeb: Allow having auto GridTrackPlacements
For grid-row-start, grid-column-end and similar values it is possible to
have auto values (nothing was specified, for example).
2022-09-14 00:09:14 +02:00
martinfalisse
0613972f0c LibWeb: Only set has_span if there is a number following the css value
To follow spec more closely, only set the has_span value if there is a
number immediately following, like "span 2". Otherwise the span value
should be ignored.
2022-09-14 00:09:14 +02:00
martinfalisse
493c6cf0fd LibWeb: Parse flexible length values for GridTrackSizes
Fix a bug as well as implement new functionality by parsing flexible
length values for GridTrackSizes.
2022-09-14 00:09:14 +02:00
martinfalisse
2fa124e8d9 LibWeb: Use float for GridTrackSize length value
Use float instead of int for the GridTrackSize length value as
FlexibleLengths can be "1fr" as well as ".49fr" in grid-track-row
and grid-track-column values.
2022-09-14 00:09:14 +02:00
Hendiadyoin1
1ea90e340c LibWeb: Visit all edge-members in WorkerGlobalScope 2022-09-13 20:55:21 +02:00
Hendiadyoin1
34439a04e8 LibWeb: Add a visit_edges for DOM/Event 2022-09-13 20:55:21 +02:00
Hendiadyoin1
5bd34f115e LibWeb: Add some missing includes 2022-09-13 20:55:21 +02:00
Jelle Raaijmakers
6dcc808994 LibSoftGPU: Reduce subpixel precision from 6 to 4 bits
With 6 bits of precision, the maximum triangle coordinate we can
handle is sqrt(2^31 / (1 << 6)^2) = ~724. Rendering to a target of
800x600 or higher quickly becomes a mess because of integer overflow.

By reducing the subpixel precision to 4 bits, we support coordinates up
to ~2896, which means that we can (try to) render to target sizes like
2560x1440.

This fixes the main menu backdrop for the Half-Life port. It also
introduces more white pixel artifacts in Quake's water / lava
rendering, but this is a level geometry visualization bug (see
`r_novis`).
2022-09-13 20:20:03 +02:00
Jelle Raaijmakers
bac7a12fb9 LibGL: Simplify setting the color mask 2022-09-13 20:20:03 +02:00
Jelle Raaijmakers
8e3b7df408 LibGL: Implement GL_SAMPLES, GL_SAMPLE_BUFFERS context parameters
We do not support multisampling right now, so we return constant values
that indicate this.
2022-09-13 20:20:03 +02:00
Jelle Raaijmakers
62846b4691 LibGL: Implement all glMultiTexCoord*f API methods 2022-09-13 20:20:03 +02:00
Jelle Raaijmakers
eda1ffba73 LibGL: Implement GL_TEXTURE_LOD_BIAS for texture objects 2022-09-13 20:20:03 +02:00
Jelle Raaijmakers
59fc2a4aad LibGL: Implement all glRasterPos2* API methods 2022-09-13 20:20:03 +02:00
Andreas Kling
54e0e85581 LibWeb: Treat percentage width/height as "auto" more consistently in BFC
Since we can't resolve percentage sizes against an indefinitely-sized
containing block, treat the sizes as "auto" in all these cases.
2022-09-13 17:03:31 +02:00
Andreas Kling
71ca857b67 LibWeb: Break lines until we have enough space between floats
Before this change, we'd always insert one line box fragment, even when
a float was taking up too much space on the line, and the fragment
didn't actually fit.

We now perform line breaks until we have enough space between floats.
This fixes many page layouts where we'd previously see small fragments
of inline content outside the right edge of the containing block.
2022-09-13 17:03:31 +02:00
Andreas Kling
c9a7853fef LibWeb: Include all floating descendants in BFC root's automatic height
Before this change, we were only considering floating boxes that were
immediate children of the BFC root.
2022-09-13 17:03:31 +02:00
davidot
1d846e5591 LibWeb: Visit internal fields of Crypto in visit_edges
Not visiting the field holding SubtleCrypto in Crypto caused subtle
crashes all over the Value functions, due to accessing SubtleCrypto
after it was garbage collected (and potentially replaced by a new cell).
This meant that the crashes were only appearing in Value::to_boolean,
Value::typeof, etc. Which then held pointer to things that looked like
Shapes, Environments and other non-Object Cells.

To find the actual cause, all pointer used to construct Values were
checked and if a pointer was none of the allowed types, the backtrace
is logged.

Co-authored-by: Luke Wilde <lukew@serenityos.org>
2022-09-12 20:14:58 -04:00
Ben Wiederhake
0e901f8c68 Shell: Sort CompletionSuggestions for paths lexicographically
This used to be ordered by inode, which can be surprising.
2022-09-12 16:49:48 +01:00
networkException
802cf9bc69 Everywhere: Use my very shiny serenityos.org email :^) 2022-09-12 15:13:12 +01:00
Ali Mohammad Pur
660d2b53b1 LibRegex: Account for eof after \<x> when 'x' leads to legacy behaviour 2022-09-12 16:03:57 +04:30
Ali Mohammad Pur
48442059fc LibRegex: Consume exactly two chars for escaped characters
We were previously consuming an extra char afterwards, which could be
the charclass terminator, leading to possible OOB accesses.
2022-09-12 16:03:57 +04:30
networkException
45aeba15c8 CharacterMap: Allow resizing the unicode block list
Previously we would constrain the unicode block list to a width of 175,
causing it to stick to the splitter when manually resizing.

This patch allows resizing the list properly while retaining the new
width when resizing the window.
2022-09-11 23:25:08 +01:00
Linus Groh
81f1183e28 Tubes: Run clang-format 2022-09-11 23:24:33 +01:00
Jelle Raaijmakers
9dfe50170e Demos: Add Tubes :^) 2022-09-11 22:45:49 +01:00
Jelle Raaijmakers
16ca9ec762 LibGfx: Templatize VectorN::length()
This allows us to get a `float` length from an `IntVector3` without
needing to convert to `FloatVector3` first.
2022-09-11 22:45:49 +01:00
Jelle Raaijmakers
70ea2a2258 LibGL: Implement glNormal3d 2022-09-11 22:45:49 +01:00
Jelle Raaijmakers
1aa1c89afa LibGL+LibGPU+LibSoftGPU: Report texture clamp to edge support 2022-09-11 22:37:07 +01:00
Jelle Raaijmakers
087f565700 LibSoftGPU: Divide texture coordinates by Q
Up until now, we have only dealt with games that pass Q = 1 for their
texture coordinates. PrBoom+, however, relies on proper homogenous
texture coordinates for its relatively complex sky rendering, which
means that we should perform this per-fragment division.
2022-09-11 22:37:07 +01:00