Commit graph

54228 commits

Author SHA1 Message Date
Shannon Booth
f4bc1602e2 LibWeb: Port HTMLMediaElement interface from DeprecatedString to String 2023-09-05 20:36:09 -04:00
Shannon Booth
e5910a4593 LibWeb: Port HTMLAnchorElement interface from DeprecatedString to String 2023-09-05 20:36:09 -04:00
Shannon Booth
76af9d434c LibWeb: Port HTMLCanvasElement interface from DeprecatedString to String 2023-09-05 20:36:09 -04:00
Shannon Booth
7206f1777a LibWeb: Port HTMLOptionElement interface from DeprecatedString to String 2023-09-05 20:36:09 -04:00
Shannon Booth
c405ba6b08 LibWeb: Port HTMLBaseElement interface from DeprecatedString to String 2023-09-05 20:36:09 -04:00
Shannon Booth
2a732e6ddd LibWeb: Port HTMLFormElement interface from DeprecatedString to String
Leaving a FIXME for HTMLFormElement::method as it looks like this could
be Reflect in the IDL.
2023-09-05 20:36:09 -04:00
Shannon Booth
63aa93aaf4 LibWeb: Port HTMLObjectElement interface from DeprecatedString to String 2023-09-05 20:36:09 -04:00
Shannon Booth
de07fb5132 LibWeb: Port HTMLAreaElement interface from DeprecatedString to String
Which required HTMLHyperlinkElementUtils to also be changed to support
this.
2023-09-05 20:36:09 -04:00
Shannon Booth
57d8b0ec73 LibWeb: Port HTMLButtonElement interface from DeprecatedString to String 2023-09-05 20:36:09 -04:00
Shannon Booth
2ab7129595 LibWeb: Port HTMLScriptElement interface from DeprecatedString to String 2023-09-05 20:36:09 -04:00
Shannon Booth
914fb90bbe LibWeb: Don't generate Optional<String> from IDL for non-null arguments
Previously if the IDL was something like:
```
constructor(optional DOMString data = "");
```

We were generating code that would be passing through to the constructor
an Optional<String> - even though for this situation it is not possible
for it to be null.

Instead, if we know if there is a default value that is non-null and the
type is not nullish, just generate the cpp code as a String.
2023-09-05 20:36:09 -04:00
Shannon Booth
f991e40d7f LibWeb: Support [Reflect] on IDL String attributes that may return null
This change allows IDL interfaces to be compiled using new AK String
which have a attribute in the interface that may return null.

Without this change we would run into a compile error from code such as
the following example:

```
auto retval = impl->deprecated_attribute(HTML::AttributeNames::ref);

if (!retval.has_value()) {
    return JS::js_null();
 }
 return JS::PrimitiveString::create(vm, retval.release_value());
```

As `deprecated_attribute` returns a `DeprecatedString` instead of an
`Optional<String>`. Fix that by using the non-deprecated attribute
implementation, and falling back to the empty string for where we cannot
return null.

Also add a test here to cover a regression I almost introduced here
which was not previously covered by our test suite.

Ideally, all of this should actually just be calling
Element::get_attribute_value, but I'm not entirely sure at this stage
what the behavioral change would be to test for here. Since this
implementation preserves the previous behavior, stick with it, and add a
FIXME for now.
2023-09-05 20:36:09 -04:00
Shannon Booth
6fb3586baa LibWeb: Add Optional<String> version of Element::attribute
As a non-deprecated alternative to DeprecatedString Element::attribute.
2023-09-05 20:36:09 -04:00
Shannon Booth
0f6782fae6 LibWeb: Rename Element::attribute to Element::deprecated_attribute
This should allow us to add a Element::attribute which returns an
Optional<String>. Eventually all callers should be ported to switch from
the DeprecatedString version, but in the meantime, this should allow us
to port some more IDL interfaces away from DeprecatedString.
2023-09-05 20:36:09 -04:00
Shannon Booth
da637a527d LibWeb: Port CSSStyleSheet interface from DeprecatedString to String 2023-09-05 20:36:09 -04:00
Niklas Poslovski
d93e916d0c AK: Use arc4random_buf() for Random on all BSDs 2023-09-05 19:36:53 -04:00
Niklas Poslovski
c223b65a69 Ladybird: Fix the include of use_linker in CMakeLists.txt 2023-09-05 17:12:05 -06:00
Bastiaan van der Plaat
f1742ae1b9 LibWeb: Add DOMMatrix flipX and flipY 2023-09-05 20:30:36 +02:00
Bastiaan van der Plaat
fc380bf516 LibWeb: Add DOMMatrix skewX and skewY 2023-09-05 20:30:36 +02:00
Jelle Raaijmakers
b21ca0d04e Maps: Add pledge and unveils 2023-09-05 20:16:05 +02:00
Andrew Kaster
52d6c49ccc Ladybird: Add Espresso test on Android to verify we can load our views
The simple smoke test makes sure that we can boot up an android emulator
with our package in it, and that the WebView is visible on boot.

More tests to come with more features :^)
2023-09-05 19:17:48 +02:00
Andrew Kaster
f87388ff72 Ladybird: Force-add the .gitkeep file for the assets folder on Android
This folder is gitignored because we copy a generated tar file to it
during the build so that the android build tools will add it to our
APK file. However, the gitkeep was not re-added when the folder moved.
2023-09-05 19:17:48 +02:00
Andrew Kaster
1d369cb722 Ladybird: Add Android View for WebView and paint into it from bindings
This allows our WebViewImplementationNative class to paint into an
Android Bitmap class from the onDraw() view event. We also set the
viewport geometry from the view since we're setting the Kotlin Bitmap
at the same time.
2023-09-05 19:17:48 +02:00
Aliaksandr Kalenik
8d05ff1fe7 LibWeb: Print FIXME if vertical-align value is not supported in TFC
Producing incorrect layout for table cells is better than crashing :)
2023-09-05 16:51:25 +02:00
Michal Grich
331a19efe8 Calendar: Save time of the event and display it in Calendar
This PR introduces the ability to save calendar event times
and adds functionality for displaying saved times in the calendar.
Additionally, it addresses the issue where changes to the time
value in the dropdown were not being saved.
2023-09-05 15:08:42 +01:00
Zaggy1024
98926b487c LibWeb: Perform rounding when dividing CSSPixels
This should allow us to produce results that more closely match old
layouts when divisions were done in floating-point.
2023-09-05 14:50:45 +02:00
Zaggy1024
bd85e1b30b LibWeb: Entirely and exactly distribute grids' extra space to tracks
Previously, the code assumed that in dividing up the space in the
affected tracks there would never be an overshoot. Instead, we can
check for each track how much extra space is left and never consume any
extra.

In the same way, we can ensure that all extra space is consumed by
distributing all remaining extra space starting from the first track.
Thus, if there is no growth limit, the space distribution should always
consume all the extra space.
2023-09-05 14:50:45 +02:00
Zaggy1024
eb7c2ee307 LibWeb: Limit affected size of grid tracks instead of only increase
The spec says that the sum of affected size + item-incurred increase
should reach the limit, rather than just the item-incurred increase.

This seems to improve layout on the testcase `row-span-2-with-gaps`.
The extra line of space at the bottom of the left div
(`div.grid-item.item-span-two`) is not present anymore, matching other
browsers' layout much more closely.
2023-09-05 14:50:45 +02:00
Daniel Bertalan
dac443fbff Meta: Link Lagom with LLD by default and allow configuring the linker
This ports over the `LADYBIRD_USE_LLD` option from the standalone
Ladybird build and generalizes it to work for mold as well: the
`LAGOM_USE_LINKER` variable can be set to the desired name of the
linker. If it's empty, we default to trying LLD and Mold on ELF
platforms (in this order).
2023-09-05 14:50:36 +02:00
Sam Atkins
07039af982 LibWeb: Implement attr() types :^)
Support the optional `<attr-type>` parameter to the `attr()` function,
which allows parsing the attribute's value as a variety of types,
instead of always as a string.
2023-09-05 14:27:23 +02:00
Sam Atkins
6f45df5ced LibWeb: Add more CSS Token factory methods
The way we currently deal with `attr()` means having to manufacture
Tokens, so we need a way to do that from StyleComputer.
2023-09-05 14:27:23 +02:00
Sam Atkins
9735f474a2 LibWeb: Extract attr() substitution into its own method
No functional changes.
2023-09-05 14:27:23 +02:00
Sam Atkins
7d10484660 LibWeb: Move UnresolvedStyleValue resolution into the CSS Parser
Resolving typed `attr()` functions is going to involve using more
internal Parser methods, so this is the simplest solution for that.
Also... resolving these is basically parsing them, so it makes more
sense for that process to live here.

This is just moving code, with minimal changes so it still works.
2023-09-05 14:27:23 +02:00
Sam Atkins
cab8b3e180 LibWeb: Move a FIXME comment where it belongs
`var()` is now handled in  `expand_variables()`, so let's have the FIXME
where it applies to the entire process.
2023-09-05 14:27:23 +02:00
Sam Atkins
733ad57f39 LibWeb: Expose Parser::Function name as FlyString const&
This saves us from having to re-convert the StringView back to a
FlyString again when resolving UnresolvedStyleValues.
2023-09-05 14:27:23 +02:00
Sam Atkins
f527e55046 AK: Allow case-insensitive FlyString/StringView comparison 2023-09-05 14:27:23 +02:00
Sam Atkins
e9b58ff096 LibWeb: Move check for CSS-wide keywords to ValueID.h
This feels like a better home for it. The new name better reflects the
spec phrasing.
2023-09-05 14:27:23 +02:00
Sam Atkins
bf8aa33b68 LibWeb: Add tests for basic attr() behavior and fallback values 2023-09-05 14:27:23 +02:00
Andreas Kling
e013306df8 LibWeb: Allow font-size: 0
Zero is a valid font-size value, and should result in no text being
visible. We now match the behavior of other engines.
2023-09-05 14:23:35 +02:00
Andreas Kling
6a32634440 LibGfx: Don't crash on Typeface::get_font() with size 0
If someone wants a zero-sized font, we can just give it to them instead
of making a fuss.
2023-09-05 14:23:35 +02:00
Andreas Kling
589a1e9325 LibWeb: Propagate font-size & line-height into generated table boxes
The final used values for these properties is stored in the layout node,
so we need to make sure they are propagated there as well when doing
table box fixup.
2023-09-05 14:23:35 +02:00
Cubic Love
8eb10b135d Maps: Add Application Icons
Add 16px and 32px application icons for Maps
2023-09-05 14:13:32 +02:00
Timothy Flynn
bc5b7aeffb Ladybird: Hide the WebDriver-to-WebContent IPC path from the help menu
This is never meant to be passed by a human, it is created and passed by
WebDriver only. Hide it from the --help menu to avoid confusion.
2023-09-05 06:51:16 -04:00
Timothy Flynn
b6835d2c40 LibJS: Stop propagating small OOM errors from Intl.RelativeTimeFormat 2023-09-05 08:08:09 +02:00
Timothy Flynn
b3694653a7 LibJS: Stop propagating small OOM errors from Intl.NumberFormat
Note this also does the same for Intl.PluralRules. The only OOM errors
propagated from Intl.PluralRules were from Intl.NumberFormat.
2023-09-05 08:08:09 +02:00
Timothy Flynn
30a812b77b LibJS: Stop propagating small OOM errors from Intl.MathematicalValue 2023-09-05 08:08:09 +02:00
Timothy Flynn
746ce6f9a1 LibJS: Stop propagating small OOM errors from Intl.Locale 2023-09-05 08:08:09 +02:00
Timothy Flynn
9e5055c298 LibJS: Stop propagating small OOM errors from Intl.ListFormat 2023-09-05 08:08:09 +02:00
Timothy Flynn
76b5974f08 LibJS: Stop propagating small OOM errors from the Intl namespace object 2023-09-05 08:08:09 +02:00
Timothy Flynn
20aaa2c236 LibJS: Stop propagating small OOM errors from Intl.DurationFormat 2023-09-05 08:08:09 +02:00