Commit graph

57069 commits

Author SHA1 Message Date
Lucas CHOLLET
d9b69c644e LibGfx/TIFF: Allow any number of values for the tag BitsPerSample
Only some specific number of values should be allowed, but let's accept
everything for now and add these checks when the generator will be more
mature.
2023-12-07 08:17:46 +00:00
Lucas CHOLLET
ff73d5464a LibGfx/TIFF: Make loop_over_pixels autonomous for reading samples
Let's make the "read a sample" part independent of the decoder. That
will soon allow us to read samples based on the image's parameter
without duplicating the code for every decoder.
2023-12-07 08:17:46 +00:00
Nico Weber
8b50b689f9 LibPDF: Reject invalid "hival" values
Doesn't fire on any of the PDFs I have, and seems like a good thing
to check.
2023-12-07 08:10:40 +00:00
Nico Weber
43cd3d7dbd LibPDF: Tolerate palettes that are one byte too long
Fixes these errors from `Meta/test_pdf.py path/to/0000`, with
0000 being 0000.zip from the PDF/A corpus in unzipped:

    Malformed PDF file: Indexed color space lookup table doesn't
                        match size, in 4 files, on 8 pages, 73 times
      path/to/0000/0000206.pdf 2 4 (2x) 5 (3x) 6 (4x)
      path/to/0000/0000364.pdf 5 6
      path/to/0000/0000918.pdf 5
      path/to/0000/0000683.pdf 8
2023-12-07 08:10:40 +00:00
Nico Weber
832a065687 LibPDF: For low-bpp images, start scanlines on byte boundaries
Required per spec, and we get slanted images without it. Fixes e.g.
page 1 of 0000749.pdf.
2023-12-07 08:10:40 +00:00
Nico Weber
06b9633da5 LibPDF: For indexed images with 1, 2 or 4 bpp, do not repeat bit pattern
When upsampling e.g. the 4-bit value 0b1101 to 8-bit, we used to repeat
the value to fill the full 8-bits, e.g. 0b11011101. This maps RGB colors
to 8-bit nicely, but is the wrong thing to do for palette indices.
Stop doing this for palette indices.

Fixes "Indexed color space index out of range" for 11 files in the
PDF/A 0000.zip test set now that we correctly handle palette indices
as of the previous commit:

    Malformed PDF file: Indexed color space lookup table doesn't match
                        size, in 4 files, on 8 pages, 73 times
      path/to/0000/0000206.pdf 2 4 (2x) 5 (3x) 6 (4x)
      path/to/0000/0000364.pdf 5 6
      path/to/0000/0000918.pdf 5
      path/to/0000/0000683.pdf 8
2023-12-07 08:10:40 +00:00
Brandon Woodford
cdbc2a0dcd Snake: Use new GML compiler 2023-12-07 02:39:20 +01:00
Kenneth Myhra
5f275cd5ce Ports: Update curl to 8.5.0
Also remove CMake cache variable HAVE_GETADDRINFO_THREADSAFE since the
issue: https://github.com/curl/curl/issues/12093 has been resolved for
this release.
2023-12-07 00:14:36 +01:00
Nico Weber
8733ba2734 LibPDF: Fix decoding of IndexedColorSpace for palette sizes != 255
Previously, we were scaling palette indices from 0..(palette_size - 1)
to 0..255 before using them as index into the palette. Instead, do not
scale palette indices before using them as indices.

(Renderer::load_image() uses `component_value_decoders.empend(
.0f, 255.0f, dmin, dmax)`, so to get an identity mapping, we have to
return `0, 255` from IndexedColorSpace::default_decode()).

Fixes rendering of the gradient on page 5 of 0000277.pdf.
2023-12-06 15:32:13 +01:00
Aliaksandr Kalenik
e8960cf754 LibWeb: Move BorderRadiusCornerClipper allocation into CPU executor
BorderRadiusCornerClipper usage to clip border radius is specific to
CPU painter so it should not be stored in painting commands.

Also with this change bitmaps for corner sampling are allocated during
painting commands replaying instead of commands recording.
2023-12-06 13:05:59 +01:00
Aliaksandr Kalenik
89fd8dfaad LibWeb: Fix duplicated clip overflow in child stacking contexts
`StackingContext::paint_child()` does not have to clip overflow because
callers of this method already do that.
2023-12-06 13:05:59 +01:00
Timothy Flynn
154d201d41 Ladybird/AppKit: Add an Inspector context menu to edit the DOM 2023-12-06 13:04:50 +01:00
Timothy Flynn
be53596fe6 Ladybird/Qt: Add an Inspector context menu to edit the DOM 2023-12-06 13:04:50 +01:00
Timothy Flynn
5006330bc6 Browser: Add an Inspector context menu to edit the DOM 2023-12-06 13:04:50 +01:00
Timothy Flynn
636ff33d60 LibWebView: Add an escape key handler for DOM-editing <input> fields
Little quality of life improvement I keep reaching for.
2023-12-06 13:04:50 +01:00
Timothy Flynn
0ddc2ea8c4 LibWebView: Add Inspector actions to be used as context menu callbacks
These allow for triggering an edit of a DOM node (as an alternative to
double-clicking), removing a DOM node, and adding/removing DOM node
attributes.
2023-12-06 13:04:50 +01:00
Timothy Flynn
9a5fe740c6 LibWebView: Make a best-effort attempt to not "shift" edited attributes
Currently, when editing a DOM attribute, the replacement method first
removes the attribute, then adds the replacement attributes. This
results in the edited attribute jumping to the end of the attribute
list in the Inspector.

This patch will try to avoid removing the attribute if one of the
replacements has the same name. This will keep the edited attribute in
the same location.
2023-12-06 13:04:50 +01:00
Timothy Flynn
777b4f7921 LibWebView+WebContent: Add a WebContent IPC to remove a DOM node
The FIXME added to ConnectionFromClient::remove_dom_node is copied from
Web::EditEventHandler. The same behavior is observed here, with many
lingering Layout::TextNodes, for example.
2023-12-06 13:04:50 +01:00
Timothy Flynn
86d90f324d LibWebView+WebContent: Add a WebContent IPC to add DOM attributes 2023-12-06 13:04:50 +01:00
Timothy Flynn
2cdad0f068 LibWeb+LibWebView+WebContent: Add an Inspector IPC to add DOM attributes 2023-12-06 13:04:50 +01:00
Timothy Flynn
2633ea8c79 LibWeb+LibWebView+WebContent: Add an Inspector IPC to open context menus
The Inspector will have context menu support to manipulate the DOM, e.g.
adding or removing nodes/attributes. This context menu will require some
detailed knowledge about what element in the Inspector has been clicked.
To support this, we intercept the `contextmenu` event and collect the
required information to be sent to the Inspector client over IPC.
2023-12-06 13:04:50 +01:00
Andreas Kling
2d69a009fb LibWeb: Make more JS modules actually run
First, we had a logic typo where we were checking parse errors for
non-empty instead of non-null. Fixing this caused more modules to
actually start executing.

As usual, this tripped on some "empty backup incumbent settings object
stack" bugs, so this patch also pushes a module execution context in
two places where it makes sense.

Co-Authored-By: networkException <networkexception@serenityos.org>
2023-12-06 12:58:04 +01:00
Andreas Kling
a2c3db8367 LibJS: Add basic support for module code with top-level await
For now, we handle this by creating a synthetic async function to wrap
the top-level module code. This allows us to piggyback on the async
function driver wrapper mechanism.
2023-12-06 12:58:04 +01:00
Andreas Kling
26c21fba8e LibJS: Use LoadRequestedModules in the ad-hoc module loading path
This ensures that modules go through the expected state transitions,
fixing hundreds of test262 tests.
2023-12-06 12:58:04 +01:00
Andreas Kling
d7005be768 LibJS: Update CyclicModule to match current spec
Just some minor comment tweaks and an updated assertion.
2023-12-06 12:58:04 +01:00
Timothy Flynn
7970f45953 Ladybird/AppKit: Implement "Copy Email/Phone" menu item for links 2023-12-05 14:20:03 -05:00
Timothy Flynn
fff65046a3 WebWorker: Do not prefix WebWorker include with "Services/"
We don't do this elsewhere and this breaks the GN build.
2023-12-05 14:20:03 -05:00
Karol Kosek
00e422fe1e LibAudio: Fix use-after-free in write_vorbis_comment 2023-12-05 13:57:18 -05:00
Nico Weber
4cb0593daf LibPDF: Convert LAB values to bytes differently
Gfx::ICC::Profile's current API takes bytes, so we need to do some
contortions for LAB values to go through.

This will probably become nicer once we implement all the backward
transforms in Gfx::ICC::Profile, but for now let's hack it in
on the LibPDF side.

Makes colors in 0000651.pdf looks good, especially on pages 1 and 7-12.
2023-12-05 11:36:44 -05:00
Sam Atkins
715d0bacdb Ladybird/Qt: Implement "Copy Email/Phone" menu item for links 2023-12-05 11:36:22 -05:00
Sam Atkins
53f9be4ea8 Browser: Implement "Copy Email/Phone" menu item for links 2023-12-05 11:36:22 -05:00
Sam Atkins
8d987aa9d6 Browser: Make "Copy URL" action's shortcut more consistent
"Copy &URL" matches what we do in LadybirdQt, and "Copy Image &URL".
2023-12-05 11:36:22 -05:00
Sam Atkins
c8247e5737 LibWebView: Add some helpers for "Copy email/telephone" functionality
Other browsers have a nice little feature where right-clicking on a
`mailto` or `tel` link will let you copy the email address or telephone
number, instead of the full URL. So let's do that!
2023-12-05 11:36:22 -05:00
Sam Atkins
db9a507f7f TextEditor: Give the --preview-mode argument a short version 2023-12-05 09:20:32 -05:00
Aliaksandr Kalenik
a88807e5b3 LibAccelGfx: Update scissor test after switching between painters
Since scissor clip rect is a part of OpenGL global state we need to
update it after switching between painters.
2023-12-05 10:29:55 +01:00
Nico Weber
72f5461af4 LibGfx/ICC: Implement forward transform for mft1 and mft2 tags
mft1 and mft2 tags are very similar. The only difference is that
mft1 uses an u8 lookup table, while mft2 uses a u16 lookup table.
This means their PCS lookup encodings are different, and mft2 uses a
PCSLAB encoding that's different from other places in the v4 spec.
2023-12-05 09:56:50 +01:00
Nico Weber
b138bc0004 LibGfx/ICC: Simplify lerp_1d() a bit
No behavior change.
2023-12-05 09:56:50 +01:00
Nico Weber
9372f6d726 LibGfx/ICC: Extract a lerp_1d() function
Pure code move, no behavior change.
2023-12-05 09:56:50 +01:00
Sam Atkins
4c4daf4a62 LibWeb: Add tests for background-position
The css-backgrounds.html ref test file only tests the most basic usage
of this, which failed to catch some regressions, so let's add a more
extensive test. :^)
2023-12-05 09:55:16 +01:00
Sam Atkins
ef48d967d4 LibWeb: Correct parsing of background-position 3-value syntax
There were two bugs here, one of which hid the other:
- Only one offset would have a value, but we dereferenced both.
- We consumed a token whether it was a valid offset or not.
2023-12-05 09:55:16 +01:00
Andreas Kling
20da5b6153 LibWeb: Remove an unnecessary (and unsafe) cast from Node to Element
Fixes #22170
2023-12-05 09:41:22 +01:00
Shannon Booth
0cb0d60ac5 LibWeb: Make BrowsingContextGroup & TraversableNavigable return a Page&
Removing another batch of uneeded null checks :^)
2023-12-05 09:38:32 +01:00
Shannon Booth
88f8ea7c60 LibWeb: Make BrowsingContex::page() return a Page&
This exposed a whole slew of now-unnecessary null checks. :^)

Co-Authored-By: Andreas Kling <kling@serenityos.org>
2023-12-05 09:38:32 +01:00
Shannon Booth
af2bcc3b56 LibWeb: Remove Weakable from Web::Page
Nothing requires this any more.
2023-12-05 09:38:32 +01:00
Shannon Booth
fd7be22653 LibWeb: Make TraversableNavigable store Page member as NonnullGCPtr 2023-12-05 09:38:32 +01:00
Andreas Kling
bf4c8f4a09 LibWeb: Make BrowsingContext store Page member as NonnullGCPtr
No need to use WeakPtr anymore.

Co-Authored-By: Andreas Kling <kling@serenityos.org>
2023-12-05 09:38:32 +01:00
Andreas Kling
7c926d04b7 LibWeb: Make BrowsingContextGroup store Page member as NonnullGCPtr
No need to use WeakPtr anymore.
2023-12-05 09:38:32 +01:00
Shannon Booth
289ea2db9c LibWeb: Make ImageRequest store Page member as NonnullGCPtr
Co-Authored-By: Andreas Kling <kling@serenityos.org>
2023-12-05 09:38:32 +01:00
Shannon Booth
d277ac72e6 LibWeb: Make SharedImageRequest store Page member as NonnullGCPtr
This allows us to remove one raw Web::Page& member. Or rather, it
becomes a JS::NonnullGCPtr that we trace like anything else. :^)

Co-Authored-By: Andreas Kling <kling@serenityos.org>
2023-12-05 09:38:32 +01:00
Shannon Booth
0ae5c070c7 LibWeb: Make Web::Page GC-allocated
This is a first step towards removing the various Page& and Page*
we have littering the engine with "trust me bro" safety guarantees.

Co-Authored-By: Andreas Kling <kling@serenityos.org>
2023-12-05 09:38:32 +01:00