Commit graph

34756 commits

Author SHA1 Message Date
Gasim Gasimzada
4a42c97f4d LibJS: Set empty prototype for console object 2024-08-12 17:21:01 +01:00
Aliaksandr Kalenik
d0da377767 LibWeb: Make AddClipRect display list item account for scroll offset
Before this change AddClipRect was a "special" because it didn't respect
scroll frame offset and was meant to be recorded using viewport-relative
coordinates. The motivation behind this was to record a "final" clip
rectangle computed by intersecting all clip rectangles used by a clip
frame. The disadvantage of this approach is that it blocks us from
implementing an optimisation to reuse display list if the only change is
in the scroll offset, because any scroll offset change leads to
invalidating all AddClipRect items within a list.

This change aligns AddClipRect with the rest of display list items by
making it account for scroll frame offset. It required discontinuing
the recording of the intersection of all clip rectangles within a clip
frame and instead producing an AddClipRect for each of them.

A nice side effect is the removal of code that shifts clip rectangle by
`enclosing_scroll_offset()` in a bunch of places, because now it happens
automatically in `DisplayList::apply_scroll_offsets()`.
2024-08-12 18:20:13 +02:00
Shannon Booth
0b864bef60 LibTextCodec: Implement UTF8Decoder::to_utf8 using AK::String
String::from_utf8_with_replacement_character is equivalent to
https://encoding.spec.whatwg.org/#utf-8-decode from the encoding spec,
so we can simply call through to it.
2024-08-12 06:38:58 -04:00
Shannon Booth
b3bf5c4ea8 AK: Add BOM handling to String::from_utf8_with_replacement_character 2024-08-12 06:38:58 -04:00
Maks Verver
c68b8b5bda RequestServer: Fix compiling with -DREQUESTSERVER_DEBUG=ON 2024-08-12 02:27:48 +02:00
Jamie Mansfield
17c1e99ce4 LibWeb: Use keepalive maximum size in NavigatorBeacon
This is defined as 64 KiB in the fetch spec.

See:
 - https://wpt.live/beacon/beacon-basic.https.window.html
2024-08-11 20:07:10 +01:00
Jamie Mansfield
35047de1d8 LibWeb/Fetch: Add a constant for the keepalive maximum size 2024-08-11 20:07:10 +01:00
Gasim Gasimzada
c5b8e75204 LibJS: Set configurable toStringTag property for console 2024-08-11 20:06:27 +01:00
Aliaksandr Kalenik
dd8c693725 LibWeb: Unify scroll handling between viewport and scrollable boxes
This change causes the viewport to be treated as a "scroll frame,"
similar to how it already works for boxes with "overflow: scroll."
This means that, instead of encoding the viewport translation into a
display list, the items will be assigned the scroll frame id of the
viewport and then shifted by the scroll offset before execution. In the
future it will allow us to reuse a display list for repainting if only
scroll offset has changed.

As a side effect, it also removes the need for special handling of
"position: fixed" because compensating for the viewport offset while
painting or hit-testing is no longer necessary. Instead, anything
contained within a "position: fixed" element is simply not assigned
a scroll frame id, which means it is not shifted by the scroll offset.
2024-08-11 07:53:21 +02:00
Tim Ledbetter
5b09430c5e WebContent: Actually start WebDriver timeout timers
The timers added previously in #1021 had no effect, as they were never
started.
2024-08-10 23:18:08 +01:00
Alisson Lauffer
d38b28b57b LibWeb: Replace "+" in value with a space while decoding search params 2024-08-10 10:39:43 +02:00
Shannon Booth
9c72fc9642 LibWeb: Actually run UTF-8 decode without BOM
This fixes a crash using URLSearchParams when provided a percent encoded
string which does not percent decode to valid UTF-8.

Fixes a crash running https://wpt.live/url/urlencoded-parser.any.html
2024-08-10 10:39:43 +02:00
Shannon Booth
84a09476ba LibURL: Update spec comment for validation error in authority state
See: https://github.com/whatwg/url/commit/3e8cd02bb
2024-08-10 10:39:43 +02:00
Shannon Booth
84a7fead0e LibURL: Make percent_encode return a String
This simplifies a bunch of places which were needing to error check and
convert from a ByteString to String.
2024-08-10 10:39:43 +02:00
Diego Frias
c58665332e LibWasm: Ensure correct section ordering when parsing binary modules
There are (currently) no spec-tests ensuring that section ordering is
enforced, but it _is_ a part of the spec. A pull request to add this to
the specification testsuite has been opened at WebAssembly/spec#1775.
2024-08-10 10:39:10 +02:00
Aliaksandr Kalenik
ea8d0304e9 LibWeb: Create clip and scroll frame trees separately for each navigable
While introducing clip and scroll frame trees, I made a mistake by
assuming that the paintable tree includes boxes from nested navigables.
Therefore, this comment in the code was incorrect, and clip/scroll
frames were simply not assigned for iframes:
// NOTE: We only need to refresh the scroll state for traversables
//       because they are responsible for tracking the state of all
//       nested navigables.

As a result, anything with "overflow: scroll" is currently not
scrollable inside an iframe

This change fixes that by ensuring clip and scroll frames are assigned
and refreshed for each navigable. To achieve this, I had to modify the
display list building process to record a separate display list for each
navigable. This is necessary because scroll frame ids are local to a
navigable, making it impossible to call
`DisplayList::apply_scroll_offsets()` on a display list that contains
ids from multiple navigables.
2024-08-10 10:38:12 +02:00
Tim Ledbetter
1b2f35c3af WebContent: Add timeouts to WebDriver window state modification methods 2024-08-10 10:37:43 +02:00
Tim Ledbetter
fbff0ca6a8 WebContent: Abort WebDriver navigation if session timeout exceeded 2024-08-10 10:37:43 +02:00
Sam Atkins
80a20be176 LibWeb/CSS: Bring previous CSSRule parsing up to standard
GCPtrs instead of raw pointers, and logging when the media rule is
invalid.
2024-08-10 10:36:39 +02:00
Sam Atkins
9de73bf89b LibWeb/CSS: Parse gradient functions with TokenStream
They already used TokenStream for parsing the function parameters, but
this makes the `parse_foo_gradient()` functions themselves take a
TokenStream.
2024-08-10 10:36:39 +02:00
Sam Atkins
29d7aa9fc9 LibWeb/CSS: Parse url() functions with TokenStream 2024-08-10 10:36:39 +02:00
Sam Atkins
d5f3a610ac LibWeb/CSS: Split out @keyframes parsing code
Changes are very minimal, this is just a code move.
2024-08-10 10:36:39 +02:00
Sam Atkins
e5737232c0 LibWeb/CSS: Split out @supports parsing code 2024-08-10 10:36:39 +02:00
Sam Atkins
5b883929e0 LibWeb/CSS: Split out @namespace parsing code 2024-08-10 10:36:39 +02:00
Sam Atkins
16049db560 LibWeb/CSS: Split out @import parsing and convert it to TokenStream 2024-08-10 10:36:39 +02:00
Sam Atkins
b9b2fd62b5 LibWeb/CSS: Parse builtin values using TokenStream 2024-08-10 10:36:39 +02:00
Sam Atkins
98963e0c9a LibWeb/CSS: Flatten parse_basic_shape_function() into only caller 2024-08-10 10:36:39 +02:00
Sam Atkins
e5553d6d2f LibWeb/CSS: Make parse_color() take a TokenStream
This makes the parse_color_value() code a lot simpler.
2024-08-10 10:36:39 +02:00
Sebastian-Webster
b0e3b28929 LibWebView: Add Ecosia search engine 2024-08-10 10:36:32 +02:00
Tobias Christiansen
c3e69f2fc6 Inspector: Add "Fonts" tab
This adds another tab to the bottom tabs providing information
regarding the fonts computed for the currently selected DOM node.
2024-08-09 18:58:04 +01:00
Tobias Christiansen
5621f34062 LibWebView + WebContent: Add fonts to be transferable to inspector
This patch adds all the needed plumbing to transfer information
regarding fonts of the selected DOM node to the inspector.
2024-08-09 18:58:04 +01:00
Tobias Christiansen
049a261782 LibGfx: Add for_each_font_entry to FontCascadeList
This way there is a way to iterate over all the fonts in the object.
2024-08-09 18:58:04 +01:00
simonkrauter
dd5550dde3 LibWebView: Remove early exit in InspectorClient::inspect()
This early exit prevents to show the current DOM in the inspector, when
the inspector was already opened.

Fixes #990
2024-08-09 17:19:56 +01:00
Jelle Raaijmakers
7a783d3a89 LibWeb: Account for intrinsic width or height in flex base size
In calculating the base size of a flex item, we have a piece of ad-hoc
code that deals with an item that does have an instrinsic aspect ratio,
but not a cross size to resolve that ratio against. In determining the
actual flex item size however, we also take into account the minimum
content width and height, which assumes the box' intrinsic width or
height when available. This would break having an image as a flex item,
which gets stretched to its maximum size within the flex container
instead of the flex item being shrunk to the instrinsic size of the
image.

Fix this by only stretching flex items that do not have an instrinsic
width nor height set.
2024-08-09 17:01:50 +01:00
Jelle Raaijmakers
d82f8a4b16 LibWeb: Update two spec URIs
No functional changes.
2024-08-09 17:01:50 +01:00
Jelle Raaijmakers
89d21335a1 LibWeb: Remove unused includes
No functional changes.
2024-08-09 17:01:50 +01:00
Alec Murphy
b3a67ee088 LibWeb: Skip trim trailing whitespace if user is typing
This PR stops the cursor from disappearing while typing trailing spaces
in a text input box.
2024-08-09 16:57:14 +01:00
Gasim Gasimzada
8545756d17 LibJS: Treat passing undefined as no argument for console labels
- Affects time, timeLog, timeEnd, count, and countReset functions
2024-08-09 11:02:22 +01:00
BenJilks
0ca5675d59 LibTextCodec: Implement iso-2022-jp encoder
Implements the `iso-2022-jp` encoder, as specified by
https://encoding.spec.whatwg.org/#iso-2022-jp-encoder
2024-08-08 17:49:58 +01:00
BenJilks
08a8d67a5b LibTextCodec: Implement shift_jis encoder
Implements the `shift_jis` encoder, as specified by
https://encoding.spec.whatwg.org/#shift_jis-encoder
2024-08-08 17:49:58 +01:00
BenJilks
c1958437f9 LibWeb: Use text encoding from DOM when parsing URLs
This passes the DOM encoding down to the URL parser, so the correct
encoder can be used.
2024-08-08 17:49:58 +01:00
BenJilks
d80575a410 LibTextCodec: Implement gb18030 and gbk encoders
Implements the `gb18030` and `gbk` encoders, as specified by
https://encoding.spec.whatwg.org/#gb18030-encoder
https://encoding.spec.whatwg.org/#gbk-encoder
2024-08-08 17:49:58 +01:00
BenJilks
34c8c559c1 LibTextCodec: Implement big5 encoder
Implements the `big5` encoder, as specified by
https://encoding.spec.whatwg.org/#big5-encoder
2024-08-08 17:49:58 +01:00
BenJilks
826292536c LibTextCodec: Implement euc-kr encoder
Implements the `euc-kr` encoder, as specified by
https://encoding.spec.whatwg.org/#euc-kr-encoder
2024-08-08 17:49:58 +01:00
BenJilks
72d0e3284b LibTextCodec+LibURL: Implement utf-8 and euc-jp encoders
Implements the corresponding encoders, selects the appropriate one when
encoding URL search params. If an encoder for the given encoding could
not be found, fallback to utf-8.
2024-08-08 17:49:58 +01:00
Tim Ledbetter
85863bb0ef LibWeb: Don't verify_cast where input and output types are the same 2024-08-08 17:50:59 +02:00
Shannon Booth
deff8df2c7 LibWeb: Actually perform "update the href steps"
We completely missed this step, which made setters not actually do
anything!

Fixes 336 test failures on:

https://wpt.live/url/url-setters-a-area.window.html
2024-08-08 14:59:42 +01:00
Aliaksandr Kalenik
40742d95e6 LibWeb: Call set_needs_display() if navigable is scrolled or resized
`m_needs_repaint = true` is not enough because it doesn't schedule
repaint of a parent navigable.

Fixes the bug when an iframe is not repainted after scrolling.
2024-08-08 12:38:15 +02:00
Tim Ledbetter
087d400472 LibWeb: Avoid division by zero in SourceSet width descriptor calculation 2024-08-08 12:20:04 +02:00
Shannon Booth
2e884ff140 LibJS: Add Value::to_well_formed_string 2024-08-08 10:50:06 +01:00