Commit Graph

34128 Commits

Author SHA1 Message Date
Aliaksandr Kalenik
4cdc5d2ce9 LibWeb: Add text shadows support in Skia painter 2024-06-28 20:53:39 +02:00
Aliaksandr Kalenik
b27cf1be49 LibWeb: Remove fragment_baseline from PaintTextShadow
Translate text_rect instead, so the struct doesn't have to carry
additional member.
2024-06-28 20:53:39 +02:00
Aliaksandr Kalenik
ebc282207b LibWeb: Save unscaled glyph run in PaintTextShadow command
Implements the same optimization we already have for DrawGlyphRun by
saving unscaled glyph run and scale factor in a painting command, which
allows to avoid copying of glyphs vector to apply scaling during
recording.
2024-06-28 20:53:39 +02:00
Timothy Flynn
6369737676 LibWeb: Ensure SkiaSurface is fully defined before it is allocated
LLVM 18 on macOS correctly errs when we try to allocate an incomplete
SkiaSurface object.
2024-06-28 12:59:10 -04:00
Andreas Kling
cf0912c700 LibIPC: Remove unused AK::Formatter for IPC::Connection 2024-06-28 17:11:24 +02:00
Andreas Kling
4fe21e6d87 LibIPC: Move stuff from Connection.h to .cpp and reduce #include count 2024-06-28 17:11:24 +02:00
Andreas Kling
6d9c4d852d LibIPC: Move more of Connection::try_parse_messages() to ConnectionBase
By moving this up to ConnectionBase, we have less custom code for each
templated subclass, and it gets a little easier to edit the code since
you don't have to rebuild as much when making changes.
2024-06-28 17:11:24 +02:00
Andreas Kling
f4d40c292b LibIPC: Remove no-longer-used DeferredInvoker abstraction 2024-06-28 17:11:24 +02:00
Andreas Kling
4db05ecf69 LibWeb: Set the correct prototype for SVGAElement instances 2024-06-28 17:10:52 +02:00
Aliaksandr Kalenik
79acb998e1 LibCore+LibWeb: Use Metal backend for Skia painter on macOS
If Metal context and IOSurface are available, Skia painter will use
Ganesh GPU backend on macOS, which is noticeably faster than the default
CPU backend.

Painting pipeline:
1. (WebContent) Allocate IOSurface for backing store
2. (WebContent) Allocate MTLTexture that wraps IOSurface
3. (WebContent) Paint into MTLTexture using Skia
4. (Browser) Wrap IOSurface into Gfx::Painter and use
   QPainter/CoreGraphics to blit backing store into viewport.

Things we should improve in the future:
1. Upload textures for images in advance instead of doing that before
   every repaint.
2. Teach AppKit client to read directly from IOSurface instead of
   copying.
2024-06-28 14:25:34 +02:00
Aliaksandr Kalenik
c62cc915df Everywhere: Pass backing store into Navigable::paint()
...instead of Gfx::Bitmap, which makes it possible to access and
directly paint into IOSurface on macOS.
2024-06-28 14:25:34 +02:00
Ali Mohammad Pur
3214f2c5bf LibCore: Handle destroyed owner when unregistering timers and notifiers
Cherry-picked from 9f4f319277
2024-06-27 14:32:48 -06:00
Tim Ledbetter
c4d5ae28ea LibWeb: Implement a minimal version of Window.find()
This is a non-standard API that other browsers implement, which
highlights matching text in the current window.

This is just a thin wrapper around our find in page functionality, the
main motivation for adding this API is that it allows us to write tests
for our find in page implementation.
2024-06-27 10:09:39 +02:00
Tim Ledbetter
cda31615da LibWeb: Add WrapAround option to find in page
This allows `Page::find_in_page()` to optionally not return a result if
the start or end of the document has been reached.
2024-06-27 10:09:39 +02:00
Tim Ledbetter
fee7b4147c LibWeb: Ensure layout is up to date before performing find in page query 2024-06-27 10:09:39 +02:00
Andrew Kaster
4b5541e1b7 Everywhere: Transition ImageDecoder to be single-instance, owned by UI
This is the same behavior as RequestServer, with the added benefit that
we know how to gracefully reconnect ImageDecoder to all WebContent
processes on restart.
2024-06-26 16:09:33 -06:00
Andrew Kaster
343a3a0d7e Ladybird+LibIPC: Move clearing FD_CLOEXEC helper logic to IPC::File 2024-06-26 16:09:33 -06:00
Andrew Kaster
54f66c574c LibWebView: Allow querying and iterating all extant WebContentClients
This is mostly useful when some application-level logic needs to
iterate over all child processes. A more robust Process abstraction
would make this easier.
2024-06-26 16:09:33 -06:00
Andrew Kaster
7c607a4749 WebContent: Remove stale on_webcontent_connection hook 2024-06-26 16:09:33 -06:00
circl
1f3285eb04 LibWeb: Restrict fetching file: and resource: URLs to internal pages
They are now blocked on pages which:
- Don't have an opaque origin (should be only user-initiated or about:)
- Aren't other file: pages
- Aren't other resource: pages
2024-06-26 12:15:33 -06:00
circl
d14888f31a LibWeb: Consider resource: URLs to be trustworthy and non-opaque
This makes icons once again load in the directory listings
2024-06-26 12:15:33 -06:00
Daniel La Rocque
cb629e18bb LibJS: Improve deep equals algorithm in tests
The `deepEquals` algorithm used for testing was naive, and incorrectly
evaluated equality of objects in some cases. The new algorithm considers
that the second object could have more keys than the first, and compares
the prototypes of the objects.
2024-06-26 12:13:08 -06:00
Tim Ledbetter
e9e195418e LibWeb: Fire a change event on mouseup of number input buttons
This matches the behavior of other browsers.
2024-06-26 10:15:07 +02:00
Tim Ledbetter
b4b947c607 LibWeb: Update number input on mousedown of number input buttons
This matches the behavior of other browsers. Previously, a click event
was used, so the value was only updated when the mouse was released.
2024-06-26 10:15:07 +02:00
Tim Ledbetter
2a980816e7 LibWeb: Fire input event on user interaction with input element buttons
An input event is now fired when the step up or step down button of an
input element of type number is clicked.

This ensures that any associated <output> element is updated when these
buttons are clicked.
2024-06-26 10:15:07 +02:00
Tim Ledbetter
a3d12e569c LibWeb: Deduplicate the firing of input events in HTMLInputElement
Input elements without a defined user-interaction behavior need to fire
an input event when the user changes the element's value in some way.
This change moves the code to do this into its own function and adds
some spec text to explain what is being done.
2024-06-26 10:15:07 +02:00
Timothy Flynn
bd73dd316d LibTimeZone: Remove LibTimeZone and TZDB data
All users have been ported to the ICU implementation.
2024-06-26 10:14:02 +02:00
Timothy Flynn
672a555f98 LibCore+LibJS+LibUnicode: Port retrieving time zone offsets to ICU
The changes to tests are due to LibTimeZone incorrectly interpreting
time stamps in the TZDB. The TZDB will list zone transitions in either
UTC or the zone's local time (which is then subject to DST offsets).
LibTimeZone did not handle the latter at all.

For example:

The following rule is in effect until November 18, 6PM UTC.

    America/Chicago -5:50:36 - LMT 1883 Nov 18 18:00u

The following rule is in effect until March 1, 2AM in Chicago time. But
at that time, a DST transition occurs, so the local time is actually
3AM.

    America/Chicago -6:00 Chicago C%sT 1936 Mar 1 2:00
2024-06-26 10:14:02 +02:00
Timothy Flynn
1b2d47e6bb LibJS+LibUnicode: Port retrieving available regional time zones to ICU 2024-06-26 10:14:02 +02:00
Timothy Flynn
4fc0fba646 LibCore+LibJS+LibUnicode: Port retrieving available time zones to ICU
This required updating some LibJS spec steps to their latest versions,
as the data expected by the old steps does not quite match the APIs that
are available with the ICU. The new spec steps are much more aligned.
2024-06-26 10:14:02 +02:00
Timothy Flynn
d3e809bcd4 LibJS+LibUnicode: Port retrieving the system time zone to ICU 2024-06-26 10:14:02 +02:00
Timothy Flynn
89aa9a3af0 LibJS: Update Intl AO spec numbers
Otherwise, upcoming AO implementations will conflict with these.
2024-06-26 10:14:02 +02:00
Timothy Flynn
c379b35798 LibUnicode: Move helper to convert StringEnumeration to a list to ICU.h
This will be needed outside of UnicodeKeywords.cpp.
2024-06-26 10:14:02 +02:00
Luke Warlow
a65f1ecc37 LibWeb: Implement stub for ElementInternals
This implements a stub ElementInternals object which implements the
shadowRoot getter only.

Also implement attachInternals function.
2024-06-26 06:30:40 +02:00
Luke Warlow
ce8d3d17c4 LibWeb: Implement unsafe HTML parsing methods
Both Element's and ShadowRoot's setHTMLUnsafe, and Document's static
parseHTMLUnsafe methods are implemented.
2024-06-26 06:13:29 +02:00
Ali Mohammad Pur
920f470735 LibCore: Fix some thread-related memory/object leaks 2024-06-26 05:47:16 +02:00
Luke Warlow
9171c35183 LibWeb: Refactor DOM parsing APIs
Multiple APIs have moved from the DOM Parsing and Serialization spec to
HTML.

Updates spec URLs and comments.

Delete InnerHTML file:
- Make parse_fragment a member of Element, matching serialize_fragment
on Node.
- Move inner_html_setter inline into Element and ShadowRoot as per the
spec.

Add FIXME to Range.idl for Trusted Types createContextualFragment
2024-06-26 05:41:00 +02:00
Andrew Kaster
a587eafbf4 CMake: Consistently use imported targets for third party dependencies 2024-06-25 17:15:42 -04:00
Tim Ledbetter
0879489084 LibMedia: Hide Matroska debug message behind a flag 2024-06-25 19:25:34 +02:00
Andreas Kling
fb9f3f10f3 LibWeb: Add Element.getHTML() and ShadowRoot.getHTML() 2024-06-25 19:22:35 +02:00
Andreas Kling
0c47b3ff97 LibWeb: Update innerHTML & co IDL definition to match spec
This stuff has moved from a mixin defined by the DOM Parsing spec, over
to the HTML spec, where they are now defined as partial interfaces for
Element and ShadowRoot.

There's also some new functionality that we don't implement yet, so
patch marks them as FIXME properties.
2024-06-25 19:22:35 +02:00
Andreas Kling
f4bdf56212 LibWeb: Rename Element::shadow_root_internal() to shadow_root()
And let the old shadow_root(), which was only supposed to be used by
bindings, be called shadow_root_for_bindings() instead.

This makes it much easier to read DOM code, and we don't have to worry
about when to use shadow_root_internal() or why.
2024-06-25 19:22:35 +02:00
Andreas Kling
c7d9c1c0b2 LibWeb: Update DOM cloning algorithm for declarative shadow DOM 2024-06-25 19:22:35 +02:00
Andreas Kling
a0e1112209 LibWeb: Add HTMLTemplateElement IDL attrs for declarative shadow DOM 2024-06-25 19:22:35 +02:00
Andreas Kling
8e68215d33 LibWeb: Add ShadowRoot.clonable and ShadowRoot.serializable 2024-06-25 19:22:35 +02:00
Andreas Kling
e62db9c118 LibWeb: Update HTML fragment serialization for declarative shadow DOM 2024-06-25 19:22:35 +02:00
Andreas Kling
9eb4b91168 LibWeb: Parse declarative shadow DOM template elements
We now honor the shadowrootmode attribute on template elements while
parsing, and instantiate a shadow tree as required by the spec.
2024-06-25 19:22:35 +02:00
Andreas Kling
043ad0eb76 LibWeb: Refactor Element.attachShadow() after spec changes
The bulk of this function is moved to a new "attach a shadow root"
helper, designed to be used both from here and the HTML parser.
2024-06-25 19:22:35 +02:00
Andreas Kling
f3070118b1 LibWeb: Add "allow declarative shadow roots" flag to Document 2024-06-25 19:22:35 +02:00
simonkrauter
e9001da8d6 LibWeb: Initial support for dashed lines in Canvas
Implement setLineDash() and getLineDash() in CanvasPathDrawingStyles,
which write/read from the CanvasState object.
This doesn't implement the actual drawing of a dashed line, but at least
sites using the Chart.js library no longer fail with an exception.
Unfortunately the Painter classes don't support dashed/dotted lines
based on segments yet.
2024-06-25 09:47:17 +02:00