Commit graph

63039 commits

Author SHA1 Message Date
Ali Mohammad Pur
1fa528b19f LibWeb: Keep Wasm-imported functions alive
The user is not required to keep the object alive, this commit makes it
so the lifetime of these functions is extended to match the Wasm module
it is imported into.
Fixes the crash in #907.
2024-08-01 11:41:19 +02:00
Timothy Flynn
1eced20521 LibJS: Change Intl.Locale.prototype.firstDayOfWeek to be a string
This is a normative change in the Intl Locale Info proposal. See:

https://github.com/tc39/proposal-intl-locale-info/commit/5cb45fd
https://github.com/tc39/proposal-intl-locale-info/commit/6d80e69
https://github.com/tc39/proposal-intl-locale-info/commit/04039b8
2024-08-01 11:40:37 +02:00
Tim Ledbetter
34e465a67e LibWeb: Account for header size when reading MessagePort message payload
Previously, the fact that this wasn't accounted for could lead to a
crash when large messages were received.
2024-08-01 11:39:43 +02:00
sideshowbarker
f735c464d3 LibWeb/Fetch: Don’t cache redirects
This change disables caching for 301, 302, 303, 307, and 308 responses.
This is just for now, ad-hoc — not adhering to any particular spec.
Fixes https://github.com/LadybirdBrowser/ladybird/issues/863
2024-08-01 11:39:27 +02:00
Timothy Flynn
5f8d852dae LibWebView+UI: Migrate Ladybird's command line flags to LibWebView
Currently, if we want to add a new e.g. WebContent command line option,
we have to add it to all of Qt, AppKit, and headless-browser. (Or worse,
we only add it to one of these, and we have feature disparity).

To prevent this, this moves command line flags to WebView::Application.
The flags are assigned to ChromeOptions and WebContentOptions structs.
Each chrome can still add its platform-specific options; for example,
the Qt chrome has a flag to enable Qt networking.

There should be no behavior change here, other than that AppKit will now
support command line flags that were previously only supported by Qt.
2024-08-01 11:38:42 +02:00
Timothy Flynn
0e640f6f70 WebContent: Limit the Console client to the top-level navigable client
We don't want to set the intrinsic Console object's client to non-top-
level clients, created for e.g. subframes. We also want to make sure the
Console client is updated if the top-level document has changed.
2024-08-01 11:35:49 +02:00
Timothy Flynn
0a819e628e LibWeb+WebContent: Store console clients on the DOM document
We explicitly stopped visting the map of documents to console clients in
commit 44659f2f2a to avoid keeping the
document alive. However, if nothing else visits the console clients, we
may set the top-level console client to a client that has been garbage
collected.

So instead of storing this map, just store the console client on the
document itself. This will allow the document to visit its client.
2024-08-01 11:35:49 +02:00
Timothy Flynn
a1c57ed79a WebContent: Do not create JS consoles for fragment-parsing documents
There's no need to go through this setup.
2024-08-01 11:35:49 +02:00
Timothy Flynn
c838ca78c8 LibWeb: Indicate documents are for fragment parsing during construction
This will allow testing if they are for fragment parsing during methods
invoked from Document::initialize.
2024-08-01 11:35:49 +02:00
Aliaksandr Kalenik
2cc2646f55 LibWeb: Apply scroll offset and clip rectangle to table borders
Moves paint_table_borders() call into PaintableBox::paint() to make
scroll offset and clip rectangle of enclosing scrollable be applied
in ::before_paint().
2024-07-31 21:43:17 +02:00
Timothy Flynn
cf25a06d67 LibWebView: Make open file limit modifications non-fatal
If setrlimit fails, let's just report the error rather than failing to
start the browser at all.
2024-07-31 10:12:37 -06:00
Timothy Flynn
9e7e22dc74 LibCore: Use Error::from_syscall to report get/setrlimit errors 2024-07-31 10:12:37 -06:00
Sam Atkins
3abd3ef5e2 LibWeb: Compute pseudo-element style when computing element style
Previously, pseudo-elements had their style computed while the layout
tree was being built. Instead, do so inside Element::recompute_style(),
using the same invalidation mechanism that the element itself uses.

This also has the effect of invalidating the layout much less often.
2024-07-31 12:15:39 +02:00
Sam Atkins
d58c1c1176 LibWeb/CSS: Make content property change require full invalidation
`content` determines the element or pseudo-element's layout, including
its children.
2024-07-31 12:15:39 +02:00
Timothy Flynn
4a166a45ec LibWeb: Avoid allocating UTF-16 strings only the UTF-16 length is needed 2024-07-31 05:55:34 -04:00
Timothy Flynn
7a17c654d2 AK: Add a method to compute UTF-16 length from a UTF-8 string 2024-07-31 05:55:34 -04:00
Andrew Kaster
743c71faa7 Meta: Let Wasm test pass without INCLUDE_WASM_SPEC_TESTS 2024-07-30 18:38:02 -06:00
Andrew Kaster
2fa6c445cb CMake: Work around two upstream CMake issues for Swift files
https://gitlab.kitware.com/cmake/cmake/-/issues/26174
https://gitlab.kitware.com/cmake/cmake/-/issues/26175
2024-07-30 18:38:02 -06:00
Andrew Kaster
d1969851ce LibGfx: Add an implementation of #rrggbb color parsing in Swift 2024-07-30 18:38:02 -06:00
Andrew Kaster
66c939599c AK: Add a clang modules module map 2024-07-30 18:38:02 -06:00
Andrew Kaster
7afe183172 CMake: Add proper sanitizer options for Swift files
Apparently UBSAN + Swift doesn't work on Linux :<
2024-07-30 18:38:02 -06:00
Andrew Kaster
07d387af96 Meta: Create a common Swift settings flow 2024-07-30 18:38:02 -06:00
Andrew Kaster
7f8103da7a CMake: Move GenerateSwiftHeader.cmake to Meta/CMake 2024-07-30 18:38:02 -06:00
Andrew Kaster
45301e8169 Everywhere: Remove AK_DONT_REPLACE_STD macro
Let's just always include `<utility>`. Placing our own incompatible with
the STL declaration of these functions in AK was always fishy to begin
with.
2024-07-30 18:38:02 -06:00
Andrew Kaster
cb7402bc69 Ladybird: Reformat AppKit UI Swift files 2024-07-30 18:38:02 -06:00
Andrew Kaster
1bf4a225bd Meta: Add swift-format configuration 2024-07-30 18:38:02 -06:00
Andrew Kaster
cf42bf2bca LibGfx: Factor out #rrggbb Color parsing into its own helper function 2024-07-30 18:38:02 -06:00
Diego Frias
3c5e3eef10 LibWeb: No longer return undefined on null table entry in Wasm API
Return `null` instead, as per the specification.
2024-07-30 23:43:44 +02:00
Ali Mohammad Pur
93216a875e RequestServer: Actually hold on to the preload job until it's done
This was some nonsense code left in by mistake, ref commit:
4211639e45

Fixes #904.
2024-07-30 12:03:30 -04:00
Bastiaan van der Plaat
b445b907a1 Ladybird: Update macOS app iconset 2024-07-30 12:38:44 +02:00
Sam Atkins
7daf5cdaff LibWeb: Invalidate layout if pseudo-element style changes
Pseudo-elements' style is only computed while building the layout tree.
This meant that previously, they would not have their style recomputed
in some cases. (Such as when :hover is applied to an ancestor.)

Now, when recomputing an element's style, we also return a full
invalidation if one or more pseudo-elements would exist either before or
after style recomputation.

This heuristic produces some false positives, but no false negatives.
Because pseudo-elements' style is computed during layout building, any
computation done here is then thrown away. So this approach minimises
the amount of wasted style computation. Plus it's simple, until we have
data on what approach would be faster.

This fixes the Acid2 nose becoming blue when the .nose div is hovered.
2024-07-30 09:45:45 +02:00
Sam Atkins
f23f0721bd LibWeb: Combine Element's pseudo-element data together
Rather than maintain two dynamically-allocated arrays of data for
pseudo-elements, put them in a single array, which is easier to manage.
2024-07-30 09:45:45 +02:00
Aliaksandr Kalenik
2c0f03f5b6 LibWeb: Delete BlitCornerClipping display list command
Contrary to LibGfx, where corner clipping was implemented by sampling
and blitting pixels under corners into a temporary bitmap, Skia allows
us to simply apply a mask. As a result, we no longer need the
BlitCornerClipping command, which has become a no-op.

- SampleUnderCorners is renamed to AddRoundedRectClip
- The optimization that skipped unnecessary blit and sample commands has
  been removed. However, this should not result in a performance
  regression because Skia seems to perform mask rasterization lazily.
2024-07-30 09:43:43 +02:00
Aliaksandr Kalenik
333c9270b1 LibWeb: Simplify outer box shadow's bounding box calculation
There is no need in the overly complicated OuterBoxShadowMetrics after
switching to use Skia for painting.
2024-07-30 09:43:20 +02:00
Timothy Flynn
4f5604c7db WebContent: Ignore invalid attributes set via the Inspector
Rather than crash, just ignore these values for now. We should invent a
mechanism to send feedback to the user (perhaps via the JS console).
2024-07-30 09:41:35 +02:00
Timothy Flynn
93f2af38b1 LibWebView: Escape HTML entities in attribute names
Otherwise, we can embed invalid HTML in the Inspector web view.
2024-07-30 09:41:35 +02:00
Timothy Flynn
657bbd1542 LibWeb: Append attributes to the correct element
The spec indicates we should append attributes to the top element of the
stack of open elements. We were appending the attribute to the bottom.
2024-07-30 09:41:35 +02:00
Timothy Flynn
9fe35ddddf LibWeb: Use an infallible method to add attributes to nodes
In the HTML parser spec, there are 2 instances of the following text:

    add the attribute and its corresponding value to that element

The "add the attribute" text does not have a corresponding spec link to
actually specify what to do. We currently use `set_attribute`, which can
throw an exception if the attribute name contains an invalid character
(such as '<'). Instead, switch to `append_attribute`, which allows such
attribute names. This behavior matches Firefox.

Note we cannot yet make the unclosed-html-element.html test match the
expectations of the unclosed-body-element.html due to another bug that
would prevent checking if the expected element has the right attribute.
That will be fixed in an upcoming commit.
2024-07-30 09:41:35 +02:00
Timothy Flynn
c1b0e180ba LibWebView: Insert line numbers before each line in about:srcdoc
The behavior chosen here (fixed-width counters, alignment, etc.) matches
Firefox.
2024-07-29 18:27:16 +01:00
Sam Atkins
5abe246385 LibWeb/CSS: Treat counters() function with 1 argument as invalid
Fixes #887.
2024-07-29 12:57:43 -04:00
Aliaksandr Kalenik
0bfcf73524 LibWeb: Inline apply_backdrop_filter function into paint_backdrop_filter
No need to have a separate file for this small function.
2024-07-29 17:48:56 +02:00
Aliaksandr Kalenik
8164be7ac8 LibWeb: Delete create_gfx_paint_style() for SVG gradients
No longer used after switching to Skia.
2024-07-29 16:25:05 +01:00
Sam Atkins
2a55ab13ef LibWeb: Update DOMStringList to match PlatformObject changes
- is_supported_property_index() no longer needs to be overridden
- item_value() now returns Optional
2024-07-29 11:17:05 +01:00
Sam Atkins
06484d0663 UI/Qt: Manually paint the tab-bar background where the "add" button was
The TabBar itself does not stretch the entire width of the TabWidget,
because it leaves space for the width of the new-tab button. So, we
manually tell Qt to paint the TabBar's background into the gap.

Fixes #768.
2024-07-29 12:02:02 +02:00
Sam Atkins
e17362ab79 UI/Qt: Make TabWidget responsible for new-tab button positioning
Makes use of the fact that QTabWidget automatically reserves space
for "corner widgets", and gives us the ability to override their
location with a custom style.

Also, determine the height of the new-tab button using the height of the
tab bar, instead of a hard-coded 32px which was too tall on MacOS.
2024-07-29 12:02:02 +02:00
Jamie Mansfield
75216182c9 LibWeb: Implement DOMStringList 2024-07-29 11:19:00 +02:00
Aliaksandr Kalenik
aa08e52548 LibWeb/Painting: Delete unused LinearGradientData.h 2024-07-29 11:17:55 +02:00
Andreas Kling
627dcb90bd Meta: Update CONTRIBUTING.md for the new era
- Explain project governance (now driven by the non-profit).
- Amend human language policy to keep language neutral & professional.
- Expand on the project's neutrality in detail.
- Clarify policy on rejection of bad-faith issues/PRs.
2024-07-29 11:11:48 +02:00
sideshowbarker
634b035898 Documentation: Add guidance on X11R6 linking warning message 2024-07-28 23:45:27 -06:00
circl
0af92e05d8 Documentation: Clean up some parts of the build instructions 2024-07-28 20:45:25 -06:00