Commit graph

52929 commits

Author SHA1 Message Date
Sam Atkins
73fa58da34 LibWeb: Implement the CSS outline-offset property
This allows you to push the outline a certain distance away from the
border (or inside it, if the offset is negative).
2023-08-03 05:25:48 +02:00
Sam Atkins
fe7e797483 LibWeb: Implement the CSS outline property :^)
...along with `outline-color`, `outline-style`, and `outline-width`.

This re-uses the existing border-painting code, which seems to work well
enough!

This replaces the previous code for drawing focus-outlines, with generic
outline painting for any elements that want it. Focus outlines are now
instead supported by this code in Default.css:

```css
:focus-visible {
    outline: auto;
}
```
2023-08-03 05:25:48 +02:00
Sam Atkins
5640779838 LibWeb: Allow single-value shorthand properties to parse as CompositeSV
Don't give up if we can't parse that single value for the property
directly, but let the parsing code carry on and see if we can produce a
CompositeStyleValue.
2023-08-03 05:25:48 +02:00
Sam Atkins
d98bc0da87 LibWeb: Make it clearer that several line-styles are not implemented 2023-08-03 05:25:48 +02:00
Sam Atkins
14e6bae593 LibWeb: Implement the :focus-visible pseudo-class
This is very naive for now, and matches whenever `:focus` does.
2023-08-03 05:25:48 +02:00
Sam Atkins
8520afaa11 LibWeb: Rename PaintPhase::FocusOutline -> Outline
Any element can have an outline, whether because of focus or not.
2023-08-03 05:25:48 +02:00
Andreas Kling
9e5c7abd94 LibGfx/OpenType: Return metrics from hmtx even if there is no glyf entry
This fixes an issue with some typefaces where the space character has an
advance width, but no glyf entry (and thus no ascent/descent). Before
this change, we'd render whitespace with zero advance in such cases.
2023-08-02 19:22:36 +02:00
Timothy Flynn
58e3b8cf58 Ladybird: Ensure RequestServer depends on its generated sources
Ladybird's RequestServer needs to depend on its generated IPC header
files to ensure they are generated before RequestServer is compiled,
which we currently bundle into LibWebView.
2023-08-02 12:35:05 -04:00
Karol Kosek
5b1aa2d55e LibWeb: Don't collapse boxes with CSS clear property set
I'm not sure if this is exactly correct, the link to CSS2 spec above
says something that clearance cannot separate boxes, but I'm not sure if
I understood it correctly or if I've done it in the right place.

However, this change fixes our block-and-inline/clearfix.html test again
(was regressed in previous commit).
2023-08-02 17:35:54 +02:00
Karol Kosek
142d498f14 LibWeb: Include anonymous boxes with no lines into computing BFC height
Pseudo-elements like ::before and ::after were discarded when their
content property was an empty string (ignoring whitespace), because they
are anonymous containers with no lines.

Our previous way around it was to add an empty line box (see b062a0fb7c)
however it didn't actually work for cases described in the previous
commit.

This makes avatars and cover arts square on last.fm and "fixes" the test
css-pseudo-element-should-not-be-affected-by-presentational-hints.html.
Unfortunately, this also regresses on block-and-inline/clearfix.html,
but that hopefully will be handled in subsequent commit.
2023-08-02 17:35:54 +02:00
Karol Kosek
d4b5205482 Revert "LibWeb: Make TextNode::ChunkIterator emit an empty chunk for content:"""
This reverts commit b062a0fb7c.

This made a calculation of pseudo-elements' height incorrect when they
had `height` set to `auto` and used other techniques (like setting
`padding-top`) to set height, as it was now also adding an empty line.

Additionally, the case didn't work for content containing whitespace
characters, so a pseudo-element with `content: " "` didn't have *this*
particular problem.
2023-08-02 17:35:54 +02:00
Kenneth Myhra
cf2c2cb4d7 LibWeb: Make sure we fallback to "Unsupported type" if type unrecognized
If we do not recognize the Type being serialized make sure we always
fallback to setting m_error to "Unsupported type".
2023-08-02 14:52:37 +02:00
Linus Groh
d923c2dd1b Base: Add a quote to the fortunes database 2023-08-02 13:08:59 +01:00
Sam Atkins
5cf6d51753 LibWeb: Reformat inconsistent CSS JSON files
Mostly this is about 2-space indentation, but we now also only have one
key:value pair per line.
2023-08-02 12:49:46 +01:00
Tobias Christiansen
aabdb6a801 LibWeb: Make the linter happy in Properties.json
There was a space missing and the linter complained.
2023-08-02 11:35:57 +01:00
Tobias Christiansen
8709369d43 LibWeb: Add object-fit support to HTMLImageElement
This patch adds handling of the 'object-fit' CSS property to the
painting of HTML Image Elements.
This is achieved by first calculating the rect which the image would
need if it were to fully expand into open space and then adequately
cropping it to fit into the image's box.

scale-down is not supported for now.
2023-08-02 11:35:57 +01:00
Tobias Christiansen
5fc6bff582 LibWeb: Add 'object-fit' property
This patch adds support for the 'object-fit' CSS property. :^)
2023-08-02 11:35:57 +01:00
Karol Kosek
86ad896f35 Mail: Fetch mailbox contents with BODY.PEEK[] type instead of BODY[]
We don't want to mark the entire mailbox as read when checking emails,
don't we? :^)
2023-08-02 11:21:03 +01:00
Karol Kosek
2132e0f1bb LibIMAP: Implement serializing FetchCommands with PeekBody type 2023-08-02 11:21:03 +01:00
Andrew Kaster
b5bfe732d7 Ladybird: Add RequestServer process to optionally replace Qt Networking
LibTLS still can't access many parts of the web, so let's hide this
behind a flag (with all the plumbing that entails).

Hopefully this can encourage folks to improve LibTLS's algorithm support
:^).
2023-08-02 05:44:43 +02:00
Andrew Kaster
ec3267e002 LibProtocol+LibWebView: Allow callers provide their own RequestClient
This will be used by Ladybird when it spawns its RequestServer in a
Lagom-specific way rather than using SystemServer to do it.
2023-08-02 05:44:43 +02:00
Andrew Kaster
28d3d3c9fc LibTLS: Allow applications to provide a custom default CA Cert path
On Lagom, we also need to allow the initial load of /etc/cacert.pem to
fail.
2023-08-02 05:44:43 +02:00
Andrew Kaster
5062ba347b Ladybird+LibWebView: Move Lagom code to Ladybird, Qt code to Utilities
Re-organize our helper files here a bit, to make a clearer distinction
between Qt-specific helpers and generic non-serenity helpers.

A future commit will move Lagom specific code from LibSQL to ladybird
as well, so that we can see about future generic apis for spawning
helper procesess.
2023-08-02 05:44:43 +02:00
Andrew Kaster
3be71a81bb Ladybird: Don't link SQLServer against Qt when it doesn't need it 2023-08-02 05:44:43 +02:00
Andrew Kaster
172fba4582 Ladybird: Don't prefix application files with Applications/
This was the only instance of this pattern in all of Ladybird
2023-08-02 05:44:43 +02:00
Aliaksandr Kalenik
1f28fdacf0 LibWeb: Set max-width for inline child boxes after inside layout
max-width for boxes with inline children can only be applied after
inside layout is done and width of box content is known.

Fixes https://github.com/SerenityOS/serenity/issues/20235
2023-08-02 05:27:56 +02:00
MacDue
24c848607c LibWeb: Don't lay out light DOM children of elements with a shadow root
This fixes the "last changed" time for files on GitHub. Note that this
appears to be in accordance with the shadow DOM specification, but I
can't find a line that neatly says it. Though on Google's post about
shadow DOM v1 it says:

> "the element's shadow DOM is rendered in place of its children."
https://web.dev/shadowdom-v1/#creating-shadow-dom-for-a-custom-element
2023-08-02 05:25:53 +02:00
Andrew Kaster
1903e7ff53 Meta: Port b3f82f724d to gn build 2023-08-01 19:41:18 -06:00
Timothy Flynn
a14f6e42a8 LibWeb: Begin support for requesting blob URLs with Fetch infrastructure
This does not yet implement requests with a Range header.
2023-08-02 00:52:33 +01:00
Timothy Flynn
9957d48f48 LibWeb: Implement URL.createObjectURL and URL.revokeObjectURL 2023-08-02 00:52:33 +01:00
Timothy Flynn
dd36a0c12d LibWeb: Implement extracting the origin of a blob URL 2023-08-02 00:52:33 +01:00
Timothy Flynn
b3f82f724d LibWeb: Implement an ephemeral Blob URL store
The Blob URL store is intended to be a singleton across all WebContent
instances. But for now, this implements a per-WebContent store, which
only lives as long as the WebContent process itself.
2023-08-02 00:52:33 +01:00
Simon McMahon
2ce416a676 LibWeb: Parse header value lists for some CORS headers
This adds a simple and incomplete implementation for extracting some
specific CORS headers that are used by fetch. This unifies the existing
ad-hoc parsing that already existed for Access-Control-Allow-Headers
and Access-Control-Allow-Methods, as well as adding
Access-control-Expose-Headers.
2023-08-02 00:52:23 +01:00
Simon McMahon
3a1f510af0 LibWeb: Support for Access-Control-Expose-Headers in Fetch
This adds the headers named in Access-Control-Expose-Headers to the
response's CORS-exposed header-name list which allows those headers to
be accessed from JS.
2023-08-02 00:52:23 +01:00
Andreas Kling
15440b156f LibWeb: Ignore flex container size constraints during intrinsic sizing
Properties like min-width, max-width, etc, should be ignored while we're
trying to determine the intrinsic size of a flex container.

This fixes an infinite recursion when using an intrinsic size keyword as
the max-width of a flex column container.

Note that this behavior is marked as AD-HOC in code comments because
specs don't tell us how to achieve intrinsic sizing.

We can now load product pages on the Twinings site, such as
https://twinings.co.uk/products/earl-grey-100-tea-bags :^)
2023-08-01 20:15:20 +02:00
Sam Atkins
f6e4caf197 LibWeb: Implement the :buffering and :stalled pseudo-classes
Currently, HTMLMediaElement doesn't implement the stall timeout, so
`:stalled` always returns false.
2023-08-01 12:50:40 -04:00
Sam Atkins
eb7cda1172 LibWeb: Implement the :volume-locked pseudo-class 2023-08-01 12:50:40 -04:00
Sam Atkins
c8a51f232d LibWeb: Implement the :muted pseudo-class 2023-08-01 12:50:40 -04:00
Sam Atkins
7b4ae43b91 LibWeb: Implement the :seeking pseudo-class
This matches while a media element is seeking.
2023-08-01 12:50:40 -04:00
Sam Atkins
4df5e24926 LibWeb: Implement the :playing and :paused pseudo-classes
These match media elements (`<video>` and `<audio>`) which are playing
or paused, respectively.
2023-08-01 12:50:40 -04:00
Sam Atkins
a336fe4fc4 LibWeb: Include all pseudo-classes in SimpleSelector::serialize
Rather than logging ones that are missed, just rely on the compiler to
complain if one is missing. `:indeterminate` was. :^)
2023-08-01 12:50:40 -04:00
Timothy Flynn
44911173f5 LibWeb: Make VideoPaintable's clip rect temporary
Otherwise, in a simple page such as:

    <video src=...>
    <audio src=...>

The video's clip rect would "leak" to the AudioPaintable, preventing the
audio controls from rendering at all.
2023-08-01 11:14:26 -04:00
Timothy Flynn
902c2ef5a3 LibWeb: Add a clip rect for AudioPaintable
Not a huge deal because the base MediaPaintable class goes very out of
its way to paint within the confines of its own box, but just to be
safe, this was missed when adding the AudioPaintable class.
2023-08-01 11:14:26 -04:00
Timothy Flynn
c31e8cad1e LibWeb: Remove unused VideoBox preferred width/height methods
These were copied from some other paintable, but were never used for
video.
2023-08-01 11:14:26 -04:00
Aliaksandr Kalenik
338fa8261e LibWeb: Use item minimum contribution while sizing "fr" track in GFC
Fixes the issue that before "automatic minimum size" were used to size
flexible tracks even though specification says is should be "minimum
contribution"
2023-08-01 16:25:10 +02:00
Andreas Kling
e91bdedc93 LibJS: Use correct this value when callee is a with binding
If we're inside of a `with` statement scope, we have to take care to
extract the correct `this` value for use in calls when calling a method
on the binding object via an Identifier instead of a MemberExpression.

This makes Vue.js work way better in the bytecode VM. :^)

Also, 1 new pass on test262.
2023-08-01 16:08:21 +02:00
Tom
e61fdd1dc6 LibWeb: Use viewbox attribute in SVG symbol element
Previously when a viewBox was passed to a SVG symbol element it would
not be taken into account when drawing the SVG.
2023-08-01 14:40:51 +02:00
stelar7
9f73fc87a8 LibWeb: Add tests for calc function nodes 2023-08-01 14:39:31 +02:00
Karol Kosek
eb41f0144b AK: Decode data URLs to separate class (and parse like every other URL)
Parsing 'data:' URLs took it's own route. It never set standard URL
fields like path, query or fragment (except for scheme) and instead
gave us separate methods called `data_payload()`, `data_mime_type()`,
and `data_payload_is_base64()`.

Because parsing 'data:' didn't use standard fields, running the
following JS code:

    new URL('#a', 'data:text/plain,hello').toString()

not only cleared the path as URLParser doesn't check for data from
data_payload() function (making the result be 'data:#a'), but it also
crashes the program because we forbid having an empty MIME type when we
serialize to string.

With this change, 'data:' URLs will be parsed like every other URLs.
To decode the 'data:' URL contents, one needs to call process_data_url()
on a URL, which will return a struct containing MIME type with already
decoded data! :^)
2023-08-01 14:19:05 +02:00
Karol Kosek
f27b9b9563 LibWeb: Set Content-Type for data: URLs instead of checking MIME on load
This makes the loader more agnostic.

Additionally, this allows us to load tab in Ladybird with a 'data:' URL
containing parameters, as a Resource will now call
`mime_type_from_content_type` to extract the content type from MIME. :^)
2023-08-01 14:19:05 +02:00