Commit graph

326 commits

Author SHA1 Message Date
Hexeption c0fdc7d2dd LibWeb: Added HTMLLinkElement.as Tests
(cherry picked from commit 7ac6fd274696fe3e66971bb3b82141466879f82b)
2024-06-27 14:49:29 +02:00
Hexeption 928576e0ac LibWeb: Added HTMLLinkElement.as
(cherry picked from commit 2f4668edce2effb38563b9da229d00d3ba5dc508,
manually amended to move `||` at the start of the line to appease
clang-format)
2024-06-27 14:49:29 +02:00
circl ec1692eed2 Browser: Display name as "Browser" once again
This basically reverts 15211cd, since Ladybird has been hard-forked from
the SerenityOS project, this chrome is no longer officially part of it.
2024-06-08 10:30:07 -04:00
Tim Ledbetter 8892c25520 Base: Return the correct value for fib(0) in Wasm example
Previously, using `wasm-decompile` to decompile the Wasm bytecode on
the `wasm.html` example page gave this output:

```
export function fib(a:int):int {
  if (a < 2) { return 1 }
  return fib(a - 2) + fib(a - 1);
}
```

With this change the bytecode now decompiles to:

```
export function fib(a:int):int {
  if (a <= 0) { return 0 }
  if (a == 1) { return 1 }
  return fib(a - 2) + fib(a - 1);
}
```

This means that the example page now prints the correct answer of 55 to
the console for `fib(10)`. Previously, `fib(10)` returned 89.

I also used `wasm-opt -Oz`, which removed an unnecessary `return`
instruction, saving 1 byte!
2024-04-11 01:17:20 +02:00
Bastiaan van der Plaat 1475c1810f LibWeb: Add support for select options disabled state 2024-04-08 17:24:48 -04:00
Bastiaan van der Plaat 4408581ee0 LibWeb: Refactor SelectItem to allow selecting options without value
Currently the `<select>` dropdown IPC uses the option value attr to
find which option is selected. This won't work when options don't
have values or when multiple options have the same value. Also the
`SelectItem` contained so weird recursive structures that are
impossible to create with HTML. So I refactored `SelectItem` as a
variant, and gave the options a unique id. The id is send back to
`HTMLSelectElement` so it can find out exactly which option element
is selected.
2024-04-08 17:24:48 -04:00
Matthew Olsson 53a247dbe1 Base: Extend the web-animations demo to showcase complex transforms 2024-03-02 12:25:53 +01:00
Matthew Olsson 83fd28e089 LibWeb: Add a demo for web-animations 2024-02-23 20:52:37 +01:00
Timothy Flynn 00510e40d9 LibWeb: Convert the cookie test page to a text test 2024-01-10 23:26:40 +01:00
Daniel La Rocque 242d1d8eba LibWeb: Fail to parse cookie date when date does not exist
Previously, the cookie date validation did not validate days in the
context of the month and year, resulting in dates that do not exist to
be successfully parsed (e.g. February 31st). We now validate that the
day does not exceed the number of days for the given month and year,
taking leap years into account.
2024-01-07 08:01:58 -05:00
Bastiaan van der Plaat 52397d01bd LibWeb: Add textarea placeholder 2024-01-07 10:22:32 +01:00
Andrew Kaster b10fee00eb LibWeb+WebWorker: Convert Workers to use MessagePorts for postMessage
This aligns Workers and Window and MessagePorts to all use the same
mechanism for transferring serialized messages across realms.

It also allows transferring more message ports into a worker.

Re-enable the Worker-echo test, as none of the MessagePort tests have
themselves been flaky, and those are now using the same underlying
implementation.
2023-12-25 12:09:11 +01:00
Bastiaan van der Plaat c30911ab10 LibWeb: Hide select chevron icon when appearance: none; 2023-12-23 10:12:36 +01:00
Bastiaan van der Plaat 0f37e0ee89 LibWeb: Add basic input range rendering 2023-12-21 13:17:51 +01:00
Bastiaan van der Plaat 466153e680 Ladybird+LibWeb: Add basic select element support 2023-12-09 22:06:20 +01:00
Timothy Flynn 05c8d5ba57 Base+Ladybird: Move Ladybird-related HTML files to their own folder
Pages like the new tab page, error page, etc. all belong solely to
Ladybird, but are scattered across a couple of subfolders in Base. This
moves them all to Base/res/ladybird.
2023-12-04 19:46:35 -05:00
Bastiaan van der Plaat 2107ab823d LibWeb: Add basic HTML meter element support 2023-12-04 19:54:43 +00:00
Andrew Kaster 1602663b9e LibWeb+WebWorker: Implement a first cut of post_message for Workers
This implementation completely ignores MessagePorts, and manually plumbs
data through LocalSockets.
2023-11-24 08:41:38 +01:00
Bastiaan van der Plaat 1cdbfc2ff1 LibWeb: Add ol start and li value attributes support 2023-11-09 16:10:54 +01:00
Timothy Flynn a39eebeb74 LibWebView: Reject cookies whose domain is on the Public Suffix List 2023-10-26 11:06:49 +02:00
Bastiaan van der Plaat b640747116 LibWeb: Add canvas context2d roundRect 2023-10-20 07:20:29 +02:00
Bastiaan van der Plaat e267f8e68f LibWeb: Add modifier keys to MouseEvent 2023-09-15 22:12:56 +02:00
Bastiaan van der Plaat 836a7b00dd Ladybird+LibWeb: Add MouseEvent screenX and screenY support 2023-09-15 22:12:56 +02:00
MacDue a93ba23e10 Base: Add some examples of SVG gradients with different spreadMethods
The radial gradients here are rendered correctly as focal radius is
zero, so the focal point is the center of the start circle.
2023-08-20 20:04:10 +02:00
Bastiaan van der Plaat bba14f6014 LibWeb: Add Canvas Context2D basic font property support 2023-08-09 05:48:32 +02:00
Timothy Flynn 27fa029537 Base: Remove FrogFind from the new tab page
Search queries no longer work for this engine, and FireFox even issues a
security warning on their home page.
2023-08-09 05:33:24 +02:00
Bastiaan van der Plaat 220e34b69d LibWeb: Add Canvas Context2D basic text align and text baseline support
Add the CanvasTextDrawingStyles mixin with the textAlign and
textBaseline attributes. Update fill_text in CanvasRenderingContext2D
to move the text rect by the text align and text baseline attributes.
Wrote a simple HTML example to showcase the new features.
2023-08-05 17:17:08 +02:00
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
zhiyuang 94491ead67 LibWeb: Fix border painting with border-radius and zero-width sides
When joined border width is zero width, then the midpoint
of the joined corner is no longer need to be computed
anymore. Just set the mid point to be the endpoint of the
corner.
2023-07-26 08:38:54 +02:00
zhiyuang 97130a4e66 LibWeb: More correctly paint joins between borders
The refactor of the border painting mainly to handle:
1. Single border with minor border radius.
2. Different border widths and border colors joined situations.
This refactor only apply to solid border.

The main differece is to use Path.fill to paint each border,
not fill_rect anymore. There's a special case need to consider.
The Path.fill will leave shared edge blank between two borders.
To handle this, we decide to combine the borders with same color
to paint together.
2023-07-18 14:51:13 +01:00
Alan Kemp 3fd870a429 LibWeb: Create EdgeStyleValue for BackgroundPositionXY with no offset
When specifying either `background-position-x: right` or
`background-position-y: bottom` without an offset value no
EdgeStyleValue was created.

However, the spec says the offset should be optional.

Now, if you do not provide an offset, it creates the EdgeStyleValue
with a default offset of 0 pixels.
2023-07-17 14:53:52 +01:00
Ali Mohammad Pur 0c14698028 LibWeb: Fully implement CSS animation-timing-function
This implements all the timing functions, and hopefully all their
quirks.
Also changes the animation demo to use some funny cubic timing
functions.
2023-07-13 05:10:41 +02:00
Timothy Flynn af5eaf5edf Base: Add a test page to log KeyboardEvent data
This page prepends a row to a table with the last-received
KeyboardEvent.
2023-07-09 06:32:20 +02:00
Kim Kulak cfb6baf973 Base: Add Wiby Search To New Tab Page 2023-07-02 13:20:04 +01: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 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
MacDue e27081a8ca Base: Add an SVG fill-rule example page 2023-06-11 19:34:24 +02:00
MacDue 30c316a2bf LibWeb+LibGfx: Allow stroking with a paint style and opacity 2023-06-11 16:15:56 +02:00
MacDue eb4a58528e LibWeb+LibGfx: Allow filling with a paint style and opacity 2023-06-11 16:15:56 +02:00
Timothy Flynn e7faca4431 Base: Use a relative path to load the new tab page's browser icon
Similar to 59a1a3f463, this is to allow
using this page outside of Serenity.
2023-06-08 07:22:00 +02:00
MacDue d259421b69 LibWeb: Allow paint style fills for CRC2D strokes 2023-06-08 07:17:43 +02:00
Luke Wilde 42a183720b LibWeb/SVG: Support url() in the stroke attribute
This allows you to draw gradients in strokes, for example.
2023-06-07 06:29:46 +02:00
Ben Wiederhake 189af20294 Base: Remove unlicensed copy of BMFW
The creator of this site is most definitely not going to enforce his
copyright, yes, but it's still a bad idea to keep around an unlicensed
copy of someone else's work. We no longer use it to 'test' anything, so
let's just remove it entirely.
2023-06-03 14:29:19 +02:00
Ben Wiederhake 38f107685c Base: Replace GPL bmpsuite by link to original
bmpsuite on GitHub is licensed under the GPLv3:
https://github.com/jsummers/bmpsuite/blob/master/COPYING.txt

However, we did not "conspicuously and appropriately publish on each
copy an appropriate copyright notice", therefore we probably were in
violation with GPLv3 paragraph 4, "Conveying Verbatim Copies".

Let's just remove this entirely, because Ladybird can just access
the original pages instead.

At the time of writing, `bmpsuite.html` and the HTML response from the
linked URL are byte-identical.
2023-06-03 14:29:19 +02:00
Ali Mohammad Pur e90752cc21 LibWeb: Add preliminary support for CSS animations
This partially implements CSS-Animations-1 (though there are references
to CSS-Animations-2).
Current limitations:
- Multi-selector keyframes are not supported.
- Most animation properties are ignored.
- Timing functions are not applied.
- Non-absolute values are not interpolated unless the target is also of
  the same non-absolute type (e.g. 10% -> 25%, but not 10% -> 20px).
- The JavaScript interface is left as an exercise for the next poor soul
  looking at this code.

With those said, this commit implements:
- Interpolation for most common types
- Proper keyframe resolution (including the synthetic from-keyframe
  containing the initial state)
- Properly driven animations, and proper style invalidation

Co-Authored-By: Andreas Kling <kling@serenityos.org>
2023-05-29 05:35:41 +02:00
MacDue ac104f7845 Base: Use fill-opacity and stroke-opacity in SVG example 2023-05-20 08:52:19 +02:00
MacDue 1d91a56242 Base: Use stop-opacity in SVG gradients example 2023-05-20 08:52:19 +02:00
Timothy Flynn 2b269cf425 Base: Add a test page to load a video element with <source> children
This verifies we cycle through the source children until we land on one
with a video we can play.
2023-05-13 15:51:44 +02:00
Andreas Kling 15211cd753 Userland: Show "Ladybird" instead of "Browser" in titles, menus, etc
While the binary is still called "Browser" for now, let's make it clear
that we're converging on a single name for this application.
2023-05-09 06:12:09 +02:00