Commit Graph

6020 Commits

Author SHA1 Message Date
Aliaksandr Kalenik
ffd5b3da16 LibWeb: Implement reload for navigables 2023-06-20 18:30:27 +02:00
Aliaksandr Kalenik
21f39061fd LibWeb: Set 0px fixed size to collapsed auto-fit tracks in GFC
Fixes the issue that before we set base_size and growth_limit of
collapsed tracks to 0px which still allowed them to grow by space
distribution.
2023-06-20 18:24:26 +02:00
Andi Gallo
e4d0c077c3 LibWeb: Don't skip width computation for intrinsic table width
The shortcut we put in place didn't resolve percentage widths and
ignored border spacing. We can still return early after we compute the
width per the specifications.
2023-06-20 18:24:19 +02:00
Aliaksandr Kalenik
aafa09e7a5 LibWeb: Implement "traverse the history by delta" for traversables 2023-06-20 17:36:44 +02:00
Sam Atkins
0e2684b10f LibWeb: Fix serialization of CSSFontFaceRule
- The check for `local()` sources wasn't working, and output `local()`
  every time. Since we don't parse `local()` yet, let's just always
  output a regular URL source.
- Put a space between the URL and the `format()`.
- Stop double-quoting the format string.
2023-06-20 15:50:26 +01:00
Andreas Kling
c808f6c637 LibWeb: Don't use BFC auto height for non-BFC abspos elements
While CSS 2.2 does tell us to use the "auto height for BFC roots"
calculation when resolving auto heights for abspos elements, that
doesn't make sense for other formatting context roots, e.g flex.

In lieu of implementing the entire new absolute positioning model from
CSS-POSITION-3, this patch borrows one small nugget from it: using
fit-content height as the auto height for non-BFC-root abspos elements.
2023-06-20 13:42:31 +02:00
Andreas Kling
38a6b7ad3d LibWeb: Don't assert when flex-item has align-self: end
We were missing the code to convert this to `align-items: end`.
2023-06-20 13:26:41 +02:00
Andreas Kling
55c1d8ba29 LibWeb: Honor the opacity attribute on SVG graphics elements
This is simply converted to an equivalent CSS `opacity` property value.
2023-06-20 13:24:33 +02:00
Andreas Kling
9f24c1b34c LibWeb: Use width & height to create fallback viewBox for SVG-as-image
When embedding an SVG in an img element, if the external SVG's root
element has both width and height attributes, but no viewBox attribute,
we now create a fallback viewBox with "0 0 width height".

This appears to match the behavior of other browsers. Inspired by
discussion on Mozilla's bug tracker:
https://bugzilla.mozilla.org/show_bug.cgi?id=614649
2023-06-20 11:34:09 +02:00
Andi Gallo
ac6af51549 LibWeb: Improve span column width distribution
Compute the contributions to a spanning cell width from each cell in the
span. This better handles uneven column widths, since each cell
contribution is proportional with its own width as opposed to the own
width of the first cell in the span.

This better matches the behavior of other browsers and further aligns
with the specification.
2023-06-20 06:59:43 +02:00
Aliaksandr Kalenik
b37fbcb159 LibWeb: Use PaintContext::would_be_fully_clipped_by_painter() everywhere
Always use `would_be_fully_clipped_by_painter` to check if painting can
be skipped.

This allows to quickly find all the places where this check happens and
also removes incosistency that before we checked for intersection with
viewport rect in some places and for intersection with painter clip
rect in other places.
2023-06-20 06:58:47 +02:00
Aliaksandr Kalenik
c90136d48d LibWeb: Start fleshing out "apply the history step" for traversables
Implements https://html.spec.whatwg.org/multipage/browsing-the-web.html#apply-the-history-step
2023-06-19 21:28:20 +02:00
Aliaksandr Kalenik
caf7fd4f19 LibWeb: Add supporting method to get navigables whose SHE will change
Implements https://html.spec.whatwg.org/multipage/browsing-the-web.html#get-all-navigables-whose-current-session-history-entry-will-change-or-reload
2023-06-19 21:28:20 +02:00
Aliaksandr Kalenik
9c1087de8c LibWeb: Implement "get the used step" for traversable navigables
Implements https://html.spec.whatwg.org/multipage/browsing-the-web.html#getting-the-used-step
2023-06-19 21:28:20 +02:00
Aliaksandr Kalenik
5b06e43938 LibWeb: Implement get_the_history_object_length_and_index() 2023-06-19 21:28:20 +02:00
Aliaksandr Kalenik
09cb266cb8 LibWeb: Implement "activate history entry" for navigables 2023-06-19 21:28:20 +02:00
Aliaksandr Kalenik
0285a363e2 LibWeb: Add set_current_session_history_entry setter for Navigable 2023-06-19 21:28:20 +02:00
Aliaksandr Kalenik
eb4db6057d LibWeb: Implement child_navigables() for navigables 2023-06-19 21:28:20 +02:00
MacDue
5f8b9f7936 LibWeb: Use enclosing (rather than rounded) rect for overflow clipping
If we use a rounded rect we'll clip off subpixels around the edge.
2023-06-19 21:19:08 +02:00
Andreas Kling
e99a6fede4 LibWeb: Allow IFC to size inline-flex boxes midway through flex layout
The part in FFC where we ask the parent formatting context to size the
flex container midway through layout is really weird, but let's at least
be consistently weird for BFC and IFC. Since IFC always works within its
parent BFC, it can simply forward these requests to the BFC.

This fixes an issue where inline-flex containers incorrectly had main
axis margins subtracted from their content size.
2023-06-19 18:51:00 +02:00
Andreas Kling
1b55ff6f4c LibWeb: Expand CSS var() inside calc() paren blocks
Before this change, this var() would get expanded:

    calc(10px * var(--one))

But this one would not:

    calc(10px * (var(--one))
2023-06-19 17:54:07 +02:00
Aliaksandr Kalenik
f04ae5f542 LibWeb/WebDriver: Close client connection socket when EOF is reached
Fixes the bug that currently we don't ever close webdriver client
connection socket when header "Connection: keep-alive" is specified.

This allows to run more WPT tests without running out of free file
descriptors :)
2023-06-19 09:55:47 -04:00
Andi Gallo
701b170dc0 LibWeb: Clip cell spans past the end of the table
This occurs on Wikipedia for tournament brackets, for example:
https://en.wikipedia.org/wiki/2022%E2%80%9323_UEFA_Champions_League_knockout_phase
2023-06-19 13:19:55 +02:00
Andi Gallo
205f9c75d9 LibWeb: Fix empty slot finding in table formation algorithm
The algorithm which finds the first free slot must run for every cell,
not for every row.
2023-06-19 13:19:32 +02:00
Tim Ledbetter
1a17e08f87 Everywhere: Correctly report progress of downloads larger than 4GiB
This commit changes the variables used to represent the size and
progress of downloads from u32 to u64. This allows `pro` and
`Browser` to report the total size and progress of a download
correctly for downloads larger than 4GiB.
2023-06-19 06:13:19 +02:00
Luke Wilde
c5e0547377 LibWeb: Add HTMLFormElement#{method,action,target} 2023-06-19 06:12:26 +02:00
Luke Wilde
f04d1d493d LibWeb: Bring form submission more up to spec
The main missing things are:
- Dialog submission
- Form validation
- Encoding URLs in the form element's encoding
- Navigables
2023-06-19 06:12:26 +02:00
Luke Wilde
bd62fe9c33 LibWeb: Set method, headers and Content-Length in BC navigation
This is all ad-hoc, but will disappear when we switch to navigables.
2023-06-19 06:12:26 +02:00
Luke Wilde
a53486a073 LibWeb: Add method to get last added task to an EventLoop 2023-06-19 06:12:26 +02:00
Luke Wilde
995df8f565 LibWeb: Move get_an_elements_{target,noopener} to HTMLElement
This will be used by form submission on `<form>` elements.
2023-06-19 06:12:26 +02:00
Luke Wilde
c9c1ddd0bb LibWeb: Fix up constructing the form entry list
In particular:
- Don't include none submitter buttons.
- Use type_state() instead type() to avoid direct string comparisons
- Support the hidden _charset_ input
- Get form associated element's value directly instead of via the value
  attribute
- Split line break normalization into a separate function so that it
  can also be used by form submission.
2023-06-19 06:12:26 +02:00
Andi Gallo
f154446a9f LibWeb: Skip separate height computation for tables
With multi-line text cells, we don't reliably know the height would stay
the same as the one set by the independent format context run. In such
situations, we can end up with a table box which is sized inconsistently
with the grid boxes of the table due to differences in line breaks.
2023-06-18 20:55:06 +02:00
Simon Danner
45f86466bb LibWeb: Add initial implementation of CRC2D.globalAlpha
Works for fills and strokes (using colors, gradients, or patterns),
along with images.

fill_rect() has been updated to use fill_path(), which allows it to
easily transform the rect, and already supports opacity.

Co-authored-by: MacDue <macdue@dueutil.tech>
2023-06-18 20:31:11 +02:00
MacDue
ff5d530aa3 LibWeb: Pass CRC2D fill_rule as enum rather than StringView 2023-06-18 20:31:11 +02:00
Aliaksandr Kalenik
ca0c2339f4 LibWeb: Use padding box of containing block to resolve % height size
From CSS-POSITION-3 <https://www.w3.org/TR/css-position-3/#def-cb>

"..the containing block is formed by the padding edge of the ancestor.."

Fixes crash on Acid2 test.
2023-06-18 20:29:40 +02:00
Luke Wilde
14ae0524e9 LibWeb: Add HTMLButtonElement#disabled 2023-06-18 19:07:06 +02:00
Andi Gallo
db121c7af1 LibWeb: Handle leading whitespace in grid-template-* block components
We're already handling whitespace between components, do the same for
leading whitespace. Fixes crash on https://distill.pub/2021/gnn-intro.
2023-06-18 13:41:15 +02:00
Ben Wiederhake
0184fc5e43 Everywhere: Use AK_MAKE_DEFAULT_MOVABLE to avoid mistakes 2023-06-18 08:47:51 +01:00
Shannon Booth
ef391de635 LibWeb: Implement Web::FileAPI::Blob::text to spec 2023-06-18 08:34:02 +02:00
Shannon Booth
501b698385 LibWeb: Implement Web::FileAPI::Blob::array_buffer to spec 2023-06-18 08:34:02 +02:00
Shannon Booth
b0bc8f2282 LibWeb: Add ReadableStreamDefaultReader::read_all_bytes_deprecated
This is not to the specification, but as the FIXME comment for the
function states, we need it to be able to properly interface with the
FileAPI spcification, which seems to have not been updated to the non
promise based API.
2023-06-18 08:34:02 +02:00
Shannon Booth
3df10d7fb6 LibWeb: Add Streams::ReadableStreamDefaultReader::read_all_bytes 2023-06-18 08:34:02 +02:00
Shannon Booth
46f9a49bd8 LibWeb: Add Streams::ReadableStreamDefaultReader read-loop reader
This algorithm is used by ReadableStreamDefaultReader to read all bytes
from a given stream. Currently the algorithm used is somewhat naive as
it is recursive, but given the initial use of this reader, it should not
be a problem.
2023-06-18 08:34:02 +02:00
Shannon Booth
f320406a4c LibWeb: Make Bindings::dom_exception_to_throw_completion public API
I found myself needing to call this method when attempting to implement
Blob::text and Blob::array_buffer. Turns out that the only caller
outside of the Detail namespace  already had a FIXME to make this a
public API - so let's do that.
2023-06-18 08:34:02 +02:00
Andi Gallo
c5eeb303d8 LibWeb: Don't cap used width by available width from a constraint
In compute_table_box_width_inside_table_wrapper, we should only consider
available_width when it's valid. Values which come from {min,
max}-content constraints aren't meaningful and shouldn't be considered
for the cap.
2023-06-18 08:27:24 +02:00
MacDue
a910c4d984 LibWeb: Fix end position for objectBoundingBox SVG <radialGradient>s
The translation to the bounding box location is handled by the gradient
transform, also doing it here breaks things.

This fixes the MDN <radialGradient> example.
2023-06-17 22:25:26 +01:00
Kenneth Myhra
57626c4f9a LibWeb: Migrate WebSockets::WebSocket to String 2023-06-17 20:38:20 +02:00
Andreas Kling
c374541711 LibWeb: Use correct reference for abspos elements with % height sizes
Absolutely positioned elements should have their percentage sizes
resolved against the padding box of the containing block, not the
content box.

From CSS-POSITION-3 <https://www.w3.org/TR/css-position-3/#def-cb>

"..the containing block is formed by the padding edge of the ancestor.."
2023-06-17 20:35:19 +02:00
Andreas Kling
9c568282dc Ladybird+LibJS: Add CLI option to run browser with LibJS bytecode VM
This required quite a bit of plumbing, but now you can run

    ladybird --use-bytecode
2023-06-17 14:16:45 +02:00
Luke Wilde
7ec7015750 LibWeb: Create an audio document for audio/ MIME types on navigation 2023-06-17 14:16:26 +02:00