Commit graph

56879 commits

Author SHA1 Message Date
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
Timothy Flynn
7edfeb7056 LibWeb: Support committing changes to <input> elements
We currently fire the change event on <input> elements when they lose
focus. The spec allows for us to also fire the event when changes are
"committed", so long as such an action makes sense for the input type.

This patch detects when the return key is entered in an <input> element
and uses that as the commit action for text-related types. If no change
has occurred since the last commit, no change event is fired.
2023-12-02 10:34:22 +01:00
Timothy Flynn
97665fa92f Meta: Port recent changes to the GN build
fbfb70f81a
2023-12-02 10:34:22 +01:00
Lucas CHOLLET
e6fc18d96a LibGfx/TIFF: Support TIFF 5.0 LZW images
This makes us decode `quad-lzw.tif` from libtiff's test suite:
https://libtiff.gitlab.io/libtiff/images.html
2023-12-02 08:04:44 +01:00
Timothy Flynn
4c145fdb12 Ladybird/AppKit: Support enabling the GPU painter 2023-12-01 20:07:27 -05:00
Timothy Flynn
07e9a8f79b Ladybird+LibWebView: Move options used to launch WebContent to a struct
It is currently a bit messy to pass these options along from main() to
where WebContent is actually launched. If a new flag were to be added,
there are a couple dozen files that need to be updated to pass that flag
along. With this change, the flag can just be added to the struct, set
in main(), and handled in launch_web_content_process().
2023-12-01 20:07:27 -05:00
Timothy Flynn
8504d8f588 Meta: Support GPU painting in the GN build 2023-12-01 20:07:27 -05:00
Timothy Flynn
8fc5c8b7df WebContent: Print a warning if GPU painting is enabled but not supported 2023-12-01 20:07:27 -05:00
Timothy Flynn
ea81470fc0 WebContent: Remove a bunch of unused includes from PageHost
Mostly just to narrow down where HAS_ACCELERATED_GRAPHICS is used, to
make it easier to see where it needs to be defined by the build system.
2023-12-01 20:07:27 -05:00
Sam Atkins
4ced88b4e5 LibWeb: Make create_a_css_style_sheet() take String arguments 2023-12-01 20:48:13 +01:00
Sam Atkins
d344c50663 LibWeb: Return String from CSSStyleRule::selector_text() 2023-12-01 20:48:13 +01:00
Sam Atkins
374b6cdffd LibWeb: Return String from CSSImportRule::href() 2023-12-01 20:48:13 +01:00
Sam Atkins
ef1e942f3e LibWeb: Use String for getting/setting MediaQueryList media 2023-12-01 20:48:13 +01:00
Sam Atkins
6dbc3044bd LibWeb: Remove some to_deprecated_string() calls in the CSS code 2023-12-01 20:48:13 +01:00
Sam Atkins
9c1c7720c5 LibWeb: Use serialize_a_url() to serialize @import url(...) 2023-12-01 20:48:13 +01:00
Andrew Kaster
fbfb70f81a LibWeb+WebContent: Plumb ability for WebContent process to hold N pages
In order for same-origin NavigableContainers (iframe, frame, embed, ...)
and window.open() WindowProxies to have the proper JS access to their
embedder/opener, we need to host multiple top level traversables in the
same WebContent process. As a first step, make WebContent::PageHost hold
a HashMap of PageClient objects, each holding their own Web::Page that
represents a TraversableNavigable's API surface with the UI process.
2023-12-01 20:47:44 +01:00
Andreas Kling
34ae39478a Kernel/SysFS: Fix bizarre mode bits for directories in SysFS
Not sure what led to 0445 being used here, but let's use 0755.
2023-12-01 20:46:21 +01:00