Commit Graph

9511 Commits

Author SHA1 Message Date
Jamie Mansfield
30db7fb323 LibWeb: Implement IDBOpenDBRequest.onblocked 2024-06-22 14:57:47 +02:00
Jamie Mansfield
1114bbf2f1 LibWeb: Implement HTMLStyleElement.disabled 2024-06-22 14:57:47 +02:00
Jamie Mansfield
be08abbf8a LibWeb: Remove is_media_feature_name function
This was made redundant in GH-12971 (SerenityOS), and removing it drops
a FIXME :^)

See:
- https://github.com/SerenityOS/serenity/pull/12971
2024-06-22 14:57:47 +02:00
Tim Ledbetter
31d7fa2442 LibWeb: Fire auxclick event on middle click
Previously, no event was fired on middle click. This change also allows
the UI to open a link in a new tab on middle click.
2024-06-22 14:57:36 +02:00
Tim Ledbetter
728fca1b1f LibWeb: Add Internals.middleClick
This simulates click of the middle mouse button, which is necessary for
testing whether the `auxevent` fires correctly.
2024-06-22 14:57:36 +02:00
Timothy Flynn
aa3a30870b LibUnicode: Replace code point bidirectional classes with ICU 2024-06-22 14:56:39 +02:00
Timothy Flynn
986ff984cc LibUnicode: Replace code point general categories with ICU 2024-06-22 14:56:39 +02:00
Luke Warlow
a0561ea9b2 LibWeb: Implement type attribute validation for image loading
This change fixes image loading where unsupported image types are
included in the list of source elements.
2024-06-21 17:29:25 +01:00
Andreas Kling
d3a8f9ba9a LibGfx: Remove unused GrayscaleBitmap class 2024-06-21 10:31:13 +02:00
Andreas Kling
345ae18929 LibGfx: Remove Gfx::Painter::draw_text() and helpers 2024-06-21 10:31:13 +02:00
Andreas Kling
23f6280817 LibWeb: Remove the now-unused DrawText display list command 2024-06-21 10:31:13 +02:00
Andreas Kling
63f8feb9a4 LibWeb: Implement RecordingPainter::draw_text() via draw_text_run()
To get away from the ancient (and buggy) text layout code in
Gfx::Painter, we want to remove all the uses of Painter::draw_text().

As a first step towards this, we implement the draw_text() display list
command in terms of the draw_text_run() command by performing the very
simple necessary layout in draw_text() beforehand.
2024-06-21 10:31:13 +02:00
Timothy Flynn
12f177e9e9 LibWeb: Port text segmentation to the ICU text segmenter 2024-06-20 13:46:54 +02:00
Tim Ledbetter
a3a7a65b1c LibWeb: Don't search non-visible text for find in page results
Elements which are `display: none` or `visibility: hidden` are no
longer included in find in page results.
2024-06-20 10:59:32 +02:00
Tim Ledbetter
23166b85d2 LibWeb: Don't match text across block elements for find in page queries
Find in page will no longer match text that spans across block elements.
Previously, given the markup `WH<div>F</div>`, the query `WHF` would
find a match. We would now match `WH` and `F` separately, but not `WHF`.
2024-06-20 10:59:32 +02:00
Tim Ledbetter
6f5ccaecbd LibWeb: Update current find in page match after performing query
Previously, the `Page::find_in_page_next_match()` needed to be called
twice before the match index would be updated.
2024-06-20 10:59:32 +02:00
Aliaksandr Kalenik
8a509a8023 LibWeb: Take into account specified winding rule in Skia painter 2024-06-19 16:51:52 +02:00
Aliaksandr Kalenik
0b48c1ea3f Everywhere: Remove AffineCommandExecutorCPU
No need to have it after introduction of Skia painter that supports
transforms.
2024-06-19 17:22:30 +03:00
Aliaksandr Kalenik
de6d99e940 LibWeb: Respect selected painter in SVGDecodedImageData
Now SVGDecodedImageData uses Skia painter, if it's selected.
2024-06-19 16:26:37 +03:00
Aliaksandr Kalenik
6dd124fc87 LibWeb+WebContent+WebWorker: Allow to query painter type from PageClient
Now it's possible to query selected type from SVGPageClient.
2024-06-19 16:26:37 +03:00
Ali Mohammad Pur
8c9d3b30cf LibWeb/CSS: Avoid capturing structured binding in generic lambda
Apple Clang doesn't like this, rather than waiting for their version of
random-clang-commit-to-call-a-release to catch up with llvm trunk, just
work around the issue.

Fixes #186.
2024-06-19 12:46:27 +02:00
Andreas Kling
847243b706 LibWeb: Only inject "User-Agent"/"Accept" headers when they're missing
...otherwise we send out HTTP requests with duplicates of these headers.
2024-06-19 08:09:10 +02:00
Aliaksandr Kalenik
bd16648b71 LibWeb: Support bitmap scaling mode in Skia painter
Co-authored-by: Andreas Kling <kling@serenityos.org>
2024-06-19 07:52:14 +02:00
Aliaksandr Kalenik
ef1f54b6b0 LibWeb: Accept value by reference in Skia type conversion helpers 2024-06-19 07:52:14 +02:00
Aliaksandr Kalenik
8f721e5b1a LibWeb: Drop gfx_{type} prefix from helpers that convert LibGfx to Skia
Having it was unnecessary verbosity.
2024-06-19 07:52:14 +02:00
Aliaksandr Kalenik
e9658356c4 LibWeb: Skip missing glyphs in Skia painter
Port fbc42e7d42
2024-06-19 07:52:14 +02:00
Zaggy1024
7c10e1a08d LibMedia: Rename LibVideo to LibMedia
This change is in preparation for implementing audio codecs into the
library and using audio as timing for video playback.
2024-06-19 07:51:55 +02:00
Aliaksandr Kalenik
d292152e2e LibWeb: Add Skia painting command executor
This change introduces Skia painter available under a flag. It's not
yet match capabilities of Gfx::Painter and is not ready to replace it.

Motivation:
- The current CPU painter is a performance bottleneck on most websites.
  Our own GPU painter implementation is very immature and has received
  relatively little attention.
- There is ongoing effort on building painter that supports affine
  transforms (AffineCommandExecutorCPU) but it is far from being on par
  with the default CPU painter. Skia will allow us to immediately get
  full transformation support for all painting commands.

GPU painting:
I experimented with Ganesh GPU-backend, however profiling revealed that
without sharing viewport texture between WebContent and Browser
processes, it won't bring much performance improvement compared to
CPU-backend. Therefore, I decided to keep this PR focused on
implementing most of painting commands and switch to GPU-backend in
future changes.

Text rendring:
Skia painter uses glyph bitmaps produced by LibGfx. Using Skia for text
rendering will require large refactoring of the font rendering
subsystem. Currently, it's impossible to construct SkFont right before
rendering because Gfx::VectorFont can't be serialized back into sequence
of bytes.

There is a problem with ugly include paths like:
`#include <core/SkBitmap.h>`.
I would prefer to have skia prefix in the path. There was an attempt to
fix that but PR was rejected https://github.com/microsoft/vcpkg/pull/32660

Regressions compared to Gfx::Painter:
- DrawText is not implemented
- PaintTextShadow is not implemented
- PaintRadialGradient and PaintLinearGradient do not support "transition
  hints" and repeat length
- PaintConicGradient is not implemented
- DrawTriangleWave is not implemented
- DrawLine does not account for line style property
- DrawScaledBitmap and DrawScaledImmutableBitmap do not account for
  scaling mode property
2024-06-18 21:05:50 +02:00
Aliaksandr Kalenik
25c4355406 Ladybird+LibWeb+WebContent: Add an option to enable Skia painter 2024-06-18 21:05:50 +02:00
Aliaksandr Kalenik
8a7cd8055f LibWeb: Add save and restore commands in recording painter
This change is a preparation before introducing Skia painter in an
upcoming change. It's needed because Skia does not have an API to
implement ClearClipRect command. It only allows to return previous
clip rect by popping from its internal state stack.

A bit more context: initially we had save and restore commands, but
their frequent use led to many reallocations of vector during painting
commands recording. To resolve this, we switched to SegmentedVector to
store commands list, which allows fast appends. Now, having many save
and restore commands no longer causes noticeable performance issue.
2024-06-18 21:05:50 +02:00
Luke Warlow
099b77d60f LibWeb: Add motion preference
This adds a motion preference to the browser UI similar to the existing
ones for color scheme and contrast.
Both AppKit UI and Qt UI has this new preference.
The auto value is currently the same as NoPreference, follow-ups can
address wiring that up to the actual preference for the OS.
2024-06-18 10:31:54 -04:00
Luke Warlow
564e546ff0 LibWeb: Prevent select.click() opening the dropdown
No other browser allows opening the select element dropdown with the
select.click() function.
This change stops this happening in Ladybird.
2024-06-18 09:37:07 +02:00
Andreas Kling
4b4254c3d0 LibGfx: Remove QOI image format support
This format is not supported by other browsers.
2024-06-17 21:57:35 +02:00
Luke Warlow
5098ed6b1f LibWeb: Add HTMLSelectElement showPicker()
Adds the showPicker() function for select elements.
This doesn't do the check for "being rendered" which is in the spec.
2024-06-17 07:01:26 -06:00
Timothy Flynn
06ed0dfcc1 LibWeb: Run clang-format
We mistakenly did not add the clang-format linter to the new repo's CI,
and some unformatted code made its way into the repo.
2024-06-16 15:30:28 -04:00
Daniel Bertalan
bf1f631f25 Everywhere: Write dtors for types with incomplete members out-of-line
These are rejected by Clang (19) trunk as a result of
https://github.com/llvm/llvm-project/pull/77753.
2024-06-16 07:19:56 -04:00
Daniel Bertalan
397774d422 Everywhere: Remove usages of template keyword with no parameter list
These were made invalid with P1787, and Clang (19) trunk started warning
on them with https://github.com/llvm/llvm-project/pull/80801.
2024-06-16 07:19:56 -04:00
Tim Ledbetter
9b5d1382bf LibWeb: Rerun find in page query when navigating between URLs
Previously, the "Find Next Match" and "Find Previous Match" actions
simply updated the match index of the last query to be performed. This
led to incorrect results if the page had been modified after the last
query had been run.

`Page::find_in_page_next_match()` and
`Page::find_in_page_previous_match()` both now rerun the last query to
ensure the results are up to date before updating the match index.

The match index is also reset if the URL of the active document has
changed since the last query. The current match index is maintained if
only the URL fragment changes.
2024-06-16 09:46:43 +02:00
Tim Ledbetter
077cb7687d LibWeb: Limit find in page query to documents in the active window
Previously, refreshing the current page and doing a new find in page
query would result in duplicate matches being returned.
2024-06-16 09:46:43 +02:00
Matthew Olsson
7950992fc2 LibWeb: Remove TimingFunction in favor of EasingStyleValue::Function
Now that EasingStyleValue is a lot nicer to use, there isn't much reason
to keep TimingFunction around.
2024-06-16 07:12:46 +02:00
Matthew Olsson
ac35f76e67 Meta: Remove GenerateCSSEasingFunctions 2024-06-16 07:12:46 +02:00
Matthew Olsson
667e313731 LibWeb: Parse easing values manually
The values aren't that complex, so it doesn't make much sense to have a
dedicated generator for them. Parsing them manually also allows us to
have much more control over the produced values, so as a result of this
change, EasingStyleValue becomes much more ergonomic.
2024-06-16 07:12:46 +02:00
Andreas Kling
f7a83e5755 LibWeb: Improve FIXME message about getComputedStyle() properties
Let's log which property we're trying to look up, since that's the most
interesting part!
2024-06-14 20:45:37 +02:00
Andreas Kling
4c94202e97 LibWeb: Remove unnecessary FIXME marker for CSSStyleDeclaration.cssFloat 2024-06-14 20:45:37 +02:00
Andreas Kling
19fa630fa7 LibWeb: Make CSSKeyframeRule.parentRule actually point to parent rule 2024-06-14 20:45:37 +02:00
Andreas Kling
7f2c833a39 LibWeb: Implement CSSKeyframesRule.cssRuleList
To make this straightforward, CSSKeyframesRule now uses a CSSRuleList
for internal storage.
2024-06-14 20:45:37 +02:00
Andreas Kling
a12d28fd30 LibWeb: Implement CSSStyleDeclaration.parentRule
This readonly attribute returns the containing CSS rule, or null (in the
case of element inline style).
2024-06-14 20:45:37 +02:00
Tim Ledbetter
ec4d29849d LibWeb: Support finding text split across multiple text nodes
Previously, the find in page function would fail to find text which was
split across multiple text nodes. For example, given the following
markup: `WH<span>F` the query `WHF` would previously fail to be
matched.

This is done by traversing all of the document's text nodes -
constructing a complete string to query against and keeping track of
the locations where that string is split across multiple nodes.
2024-06-14 16:55:39 +02:00
circl
d2f9ba7db1 Revert "LibWeb: Use memcpy() in CanvasRenderingContext2D.getImageData()"
This reverts commit 59cb7994c6.

This change caused a bug where getImageData returned the image in
BGRA8888 format instead of RGBA8888.
2024-06-14 16:54:32 +02:00
Aliaksandr Kalenik
9502926b76 LibWeb: Remove painting command for drawing signed distance field
No longer used since we switched to vector paths for checkbox rendering.
2024-06-14 08:00:17 +02:00