Commit graph

35075 commits

Author SHA1 Message Date
Sam Atkins c29f4f69ef LibWeb: Rename Document::for_each_css_style_sheet for clarity
This only iterates style sheets that are in use, so make this clear by
renaming it to `for_each_active_css_style_sheet()`.
2024-09-03 10:12:07 +01:00
Olekoop 873e576da2 LibGfx: Use a diffrent way for finding libjxl on Android
When trying to use pkgconfig for finding libjxl, the build fails
trying to link the cross-compiler's libc++.
Using this way libjxl also requires hwy library.

Findlibjxl.cmake was taken from SDL_image and altered to include its license.
2024-09-03 00:17:49 -06:00
Olekoop a7a136f30a LibGfx: Use Android functions when compiling for Android in TypefaceSkia 2024-09-03 00:17:49 -06:00
Olekoop 8fe2c9e43d LibAudio: Override onAudioReady in PlaybackStreamOboe 2024-09-03 00:17:49 -06:00
Olekoop 4e6e23c242 LibAudio: Replace Duration with AK::Duration in PlaybackStreamOboe
AK::Duration isn't exported into global namespace since commit bf600c8
It basically does the same job as commit 6772d44
2024-09-03 00:17:49 -06:00
sideshowbarker 1975640e31 LibWeb: Make “create an event” set the event’s isTrusted to true
This change ensures that when then the code corresponding to the “create
an event” operation at https://dom.spec.whatwg.org/#concept-event-create
is called, the event’s isTrusted is set to true — as the spec requires.

That causes the failures for the following WPT tests to pass:

- https://wpt.fyi/results/html/semantics/forms/the-input-element/checkbox.html?run_id=5080423051034624
- https://wpt.fyi/results/html/semantics/interactive-elements/the-dialog-element/dialog-close.html?run_id=5080423051034624

…and there are likely a number of similar WPT tests that hit this same
code path which this commit will cause to be changed to passes.

Otherwise, without this change, the “create event” implementation
doesn’t conform to the spec requirements – nor behave interoperably with
other existing engines — and those WPT test would continue to fail.

This change also ensures that isTrusted continues to be set to false for
synthetic events.
2024-09-03 00:14:31 -06:00
Tim Ledbetter 5800b7e884 LibWeb: Invalidate the display list when calling set_needs_display()
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-22.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-22.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
Calls to `Document::set_needs_display()` and
`Paintable::set_needs_display()` now invalidate the display list by
default. This behavior can be changed by passing
`InvalidateDisplayList::No` to the function where invalidating the
display list is not necessary.
2024-09-02 20:12:08 +02:00
BenJilks 46649fbe1b LibWeb: Add support for flex-wrap: wrap-reverse
Reverse the order of flex lines, when the `flex-wrap` property is set to
`wrap-reverse`. This will also swap the cross-start and cross-end
directions.
2024-09-02 17:42:11 +02:00
BenJilks e2c1fe7255 LibWeb: Only reverse each line of a reverse flex-direction
When a flex container with a reverse `flex-direction` is wrapped. Only
each line should be reversed, not all items.
2024-09-02 17:42:11 +02:00
Andreas Kling 0f9444fa06 LibJS: Fix mix-up when re-exporting an imported symbol with a new name
This makes https://cling.com/ load, and more of the animated elements
on https://shopify.com/ start appearing.
2024-09-02 17:14:21 +02:00
Aliaksandr Kalenik 427e6cec7b LibWeb: Use border box to position sticky elements
Fixes https://github.com/LadybirdBrowser/ladybird/issues/1245
2024-09-02 15:23:04 +02:00
Andreas Kling 2e06d26ddb LibJS: Remember arrow function parsing failures by offset
We don't need to remember these by (line, column, offset). Just the
offset should be enough.
2024-09-02 15:22:51 +02:00
Andreas Kling d5a0bb9159 LibJS: Remove unused field Token::m_filename 2024-09-02 15:22:51 +02:00
Andreas Kling 93a4d7395f LibJS: Make JS lexer handle 2 and 3 character tokens faster
By checking the lengths and then looking directly at the bytes, the
generated code becomes a lot nicer.

This gives a 1.23x speedup when parsing the JS from x.com
2024-09-02 15:22:51 +02:00
Jamie Mansfield 3440d2b843 LibWeb: Implement AbstractWorker
This effectively implements Worker.onerror, and in future
SharedWorker.onerror.
2024-09-02 13:10:44 +02:00
Aliaksandr Kalenik 20f68106a7 LibWeb: Fix getBoundingClientRect() for elements with "position: sticky"
Use offset from ScrollFrame which is an actual value a box is shifted by
while painting.

Also change `update_paint_and_hit_testing_properties_if_needed()` to
refresh scroll frames state, because `getBoundingClientRect()` now
depends on them.

Fixes wrong file tree sidebar location and excessive layout
invalidations caused by some miscalculation on JS-side when wrong
bounding client rect is provided on Github PR pages like
https://github.com/LadybirdBrowser/ladybird/pull/1232/files
2024-09-02 13:10:22 +02:00
Khaled Lakehal d1bea9c2a4 LibWeb: Add scope attribute to HTMLTableCellElement 2024-09-02 13:09:41 +02:00
Aliaksandr Kalenik 59f2b4fefc LibWeb: Account for fixed position in nearest scrollable ancestor lookup
Scroll offset of body does not affect position of fixed elements, so
nearest scrollable lookup should early return from ancestor scrollable
lookup loop once "position: fixed" box is encountered.

Fixes regression introduced in 866608532a
2024-09-01 12:42:36 +02:00
Timothy Flynn 8fb2cc2be1 LibWeb: Do not assume the shadow root has a host when updating selection
For example, if the shadow root was detached from the document in some
manner, its host will be null.
2024-08-31 15:51:08 +02:00
Timothy Flynn 59fe7ca830 LibWeb: Convert internal test event coordinates to device pixels
This allows for coming up with coordinates that work on macOS with a DPR
of 2 more easily.
2024-08-31 15:51:08 +02:00
Timothy Flynn 96ad310643 LibWeb: Remove range-count filter from selection change handlers
The implementation of setBaseAndExtent will create a new range.
2024-08-31 15:51:08 +02:00
Timothy Flynn fd289deb44 LibWeb: Update the document cursor position when the selection changes
Otherwise, it looks a bit awkward where the cursor position does not
update while the selection is elsewhere.

Note that this requires passing along the raw selection positions from
`set the selection range` to the elements. Otherwise, consider what will
happen if we set the selection start and end to the same value. By going
through the API accessor, we hit the case where the start and end are
the same value, and return the document cursor position. This would mean
the cursor position would not be updated.

The test changes here more closely match what Firefox produces now. It
is not a 100% match; the `select event fired` test case isn't right. The
problem is the event fires for the input element, but we most recently
focused the textarea element. Thus, when we retrieve the selection from
the input element, we return the document's cursor position, which is
actually in the textarea element. The fix will ultimately be to fully
implement the following:

https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-textarea/input-cursor

That is, each input / textarea element should separately track its own
text cursor position.
2024-08-31 15:51:08 +02:00
Timothy Flynn 430c9d3e3f LibWeb: Use a Unicode text segmenter to select words on double-click
We currently use a naive word segmentation, looking for ASCII spaces to
mark a word boundary. Use LibUnicode's complete implementation instead.
2024-08-31 15:51:08 +02:00
BenJilks 11e7d72686 LibWeb: Layout text chunks based on their Unicode direction
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-22.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-22.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
Append text chunks to either the start or end of the text fragment,
depending on the text direction. The direction is determined by what
script its code points are from.
2024-08-31 11:49:47 +02:00
Tim Ledbetter 2f5b070716 LibWeb: Implement setRangeText for input and textarea elements
This method replaces range of text in its respective element with a new
string
2024-08-31 07:47:54 +02:00
Tim Ledbetter 206262cd55 LibWeb: Subclass FormAssociatedElement text selection methods
These are only relevant to HTMLInputElement and HTMLTextArea elements.
2024-08-31 07:47:54 +02:00
Aliaksandr Kalenik 7b2042571b LibWeb: Implement missing step in GFC fr size calculation
Implements:
"If the product of the hypothetical fr size and a flexible track’s flex
factor is less than the track’s base size, restart this algorithm
treating all such tracks as inflexible."

Fixes https://github.com/LadybirdBrowser/ladybird/issues/1211
2024-08-31 07:47:20 +02:00
Aliaksandr Kalenik 30b636e90b LibWeb: Add "position: sticky" support
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-22.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-22.04, Linux, Linux-x86_64) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
Sticky positioning is implemented by modifying the algorithm for
assigning and refreshing scroll frames. Now, elements with
"position: sticky" are assigned their own scroll frame, and their
position is refreshed independently from regular scroll boxes.
Refreshing the scroll offsets for sticky boxes does not require display
list invalidation.

A separate hash map is used for the scroll frames of sticky boxes. This
is necessary because a single paintable box can have two scroll frames
if it 1) has "position: sticky" and 2) contains scrollable overflow.
2024-08-30 19:03:06 +02:00
Aliaksandr Kalenik 866608532a LibWeb: Add parent-child relationship between scroll frames
This allows the calculation of the cumulative scroll offset for a scroll
frame by adding its scroll offset to the parent’s scroll offset, rather
than traversing the containing block chain. While it doesn't greatly
simplify calculations for typical scroll frames, it serves as a
preparation for supporting "position: sticky".
2024-08-30 19:03:06 +02:00
Khaled Lakehal 2565757c7a LibWeb: Set document type to HTML for text and media documents
This update fixes an issue where the document type was incorrectly set
to XML instead of HTML when initializing text and media documents.
2024-08-30 08:28:16 -04:00
Tim Ledbetter a95905f93f LibWeb: Support animations in embedded SVG images 2024-08-30 13:35:07 +02:00
Onorio Catenacci b86f57ebf7 LibWeb: Add minimum thumb size
This change is intended to insure that the thumb control on the dialog
will never be narrower than 50 pixels no matter how long the line it's
displaying.
2024-08-30 13:32:29 +02:00
Timothy Flynn a04327a0c9 LibWebView: Add a command line option to override the User-Agent
This commit just adds a command line option to case-insensitively accept
a User-Agent name to use as the UA override. The UIs will individually
need to make use of this option.
2024-08-29 13:05:47 +01:00
Andreas Kling a6bf253602 LibJS: Use the system native page size as the HeapBlock::block_size
Before this change, we were hard-coding 4 KiB. This meant that systems
with a 16 KiB native page size were wasting 12 KiB per HeapBlock on
nothing, leading to worse locality and more mmap/madvise churn.

We now query the system page size on startup and use that as the
HeapBlock size.

The only downside here is that some of the pointer math for finding the
base of a HeapBlock now has to use a runtime computed value instead of a
compile time constant. But that's a small price to pay for what we get.
2024-08-29 13:56:09 +02:00
Tim Ledbetter df431a0c32 LibWeb: Use the correct base class in for SVGImageElement 2024-08-29 11:46:36 +01:00
Adam Harald Jørgensen 3e92ec80f3 LibWeb: Set correct longhand values when using grid-placement shorthand
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-22.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-22.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
According to https://www.w3.org/TR/css-grid-2/#placement-shorthands
when setting the 'grid-row' and 'grid-column' shorthand property to a
single <custom-ident> value, both 'grid-row-start'/'grid-column-start'
and 'grid-row-end'/'grid-column-end' should be set to that
<custom_ident>.
2024-08-29 07:00:00 +02:00
Andrew Kaster 77718c0a66 LibWeb: Implement the Data state for the Swift tokenizer
And add tests! This implementation closely follows the current C++
implementation, replacing macros and gotos with a slightly more
complex state machine. It's very possible that an async version that
yields tokens on "emit" would be even simpler, but let's get this
one working first :).
2024-08-29 06:31:25 +02:00
Andrew Kaster a3e6856b56 AK+Swift: Remove Foundation.Data footgun for AK.StringView
Also give the Swift.String init routines an explict label when
constructing from AK String types, as this caused issues in a later
commit to have them both with `_ data`.
2024-08-29 06:31:25 +02:00
Tim Ledbetter 03bbc2b111 LibWeb/SVG: Implement SVGImageElement
This element allows images to be embedded within SVGs.
2024-08-29 06:28:44 +02:00
Tim Ledbetter 267420d5aa LibWeb: Remove ImagePaintable::layout_box()
This was not used.
2024-08-29 06:28:44 +02:00
Andreas Kling b64df59cc6 LibWeb: Fix crash when setting innerHTML inside iframe srcdoc document
In particular, there was an assertion failure due to the temporary
parser document's "about base URL" being empty when trying to "parse a
URL" during parsing.

We fix this by copying the context element's document's about base URL
to the temporary parsing document while parsing a fragment.

This fixes a crash when loading search results on https://amazon.com/
2024-08-29 06:24:18 +02:00
Jamie Mansfield f1098b4226 LibWeb: Implement ServiceWorkerContainer.onmessageerror
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-22.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-22.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
2024-08-28 18:36:28 +01:00
Jamie Mansfield 4b1273cbde LibWeb: Implement ServiceWorkerContainer.onmessage 2024-08-28 18:36:28 +01:00
simonkrauter 820676857a LibWeb: Use nearest-neighbor scaling for ScalingMode::SmoothPixels
Adjust the translation from Gfx::ScalingMode to Skia SkFilterMode, so
that CSS::ImageRendering::Pixelated will result in
SkFilterMode::kNearest.

Before:
ScalingMode::SmoothPixels -> kLinear

After:
ScalingMode::SmoothPixels -> kNearest

Fixes #1170
2024-08-28 19:30:40 +02:00
sideshowbarker e76e48421f LibWeb: Add “valid floating-point number” for HTMLInputElement.value
This change adds checking for the following spec requirements:

- https://html.spec.whatwg.org/#number-state-(type=number):value-sanitization-algorithm
- https://html.spec.whatwg.org/#range-state-(type=range):value-sanitization-algorithm

That is, it adds checking that HTMLInputElement.value is what the spec
defines as a “valid floating-point number” when the “type” attribute for
the HTMLInputElement is either “number” or “range”.

This change causes Ladybird to pass all the failing tests at
https://wpt.fyi/results/html/semantics/forms/the-input-element/number.html?run_id=5080423051034624
and to match the relevant behavior in Webkit, Blink, and Gecko.

Otherwise, without this change, Ladybird fails those tests, and the
relevant Ladybird behavior isn’t interoperable with other engines.
2024-08-28 07:49:17 -04:00
Tim Ledbetter b688b5d9d4 LibWeb: Correctly test if WebDriver ExecuteScript timeout is reached
Previously, the conversion assumed that the supplied timeout was in
seconds rather than milliseconds.
2024-08-28 06:57:42 +01:00
Andrew Kaster c5153cb398 Meta+Libraries+AK: Append Cxx to imported library module names in swift
At the same time, simplify CMakeLists magic for libraries that want to
include Swift code in the library. The Lib-less name of the library is
now always the module name for the library with any Swift additions,
extensions, etc. All vfs overlays now live in a common location to make
finding them easier from CMake functions. A new pattern is needed for
the Lib-less modules to re-export their Cxx counterparts.
2024-08-27 17:22:31 -06:00
Andrew Kaster f27d638e0a CMake: Always use a target for linking skia 2024-08-27 17:22:31 -06:00
Timothy Flynn e782947a03 LibJS: Use the IteratorStepValue AO in Iterator prototypes
This is an editorial change in the Iterator Helpers proposal. See:
https://github.com/tc39/proposal-iterator-helpers/commit/b4ccc31
2024-08-27 13:00:37 -04:00
Timothy Flynn 48bef246a0 LibJS: Change generator state enum casing in IteratorHelperPrototype
This is an editorial change in the Iterator Helpers proposal. See:
https://github.com/tc39/proposal-iterator-helpers/commit/f1427ec
2024-08-27 13:00:37 -04:00
Jelle Raaijmakers dee81f3545 LibWeb: Compare start container to parent in Text.splitText()
Some checks failed
CI / Lagom (NO_FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (NO_FUZZ, ubuntu-22.04, Linux, GNU) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-22.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
Validate code with clang plugins / build-and-verify (push) Has been cancelled
Tiny mistake in the implementation of the spec; fixes 16 FAILs in the
WPT `/dom/ranges/Range-mutations-splitText.html` tests.
2024-08-27 07:13:08 -04:00
Jelle Raaijmakers 732e3fa82f LibWeb: Propagate input/textarea selection update to document selection
Calling `.setSelectionRange()` or `.select()` now updates the document
selection as well, visualizing the text selection.
2024-08-27 07:11:50 -04:00
Jelle Raaijmakers badcdcacf5 LibWeb: Update input/textarea selection on document selection change
This causes UI interactions with the document selection to also update
the input and textarea DOM selection state. Note that we switch around
the order of focusing a DOM node and setting the selection, so we allow
the focus event to override whatever selection we came up with.
2024-08-27 07:11:50 -04:00
Jelle Raaijmakers 814ca3267e LibWeb: Implement input/textarea selection APIs
For both types of elements, `.selectionStart`, `.selectionEnd`,
`.selectionDirection`, `.setSelectionRange()`, `.select()` and the
`select` event are now implemented.
2024-08-27 07:11:50 -04:00
Jelle Raaijmakers 69bbeea4ef LibWeb: Remove duplicate code from ViewportPaintable
No functional changes.
2024-08-27 07:11:50 -04:00
Timothy Flynn 660e846e94 Revert "LibWeb: Change where content selection via mouse is allowed"
This reverts commit 6c9adf3dbc.

This change breaks e.g. typing into the search box on google.com and
comment boxes on github.com.
2024-08-26 14:08:59 -04:00
Timothy Flynn fa4b324a12 LibUnicode: Remove unused time zone cache option
Some checks are pending
CI / Lagom (FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (NO_FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (NO_FUZZ, ubuntu-22.04, Linux, GNU) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-22.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
Added this during development while testing some callers, but forgot to
remove it before opening a PR.
2024-08-26 11:37:02 -04:00
Bram Otte 003fc4f8ee LibWeb: Handle multiple result values for WebAssembly functions 2024-08-26 16:50:05 +02:00
Andreas Kling c22acc2551 LibWeb: Implement vertical-align: middle correctly for atomic inlines
This makes inline icons pop into the right place on https://ahrefs.com/
2024-08-26 15:49:07 +02:00
Samuel Fry c42679597a LibWeb: Support parsing columns 2024-08-26 08:26:22 +01:00
Samuel Fry 23b4367c9c LibWeb: Support parsing column-span 2024-08-26 08:26:22 +01:00
Samuel Fry c113d3fae9 LibWeb: Support parsing column-width 2024-08-26 08:26:22 +01:00
Andreas Kling 84ab8bf797 LibWeb: Make CSS :hover selector match shadow-inclusive ancestors
Before this change, :hover wouldn't match anything outside the shadow
boundary when hovering elements inside a shadow tree. This was most
noticeable when hovering the text inside an input element and hover
styles disappearing from the hosting input element itself.
2024-08-25 12:53:08 +02:00
Tim Ledbetter f3405b6eb2 LibWeb: Implement Navigator.serviceWorker
This currently returns a stubbed `ServiceWorkerContainer` object.
2024-08-25 09:48:30 +02:00
Tim Ledbetter 53ab6fa403 LibWeb: Stub the ServiceWorkerContainer interface 2024-08-25 09:48:30 +02:00
Tim Ledbetter 0c0a4a6042 LibWeb: Stub the ServiceWorkerRegistration interface 2024-08-25 09:48:30 +02:00
Tim Ledbetter d3e076f963 LibWeb: Implement cloning steps for HTMLTextAreaElement 2024-08-25 09:48:19 +02:00
Tim Ledbetter 71cfa705d1 LibWeb: Implement cloning steps for HTMLInputElement 2024-08-25 09:48:19 +02:00
Timothy Flynn d8c69a0e9e LibWebView+WebContent: Monitor for system time zone changes
This creates a TimeZoneWatcher in the UI process to inform all open
WebContent processes when the time zone changes. The WebContent process
will clear its time zone cache to retrieve a fresh zone the next time
it is asked for one.
2024-08-25 09:47:42 +02:00
Timothy Flynn 577efcdc32 LibCore: Create a system time zone watcher
This creates platform-dependent monitors to detect when the system time
zone changes. On Linux, we use a file watcher to monitor files such as
/etc/localtime for changes. On macOS, this uses CFNotificationCenter to
be notified by the OS when the time zone changes.

Note: the macOS implementation requires running in a process which is
running the CoreFoundation event loop. Both the AppKit and Qt chromes
are doing so in the UI process, but this means we cannot run this
monitor in the WebContent process.
2024-08-25 09:47:42 +02:00
Timothy Flynn b31c11bca5 LibUnicode: Cache the system time zone
It's expensive to determine the system time zone from disk each time it
is requested. This makes LibUnicode cache the result, and provides an
API to clear that cache. This will let us set up a monitor to watch for
system time zone changes in platform-dependent ways.
2024-08-25 09:47:42 +02:00
Timothy Flynn e25681203e LibCore: Add support for monitoring symbolic links
Symbolic links are currently always followed to their target. This lets
us monitor the link file itself.
2024-08-25 09:47:42 +02:00
Timothy Flynn 9f496a9c65 LibCore: Improve support for the macOS file watcher with actual files
When asked to monitor a file (not a directory), we often need to instead
monitor the parent directory to receive FS events. For example, when a
symbolic link is deleted/created, we don't receive any events unless we
are watching the parent.
2024-08-25 09:47:42 +02:00
Timothy Flynn 574b4be433 LibCore: Remove deleted monitored files before invoking change callbacks
The caller may want to re-add the monitored file. It won't be able to do
so if we internally believe the file is still being monitored.
2024-08-25 09:47:42 +02:00
Timothy Flynn abc462999e LibCore: Remove monitored file data before invoking system calls
The monitored files can be internally removed by inotify. If we then try
to explicitly remove them, the inotify_rm_watch call will fail. We do
this when the file is deleted and we receive an IN_DELETE event. This
ensures we clean up the monitored files.
2024-08-25 09:47:42 +02:00
Timothy Flynn 61419cf717 LibCore: Silently ignore IN_IGNORED events
According to the inotify man page, this event is always generated after
a IN_DELETE, which we separately handle. Just ignore IN_IGNORED events
to avoid spamming stderr.
2024-08-25 09:47:42 +02:00
Andrew Kaster 49733ed09b LibWeb: Add an HTML tokenizer re-implementation in swift
It doesn't do much yet, the fun part was the scaffolding
2024-08-24 19:14:09 -06:00
Andrew Kaster e15dd3c22a LibGfx: Use new AK+Swift extensions to simplify parseHexString 2024-08-24 19:14:09 -06:00
Andreas Kling 349b17cc7a LibWeb: Don't paint text fragments with CSS visibility:hidden
We *could* even skip creating a paintable for hidden nodes, but that
means that dynamic updates to the CSS visibility property would require
mutating the paint tree, so let's keep it simple for now.
2024-08-24 14:53:26 +02:00
Jamie Mansfield 2e9aec984c LibWeb/HTML: Implement DataTransferItem.webkitGetAsEntry() 2024-08-24 14:53:11 +02:00
Jamie Mansfield 169163b002 LibWeb/EntriesAPI: Implement FileSystemEntry 2024-08-24 14:53:11 +02:00
Jamie Mansfield b583aec3ac LibWeb: Add [Clamp] extended attribute to WebSocket.close 2024-08-24 14:52:27 +02:00
Jamie Mansfield f02ca0c431 LibWeb: Expose TextMetrics to Worker 2024-08-24 11:25:19 +01:00
Jamie Mansfield 4133177895 LibWeb: Expose Worker to DedicatedWorker and SharedWorker 2024-08-24 11:25:19 +01:00
mrdcbrush b757ee0bc8 LibWebView: Add Kagi search engine to menu
LibWebView: Add Kagi search engine to selection menu
2024-08-24 11:21:25 +01:00
Andrew Kaster 33e50889f2 LibWeb: Add CustomStringConvertible extension for HTMLToken types 2024-08-23 19:17:20 -06:00
Andrew Kaster fb074f9d0c LibWeb: Add start of HTML Tokenizer in Swift
Currently it's just a Token class.
2024-08-23 19:17:20 -06:00
Jamie Mansfield 67976d041b LibWeb/FileAPI: Add [Clamp] extended attribute to Blob.slice
See:
 - http://wpt.live/FileAPI/blob/Blob-slice-overflow.any.html
2024-08-23 12:08:11 +01:00
Jamie Mansfield 9650a5ff33 LibWeb/FileAPI: Update Blob.slice for spec changes 2024-08-23 12:08:11 +01:00
Timothy Flynn 181ece4d9c LibWeb: Implement DataTransferItem.prototype.getAsString() 2024-08-23 10:10:34 +01:00
Timothy Flynn b978dba8bd LibWeb: Implement DataTransferItem.prototype.getAsFile()
This is used on imgur after drag-and-dropping an image onto its page.
2024-08-23 10:10:34 +01:00
simonkrauter 6c9adf3dbc LibWeb: Change where content selection via mouse is allowed
Previously, only DOM nodes with `is_editable()` allowed selection via
the mouse. This had the unwanted consequence, that read-only
input/textarea elements did not allow selection.

Now, `EventHandler::handle_mousedown()` asks the node's non-shadow
parent element over the new virtual method `is_child_node_selectable()`,
if selection of the node is allowed.
This method is overridden for `HTMLButtonElement` and
`HTMLInputElement`, to disallow selection of buttons and placeholders.

Fixes #579
2024-08-23 09:31:05 +01:00
simonkrauter a2e4259099 LibWeb: Introduce variable dom_node in EventHandler::handle_mousedown
to make the code more readable
2024-08-23 09:31:05 +01:00
Jamie Mansfield dda7325358 LibWeb/XHR: Expose FormData to Worker
See:
 - http://wpt.live/fetch/api/response/response-init-contenttype.any.worker.html
2024-08-22 19:52:06 -06:00
Andreas Kling 8eacfc8f10 LibWeb: Derive SVG root's natural size from width/height attributes
We were incorrectly looking at the CSS computed values for width and
height to determine the natural size of <svg> root elements.
This meant that elements where the attribute and computed value were
different values would end up with incorrect natural size.
2024-08-22 15:29:29 +02:00
Timothy Flynn b16b9709b9 LibWeb: Include the Content-Type boundary directive in form submissions
The spec requires that "multipart/form-data" Content-Type headers also
include a boundary directive. This allows the content server to validate
the submitted form data.

Google Lens, for example, rejects forms missing this directive.
2024-08-22 14:21:13 +02:00
Timothy Flynn 1cdccf901b LibWeb: Transform errant return to a break in form submission
There are more steps to be run after extracting the form body and type.
2024-08-22 14:21:13 +02:00
Timothy Flynn 001d8384e5 LibWeb: Implement the DataTransferItem kind and type attributes 2024-08-22 14:21:13 +02:00
Timothy Flynn ceb9e30d42 LibWeb: Implement the DataTransferItemList indexed getter 2024-08-22 14:21:13 +02:00
Timothy Flynn 843f8f04a5 LibWeb: Implement the DataTransferItemList length attribute 2024-08-22 14:21:13 +02:00