Commit graph

8823 commits

Author SHA1 Message Date
Sam Atkins
97e917bdf5 LibWeb/CSS: Allow bare zero for gradient angles
Corresponds to f952e97da9
2025-03-18 20:04:08 +00:00
Timothy Flynn
4dfc29356d LibWeb: Initialize the Storage byte count upon creation
A Storage object may be created with an existing storage bottle. For
example, if you navigate from site.com/page1 to site.com/page2, they
will have different localStorage objects, but will use the same bottle
for actual storage.

Previously, if page1 set some key/value item, we would initialize the
byte count to 0 on page2 despite having a non-empty bottle. Thus, if
page2 set a smaller value with the same key, we would overflow the
computed byte count, and all subsequent writes would be rejected.

This was seen navigating from the chess.com home page to the daily
puzzle page.
2025-03-18 20:34:13 +01:00
Aliaksandr Kalenik
394073f611 LibWeb: Rename internals.signalTextTestIsDone() to signalTestIsDone()
In upcoming change this function will be used for ref-tests as well.
2025-03-18 20:09:46 +01:00
Alec Murphy
101a8aef26 LibWeb: Use Super on macOS for page scroll/nav
On macOS, we should use the Cmd (Super) modifier key along with the
arrow keys to scroll to the beginning/end of the document, or navigate
back and forth in the history, rather than the Ctrl or Alt keys.
2025-03-18 15:07:09 -04:00
Shannon Booth
894c51e8e7 LibWeb/HTML: Handle missing second component in datetime-local
We were previously not checking for EOF which meant we were not
handling seconds being missing in the time component.
2025-03-18 15:05:02 -04:00
Shannon Booth
a457ebeec5 LibWeb/HTML: Implement 'convert string to number' for datetime-local 2025-03-18 15:05:02 -04:00
Timothy Flynn
780de1395b LibJS: Merge Intl.DurationFormat style and display fields into a struct
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/d56d624
2025-03-18 11:47:23 -04:00
Timothy Flynn
00d00b84d3 LibJS: Ensure relevant extension keys are included in ICU locale data
This is a normative change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/7508197

In our implementation, we don't have the affected AOs directly, as we
delegate to ICU. So instead, we must ensure we provide ICU a locale with
the relevant extension keys present.
2025-03-18 11:47:23 -04:00
Timothy Flynn
37b8ba96f1 LibJS: Use currency digits for NumberFormat only for standard notation
This is a normative change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/9140da2
2025-03-18 11:47:23 -04:00
Timothy Flynn
96c059bf67 LibJS: Use correct enum casing in some Intl constructors 2025-03-18 11:47:23 -04:00
Timothy Flynn
ea10470071 LibJS: Correctly print labels for some Intl objects
For example, printing an Intl.Collator object would previously display:

    [Intl.Collator]  numeric:
    "en"  locale:
    "sort"  usage:
    "variant"  sensitivity:
    "upper"  caseFirst:
    "default"  collation:
    false  ignorePunctuation:
    false

We now print:

    [Intl.Collator]
      locale: "en"
      usage: "sort"
      sensitivity: "variant"
      caseFirst: "upper"
      collation: "default"
      ignorePunctuation: false
      numeric: false
2025-03-18 11:47:23 -04:00
Aliaksandr Kalenik
4a7b947c5d LibWeb: Clamp content-based minimum size by limited max track size [GFC]
Progress on https://wpt.live/css/css-grid/grid-items/grid-minimum-size-grid-items-022.html
2025-03-18 15:01:02 +01:00
Shannon Booth
ec3c545426 LibURL+LibWeb: Ensure opaque paths always roundtrip
Corresponds to: https://github.com/whatwg/url/commit/6c782003
2025-03-18 12:17:19 +00:00
Tim Ledbetter
01d1a9528b LibWeb: Calculate the correct resolved value for inset properties
This improves the output of `getComputedStyle()` for the `top`,
`bottom`, `left` and `right` properties, where the used value is now
returned rather than the computed value, where applicable."
2025-03-18 09:27:51 +00:00
Shannon Booth
b8adf193f5 LibWeb/SVG: Work around no layout node in SVGCircleElement::get_path
This is clearly not the correct fix, but instead of crashing let's
log an error and bail.

Works around a crash seen on both:

 * https://reddit.com
 * https://www.w3.org/TR/web-animations-1 (#879)
2025-03-17 20:10:11 +01:00
mikiubo
c85df78c4c LibRegex: Remove orphaned save points in nested LookAhead 2025-03-17 16:11:02 +01:00
stasoid
a6935299eb LibWeb: Correctly calculate static position rect when absolutely
positioned element is a descendant of inline-block

Sets inline block offsets in InlineFormattingContext.cpp, but this is
not enough. When static position rect is calculated during layout,
not all ancestors of abspos box may have their offsets calculated yet
(more info here: https://github.com/LadybirdBrowser/ladybird/pull/2583#issuecomment-2507140272).
So now static position rect is calculated relative to static containing
block during layout and calculation relative to actual containing block
is done later in
FormattingContext::layout_absolutely_positioned_element.

Fixes wpt/css/CSS2/abspos/static-inside-inline-block.html
2025-03-17 15:55:06 +01:00
Tim Ledbetter
1821896ecf LibWeb: Implement the HTMLLinkElement.sheet attribute
This returns the link element's associated style sheet.
2025-03-17 14:47:20 +01:00
Sam Atkins
db597843d6 LibWeb/CSS: Correct parsing of @supports selector()
A couple of fixes here:
- Parse a `<complex-selector>` instead of a `<selector-list>`
- Don't match if any unknown `::-webkit-*` pseudo-elements are found
2025-03-17 10:00:19 +00:00
Sam Atkins
b6fb4baeb7 LibWeb/CSS: Implement @supports font-format() and font-tech()
These let authors query whether we support font formats and features.
2025-03-17 10:00:19 +00:00
Sam Atkins
adfe8a9dcb LibWeb/CSS: Add functions that report font format/technology support
Both `@supports` and `@font-face` need this. There may be some automatic
way of querying whether our renderer supports these, but I couldn't
figure it out, so here's a basic hard-coded list. I think the font-tech
list has false negatives, as I don't know enough about fonts to
determine what we support accurately.
2025-03-17 10:00:19 +00:00
Sam Atkins
1e6f703b30 LibWeb/CSS: Compare MediaFeatureValues using references not copies 2025-03-17 10:00:19 +00:00
Sam Atkins
e125ab360e LibWeb/CSS: Merge MediaFeature data members
A MediaFeature either has a MediaFeatureValue, or a Range, or nothing.
Combining these into a Variant reduces the size from 176 bytes to 128,
and also makes constructing these a little less awkward.
2025-03-17 10:00:19 +00:00
Sam Atkins
0f5e054f97 LibWeb: Implement generic boolean logic for media/supports queries
CSS Values 5 now defines a `<boolean-expr[]>` type that is used in place
of the bespoke grammar that previously existed for `@media` and
`@supports` queries. This commit implements some BooleanExpression
types to represent the nodes in a `<boolean-expr[]>`, and reimplements
`@media` and `@supports` queries using this.

The one part of this implementation I'm not convinced on is that the
`evaluate()` methods take a `HTML::Window*`. This is a compromise
because `@media` requires a Window, and `@supports` does not require
anything at all. As more users of `<boolean-expr[]>` get implemented in
the future, it will become clear if this is sufficient, or if we need
to do something smarter.

As a bonus, this actually improves our serialization of media queries!
2025-03-17 10:00:19 +00:00
Sam Atkins
84a695c958 LibWeb/CSS: Evaluate Supports query components during parsing
Instead of parsing the parts of a `@supports` query, then only
evaluating them when constructing the Supports itself, we can instead
evaluate them as we parse them. This simplifies things as we no longer
need to pass a Realm around, and don't have to re-parse the conditions
again with a new Parser instance.
2025-03-17 10:00:19 +00:00
Sam Atkins
95730c66aa LibWeb: Make non-replaced flex items make use of transferred size
Corresponds to 9beaea1f2a
2025-03-17 09:35:58 +00:00
Sam Atkins
3dd079b308 LibWeb/HTML: Add stub for WebDriver BiDi to intercept file dialogs
Corresponds to 09ad1b9894
2025-03-17 09:34:48 +00:00
Aliaksandr Kalenik
2e256d2eac LibWeb: Invalidate text-decoration-thickness as paint-only property
Fixes underinvalidation caused by resolving text-decoration-thickness
during layout commit, while this property can be invalidated
independently of layout.
2025-03-16 22:25:26 +01:00
Luke Wilde
61c1e4a855 LibWebView: Keep javascript URL navigations in the same process
JavaScript URLs run in the same document context the navigation was
started in, so they're not eligible to be moved to a new WebContent
process.

Fixes the "Login as demo user" link on https://demo.immich.app/
2025-03-16 10:59:41 -04:00
Andrew Kaster
c8787e6a9f LibCore: Add swift bindings for EventLoop as an Executor and Actor 2025-03-15 21:51:22 -06:00
Timothy Flynn
3af63bc5a3 Everywhere: Replace miscellaneous references to the chrome process 2025-03-15 19:57:27 -04:00
Timothy Flynn
18eee7e3f0 LibWebView: Rename the Chrome process type to Browser 2025-03-15 19:57:27 -04:00
Timothy Flynn
e20d7be15f LibWeb+UI: Rename ChromeInputData to BrowserInputData 2025-03-15 19:57:27 -04:00
Timothy Flynn
47d6747945 LibWebView+UI: Rename ChromeProcess to BrowserProcess 2025-03-15 19:57:27 -04:00
Timothy Flynn
e00c0c176e LibWebView+UI: Rename ChromeOptions to BrowserOptions 2025-03-15 19:57:27 -04:00
Timothy Flynn
6078143241 LibWeb+WebContent: Remove "chrome" from generated page template strings 2025-03-15 19:57:27 -04:00
Timothy Flynn
df7917d705 LibWebView: Change the DevTools server to be a runtime-enabled feature 2025-03-15 19:09:40 +01:00
Timothy Flynn
810d04b3f4 LibWeb+LibWebView+WebContent: Remove the built-in Inspector 2025-03-15 19:09:40 +01:00
Mehran Kamal
bb87de58a0 LibWeb+LibGfx: Paint line_cap, line_join for Canvas Strokes 2025-03-15 14:02:27 +01:00
Mehran Kamal
12968ff025 LibGfx: Move to_skia_cap, to_skia_join to SkiaUtils 2025-03-15 14:02:27 +01:00
Aliaksandr Kalenik
23151de217 LibWeb/Layout: Fix min{max}-content size calculation for grid items
Instead of directly invoking `to_px()`,
`calculate_min_content_contribution()` needs to use
`calculate_inner_width()` and `calculate_inner_height()`, which are
aware of how to correctly handle `min-content` and `max-content` values.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/3469
2025-03-15 13:51:16 +01:00
Aliaksandr Kalenik
08c155cd3f LibWeb: Resolve "height: auto" using preferred aspect ratio if possible
Fixes https://github.com/LadybirdBrowser/ladybird/issues/2276
2025-03-15 13:51:16 +01:00
Aliaksandr Kalenik
227b4c38b7 LibWeb: Use parent's available space for anonymous blocks in BFC
Height resolution assumes that when available space is definite, it
matches the size of non-anonymous containing block. With this change, we
correctly maintain this assumption when box is wrapped in anonymous
node.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/3422
2025-03-15 13:31:07 +01:00
Aliaksandr Kalenik
9e287465b9 LibWeb: Fix CSS transform invalidation when transitioning to none
Fixes https://github.com/LadybirdBrowser/ladybird/issues/2707
2025-03-15 13:30:45 +01:00
Shannon Booth
a9e20cb6c3 LibURL/Pattern: Use ConstructorStringParser to construct URLPatternInit 2025-03-15 07:39:03 -04:00
Shannon Booth
e369756e9c LibURL/Pattern: Implement the constructor string parser
This is missing one small bit of functionality where the not-yet
impplemented component compilation is required.
2025-03-15 07:39:03 -04:00
Shannon Booth
e70272ddef LibURL/Pattern: Implement URL Pattern canonicalization
These are used to normalize URL components.
2025-03-15 07:39:03 -04:00
Shannon Booth
f775ee8a93 LibURL: Rename 'cannot be a base URL' state to 'opaque path' state
This follows a rename made in the URL specification.
2025-03-15 07:39:03 -04:00
Shannon Booth
f8f21319f9 LibURL/Pattern: Implement the URL Pattern Tokenizer
The tokenizer is used for both pattern string and constructor string
parsing of URL Patterns.
2025-03-15 07:39:03 -04:00
Sam Atkins
70e3a48892 LibWeb: Stub out "focus-without-user-activation" feature policy
For now this always returns that focus is allowed, as that matches our
previous behavior.

Corresponds to d7053d86ad
2025-03-14 20:33:25 +00:00