Commit graph

56945 commits

Author SHA1 Message Date
Shannon Booth
feb7fbb95d LibWeb: Implement ReadableStreamBYOBRequest.respond
The parameter in IDL is left as an unsigned long instead of an unsigned
long long as the IDL generator does not currently support that.
2023-12-03 20:26:14 +01:00
Shannon Booth
08be5deb3f LibWeb: Implement AO ReadableByteStreamControllerRespond 2023-12-03 20:26:14 +01:00
Shannon Booth
2ab933e534 LibWeb: Implement AO ReadableByteStreamControllerRespondInternal 2023-12-03 20:26:14 +01:00
Shannon Booth
426cbd8ed3 LibWeb: Implement AO ReadableByteStreamControllerRespondInClosedState 2023-12-03 20:26:14 +01:00
Shannon Booth
be2195cb8c LibWeb: Implement AO ReadableByteStreamControllerRespondInReadableState 2023-12-03 20:26:14 +01:00
Shannon Booth
0245be70d8 LibWeb: Implement Streams AO CanTransferArrayBuffer 2023-12-03 20:26:14 +01:00
Shannon Booth
9d0700e770 LibWeb: Fix IDL getter for ReadableByteStreamController byobRequest
We were previously only returning the controllers current
[[byobRequest]] instead of taking into account pending pull intos.

Rename the getter function which would return the controllers
[[byobRequest]] slot to `raw_byob_request` to differentiate it from
the IDL getter.

This also leaves a FIXME for a spec step which we are also not currently
implementing correctly.
2023-12-03 20:26:14 +01:00
Shannon Booth
1e607f5775 LibWeb: Fix some missing initialize overrides for some Streams classes
This is some more motivation for me to get around to automatically
generate these initialize calls at some point.
2023-12-03 20:26:14 +01:00
Shannon Booth
b2a0a41503 LibWeb: Use TypedArrayBase::kind for pull into constructor lookup 2023-12-03 20:26:14 +01:00
Shannon Booth
a9a3dcd952 LibWeb: Use ArrayBufferView in ReadableStreamBYOBRequest 2023-12-03 20:26:14 +01:00
Ali Mohammad Pur
4893dfdc57 Ports: Update Jakt to the latest commit 2023-12-03 14:11:23 +01:00
Ali Mohammad Pur
167b54d03d Ports: Make the LLVM port install its ocaml bindings somewhere else
By default the bindings go to /usr/local on the host, which is a very
big no-no; this path is not affected by CMAKE_INSTALL_PREFIX, so this
commit sets the LLVM_OCAML_INSTALL_PATH variable instead.
It should be noted that disabling the ocaml bindings doesn't make all
the users of this variable go away, so this commit doesn't do so.

This also sorts the -DFOO options passed to cmake, because...sorting.
2023-12-03 14:11:23 +01:00
hanaa12G
e6cde722c9 LibLine: Reset m_times_tab_pressed in interrupt handling code
We forgot to reset all the variables that keep track of suggestion
state, resulting in an underflow value when calculating the lines to
display completion suggestions later.

Setting `m_times_tab_pressed` to 0 apparently forces it to recalculate
the those variables and seems to fix the problem.

Fixes #22128
2023-12-03 10:02:51 +03:30
Shannon Booth
f976ec005c LibWeb: Port DOM::Document from DeprecatedString 2023-12-02 22:54:53 +01:00
Shannon Booth
c4d3134436 LibWeb: Port NavigatorLanguage from DeprecatedString 2023-12-02 22:54:53 +01:00
Shannon Booth
a8f5ebeddd LibWeb: Port DOM::Node from DeprecatedString 2023-12-02 22:54:53 +01:00
Shannon Booth
89bbf53745 LibWeb: Port CSS Parser from DeprecatedString
These are the last instances of DeprecatedString in the CSS folder.
2023-12-02 22:54:53 +01:00
Shannon Booth
2cf3819caf LibWeb: Port HTMLFieldSetElement from DeprecatedString 2023-12-02 22:54:53 +01:00
Shannon Booth
cc43dbf56e LibWeb: Port HTMLTextAreaElement from DeprecatedString 2023-12-02 22:54:53 +01:00
Shannon Booth
a7b8828db2 LibWeb: Port call_user_object_operation from DeprecatedString 2023-12-02 22:54:53 +01:00
Shannon Booth
6813dcaff8 LibWeb: Return FlyString const& from CSS::Parser::Token
This allows us to not need to convert back to a FlyString when we need
one.
2023-12-02 22:54:53 +01:00
Timothy Flynn
b9902fef36 LibWebView: Add a draggable separator between the two Inspector panes 2023-12-02 22:54:06 +01:00
Timothy Flynn
b10934af27 Ladybird/AppKit: Implement cursor images for row-resize and col-resize 2023-12-02 22:54:06 +01:00
Timothy Flynn
582f19ba24 Ladybird: Allow opening the Inspector with both ctrl+shift+I and F12
Ladybird on Serenity currently only uses F12, and on other platforms
only uses ctrl+shift+I. Most browsers support both hotkeys, so let's do
the same for consistency.

Note that the AppKit chrome cannot support both shortcuts. macOS does
not allow setting multiple "key equivalent" strings on an action. There
are some questionable hacks we could do to support this eventually, but
for now, just ctrl+shift+I is supported on macOS.
2023-12-02 22:54:06 +01:00
Timothy Flynn
1d03301037 LibWeb: Allow JS event handlers to stop propagation of mousemove events
This follows similar logic to keydown events.
2023-12-02 22:54:06 +01:00
Nico Weber
7f5e9a0236 LibGfx/ICC: Support for A curves and CLUT in LutAToBTagData::evaluate()
`lerp_nd()` is very similar to PDF::SampleFunction::evaluate(). But we
know that the result is a FloatVector3 in the ICC code (at least for
now), so we can save a bunch of redundant computation by returning
all three channels of the LUT at once.

This is enough for images using mAB with A curve / CLUT if the
profile connecting space is PCSXYZ, such as for Upper_Right.jpg
from https://www.color.org/version4html.xalter like so:

    % Build/lagom/icc --name sRGB --reencode-to serenity-sRGB.icc
    % Build/lagom/bin/image -o out.png \
        --convert-to-color-profile serenity-sRGB.icc \
        ~/Downloads/Upper_Right.jpg
2023-12-02 22:26:13 +01:00
Nico Weber
1c88b82dfc LibPDF: Do less work in SampledFunction::evaluate()'s inner loop
Instead of recomputing the left index and the float amount in that
interval for each coordinate all the time, do it once when we
preprocess the input coordinates.

One line less, faster, and arguably easier to read.

No behavior change.
2023-12-02 22:26:13 +01:00
Nico Weber
54883b7d41 LibPDF: Remove get_bounds lambda in SampledFunction::evaluate()
Using `min()` to guarantee the left index is never == `size() - 1`,
even for an interpolation value of 1.0, is less code, and arguably
easier to understand as well.

No behavior change.
2023-12-02 22:26:13 +01:00
Nico Weber
d9fd72007e LibPDF: Add a spec comment to SampledFunction::sample() 2023-12-02 22:26:13 +01:00
Idan Horowitz
aad5c58996 LibPDF: Eliminate reference cycle between OutlineItem parent/children
Since all parents held a reference pointer to their children, and all
children held reference pointers to their parents, both objects would
never get free'd once the document was no longer being used.

Fixes ossfuzz-63833.
2023-12-02 22:23:53 +01:00
Aliaksandr Kalenik
681771d210 LibGfx+LibWeb: Calculate and save glyph positions during layout
Previously, we determined the positions of glyphs for each text run at
the time of painting, which constituted a significant portion of the
painting process according to profiles. However, since we already go
through each glyph to figure out the width of each fragment during
layout, we can simultaneously gather data about the position of each
glyph in the layout phase and utilize this information in the painting
phase.

I had to update expectations for a couple of reference tests. These
updates are due to the fact that we now measure glyph positions during
layout using a 1x font, and then linearly scale each glyph's position
to device pixels during painting. This approach should be acceptable,
considering we measure a fragment's width and height with an unscaled
font during layout.
2023-12-02 22:06:11 +01:00
Idan Horowitz
1a35621930 LibGfx: Eliminate multiplication integer overflow in planar_to_chunky
Multiplying two u16s will result in a i32 sized result, which will
overflow to negative values for large input values.

Fixes ossfuzz-64198.
2023-12-02 11:46:03 +01:00
Idan Horowitz
e1b438bb1a LibGfx: Actually ensure Cmap subtable offset is within expected range
Our previous check was not sufficient, since it merely checked the
first byte of the EncodingRecord offset is within range, while the
actual read is 4-byte wide.

Fixes ossfuzz-64165.
2023-12-02 11:22:48 +01:00
Tim Ledbetter
10757b7787 LibGfx/TinyVG: Clamp RGBAF32 color values from 0 and 255 2023-12-02 10:47:39 +01:00
Tim Ledbetter
aa54007943 LibGfx/TinyVG: Avoid OOM if header contains a bogus color table size
This change limits the amount of memory that is initially allocated for
the color table. This prevents an OOM condition if the file contains an
incorrect color table size.
2023-12-02 10:47:39 +01:00
Lucas CHOLLET
1ede4f249d LibGfx/TIFF: Decode all PackedBits beforehand
This change doesn't change much on its own. The idea behind this
refactoring is to separate the sample reading from the decoding step.
The decoder returning data byte per byte was fine as we only support
8 bits images, but this assumption won't hold for a long time. So let's
decode everything beforehand and strictly partition the sample reading
code somewhere else.
2023-12-02 10:37:07 +01:00
Lucas CHOLLET
4994609af0 LibGfx/TIFF: Add support for the ICCProfile tag 2023-12-02 10:36:02 +01:00
Lucas CHOLLET
5622e7d77c LibGfx/TIFF: Support tag names with capitalized acronym
We now turn 'ICCProfile' into 'icc_profile' instead of 'i_c_c_profile'.
2023-12-02 10:36:02 +01:00
Lucas CHOLLET
62f28d9968 LibGfx/TIFF: Teach the generator how to handle tags of type Undefined
This tag type is a bit different as even if it fits in the general
definition given in the TIFF specification. That is the value will be of
one specified type multiplied by a known count. Having a
`Vector<Variant<u8, ...>>` will be very painful to use. So let's deviate
a bit from the normal way and use a `ByteBuffer` directly instead this
complicated type.
2023-12-02 10:36:02 +01:00
Kemal Zebari
24b9d05ea8 LibWeb/HTML: Implement text attribute in HTMLTitleElement 2023-12-02 10:35:43 +01:00
Timothy Flynn
d6df13af6a LibWebView: Remove the now-unused ConsoleClient
It is superseded by the Inspector's console.
2023-12-02 10:34:22 +01:00
Timothy Flynn
dc04385465 Ladybird/AppKit: Remove the standalone JavaScript console 2023-12-02 10:34:22 +01:00
Timothy Flynn
c4daaa9902 Ladybird/Qt: Remove the standalone JavaScript console 2023-12-02 10:34:22 +01:00
Timothy Flynn
b385a44f6f Browser: Remove the standalone JavaScript console 2023-12-02 10:34:22 +01:00
Timothy Flynn
d8a700d9be LibWebView: Implement a JavaScript console tab in the Inspector
This adds a JS console to the bottom section of the Inspector WebView.
Much of this code is based on the existing WebView::ConsoleClient, but
ported to fit the inspector model. That is, much of the code from that
class is now handled in the Inspector's JS.
2023-12-02 10:34:22 +01:00
Timothy Flynn
9f374a5d2a LibWeb+LibWebView+WebContent: Add an Inspector IPC to execute JavaScript
The Inspector will have an <input> element to execute user-provided JS.
This adds an IDL method and IPC to forward that JS from the Inspector
WebView to the Inspector client.
2023-12-02 10:34:22 +01:00
Timothy Flynn
060807e3da LibWeb: Set correct keyCode for number keys and optional virtual keys
The spec states that if an input key would insert a numerical character
if it were pressed without a modifier, then the keyCode should be that
of the numerical character. For example, the keyCode for a dollar sign
should be that of the number 4.

Further, we should implement the optional fixed virtual key codes.
Otherwise, our implementation would give e.g. the double quote a keyCode
value of 38, which is the same as the up arrow key.
2023-12-02 10:34:22 +01:00
Timothy Flynn
7e92ff062e LibWeb: Update the document's cursor after setting an <input>'s value
The spec step here explicitly says to "move the text entry cursor
position to the end of the text control".
2023-12-02 10:34:22 +01:00
Timothy Flynn
d5d6f9bc92 LibWeb: Dispatch keydown events before invoking special handlers
We need to give pages the opportunity to intercept keydown events and
potentially stop them from propagating. Otherwise, for example, pressing
an arrow key in an <input> element is not observable via script.
2023-12-02 10:34:22 +01:00
Timothy Flynn
27d40bafc9 LibWeb: Do not invert the dispatch_event result in fire_keyboard_event
The return value of fire_keyboard_event is meant to indicate whether the
event should continue propagating (true) or halt (false). This exactly
matches the return value of dispatch_event, so by negating the result,
we are propagating events we shouldn't, and not propagating events we
should.
2023-12-02 10:34:22 +01:00