Commit Graph

58778 Commits

Author SHA1 Message Date
Nico Weber
eb4632e08a LibPDF: Give CFF built-in encoding and charset arrays an underlying type
These arrays store SIDs ("String IDs"), so give them that type now
that we have to_array() and it's easy to do.

No behavior change.
2024-02-14 06:56:43 +01:00
Aliaksandr Kalenik
5bea99367a LibWeb: Add hit-testing test for SVG path
Adds a test for <rect> to ensure we have at least some hit-testing
coverage for SVGs.
2024-02-14 06:56:22 +01:00
Aliaksandr Kalenik
88ad871e2b LibWeb: Do paint-order traversal in Document::element_from_point()
Specify callback for hit-test function to identify closest DOM element,
excluding text nodes. Add a previously failing test case.
2024-02-14 06:56:22 +01:00
Aliaksandr Kalenik
9d2809146f LibWeb: Do paint-order traversal in Document::elements_from_point()
Elements are now collected according to paint order as spec says,
replacing the depth-first traversal of the paint tree with hit-testing
on each box.

This change resolves a FIXME in an existing test and adds a new
previously non-working test.
2024-02-14 06:56:22 +01:00
Aliaksandr Kalenik
9c99182b1e LibWeb: Change StackingContext::hit_test() to accept callback
This change modifies hit_test() to no longer return the first paintable
encountered at a specified position. Instead, this function accepts a
callback that is invoked for each paintable located at a position, in
hit-testing order.

This modification will allow us to reuse this call for
`Document.elementsFromPoint()` in upcoming changes.
2024-02-14 06:56:22 +01:00
Lucas CHOLLET
15d151ee66 LibGfx/ICO: Remove unused parameter 2024-02-14 06:56:03 +01:00
Andrew Kaster
aef188207c CI: Add debug logging to WPT run to see if we are overusing /tmp 2024-02-14 06:55:40 +01:00
Andrew Kaster
e64aa7da7a Tests: Add patch to WPT to let our metadata update script work again 2024-02-14 06:55:40 +01:00
Andrew Kaster
52f1eaefa0 Tests: Update WPT metadata for current state of Ladybird 2024-02-14 06:55:40 +01:00
Andrew Kaster
2819067370 Tests: Pass WPT certificate to WebDriver when running CI tests 2024-02-14 06:55:40 +01:00
Andrew Kaster
ff9eb62f3d WebDriver: Add commandline option to pass extra certificates
This is useful for running WPT
2024-02-14 06:55:40 +01:00
Jelle Raaijmakers
96675e61cd Kernel/TTY: Support non-blocking reads with termios VMIN == 0
In a TTY's non-canonical mode, data availability can be configured by
setting VMIN and VTIME to determine the minimum amount of bytes to read
and the timeout between bytes, respectively. Some ports (such as SRB2)
set VMIN to 0 which effectively makes reading a TTY such as stdin a
non-blocking read. We didn't support this, causing ports to hang as soon
as they try to read stdin without any data available.

Add a very duct-tapey implementation for the case where VMIN == 0 by
overwriting the TTY's description's blocking status; 3 FIXMEs are
included to make sure we clean this up some day.
2024-02-13 19:48:39 +01:00
Tim Ledbetter
877641f626 LibWeb: Display an IBeam cursor by default when mousing over a text node
We now check the type of the layout node at the current mouse position
when determining which cursor to display during a mouse move event.
2024-02-13 19:47:39 +01:00
Nico Weber
ddbcd901d1 LibPDF: Separate Type0 CMap errors
No behavior change, just more granular "not implemented" diagnostics.
2024-02-13 19:46:31 +01:00
Nico Weber
8e50bbc9fb LibPDF: Add string drawing code for Type0Fonts
This is very similar to SimpleFont::draw_string() for now, but
it'll become a bit different when we add support for vertical
text.

CIDFontType now only needs to draw single glyphs. Neither of the
subclasses can do that yet, so no behavior change yet.
2024-02-13 19:46:18 +01:00
Andrew Kaster
9077fe15ac WebContent: Tolerate invalid page_ids in ConnectionFromClient
When a tab or nested traversable navigable is closed, there might be
messages still in the pipe from the UI process that we need to
gracefully drop, rather than crash trying to access an invalid pointer.
2024-02-13 19:46:10 +01:00
Andrew Kaster
3d6c515bae WebContent: Jump through less hoops to access top level traversable 2024-02-13 19:46:10 +01:00
Andrew Kaster
bc87a48e0b WebDriver: Mark current window handle as invalid after close_window() 2024-02-13 19:46:10 +01:00
Andrew Kaster
2b3bc2654f LibWeb: Mark Navigable as destroyed in destroy_top_level_traversable AO
Without this, a top level traversable might show up in settings we don't
want it to when accessing all_navigables, such as choose a navigable.
2024-02-13 19:46:10 +01:00
Andrew Kaster
a0e7af0cd9 LibWeb: Don't choose destroyed navigables in choose a navigable AO
There's a chance that we try to choose a navigable before a previously
destroyed navigable is fully destroyed and GC'd. Investigating why this
can happen is a separate endeavor, let's just not crash for now.
2024-02-13 19:46:10 +01:00
Nico Weber
eaa568210f LibPDF: Split CCITT errors by group 2024-02-13 19:45:47 +01:00
Nico Weber
c201825cc8 LibPDF: Read CCITT decode params
We don't do anything with them yet, so no behavior change.
2024-02-13 19:45:47 +01:00
Nico Weber
454a10774e LibPDF: Let Filter::handle_lzw_and_flate_parameters() read decode params
...instead of reading them in Filter::decode() for all filters and
then passing them around to only the LZW and flate filters.

(EarlyChange is LZWDecode-only, so that's read there instead.)

No behavior change.
2024-02-13 19:45:47 +01:00
Nico Weber
9875ce0c78 LibPDF: Reorder loops in SampledFunction::evaluate()
Previously, we'd loop over the index of the output coordinate,
for example for a CMYK->RGB function, we'd loop over RGB. For
every output index, we'd then sample the function at the CMYK
input point.

Now, we sample at CMYK once and return a span for all outputs,
since they're stored in contiguous memory. And we then loop
over the outputs only to do weighting and mapping to the target
range at the end.

Reduces the runtime of

      (cd Tests/LibPDF; \
          ../../Build/lagom/bin/BenchmarkPDF --benchmark_repetitions 5)

from 235.6±2.3ms to 103.2±3.3ms on my system, and makes
SampledFunction::evaluate() more similar to lerp_nd() in TagTypes.h.
2024-02-13 19:45:19 +01:00
Nico Weber
b27aca9300 Tests/LibPDF: Add a benchmark for SampledFunction::evaluate()
Takes 235.6±2.3ms to run over here, with `--benchmark_repetitions 5`.
2024-02-13 19:45:19 +01:00
Matthew Olsson
3c9c134d71 LibWeb: Implement KeyframeEffect::{get,set}_keyframes 2024-02-13 19:44:44 +01:00
Matthew Olsson
38c67ba17c LibWeb: Implement parsing a monolithic keyframes-like argument
See the last commit for a more in-depth explanation
2024-02-13 19:44:44 +01:00
Matthew Olsson
7d69fa0ccf LibWeb: Partially implement the "process a keyframes argument" procedure
Keyframes can be given in two separate forms:

- As an array of separate keyframe objects, where the keys of each
  keyframe represent CSS properties, and their values represents the
  values that those CSS properties should take

  e.x.:
  [{ color: 'red', offset: 0.3 }, { color: 'blue', offset: 0.7 }]

- As a single monolithic keyframe object, where the keys of each
  keyframe represent CSS properties, and their values are arrays of
  values, where each index k represents the value of the given
  property at the k'th frame.

  e.x.:
  { color: ['red', 'blue'], offset: [0.3, 0.7] }

This commit only implements the first option, as it is much simpler. See
the next commit for the implementation of the second option.
2024-02-13 19:44:44 +01:00
Matthew Olsson
9f404ed9c1 LibWeb: Implement the "compute missing keyframe offsets" procedure 2024-02-13 19:44:44 +01:00
Matthew Olsson
38153b47d6 LibWeb: Implement the "process a keyframe-like object" procedure 2024-02-13 19:44:44 +01:00
Matthew Olsson
212a139292 LibWeb: Add a way to test if a CSS::PropertyID is animatable 2024-02-13 19:44:44 +01:00
Aliaksandr Kalenik
edab67d5e8 LibWeb: Fix hit-testing for button element
Change 'dom_node_for_event_dispatch' to locate the closest layout node
with a DOM node instead of only checking the direct ancestor.

This fixes hit-testing for buttons because they are wrapped into
multiple anonymous layout nodes (internally we use flex formatting for
them).
2024-02-13 14:22:14 +01:00
Lucas CHOLLET
8e21bbf7bf LibGfx/TIFF: Add support for tiled images
A tile is basically a strip with a user-defined width. With that in
mind, adding support for them is quite straightforward. As a lot the
common code was named after 'strips', to avoid future confusion I
renamed everything that interact with either strips or tiles to a
global term: 'segment'.

Note that tiled images are supposed to always have a 'TileOffsets' tag
instead of 'StripOffset'. However, this doesn't seem to be enforced by
encoders, so we support having either of them indifferently.

The test case was generated with the following Python script:

import pyvips

img = pyvips.Image.new_from_file('deflate.tiff')
img.write_to_file('tiled.tiff',
                  compression=pyvips.ForeignTiffCompression.DEFLATE,
                  tile=True, tile_width=64, tile_height=64)
2024-02-13 10:13:11 +01:00
Lucas CHOLLET
a30515011a LibGfx/TIFF: Add support for TileOffset and TileByteCounts 2024-02-13 10:13:11 +01:00
Lucas CHOLLET
18871e23d7 LibGfx/TIFF: Make decoders take an IntSize
They will also need the width of the sub-image when we will add support
for tiles.
2024-02-13 10:13:11 +01:00
Lucas CHOLLET
7b510c3876 LibGfx/TIFF: Rename scanline => image_row
This variable stores the number of rows from the beginning of the image,
contrary to `row` that stores the number of rows relative to the start
of the current segment.
2024-02-13 10:13:11 +01:00
Lucas CHOLLET
e327d357d0 LibGfx/TIFF: Read Tile-related tags
-`TileWidth`
-`TileWidth`
-`TileOffsets`
-`TileByteCounts`
2024-02-13 10:13:11 +01:00
Lucas CHOLLET
c4e8e5c4a6 LibGfx/TIFF: Rename ImageHeight => ImageLength
This is the name used in the TIFF specification. No behavior change.
2024-02-13 10:13:11 +01:00
Lucas CHOLLET
f5e7ee8d4a LibGfx/CCITT: Don't be fooled by black-starting lines
The first marker is always white in CCITT streams, so lines starting
with a black pixel encodes a symbol meaning 0 white pixels. Then, the
decoding would proceed with a black symbol. We used to set the symbol's
color based on `column == 0`, which is wrong in this situation.
2024-02-13 00:37:06 +01:00
Lucas CHOLLET
a4b2e5b27b LibGfx/CCITT: Don't overrun the image width 2024-02-13 00:37:06 +01:00
Lucas CHOLLET
720187623b LibGfx/TIFF: Read and honor the FillOrder tag 2024-02-13 00:37:06 +01:00
Andrew Kaster
6a0fe08604 LibWeb: Implement document.elementsFromPoint
This API seems to be used by WPT for sending synthetic input events.

Implementing the naive translation of elementFromPoint to the spec steps
for this algorithm turns 4 'tests had errors unexpectedly' and 3 'tests
had timeouts unexpectedly' into 1 pass and 7 'tests had unexpected
subtest results' on the infrastructure/ subdirectory of WPT.
2024-02-12 11:43:22 -07:00
Andrew Kaster
e7daa02bf2 LibWeb: Unblock port 9000
This was blocked because it can be used for cross-protocol attacks on
some network printers. However, it's also used by the web platform
tests. One can argue that getting WPT working is more important than
theoretical attacks on poorly configured printers.
2024-02-12 11:43:22 -07:00
Andrew Kaster
deb11a669a LibWeb: Stub out WebDriver deserialize as a proxy capability AO
This prevents us from returning an 'unrecognized capability' error when
a WebDriver client sends us a proxy capability. We still don't actually
support setting or returning a non-empty proxy capability, though.

We just don't choke on the input capability request from the server.

This patch also doesn't actually validate the input proxy requests.
2024-02-12 11:43:22 -07:00
Jelle Raaijmakers
50bba8d9fc Ports: Add glu as a dependency to SRB2
SRB2 will try to load libGLU.so.1 dynamically if started with the OpenGL
renderer, so add it as a dependency. The game still crashes immediately,
but this brings us one step closer :^)
2024-02-12 18:01:22 +01:00
Jelle Raaijmakers
401a37417b Ports: Update glu to 9.0.3
This necessitates a switch to the Meson build system. A nice side effect
of this is that we now build & install the shared library for glu as
well.
2024-02-12 18:01:22 +01:00
Fabian Dellwing
32b07f7057 Kernel: Make ftruncate change st_ctime as per spec
Previously we only modified `st_mtime` but the spec tells
us to do both: https://pubs.opengroup.org/onlinepubs/007908799/xsh/ftruncate.html
2024-02-12 16:27:19 +01:00
Nico Weber
751185cb76 LibPDF: Scale default glyph width by font size and x scale
This fixes rendering of commas in 0000941.pdf page 1. The commas
use the default width, and without this they show up very large,
covering the page.

Also, it's nice that the code now looks like the regular case 4 lines
further up.
2024-02-12 14:32:04 +00:00
Lucas CHOLLET
b9afac0a06 LibGfx/CCITT: Consider the UseFillBits option 2024-02-12 14:08:56 +01:00
Lucas CHOLLET
cbfea68ed8 AK: Add BigEndianInputBitStream::bits_until_next_byte_boundary() 2024-02-12 14:08:56 +01:00